:root {
  --surface: #ffffff;
  --surface-soft: #f7faf9;
  --navy-soft: #1b344f;
  --shadow-soft: 0 14px 35px rgba(20, 39, 61, .07);
}

[hidden] { display: none !important; }

::selection { background: #c7f2e2; color: var(--ink); }
html { scroll-behavior: smooth; }
body, button, input, textarea, select { font-family: Vazirmatn, IRANSansX, Tahoma, Arial, sans-serif; font-synthesis: none; }
button, label { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.skip-link { background: var(--navy); border-radius: 0 0 8px 8px; color: #fff; font-size: 11px; font-weight: 700; padding: 9px 14px; position: fixed; right: 16px; top: -48px; transition: top .15s; z-index: 20; }
.skip-link:focus { top: 0; }

.sidebar { box-shadow: -1px 0 0 rgba(255,255,255,.05); position: sticky; top: 0; height: 100vh; }
.mobile-nav { display: none; }
.nav-item { position: relative; transition: background .18s ease, color .18s ease, transform .18s ease; }
.nav-item:hover { transform: translateX(-2px); }
.nav-item.active::before { background: var(--green); border-radius: 8px; content: ''; height: 20px; position: absolute; right: -20px; top: calc(50% - 10px); width: 3px; }

.content { background: radial-gradient(circle at 100% 0, rgba(75, 170, 142, .08), transparent 28rem); }
.dashboard-head { background: linear-gradient(135deg, #fff 0%, #f6fbf9 100%); border: 1px solid #dbece6; border-radius: 16px; box-shadow: var(--shadow-soft); margin-bottom: 16px; padding: 22px 24px; position: relative; overflow: hidden; }
.dashboard-head::after { background: radial-gradient(circle, rgba(19, 168, 117, .18), transparent 68%); content: ''; height: 180px; left: -55px; pointer-events: none; position: absolute; top: -75px; width: 180px; }
.dashboard-head > * { position: relative; z-index: 1; }
.dashboard-head .subhead { max-width: 560px; }
.report-status { align-items: center; color: var(--green-dark); display: flex; font-size: 10px; font-weight: 700; gap: 6px; margin: 12px 0 0; }
.report-status::before { background: var(--green); border-radius: 50%; box-shadow: 0 0 0 4px rgba(19,168,117,.1); content: ''; height: 6px; width: 6px; }

.upload-button { box-shadow: 0 10px 24px rgba(18, 33, 56, .18); flex-wrap: wrap; justify-content: flex-start; min-width: 204px; transition: background .17s, box-shadow .17s, transform .17s; }
.upload-button:hover { box-shadow: 0 14px 28px rgba(18, 33, 56, .25); transform: translateY(-2px); }
.upload-button strong { font-size: 12px; }
.upload-button small { color: #b9c7d7; flex-basis: calc(100% - 30px); font-size: 9px; margin-right: 28px; }
.upload-button .upload-icon { flex: 0 0 20px; }
.upload-button.is-uploading { cursor: progress; opacity: .82; pointer-events: none; }
.upload-stack { display: grid; gap: 8px; min-width: 278px; }
.report-title-field { display: grid; gap: 4px; }
.report-title-field > span { color: var(--muted); font-size: 10px; font-weight: 700; }
.report-title-field > span small { color: var(--green-dark); font-size: 9px; font-weight: 700; }
.report-title-field input { background: rgba(255,255,255,.92); border: 1px solid #d9e8e2; border-radius: 8px; color: var(--ink); font-size: 11px; padding: 8px 10px; transition: border-color .15s, box-shadow .15s; }
.report-title-field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(19,168,117,.1); outline: 0; }
.report-title-field > small { color: var(--muted); font-size: 9px; }

.filter-bar { box-shadow: 0 8px 22px rgba(24, 43, 66, .035); }
.filter-bar select { transition: border-color .15s, box-shadow .15s; }
.filter-bar select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(19,168,117,.1); outline: 0; }
.summary-note { align-items: center; display: flex; gap: 6px; }
.summary-note::before { background: #ccd8e4; border-radius: 50%; content: ''; height: 5px; width: 5px; }

.setup-card { align-items: center; background: linear-gradient(135deg, #17304b, #244b68); border-radius: 14px; box-shadow: 0 16px 35px rgba(18, 33, 56, .14); color: #eef7fb; display: grid; gap: 24px; grid-template-columns: minmax(190px, .8fr) minmax(0, 1.7fr); margin: 14px 0; overflow: hidden; padding: 21px 24px; position: relative; }
.setup-card::after { border: 1px solid rgba(150,230,201,.14); border-radius: 50%; content: ''; height: 260px; left: -95px; position: absolute; top: -145px; width: 260px; }
.setup-card > * { position: relative; z-index: 1; }
.setup-card .eyebrow { color: #8de5c6; }
.setup-card h2 { font-size: 17px; letter-spacing: -.025em; margin: 0; }
.setup-card p:not(.eyebrow) { color: #bbcfdd; font-size: 10px; line-height: 1.9; margin: 8px 0 0; }
.setup-steps { display: grid; gap: 8px; list-style: none; margin: 0; padding: 0; }
.setup-steps li { align-items: center; background: rgba(255,255,255,.075); border: 1px solid rgba(255,255,255,.1); border-radius: 10px; display: grid; gap: 10px; grid-template-columns: 27px 1fr; min-height: 53px; padding: 8px 10px; }
.setup-steps li > span { align-items: center; background: rgba(103,220,178,.18); border-radius: 50%; color: #9ceaca; display: flex; font-size: 11px; font-weight: 800; height: 25px; justify-content: center; width: 25px; }
.setup-steps b { display: block; font-size: 10px; }
.setup-steps small { color: #b7c8d6; display: block; font-size: 9px; margin-top: 3px; }
.text-action { background: transparent; border: 0; color: #9ceaca; font-size: 9px; font-weight: 800; margin: 3px 0 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
#dashboardView:not(.has-report) .dashboard-grid,
#dashboardView:not(.has-report) .wide-season,
#dashboardView:not(.has-report) .service-panel { display: none; }

.kpi { box-shadow: var(--shadow-soft); overflow: hidden; transition: box-shadow .18s ease, transform .18s ease; }
.kpi:hover { box-shadow: 0 18px 32px rgba(20,39,61,.09); transform: translateY(-2px); }
.kpi::after { background: linear-gradient(90deg, var(--green), #74d9b7); bottom: 0; content: ''; height: 3px; position: absolute; right: 0; width: 42%; }
.kpi:nth-child(2)::after { background: linear-gradient(90deg, #5c81d7, #a3b9ec); }
.kpi:nth-child(3)::after { background: linear-gradient(90deg, #e89b46, #f2c887); }
.panel { box-shadow: var(--shadow-soft); transition: box-shadow .18s ease; }
.panel:hover { box-shadow: 0 16px 30px rgba(20,39,61,.06); }
.team-row { position: relative; }
.team-row:hover::after, .team-row.selected::after { background: var(--green); border-radius: 99px; content: ''; height: 18px; position: absolute; right: -5px; width: 3px; }
.team-cost { color: var(--green-dark); }

.assignment { color: var(--green-dark); display: block; font-size: 10px; margin-top: 7px; }
.products-chips { direction: rtl; }
.products-chips .chip { font-family: Vazirmatn, Tahoma, sans-serif; }
.product-checklist { border: 1px solid #dce4ed; border-radius: 10px; margin: 0; padding: 8px; }
.product-checklist legend { color: var(--muted); font-size: 11px; padding: 0 4px; }
.product-checklist label { align-items: center; background: #f8fafc; border: 1px solid transparent; border-radius: 7px; cursor: pointer; display: grid; gap: 7px; grid-template-columns: auto 1fr auto; margin: 5px 0; padding: 8px; transition: background .15s, border-color .15s; }
.product-checklist label:hover { background: #f1faf6; border-color: #d8ede5; }
.product-checklist input { accent-color: var(--green); margin: 0; }
.product-checklist label span { font-size: 11px; }
.product-checklist label small { color: var(--muted); font-size: 9px; }
.mapping-item { transition: border-color .15s, box-shadow .15s, transform .15s; }
.mapping-item:hover { border-color: #cfe4db; box-shadow: 0 8px 18px rgba(27,65,53,.05); transform: translateY(-1px); }
.remove-button { border-radius: 5px; padding: 4px 6px; }
.remove-button:hover { background: #fff0f1; }

.wide-season { margin-top: 14px; }
.wide-season .season-list { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.season-item { background: #fbfcfd; border: 1px solid #edf1f5; border-radius: 9px; padding: 10px; }

.drawer-backdrop { background: rgba(11, 27, 45, .32); border: 0; inset: 0; position: fixed; z-index: 3; }
.detail-drawer { border-right: 1px solid #e5ecf2; z-index: 4; }
.drawer-line { transition: border-color .15s, background .15s; }
.drawer-line:hover { background: #f8fcfa; border-color: #cce8dc; }
.toast { border: 1px solid rgba(255,255,255,.13); max-width: min(420px, calc(100vw - 40px)); }

#dashboardView[aria-busy="true"] .summary-note { color: var(--green-dark); }
#dashboardView[aria-busy="true"] .summary-note::before { animation: pulse 1s infinite alternate; background: var(--green); }

@keyframes pulse { to { box-shadow: 0 0 0 5px rgba(19,168,117,0); } }

@media (max-width: 1120px) {
  .sidebar { position: static; height: auto; }
  .dashboard-head { padding: 20px; }
  .setup-card { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .mobile-nav { background: rgba(255,255,255,.94); border: 1px solid #e2eaf0; border-radius: 12px; box-shadow: 0 8px 24px rgba(23,43,65,.08); display: grid; gap: 4px; grid-template-columns: repeat(3, 1fr); margin: -10px 0 20px; padding: 5px; position: sticky; top: 8px; z-index: 2; }
  .mobile-nav-item { align-items: center; background: transparent; color: #718095; display: grid; font-size: 9px; justify-items: center; min-height: 49px; padding: 5px 2px; text-align: center; }
  .mobile-nav-item span, .sidebar .nav-item span { margin: 0; width: auto; }
  .mobile-nav-item span { font-size: 16px; line-height: 1; margin-bottom: 3px; }
  .mobile-nav-item.active { background: #eaf8f2; color: var(--green-dark); }
  .dashboard-head { border-radius: 13px; padding: 18px; }
  .upload-button { min-width: 0; width: 100%; }
  .upload-stack { min-width: 0; width: 100%; }
  .setup-card { padding: 18px; }
  .setup-steps { gap: 7px; }
  .nav-item.active::before { display: none; }
  .drawer-backdrop { display: none; }
  .wide-season .season-list { grid-template-columns: 1fr; }
  .login-card input, .mapping-form input, .mapping-form textarea, .filter-bar select { font-size: 16px; }
}

@media (max-width: 390px) {
  .mobile-nav-item { font-size: 8px; }
  .mobile-nav { gap: 2px; padding: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
