*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:     #2d7a4f;
  --green-l:   #43a86e;
  --green-pale:#e8f5ee;
  --peach:     #f4a261;
  --rose:      #e76f51;
  --text:      #1e2a22;
  --text-soft: #5a7060;
  --card-bg:   #ffffffee;
  --radius:    16px;
  --shadow:    0 4px 24px rgba(45,122,79,.13);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Vazirmatn', sans-serif;
  background: linear-gradient(160deg, #e8f5ee 0%, #f7ede0 50%, #e0eff8 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  display: flex; flex-direction: column;
}

/* ======== HEADER ======== */
.site-header {
  background: linear-gradient(90deg, #2d7a4f, #43a86e);
  padding: .8rem 1.5rem;
  box-shadow: 0 2px 12px rgba(45,122,79,.3);
  position: sticky; top: 0; z-index: 200;
}
.header-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
}
.header-brand { display: flex; align-items: center; gap: .75rem; flex: 1; min-width: 0; }
.header-icon { font-size: 2rem; flex-shrink: 0; }
.header-title { font-size: 1.1rem; font-weight: 800; color: #fff; line-height: 1.3; }
.header-sub { font-size: .75rem; color: #c8f0d8; margin-top: .1rem; }

/* Desktop Nav */
.desktop-nav { display: flex; align-items: center; gap: .5rem; }
.nav-user { color: #c8f0d8; font-size: .85rem; font-weight: 500; white-space: nowrap; }
.province-select-wrap { position: relative; }
.province-select {
  appearance: none;
  background: rgba(255,255,255,.15);
  border: 1.5px solid rgba(255,255,255,.4);
  color: #fff;
  font-family: 'Vazirmatn', sans-serif;
  font-size: .85rem; font-weight: 600;
  padding: .4rem 2rem .4rem .9rem;
  border-radius: 50px; cursor: pointer; outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left .6rem center;
}
.province-select option { background: #2d7a4f; color: #fff; }
.btn-nav {
  background: rgba(255,255,255,.2); color: #fff;
  padding: .4rem .9rem; border-radius: 50px; text-decoration: none;
  font-size: .85rem; font-weight: 600;
  border: 1.5px solid rgba(255,255,255,.3); white-space: nowrap;
  transition: background .2s;
}
.btn-nav:hover { background: rgba(255,255,255,.35); }
.btn-outline { background: transparent; }

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column; justify-content: center; gap: 5px;
  width: 36px; height: 36px;
  background: rgba(255,255,255,.15);
  border: 1.5px solid rgba(255,255,255,.3);
  border-radius: 8px; cursor: pointer; padding: 6px; flex-shrink: 0;
}
.hamburger span { display: block; height: 2px; background: #fff; border-radius: 2px; transition: all .3s; transform-origin: center; }
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ======== MOBILE MENU ======== */
.mobile-menu {
  position: fixed;
  top: 0; left: -300px;
  width: 270px; height: 100%;
  background: #ffffff;
  z-index: 300;
  transition: left .3s cubic-bezier(.4,0,.2,1);
  box-shadow: 6px 0 40px rgba(0,0,0,.1);
  overflow-y: auto;
  padding-top: 1.2rem;
}
.mobile-menu.open { left: 0; }

.mm-section { padding: .4rem 1.2rem; }

.mm-label {
  font-size: .7rem; font-weight: 700;
  color: #b0bdb5;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: .5rem;
  padding-right: .2rem;
}

.mm-select {
  width: 100%;
  appearance: none;
  background: #f4f8f5;
  border: 1.5px solid #e2ede7;
  color: var(--text);
  font-family: 'Vazirmatn', sans-serif;
  font-size: .9rem; font-weight: 600;
  padding: .7rem 1rem;
  border-radius: 10px; cursor: pointer; outline: none;
  transition: border .15s;
}
.mm-select:focus { border-color: var(--green-l); }

.mm-divider {
  height: 1px; background: #edf2ef;
  margin: 1rem 1.2rem;
}

.mm-btn {
  display: block;
  padding: .75rem 1rem;
  margin-bottom: .5rem;
  background: #f4f8f5;
  color: #1e2a22;
  border-radius: 10px;
  text-decoration: none;
  font-size: .88rem; font-weight: 600;
  border: 1.5px solid #e2ede7;
  transition: border-color .15s, background .15s;
}
.mm-btn:last-child { margin-bottom: 0; }
.mm-btn:hover { background: #e8f4ed; border-color: #b8d9c5; }
.mm-btn-danger {
  color: #c0392b;
  background: #fdf4f3;
  border-color: #f5dbd8;
}
.mm-btn-danger:hover { background: #faeae8; border-color: #e8b4ae; }

.mm-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 250; backdrop-filter: blur(2px);
}
.mm-overlay.open { display: block; }

/* ======== SEARCH BAR ======== */
.search-bar {
  width: 100%; background: #fff;
  border-bottom: 1.5px solid #ddeee5;
  box-shadow: 0 2px 8px rgba(45,122,79,.08);
  padding: .7rem 1.5rem;
}
.search-inner { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; gap: .7rem; }
.search-inner svg { color: var(--green-l); flex-shrink: 0; }
.search-inner input {
  flex: 1; border: none; outline: none;
  font-family: 'Vazirmatn', sans-serif; font-size: .95rem;
  color: var(--text); background: transparent; min-width: 0;
}
.search-inner input::placeholder { color: #b0c4b8; }
.search-badge {
  display: none; background: var(--green-pale); color: var(--green);
  font-size: .75rem; font-weight: 700; padding: .2rem .6rem;
  border-radius: 20px; white-space: nowrap; flex-shrink: 0;
}
.search-clear-btn {
  display: none; align-items: center; justify-content: center;
  width: 24px; height: 24px; background: #f0f0f0;
  border: none; border-radius: 50%; cursor: pointer;
  font-size: .72rem; color: #888; flex-shrink: 0;
}
.search-clear-btn:hover { background: #ddd; }

/* ======== NO RESULTS ======== */
.no-results {
  display: none; flex-direction: column; align-items: center;
  justify-content: center; gap: .6rem; padding: 4rem 2rem; color: #aaa;
}
.no-results-icon { font-size: 2.5rem; }

/* ======== GRID ======== */
.grid-container {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.2rem; padding: 1.2rem 1.5rem 3rem;
  max-width: 1400px; margin: 0 auto; width: 100%;
}

/* ======== CARD ======== */
.card {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 1.2rem 1.1rem; box-shadow: var(--shadow);
  border: 1.5px solid rgba(45,122,79,.1);
  transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 32px rgba(45,122,79,.18); }
.card-full { border-color: var(--rose); background: #fff5f3ee; }
.card-mid  { border-color: var(--peach); }
.card-name { font-size: 1rem; font-weight: 700; color: var(--green); margin-bottom: .8rem; padding-bottom: .5rem; border-bottom: 2px dashed #c8e8d4; }
.progress-wrap { display: flex; align-items: center; gap: .5rem; margin-bottom: .7rem; }
.progress-bar { flex: 1; height: 14px; background: #e0ede5; border-radius: 50px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 50px; background: linear-gradient(90deg, #43a86e, #2d7a4f); transition: width 1s cubic-bezier(.4,0,.2,1); }
.card-full .progress-fill { background: linear-gradient(90deg, var(--rose), #c0392b); }
.card-mid  .progress-fill { background: linear-gradient(90deg, var(--peach), #e07040); }
.progress-label { font-size: .82rem; font-weight: 700; color: var(--green); min-width: 36px; text-align: left; }
.card-stats { display: flex; gap: .4rem; margin-bottom: .6rem; }
.stat-item { flex: 1; text-align: center; background: var(--green-pale); border-radius: 10px; padding: .4rem .2rem; }
.stat-icon { font-size: .9rem; }
.stat-val { display: block; font-size: .85rem; font-weight: 700; color: var(--text); }
.stat-lbl { display: block; font-size: .68rem; color: var(--text-soft); }
.card-time { font-size: .7rem; color: #999; text-align: left; direction: ltr; }
.no-data { color: #bbb; font-size: .82rem; text-align: center; padding: .8rem 0; }

/* ======== AUTH ======== */
.auth-wrapper { min-height: calc(100vh - 140px); display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-card { background: #fff; border-radius: 20px; padding: 2.5rem 2rem; width: 100%; max-width: 400px; box-shadow: 0 8px 40px rgba(45,122,79,.15); text-align: center; }
.auth-icon { font-size: 3rem; margin-bottom: .5rem; }
.auth-title { font-size: 1.4rem; font-weight: 800; color: var(--green); margin-bottom: 1.5rem; }
.auth-form { text-align: right; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: .85rem; font-weight: 600; color: var(--text-soft); margin-bottom: .3rem; }
.field input { width: 100%; padding: .65rem 1rem; border: 1.5px solid #ddd; border-radius: 10px; font-family: 'Vazirmatn', sans-serif; font-size: .9rem; transition: border .2s; outline: none; }
.field input:focus { border-color: var(--green-l); }
.btn-submit { width: 100%; padding: .75rem; background: linear-gradient(90deg, var(--green), var(--green-l)); color: #fff; border: none; border-radius: 50px; font-family: 'Vazirmatn', sans-serif; font-size: 1rem; font-weight: 700; cursor: pointer; transition: opacity .2s; margin-top: .5rem; }
.btn-submit:hover { opacity: .88; }
.back-link { display: inline-block; margin-top: 1rem; color: var(--text-soft); font-size: .85rem; text-decoration: none; }
.alert-error { background: #ffeaea; color: #c0392b; border-radius: 10px; padding: .6rem 1rem; margin-bottom: 1rem; font-size: .85rem; }
.alert-success { background: #eafaf1; color: #27ae60; border-radius: 10px; padding: .6rem 1rem; margin-bottom: 1rem; font-size: .85rem; }

/* ======== DASHBOARD ======== */
.dash-wrapper { max-width: 900px; margin: 0 auto; padding: 2rem 1.5rem 3rem; }
.dash-header { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.5rem; }
.dash-icon { font-size: 2rem; }
.dash-header h2 { font-size: 1.3rem; font-weight: 800; color: var(--green); }
.dash-expert { font-size: .85rem; color: var(--text-soft); margin-top: .2rem; font-weight: 500; }
.dash-form-card { background: #fff; border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); margin-bottom: 2rem; }
.dash-form-card h3, .dash-history h3 { font-size: 1rem; font-weight: 700; color: var(--green); margin-bottom: 1rem; border-bottom: 2px dashed #c8e8d4; padding-bottom: .5rem; }
.form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.dash-history { background: #fff; border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th { background: var(--green-pale); color: var(--green); padding: .6rem; text-align: center; font-weight: 700; }
.data-table td { padding: .55rem; text-align: center; border-bottom: 1px solid #f0f0f0; }
.data-table .row-latest td { background: #f0faf5; font-weight: 600; }
.btn-delete { background: #ffeaea; border: none; border-radius: 8px; padding: .3rem .6rem; cursor: pointer; font-size: .9rem; }
.btn-delete:hover { background: #ffd0d0; }

/* ======== FOOTER ======== */
.site-footer { background: var(--green); color: #c8f0d8; text-align: center; padding: 1rem; font-size: .8rem; margin-top: auto; }

/* ======== RESPONSIVE ======== */
@media (max-width: 768px) {
  .desktop-nav { display: none; }
  .hamburger { display: flex; }
  .header-sub { display: none; }
  .search-bar { padding: .6rem 1rem; }
}
@media (max-width: 600px) {
  .site-header { padding: .6rem 1rem; }
  .header-title { font-size: .95rem; }
  .grid-container { padding: .8rem 1rem 2rem; gap: .8rem; grid-template-columns: 1fr 1fr; }
  .card { padding: .9rem .8rem; }
  .card-name { font-size: .85rem; }
  .stat-val { font-size: .78rem; }
  .dash-wrapper { padding: 1.5rem 1rem; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .grid-container { grid-template-columns: 1fr; }
}
