:root{color-scheme:light;--page:#f5f7fb;--surface:#fff;--soft:#f8f9fc;--text:#172033;--muted:#69758a;--line:#e4e9f1;--primary:#29469c;--primary-hover:#1e367f;--focus:#8298ef;--shadow:0 8px 26px rgba(24,38,76,.065);--good:#137746;--bad:#b42332;--warn:#986200}
html[data-theme="dark"]{color-scheme:dark;--page:#111722;--surface:#1a2331;--soft:#202b3b;--text:#edf1f7;--muted:#a5b0c2;--line:#344155;--primary:#829bf3;--primary-hover:#9bb0ff;--focus:#96abff;--shadow:0 10px 28px rgba(0,0,0,.22);--good:#7cdaa5;--bad:#ff9ba2;--warn:#ffd27a}
*{box-sizing:border-box}html{background:var(--page)}body{background:var(--page)!important;color:var(--text)!important;font-family:Vazir,IRANSans,Tahoma,sans-serif!important;line-height:1.7;transition:background-color .18s ease,color .18s ease}
:is(.page,.container){width:min(1360px,calc(100% - 32px));margin-inline:auto;padding:24px 0 48px;position:relative}
:is(.header,.top,.nav,.crm-nav,.card,.card-header,.login-card,.table-wrap,.tablewrap,.search-box,.branch,.branch-item,.item,.metric,.stat,.branch-list,.recent,.result,.settings,.form-card,.user-area,.section,.panel){background:var(--surface)!important;color:var(--text)!important;border:1px solid var(--line)!important;box-shadow:var(--shadow)}
:is(.header,.top){border-radius:20px!important;padding:20px 24px!important;gap:16px;margin-bottom:20px}
:is(.nav,.crm-nav){display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:10px 14px!important;margin:0 auto 18px!important;border-radius:16px!important}
:is(.nav,.crm-nav) a{display:inline-flex;align-items:center;min-height:40px;padding:8px 12px;border-radius:10px;color:var(--text)!important;text-decoration:none;font-weight:600}
:is(.nav,.crm-nav) a:hover{background:var(--soft);color:var(--primary)!important}
:is(.card,.card-header,.form-card,.section,.panel){border-radius:18px!important;padding:20px!important;margin-bottom:16px}
:is(h1,h2,h3,h4,h5,td,strong,.card-title,.customer-name,.username,.value,.stat-value,label,legend){color:var(--text)}
:is(p,small,th,.muted,.hint,.date,.label,.description,.stat-label,.subtitle){color:var(--muted)}
a{color:var(--primary)}a:hover{color:var(--primary-hover)}
input,select,textarea{font:inherit!important;color:var(--text)!important;background:var(--surface)!important;border:1px solid var(--line)!important;border-radius:10px!important;min-height:42px;padding:9px 12px!important;transition:border-color .15s,box-shadow .15s}
textarea{min-height:110px}input::placeholder,textarea::placeholder{color:var(--muted);opacity:.8}
:is(input,select,textarea,button,a):focus-visible{outline:3px solid var(--focus);outline-offset:2px}
button,.button,.submit,.search-btn{font:inherit!important;min-height:40px;border-radius:10px!important;padding:9px 15px!important;transition:background-color .15s,transform .15s}
button:not(.theme-toggle),.button:not(.muted),.submit,.search-btn{background:var(--primary)!important;color:#fff!important;border:1px solid transparent!important}
button:not(.theme-toggle):hover,.button:not(.muted):hover,.submit:hover,.search-btn:hover{background:var(--primary-hover)!important}
:is(.muted,.button.muted){background:var(--soft)!important;color:var(--text)!important;border:1px solid var(--line)!important}
button:active{transform:translateY(1px)}
table{width:100%;border-collapse:collapse;color:var(--text)}th,td{padding:12px 14px;text-align:right;vertical-align:middle;border-bottom:1px solid var(--line)!important}th{background:var(--soft);font-weight:700;color:var(--muted)}tbody tr:hover td{background:var(--soft)}
:is(.table,.table-wrap,.tablewrap){max-width:100%;overflow:auto;border-radius:14px}code,.pill,.badge{background:var(--soft);color:var(--text)}
.good,.status-sent,.status-accepted,.status-delivered{color:var(--good)!important}.bad,.status-failed,.status-undelivered,.status-rejected{color:var(--bad)!important}.warn,.status-unknown,.status-skipped{color:var(--warn)!important}
.theme-toggle{position:static!important;z-index:2;flex:0 0 auto;width:auto!important;min-width:120px;min-height:40px;margin-inline-start:auto;padding:8px 12px!important;border:1px solid var(--line)!important;border-radius:11px!important;background:var(--soft)!important;color:var(--text)!important;box-shadow:none!important;font-size:13px;font-weight:700;cursor:pointer}
.theme-toggle:hover{border-color:var(--primary)!important}.theme-host{display:flex;align-items:center;justify-content:space-between;gap:12px}.login-card{position:relative;padding-top:72px!important}.login-card .theme-toggle{position:absolute!important;inset-block-start:14px;inset-inline-start:14px}
.page>.theme-toggle,.container>.theme-toggle{position:absolute!important;inset-block-start:10px;inset-inline-start:10px}
html[data-theme="dark"] body :is(.alert,.flash,.notice){background:var(--soft)!important;color:var(--text)!important;border-color:var(--line)!important}html[data-theme="dark"] body :is(.logout,.danger,button.danger){background:#8c3039!important;color:#fff!important}
.code-input{direction:ltr;text-align:center;letter-spacing:.12em;font-size:22px;font-weight:700}
@media(max-width:760px){:is(.page,.container){width:calc(100% - 20px);padding-top:14px}:is(.header,.top){padding:16px!important;flex-wrap:wrap}:is(.nav,.crm-nav){overflow-x:auto;flex-wrap:nowrap;justify-content:flex-start}:is(.nav,.crm-nav) a{white-space:nowrap}.card{padding:16px!important}.theme-toggle{min-height:38px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{transition-duration:.01ms!important;scroll-behavior:auto!important}}

/* Admin analytics: lightweight, responsive charts with no third-party runtime. */
.analytics{display:grid;gap:16px;margin:0 0 22px}.analytics-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.analytics-head h2{margin:0}.analytics-period{display:flex;align-items:center;gap:8px}.analytics-kpis{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px}.analytics-kpi{padding:16px;border:1px solid var(--line);border-radius:15px;background:var(--surface);box-shadow:var(--shadow)}.analytics-kpi span{display:block;color:var(--muted);font-size:12px}.analytics-kpi strong{display:block;margin-top:5px;color:var(--text);font-size:22px}.analytics-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.analytics-card{min-width:0;padding:18px;border:1px solid var(--line);border-radius:16px;background:var(--surface);box-shadow:var(--shadow)}.analytics-card h3{margin:0 0 5px;font-size:15px}.analytics-note{margin:0 0 10px;color:var(--muted);font-size:11px}.analytics-chart{display:block;width:100%;height:auto;overflow:visible}.analytics-chart text{fill:var(--muted);font:11px Vazir,Tahoma,sans-serif}.analytics-gridline{stroke:var(--line);stroke-width:1}.analytics-line{fill:none;stroke:var(--primary);stroke-width:3;stroke-linecap:round;stroke-linejoin:round}.analytics-line.sales{stroke:var(--good)}.analytics-dot{stroke:var(--surface);stroke-width:2}.analytics-bars{display:grid;gap:12px}.analytics-bar-row{display:grid;grid-template-columns:minmax(84px,1fr) minmax(80px,2fr) auto;align-items:center;gap:10px;font-size:12px}.analytics-bar-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text)}.analytics-track{height:9px;overflow:hidden;border-radius:999px;background:var(--soft)}.analytics-fill{height:100%;border-radius:inherit;background:var(--primary)}.analytics-fill.sales{background:var(--good)}.analytics-value{min-width:90px;text-align:left;color:var(--muted);font-variant-numeric:tabular-nums}.analytics-split{display:flex;gap:14px;align-items:center;margin-top:14px}.analytics-split .analytics-track{flex:1}.analytics-badges{display:flex;gap:8px;flex-wrap:wrap}.analytics-badge{padding:6px 9px;border-radius:999px;background:var(--soft);color:var(--text);font-size:11px}@media(max-width:1000px){.analytics-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}}@media(max-width:700px){.analytics-grid{grid-template-columns:1fr}.analytics-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.analytics-bar-row{grid-template-columns:minmax(70px,1fr) minmax(50px,1.4fr) auto;gap:7px}.analytics-value{min-width:70px;font-size:11px}}
