@font-face { font-family: "Vazirmatn FD"; src: url("../fonts/Vazirmatn-FD-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn FD"; src: url("../fonts/Vazirmatn-FD-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Vazirmatn FD"; src: url("../fonts/Vazirmatn-FD-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Vazirmatn FD"; src: url("../fonts/Vazirmatn-FD-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --primary: #0f766e;
  --primary-ink: #ffffff;
  --primary-text: var(--primary);
  --primary-soft: color-mix(in srgb, var(--primary) 10%, transparent);
  --primary-soft-2: color-mix(in srgb, var(--primary) 18%, transparent);
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #344054;
  --muted: #667085;
  --success: #12805c;
  --warning: #b54708;
  --danger: #c4320a;
  --info: #175cd3;
  --success-soft: #ecfdf3;
  --warning-soft: #fffaeb;
  --danger-soft: #fef3f2;
  --info-soft: #eff8ff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18);
  --sidebar: 264px;
  --topbar: 64px;
  --font: "Vazirmatn FD", Tahoma, system-ui, sans-serif;
  --c1: var(--primary);
  --c2: #f59e0b;
  --c3: #6366f1;
  --c4: #e11d48;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --primary-text: color-mix(in srgb, var(--primary) 55%, #ffffff);
  --bg: #0b1018;
  --surface: #121924;
  --surface-2: #1a2330;
  --border: #243041;
  --border-strong: #324155;
  --text: #f2f4f7;
  --text-2: #d0d5dd;
  --muted: #98a2b3;
  --primary-soft: color-mix(in srgb, var(--primary) 22%, transparent);
  --primary-soft-2: color-mix(in srgb, var(--primary) 32%, transparent);
  --success: #47cd89;
  --warning: #fdb022;
  --danger: #f97066;
  --info: #84caff;
  --success-soft: rgba(18, 128, 92, .18);
  --warning-soft: rgba(181, 71, 8, .2);
  --danger-soft: rgba(196, 50, 10, .2);
  --info-soft: rgba(23, 92, 211, .2);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.7; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.4; font-weight: 700; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
code, .code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; }
.code { display: block; background: var(--surface-2); border: 1px solid var(--border); padding: .6rem .8rem; border-radius: 8px; margin: .4rem 0 .8rem; overflow-x: auto; white-space: nowrap; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
::selection { background: var(--primary-soft-2); }

.ic { width: 20px; height: 20px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ic.sm { width: 16px; height: 16px; }
.ic.lg { width: 24px; height: 24px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.xs { font-size: .78rem; }
.center { text-align: center; }
.ltr { direction: ltr; unicode-bidi: embed; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }
.mt { margin-top: 1rem; }
.mb { margin-bottom: 1rem; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: 1rem; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

/* ---------- Layout ---------- */
.app { min-height: 100vh; }
.sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar); background: var(--surface); border-inline-end: 1px solid var(--border); display: flex; flex-direction: column; z-index: 40; transition: transform .25s ease; }
.brand { color: var(--text); display: flex; align-items: center; gap: .75rem; height: var(--topbar); padding: 0 1.25rem; border-bottom: 1px solid var(--border); }
.brand img { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: var(--primary-ink); display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; flex-shrink: 0; }
.brand-name { font-weight: 700; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-sub { font-size: .75rem; color: var(--muted); }
.nav { flex: 1; overflow-y: auto; padding: .75rem; }
.nav-group { font-size: .72rem; font-weight: 600; color: var(--muted); padding: 1rem .75rem .35rem; letter-spacing: .02em; }
.nav a { display: flex; align-items: center; gap: .75rem; padding: .55rem .75rem; border-radius: 10px; color: var(--text-2); font-weight: 500; font-size: .92rem; min-height: 42px; transition: background .15s, color .15s; }
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.nav a .count { margin-inline-start: auto; background: var(--danger); color: #fff; font-size: .7rem; border-radius: 999px; padding: 0 .45rem; min-width: 20px; text-align: center; line-height: 20px; }
.sidebar-foot { padding: .75rem; border-top: 1px solid var(--border); }
.main { margin-inline-start: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .5rem; padding: 0 1.5rem; }
.topbar h1 { font-size: 1.05rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { padding: 1.5rem; max-width: 1400px; width: 100%; margin: 0 auto; flex: 1; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: .9rem; }
.icon-btn { position: relative; width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 10px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .badge-dot { position: absolute; top: 6px; inset-inline-end: 6px; background: var(--danger); color: #fff; border-radius: 999px; font-size: .65rem; min-width: 18px; height: 18px; line-height: 18px; text-align: center; padding: 0 4px; border: 2px solid var(--surface); }
.menu-btn { display: none; }
.overlay { display: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-soft-2); color: var(--primary-text); display: inline-grid; place-items: center; font-weight: 700; font-size: .9rem; flex-shrink: 0; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.4rem; }
.bottom-nav { display: none; }

/* Dropdowns */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .4rem; display: none; z-index: 60; }
.dropdown.open .dropdown-menu { display: block; animation: pop .15s ease-out; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .55rem .7rem; border-radius: 8px; color: var(--text-2); background: none; border: 0; font: inherit; cursor: pointer; text-align: start; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); text-decoration: none; }
.notif-panel { width: min(380px, calc(100vw - 24px)); padding: 0; }
.notif-panel .head { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1rem; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif-item { display: block; padding: .75rem 1rem; border-bottom: 1px solid var(--border); color: var(--text); }
.notif-item:hover { background: var(--surface-2); text-decoration: none; }
.notif-item.unread { background: var(--primary-soft); }
.notif-item .t { font-weight: 600; font-size: .9rem; }
.notif-item .b { font-size: .82rem; color: var(--muted); white-space: pre-line; }
.notif-item .d { font-size: .72rem; color: var(--muted); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.card + .card { margin-top: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.card-title { font-size: 1rem; font-weight: 700; margin-bottom: .75rem; }
.card-head .card-title { margin: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 1rem 1.25rem 0; }
.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; display: flex; gap: .9rem; align-items: center; box-shadow: var(--shadow); }
.kpi .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); flex-shrink: 0; }
.kpi .ico.warn { background: var(--warning-soft); color: var(--warning); }
.kpi .ico.danger { background: var(--danger-soft); color: var(--danger); }
.kpi .ico.info { background: var(--info-soft); color: var(--info); }
.kpi .label { font-size: .8rem; color: var(--muted); }
.kpi .value { font-size: 1.3rem; font-weight: 700; line-height: 1.3; }
.kpi .value small { font-size: .75rem; font-weight: 500; color: var(--muted); }
a.kpi:hover { text-decoration: none; border-color: var(--border-strong); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 42px; padding: .5rem 1rem; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; transition: background .15s, border-color .15s, color .15s, transform .05s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--primary) 88%, #000); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 34px; padding: .25rem .7rem; font-size: .82rem; border-radius: 8px; }
.btn.lg { min-height: 48px; font-size: 1rem; }
.btn.block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }
.btn-group { display: inline-flex; gap: .4rem; flex-wrap: wrap; }

.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.primary { background: var(--primary-soft); color: var(--primary-text); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c1); }
.dot.c2 { background: var(--c2); } .dot.c3 { background: var(--c3); } .dot.c4 { background: var(--c4); }

.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); border: 1px solid transparent; margin-bottom: 1rem; font-size: .92rem; }
.alert.success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert.danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert.warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.alert.info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.toasts { position: fixed; top: 76px; inset-inline-end: 1.25rem; z-index: 80; display: flex; flex-direction: column; gap: .5rem; max-width: min(420px, calc(100vw - 2rem)); }
.toasts .alert { box-shadow: var(--shadow-lg); margin: 0; animation: pop .2s ease-out; background-color: var(--surface); }

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: start; font-weight: 600; font-size: .78rem; color: var(--muted); background: var(--surface-2); padding: .65rem 1rem; white-space: nowrap; border-bottom: 1px solid var(--border); }
.table td { padding: .7rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table .actions { text-align: end; white-space: nowrap; }
.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tfoot td { font-weight: 700; background: var(--surface-2); }
.person { display: flex; align-items: center; gap: .6rem; min-width: 160px; }
.person .avatar { width: 32px; height: 32px; font-size: .8rem; }
.person .name { font-weight: 600; color: var(--text); }
.person .meta { font-size: .78rem; color: var(--muted); }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1rem; margin-bottom: 1rem; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field > span { font-size: .85rem; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: .78rem; color: var(--muted); font-weight: 400; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; padding: .55rem .8rem; min-height: 44px; width: 100%; transition: border-color .15s, box-shadow .15s; }
textarea { min-height: 96px; resize: vertical; line-height: 1.7; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft-2); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); padding: 0; flex-shrink: 0; }
input[type="color"] { padding: 4px; height: 44px; }
input[type="file"] { padding: .45rem; }
input[dir="ltr"] { text-align: left; }
.check { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .9rem; min-height: 32px; }
.checks-inline { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: 1rem; }
.filters .field { min-width: 150px; flex: 1; max-width: 240px; }
.filters .btn { min-height: 44px; }
.form-actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; padding-top: .5rem; }
.input-group { display: flex; gap: .5rem; }
.input-group > input { flex: 1; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; margin: 0 0 1rem; }
legend { padding: 0 .4rem; font-weight: 700; font-size: .9rem; }

/* Tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: .6rem 1rem; border: 0; background: none; font: inherit; font-weight: 600; font-size: .9rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; cursor: pointer; }
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs a.active, .tabs button.active { color: var(--primary-text); border-bottom-color: var(--primary); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button, .seg a { border: 0; background: none; font: inherit; font-size: .85rem; font-weight: 600; padding: .45rem .9rem; border-radius: 8px; color: var(--muted); cursor: pointer; }
.seg .active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: .75rem; padding: .75rem 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { min-width: 0; }
.list .t { font-weight: 600; font-size: .92rem; }
.list .s { font-size: .8rem; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; font-size: .9rem; }
.empty .ic { width: 40px; height: 40px; opacity: .45; display: block; margin: 0 auto .5rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.color-chip { width: 12px; height: 12px; border-radius: 4px; display: inline-block; vertical-align: middle; }

/* Pagination */
.pager { display: flex; gap: .3rem; justify-content: center; padding: 1rem; flex-wrap: wrap; }
.pager a, .pager span { min-width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--border); color: var(--text-2); font-size: .85rem; padding: 0 .5rem; }
.pager .current { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }

/* Charts */
.chart-wrap { width: 100%; overflow-x: auto; }
.chart { width: 100%; height: auto; min-width: 480px; display: block; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .bar { fill: var(--c1); transition: opacity .15s; }
.chart .bar:hover { opacity: .8; }
.chart .bar.c2 { fill: var(--c2); } .chart .bar.c3 { fill: var(--c3); } .chart .bar.c4 { fill: var(--c4); }
.chart .lbl { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: .5rem; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.meter { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; min-width: 80px; }
.meter span { display: block; height: 100%; background: var(--c1); border-radius: 999px; }
.meter span.c2 { background: var(--c2); } .meter span.c4 { background: var(--danger); }

/* Weekly schedule */
.week { display: grid; grid-template-columns: 56px repeat(7, minmax(120px, 1fr)); min-width: 920px; position: relative; }
.week-head { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; font-size: .82rem; text-align: center; padding: .6rem .25rem; border-bottom: 1px solid var(--border); z-index: 2; }
.week-head.today { color: var(--primary-text); }
.week-hours { position: relative; border-inline-end: 1px solid var(--border); }
.week-hours span { position: absolute; inset-inline: 0; font-size: .72rem; color: var(--muted); text-align: center; transform: translateY(-50%); }
.week-day { position: relative; border-inline-end: 1px solid var(--border); background-image: linear-gradient(var(--border) 1px, transparent 1px); }
.week-day.today { background-color: var(--primary-soft); }
.slot { position: absolute; inset-inline: 4px; border-radius: 8px; padding: .3rem .45rem; font-size: .75rem; line-height: 1.45; overflow: hidden; color: var(--text); border-inline-start: 3px solid var(--slot, var(--primary)); background: color-mix(in srgb, var(--slot, var(--primary)) 14%, var(--surface)); box-shadow: var(--shadow); }
.slot:hover { z-index: 3; overflow: visible; min-height: fit-content; text-decoration: none; box-shadow: var(--shadow-lg); }
.slot .st { font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .sm { color: var(--text-2); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-list { display: none; }

/* Attendance */
.att-row { display: flex; align-items: center; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.att-opts { display: inline-flex; gap: .3rem; margin-inline-start: auto; flex-wrap: wrap; }
.att-opts label { cursor: pointer; }
.att-opts input { position: absolute; opacity: 0; pointer-events: none; }
.att-opts span { display: inline-flex; align-items: center; min-height: 38px; padding: .3rem .8rem; border-radius: 8px; border: 1px solid var(--border-strong); font-size: .82rem; font-weight: 600; color: var(--muted); }
.att-opts input:checked + span.present { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.att-opts input:checked + span.absent { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.att-opts input:checked + span.late { background: var(--warning-soft); color: var(--warning); border-color: var(--warning); }
.att-opts input:checked + span.excused { background: var(--info-soft); color: var(--info); border-color: var(--info); }
.att-opts input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Messages */
.chat { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - var(--topbar) - 3rem); min-height: 480px; padding: 0; overflow: hidden; }
.chat-list { border-inline-end: 1px solid var(--border); overflow-y: auto; }
.chat-list a { display: flex; gap: .7rem; padding: .8rem 1rem; border-bottom: 1px solid var(--border); color: var(--text); align-items: center; }
.chat-list a:hover { background: var(--surface-2); text-decoration: none; }
.chat-list a.active { background: var(--primary-soft); }
.chat-list .unread { background: var(--primary); color: var(--primary-ink); border-radius: 999px; font-size: .7rem; padding: 0 .45rem; }
.chat-pane { display: flex; flex-direction: column; min-width: 0; }
.chat-head { padding: .8rem 1rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .7rem; }
.chat-body { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .5rem; background: var(--bg); }
.bubble { max-width: min(75%, 520px); padding: .55rem .85rem; border-radius: 14px; font-size: .92rem; white-space: pre-wrap; word-wrap: break-word; background: var(--surface); border: 1px solid var(--border); align-self: flex-end; }
.bubble.me { align-self: flex-start; background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.bubble .time { display: block; font-size: .68rem; opacity: .7; margin-top: .15rem; }
.chat-form { display: flex; gap: .5rem; padding: .75rem; border-top: 1px solid var(--border); background: var(--surface); }
.chat-form textarea { min-height: 44px; height: 44px; max-height: 140px; }

/* Exams */
.q-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; margin-bottom: .9rem; background: var(--surface); }
.q-card .q-head { display: flex; gap: .5rem; align-items: center; margin-bottom: .75rem; flex-wrap: wrap; }
.q-card .q-num { width: 28px; height: 28px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-text); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.q-body { font-weight: 600; margin-bottom: .75rem; white-space: pre-wrap; }
.q-opt { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: 10px; margin-bottom: .45rem; cursor: pointer; }
.q-opt:hover { background: var(--surface-2); }
.q-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.q-opt.correct { border-color: var(--success); background: var(--success-soft); }
.q-opt.wrong { border-color: var(--danger); background: var(--danger-soft); }
.opt-row { display: flex; gap: .5rem; align-items: center; margin-bottom: .45rem; }
.timer { position: sticky; top: calc(var(--topbar) + 8px); z-index: 5; display: inline-flex; align-items: center; gap: .4rem; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: .35rem .9rem; font-weight: 700; box-shadow: var(--shadow); }
.timer.low { color: var(--danger); border-color: var(--danger); }
.score-big { font-size: 2.4rem; font-weight: 700; color: var(--primary-text); line-height: 1.2; }

/* Payment */
.pay-card { max-width: 560px; margin: 0 auto; }
.bank-card { border-radius: 16px; padding: 1.25rem; color: #fff; background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 55%, #111827)); box-shadow: var(--shadow-lg); margin-bottom: .75rem; }
.bank-card .num { font-size: 1.35rem; letter-spacing: .08em; direction: ltr; text-align: center; margin: .9rem 0; font-weight: 700; }
.bank-card .meta { display: flex; justify-content: space-between; font-size: .85rem; opacity: .9; gap: .5rem; flex-wrap: wrap; }
.bank-card button { color: #fff; border-color: rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .12); }
.method { display: flex; align-items: center; gap: .8rem; padding: 1rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; margin-bottom: .6rem; }
.method:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.amount-big { font-size: 1.8rem; font-weight: 700; }

/* Guest pages */
body.guest { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem 1rem; background: radial-gradient(1200px 600px at 100% 0, var(--primary-soft), transparent 60%), var(--bg); }
.auth { width: 100%; max-width: 420px; }
.auth .card { padding: 1.75rem; }
.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.auth-brand .brand-mark, .auth-brand img { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto .75rem; font-size: 1.5rem; display: grid; }
.auth-brand img { object-fit: cover; display: block; }
.install { width: 100%; max-width: 720px; }
.install-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.install-head .brand-mark { width: 52px; height: 52px; font-size: 1.4rem; border-radius: 14px; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .4rem 1rem; font-size: .9rem; }
.checks li { display: flex; gap: .5rem; align-items: center; }
.checks li span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; }
.checks .ok span { background: var(--success-soft); color: var(--success); }
.checks .fail span { background: var(--danger-soft); color: var(--danger); }
.checks .fail { color: var(--danger); }
.steps { padding-inline-start: 1.25rem; }
.steps li { margin-bottom: .75rem; }
.public-wrap { width: 100%; max-width: 760px; }

/* Dialog */
dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(520px, calc(100vw - 24px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(16, 24, 40, .45); backdrop-filter: blur(2px); }
dialog[open] { animation: pop .18s ease-out; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.dlg-body { padding: 1.25rem; max-height: 70vh; overflow-y: auto; }
.dlg-foot { padding: .9rem 1.25rem; border-top: 1px solid var(--border); display: flex; gap: .5rem; justify-content: flex-end; }

/* Jalali date picker */
.jdp { position: absolute; z-index: 90; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .75rem; width: 288px; user-select: none; }
.jdp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; font-weight: 700; }
.jdp-head button { width: 34px; height: 34px; border-radius: 8px; border: 0; background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; }
.jdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.jdp-grid .w { font-size: .72rem; color: var(--muted); padding: .2rem 0; }
.jdp-grid button { height: 36px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: .85rem; cursor: pointer; }
.jdp-grid button:hover { background: var(--surface-2); }
.jdp-grid button.today { color: var(--primary-text); font-weight: 700; }
.jdp-grid button.sel { background: var(--primary); color: var(--primary-ink); }
.jdp-grid button.fri { color: var(--danger); }
.jdp-foot { display: flex; justify-content: space-between; margin-top: .5rem; }
.jdp-foot button { border: 0; background: none; color: var(--primary-text); font: inherit; font-size: .82rem; cursor: pointer; padding: .3rem .5rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .sidebar { transform: translateX(100%); box-shadow: var(--shadow-lg); }
  [dir="ltr"] .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .overlay { display: block; position: fixed; inset: 0; background: rgba(16, 24, 40, .4); z-index: 35; }
  .main { margin-inline-start: 0; }
  .menu-btn { display: inline-grid; }
  .grid.side, .grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .chat { grid-template-columns: 1fr; }
  .chat.has-thread .chat-list { display: none; }
  .chat:not(.has-thread) .chat-pane { display: none; }
}
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .content { padding: 1rem 1rem calc(80px + env(safe-area-inset-bottom)); }
  .topbar { padding: 0 .75rem; }
  .grid.cols-2, .grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: .85rem; gap: .6rem; flex-direction: column; align-items: flex-start; }
  .kpi .ico { width: 36px; height: 36px; }
  .kpi .value { font-size: 1.1rem; }
  .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .card { padding: 1rem; }
  .page-head h1 { font-size: 1.15rem; }
  .filters .field { max-width: none; min-width: calc(50% - .3rem); }
  .bottom-nav { display: flex; position: fixed; bottom: 0; inset-inline: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--border); padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom)); }
  .bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .1rem; font-size: .68rem; color: var(--muted); padding: .3rem 0; background: none; border: 0; font-family: inherit; min-height: 48px; justify-content: center; }
  .bottom-nav a.active { color: var(--primary-text); font-weight: 600; }
  .bottom-nav a:hover { text-decoration: none; }
  .week-scroll { display: none; }
  .day-list { display: block; }
  .chat { height: calc(100vh - var(--topbar) - 96px); }
  .checks { grid-template-columns: 1fr; }
  .table.responsive thead { display: none; }
  .table.responsive tr { display: block; border-bottom: 1px solid var(--border); padding: .5rem 0; }
  .table.responsive td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .3rem 1rem; text-align: end; }
  .table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; text-align: start; }
  .table.responsive td.actions { justify-content: flex-end; }
  .table.responsive td.actions::before { content: none; }
  .toasts { inset-inline: 1rem; top: 72px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
  .sidebar, .topbar, .bottom-nav, .no-print, .filters, .btn, .tabs, .toasts { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  body { background: #fff; color: #000; }
}
[data-theme="dark"] .theme-dark { display: none; }
:root:not([data-theme="dark"]) .theme-light { display: none; }
.d-block { display: block; }
.brand-name, .brand-sub { display: block; }
a.kpi { color: inherit; }
.d-flex { display: flex; }
.class-card { display: block; color: inherit; border-top: 3px solid var(--slot, var(--primary)); transition: box-shadow .15s, transform .15s; }
.class-card:hover { text-decoration: none; box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.class-card h3 { margin-bottom: .2rem; }
.class-card .meter { margin-top: .4rem; }
.card + .card.class-card, .grid > .card + .card { margin-top: 0; }
.slot.cancelled { opacity: .55; text-decoration: line-through; }
.kpi-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); flex-shrink: 0; }
