:root {
  color-scheme: light;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f1f5f9;
  --card: #ffffff;
  --accent: #0f52ba;
  --accent-soft: #e8f0fe;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --err: #b91c1c;
  --err-soft: #fee2e2;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Vazirmatn, Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.55;
}
@font-face {
  font-family: Vazirmatn;
  src: url("/assets/Vazirmatn.woff2") format("woff2");
  font-display: swap;
}
button, input, select, textarea { font: inherit; }
button {
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  border-radius: 6px;
  height: 36px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}
button:hover { filter: brightness(0.95); }
button.secondary { background: #fff; color: var(--ink-soft); border-color: #cbd5e1; }
button.ghost { background: transparent; color: var(--ink-soft); border-color: transparent; }
button.danger { background: #fff; color: var(--err); border-color: #fecaca; }
button.ok { background: var(--ok); color: #fff; }
button.sm { height: 30px; padding: 0 10px; font-size: 12px; }
h1 { margin: 0; font-size: 20px; font-weight: 700; }
h2 { margin: 0; font-size: 14.5px; font-weight: 700; }
h3 { margin: 0; font-size: 13.5px; font-weight: 700; }
p { margin: 0; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.04), transparent 28%),
    #16325c;
  color: #e8eef7;
  border-left: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 12px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; border-bottom: 1px solid #1e293b; margin-bottom: 8px; }
.mark {
  width: 34px; height: 34px; border-radius: 8px; flex: 0 0 auto;
  display: grid; place-items: center; color: #fff; font-weight: 700;
  background: #2563eb;
}
.brand strong { display: block; font-size: 14px; color: #fff; }
.brand span { display: block; color: #94a3b8; font-size: 11.5px; }
.nav { display: grid; gap: 2px; overflow: auto; }
.nav-label { margin: 12px 8px 4px; color: #64748b; font-size: 11px; font-weight: 600; }
.nav-btn {
  width: 100%; height: auto; background: transparent; color: #cbd5e1;
  display: flex; align-items: center; gap: 10px; text-align: right;
  border-radius: 6px; padding: 8px 10px; font-weight: 500;
}
.nav-btn:hover { background: #162038; color: #fff; filter: none; }
.nav-btn.active { background: #fff; color: #16325c; font-weight: 700; }
.nav-btn.sub { padding-right: 28px; font-size: 13px; opacity: 0.92; }
.ico { width: 17px; height: 17px; display: inline-flex; flex: 0 0 auto; }
.ico svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px;
}
.side-user strong { display: block; color: #fff; font-size: 13px; }
.side-user small { color: #d6e0ee; font-size: 11px; }
.side-user .avatar { background: #fff; color: #16325c; }
.logout-top { margin-inline-start: auto; border-radius: 12px; background: #16325c; }
.plan-pill {
  display: flex; align-items: center; gap: 8px;
  background: #f8fafc; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
}
.plan-pill span, .plan-pill small { color: var(--muted); font-size: 12px; }
.plan-pill b { color: #16325c; }
.org-select { height: 36px; min-width: 140px; }
.logout { width: 100%; background: #162038; color: #fca5a5; border-color: #334155; }

.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  min-height: 58px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 8px 24px; position: sticky; top: 0; z-index: 5;
}
.top-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.crumb { color: var(--muted); font-size: 13px; }
.crumb b { color: var(--ink); }
.org-inline { display: flex; align-items: center; gap: 8px; }
.org-inline span { color: var(--muted); font-size: 12px; }
.org-inline select { height: 34px; min-width: 210px; }
.userchip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700;
}
.userchip small { display: block; color: var(--muted); font-size: 11.5px; }

.page { width: 100%; max-width: 1240px; padding: 20px 24px 36px; display: grid; gap: 14px; align-content: start; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.lead { color: var(--muted); font-size: 12.5px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 10px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow); padding: 13px 15px; display: grid; gap: 4px;
}
.stat span { color: var(--muted); font-size: 12px; }
.stat strong { font-size: 23px; line-height: 1.2; font-weight: 700; }
.stat.quiet strong { font-size: 14px; font-weight: 600; }

.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow); padding: 15px 16px; display: grid; gap: 12px; min-width: 0;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.tabs { display: inline-flex; background: #e2e8f0; padding: 3px; border-radius: 7px; gap: 3px; flex-wrap: wrap; }
.tab { height: 30px; padding: 0 12px; background: transparent; color: var(--ink-soft); font-size: 12.5px; }
.tab.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 9px 8px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; font-size: 13px; }
th { color: #475569; font-size: 11.5px; font-weight: 700; background: #f8fafc; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); }
.badge {
  display: inline-flex; align-items: center; border-radius: 999px;
  padding: 2px 8px; font-size: 11.5px; font-weight: 600; background: #f1f5f9; color: var(--ink-soft);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.blue { background: var(--accent-soft); color: var(--accent); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end; }
label { display: grid; gap: 5px; color: var(--ink-soft); font-size: 12px; font-weight: 600; }
input, select, textarea {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid #cbd5e1;
  border-radius: 6px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: #3b82f6; }
input[type="checkbox"], input[type="radio"] {
  width: 15px; height: 15px; min-width: 15px; max-width: 15px;
  padding: 0; margin: 0; flex: 0 0 15px; accent-color: #16325c;
}
.check {
  display: inline-flex; align-items: center; gap: 6px; width: auto; height: auto;
  font-size: 13px; font-weight: 500; cursor: pointer;
}
input[type="file"] { height: auto; padding: 6px; background: #f8fafc; }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.note { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 11px 13px; color: var(--ink-soft); }
.msg { padding: 9px 11px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; }
.msg.err { background: var(--err-soft); color: var(--err); }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.link { color: var(--accent); font-weight: 700; text-decoration: none; }
.ltr { direction: ltr; text-align: left; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.week-grid { display: grid; grid-template-columns: repeat(7, minmax(135px, 1fr)); gap: 8px; overflow-x: auto; }
.day-col {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 8px;
  padding: 9px; display: grid; gap: 7px; align-content: start; min-height: 170px;
}
.day-col.today { border-color: #3b82f6; background: #f5f9ff; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.day-head strong { font-size: 12.5px; }
.day-head span { color: var(--muted); font-size: 11px; }
.event-card {
  background: #fff; border: 1px solid var(--line); border-right: 3px solid var(--accent);
  border-radius: 6px; padding: 8px; display: grid; gap: 4px; font-size: 12px;
}
.event-card.live { border-right-color: var(--ok); }
.event-card.cancelled { opacity: 0.55; border-right-color: #94a3b8; }
.event-meta { color: var(--muted); font-size: 11px; }

.hero-card {
  background: linear-gradient(135deg, #0f172a, #1e3a8a); color: #fff;
  border-radius: 10px; padding: 18px 20px; display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
}
.hero-card p { color: #cbd5e1; font-size: 12.5px; }

.login-screen {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(circle at top, #dbeafe, transparent 42%), var(--bg);
}
.login-card {
  width: min(400px, 100%); background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  padding: 24px; display: grid; gap: 12px;
}
.login-card .brand { border-bottom: 0; margin: 0; padding: 0; }
.login-card .brand strong { color: var(--ink); }
.login-card.wide { width: min(560px, 100%); }
.entry-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.entry-card {
  height: auto; min-height: 72px; background: #fff; color: #16325c; border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; display: grid; gap: 4px; text-align: right; white-space: normal; font-weight: 500;
}
.entry-card small { color: var(--muted); font-size: 12px; font-weight: 500; }
.login-card > button[type="submit"] { width: 100%; }

.welcome-card, .metric, .day-bar, .calendar-shell, .events-card {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 24px rgba(22, 50, 92, 0.05);
}
.welcome-card { display: flex; justify-content: space-between; gap: 16px; padding: 22px; align-items: center; }
.welcome-copy { display: grid; gap: 10px; max-width: 640px; }
.welcome-copy p { color: var(--muted); }
.welcome-art { width: 220px; flex: 0 0 auto; }
.welcome-art svg { width: 100%; height: auto; }
.cta {
  height: 44px; border-radius: 12px; background: #1d4ed8; color: #fff; padding: 0 18px; font-weight: 700;
}
.cta.pink { background: #db2777; }
.metric-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.metric { padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; }
.metric strong { font-size: 28px; }
.metric div { display: grid; gap: 8px; }
.pill { border-radius: 999px; padding: 3px 8px; font-size: 11px; font-weight: 700; width: max-content; }
.pill.green { background: #dcfce7; color: #15803d; }
.pill.purple { background: #ede9fe; color: #6d28d9; }
.pill.pink { background: #fce7f3; color: #be185d; }
.day-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; }
.day-bar-main, .calendar-head, .day-side-head { display: flex; align-items: center; justify-content: center; gap: 12px; }
.day-bar-main { flex-direction: column; gap: 0; }
.day-bar-main small, .text-nav { color: #2563eb; background: transparent; border: 0; height: auto; padding: 0; }
.arrow, .page-btn, .icon-btn {
  width: 34px; height: 34px; border-radius: 8px; background: #fff; color: #16325c; border: 1px solid #dbe3ef; padding: 0;
}
.page-btn.active { background: #db2777; color: #fff; border-color: #db2777; }
.empty-day {
  border: 1px dashed #dbe3ef; border-radius: 12px; padding: 28px 12px; text-align: center; color: var(--muted);
}
.day-events { display: grid; gap: 8px; }
.activity-head {
  background: #16325c; color: #fff; text-align: center; border-radius: 12px 12px 0 0; padding: 12px; font-weight: 700;
}
.activity-card { padding: 0; overflow: hidden; }
.activity-card .table-wrap { padding: 0 8px 8px; }
.kind-mark { border-right: 3px solid #7c3aed; padding-right: 8px; color: #6d28d9; font-weight: 700; }
.calendar-shell { display: grid; grid-template-columns: 148px minmax(0, 1fr) 280px; min-height: 560px; overflow: hidden; }
.month-rail { background: #f8fafc; border-left: 1px solid var(--line); padding: 12px; display: grid; align-content: start; gap: 4px; }
.month-btn { background: transparent; color: #334155; border: 0; text-align: right; height: 32px; border-radius: 8px; }
.month-btn.active { background: #e8eef7; box-shadow: inset -3px 0 #f59e0b; }
.calendar-main { padding: 16px; display: grid; gap: 10px; align-content: start; }
.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-weekdays span { text-align: center; color: var(--muted); font-size: 12px; }
.cal-cell {
  min-height: 64px; background: #fff; border: 1px solid #e8eef7; border-radius: 8px; color: #16325c;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; padding: 6px;
}
.cal-cell.outside { background: #f8fafc; color: #94a3b8; }
.cal-cell.selected { border: 2px solid #16325c; font-weight: 800; }
.cal-cell i { font-style: normal; background: #dbeafe; color: #1d4ed8; border-radius: 999px; padding: 0 6px; font-size: 11px; }
.day-side { border-right: 1px solid var(--line); padding: 14px; display: grid; gap: 10px; align-content: start; max-height: 70vh; overflow: auto; }
.scroll-pane { max-height: 70vh; overflow: auto; }
.cal-tools { margin-bottom: 12px; }
.week-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.week-table th, .week-table td { border: 1px solid var(--line); padding: 8px; vertical-align: top; text-align: right; }
.week-item { display: grid; gap: 2px; margin-bottom: 6px; }
.week-item span { color: var(--muted); font-size: 12px; }
.events-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-box { margin-inline-start: auto; min-width: 180px; }
.pager { display: flex; justify-content: center; gap: 6px; }
.modal-back {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 30;
  display: grid; place-items: center; padding: 18px;
}
.event-modal {
  width: min(640px, 100%); max-height: min(92vh, 820px); overflow: auto;
  background: #fff; border-radius: 14px; padding: 14px 16px 16px; display: grid; gap: 10px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { border-bottom: 2px solid #1d4ed8; padding-bottom: 2px; font-size: 15px; }
.modal-label { color: #16325c; font-size: 12px; }
.modal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.modal-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fake-input {
  width: 100%; height: 34px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: #0f172a; text-align: right; font-weight: 500;
}
.hold-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.hold-row > span { font-weight: 700; color: #16325c; }
.schedule-box, .policy-box { display: grid; gap: 6px; }
.weekday-picks { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.switch-row {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  font-weight: 500; font-size: 12.5px; padding: 4px 0; border-bottom: 1px solid #f1f5f9;
}
.jalali-pop, .time-pop {
  background: #fff; border: 1px solid #dbe3ef; border-radius: 12px; box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12); padding: 10px;
}
.time-pop { max-height: 220px; overflow: auto; display: grid; }
.time-opt { background: transparent; color: #0f172a; border: 0; border-radius: 8px; text-align: center; }
.time-opt.active, .cal-grid.pop .cal-cell.selected { background: #16325c; color: #fff; }
.cal-grid.pop .cal-cell { min-height: 36px; align-items: center; }
.modal-submit { justify-self: center; min-width: 220px; }
.icon-btn { width: auto; padding: 0 8px; }
.class-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.class-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: grid; gap: 10px; }
.class-card header { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.plain { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.cap-form { display: flex; gap: 8px; align-items: end; }
.guest-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #f4f7fb; }
.guest-card { width: min(420px, 100%); background: #fff; border-radius: 18px; padding: 22px; display: grid; gap: 12px; box-shadow: 0 16px 40px rgba(22, 50, 92, 0.08); }
details.panel summary { cursor: pointer; font-weight: 700; }
.ws-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 14px; }
.ws-card { display: grid; gap: 6px; border: 1px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; background: #fff; }
.ws-card input { justify-self: start; }
.ws-card.active, .ws-card:has(input:checked) { border-color: #16325c; box-shadow: inset 0 0 0 1px #16325c; }
.ws-card span { color: #64748b; font-size: 13px; }

@media (max-width: 960px) {
  .cols-2, .cols-3, .metric-row, .calendar-shell, .modal-grid, .modal-grid.two { grid-template-columns: 1fr; }
  .welcome-art { display: none; }
  .search-box { margin-inline-start: 0; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-left: 0; }
  .nav { display: flex; gap: 6px; }
  .nav-label, .side-foot { display: none; }
  .nav-btn { width: auto; white-space: nowrap; }
  .page, .topbar { padding-right: 14px; padding-left: 14px; }
}
