@font-face { font-family: Vazirmatn; src: url(/fonts/Vazirmatn.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --primary: #490fa7; --primary-ink: #fff; --accent: #12b886;
  --bg: #f4f6fb; --surface: #fff; --surface-2: #f0f3fa; --line: #e3e8f2; --ink: #1b2236; --ink-2: #5b6580; --ink-3: #8a93aa;
  --ok: #12945f; --ok-bg: #e3f7ee; --warn: #b7791f; --warn-bg: #fff4dc; --bad: #c92a3a; --bad-bg: #fde8ea; --info: #2563eb; --info-bg: #e6eeff;
  --radius: 14px; --shadow: 0 1px 2px rgba(20,30,60,.05), 0 6px 20px rgba(20,30,60,.06);
}
@media (prefers-color-scheme: dark) {
  :root { --primary: #9d7bf0; --primary-ink: #14102a; --bg: #0f1424; --surface: #171d33; --surface-2: #1d2540; --line: #28324f; --ink: #e8ecf8; --ink-2: #a3adc8; --ink-3: #7480a0;
    --ok-bg: #0f3326; --warn-bg: #3a2c0c; --bad-bg: #411820; --info-bg: #14264f; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.3); }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Vazirmatn, system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.7; }
h1, h2, h3 { margin: 0; line-height: 1.4; }
h1 { font-size: 1.45rem; font-weight: 800; } h2 { font-size: 1.15rem; font-weight: 700; } h3 { font-size: 1rem; font-weight: 700; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.muted { color: var(--ink-2); } .small { font-size: .86rem; } .tiny { font-size: .78rem; color: var(--ink-3); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } .spread { justify-content: space-between; } .grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.num { font-feature-settings: "ss01"; direction: ltr; unicode-bidi: plaintext; }
.ltr { direction: ltr; unicode-bidi: plaintext; text-align: left; }

/* shell */
.shell { display: grid; grid-template-columns: 262px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-inline-end: 1px solid var(--line); padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 12px; border-bottom: 1px solid var(--line); }
.brand .logo { width: 44px; height: 44px; border-radius: 12px; background: var(--primary); color: var(--primary-ink); display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; overflow: hidden; flex: none; }
.brand .logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.brand b { display: block; line-height: 1.3; } .brand span { font-size: .8rem; color: var(--ink-2); }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px; color: var(--ink-2); font-weight: 500; cursor: pointer; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); font-weight: 700; }
.side .me { margin-top: auto; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.shell > div { min-width: 0; }
.main { padding: 26px clamp(16px, 3vw, 40px) 60px; max-width: 1280px; width: 100%; }
.topbar { display: none; }
.pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.pagehead p { margin: 4px 0 0; color: var(--ink-2); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 0 0 auto; width: min(290px, 86vw); z-index: 30; transform: translateX(105%); transition: transform .22s; box-shadow: var(--shadow); height: 100dvh; }
  .side.open { transform: none; }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
  .scrim { position: fixed; inset: 0; background: rgba(10,15,30,.45); z-index: 25; }
}

/* cards & grids */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat b { display: block; font-size: 1.7rem; font-weight: 800; line-height: 1.3; } .stat span { color: var(--ink-2); font-size: .88rem; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; transition: .15s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.good { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.sm { padding: 5px 11px; font-size: .86rem; border-radius: 9px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.big { padding: 13px 22px; font-size: 1.05rem; border-radius: 13px; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--ink-2); }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.info { background: var(--info-bg); color: var(--info); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.live .dot { animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: .9rem; }
.field .hint { font-size: .8rem; color: var(--ink-3); }
input[type=text], input[type=password], input[type=number], input[type=time], input[type=search], input[type=email], input[type=tel], select, textarea {
  width: 100%; padding: 10px 13px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); outline: none; transition: .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; padding: 4px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 14px; }

/* tables */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--surface-2); font-size: .82rem; color: var(--ink-2); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
td.wrap { white-space: normal; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(10,15,30,.5); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 18px; width: min(560px, 100%); max-height: 92vh; overflow: auto; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.modal.wide { width: min(860px, 100%); }
.modal h2 { margin-bottom: 16px; } .modal .actions { display: flex; gap: 10px; justify-content: flex-start; margin-top: 18px; }
@keyframes fade { from { opacity: 0; } }

#toasts { position: fixed; bottom: 18px; inset-inline-start: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 80; }
.toast { background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 12px; box-shadow: var(--shadow); animation: fade .2s; max-width: 380px; }
.toast.bad { background: var(--bad); color: #fff; } .toast.ok { background: var(--ok); color: #fff; }

.empty { text-align: center; padding: 44px 16px; color: var(--ink-2); }
.empty .big { font-size: 2.4rem; margin-bottom: 8px; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { padding: 7px 16px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; color: var(--ink-2); }
.tabs button.on { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }

/* class tiles (today) */
.tile { position: relative; display: flex; flex-direction: column; gap: 10px; }
.tile.live { border-color: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 15%, transparent), var(--shadow); }
.tile.now { border-color: var(--primary); }
.tile.cancelled { opacity: .65; }
.tile .time { font-weight: 800; font-size: 1.1rem; }
.tile .title { font-weight: 800; font-size: 1.15rem; }

/* timetable */
.ttable th, .ttable td { text-align: center; white-space: normal; min-width: 108px; vertical-align: middle; }
.ttable td { height: 76px; padding: 6px; }
.cell { border-radius: 10px; padding: 6px 8px; background: color-mix(in srgb, var(--primary) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--line)); font-size: .86rem; cursor: pointer; line-height: 1.5; }
.cell b { display: block; } .cell.empty-cell { background: transparent; border: 1px dashed var(--line); color: var(--ink-3); }
.cell.today { outline: 2px solid var(--accent); }

/* attendance chips */
.chip { display: inline-block; min-width: 60px; text-align: center; padding: 2px 10px; border-radius: 8px; font-size: .8rem; font-weight: 700; }
.chip.present { background: var(--ok-bg); color: var(--ok); } .chip.late { background: var(--warn-bg); color: var(--warn); }
.chip.absent { background: var(--bad-bg); color: var(--bad); } .chip.excused { background: var(--info-bg); color: var(--info); }

/* charts */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: 10px; direction: ltr; }
.bars div { flex: 1; min-width: 4px; background: var(--primary); border-radius: 5px 5px 0 0; opacity: .85; position: relative; }
.bars div:hover { opacity: 1; }
.meter { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; } .meter > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.meter.hot > i { background: var(--bad); } .meter.warm > i { background: var(--warn); }

/* login & public pages */
.center { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.authcard { width: min(430px, 100%); }
.authcard .logo { width: 68px; height: 68px; border-radius: 18px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 1.9rem; font-weight: 800; margin: 0 auto 14px; overflow: hidden; }
.authcard .logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.authcard h1 { text-align: center; } .authcard p.sub { text-align: center; color: var(--ink-2); margin: 6px 0 22px; }
@media print { .side, .topbar, .btn, .tabs { display: none !important; } .shell { display: block; } body { background: #fff; } .card, .tablewrap { box-shadow: none; } }

/* drag & drop timetable */
.cell { --h: 220; background: hsl(var(--h) 80% 94%); border-color: hsl(var(--h) 55% 78%); color: #1b2236; }
@media (prefers-color-scheme: dark) { .cell { background: hsl(var(--h) 35% 22%); border-color: hsl(var(--h) 35% 38%); color: #e8ecf8; } }
.cell[draggable="true"] { cursor: grab; }
.cell.dragging { opacity: .45; }
.cell.empty-cell { background: transparent; }
td.drop { background: color-mix(in srgb, var(--accent) 22%, transparent); outline: 2px dashed var(--accent); outline-offset: -4px; }
.cell:focus-visible { outline: 3px solid var(--primary); }
.ttable td { transition: background .12s; }
@media print { .ttable th, .ttable td { min-width: 0; padding: 3px; } .cell { border-color: #999; } }

/* Hamdid mark: default logo, plus a small credit under every login/registration card and the side menu */
.authcard::after, .side .me::after { content: "قدرت‌گرفته از همدید"; display: block; margin-top: 16px; padding-top: 24px; font-size: .74rem; color: var(--ink-3); text-align: center; background: url(/brand/hamdid.svg) no-repeat center top / auto 18px; }
.side .me::after { margin-top: 10px; }
.brand .logo img, .authcard .logo img { padding: 4px; }
