/* Smart Center — design tokens
   Ink navy for structure, deep teal for actions, saffron for money,
   one colour per module so each area is recognisable from its icon tile. */
:root {
  --bg: #F1F4F6;
  --surface: #FFFFFF;
  --surface-2: #F7F9FA;
  --ink: #10233A;
  --ink-2: #2B3D52;
  --muted: #627285;
  --line: #E0E6EB;
  --primary: #0B7A75;
  --primary-ink: #075F5B;
  --primary-soft: #DDF1EF;
  --saffron: #E59A0C;
  --saffron-soft: #FDF0D5;
  --danger: #D2443A;
  --danger-soft: #FBE3E1;
  --success: #1F8F57;
  --success-soft: #DDF3E7;
  --violet: #6B4FD8;
  --violet-soft: #ECE7FD;
  --blue: #2D6CDF;
  --blue-soft: #E1EBFC;
  --pink: #C23F78;
  --pink-soft: #FAE3EE;
  --slate-soft: #E8EDF2;
  --sidebar: #10233A;
  --sidebar-ink: #C9D5E1;
  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 35, 58, .06), 0 6px 20px -8px rgba(16, 35, 58, .12);
  --font: "Readex Pro", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: rgba(11,122,117,.12); }
a, button, input, select, textarea, label { touch-action: manipulation; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-ink); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; text-wrap: balance; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; }
.skip-link:focus { top: 12px; color: #fff; }
.content:focus { outline: none; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .6em; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; border-radius: 6px; }
.ti { line-height: 1; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.text-end { text-align: end; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; }
.stack > * + * { margin-top: 1rem; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-ink);
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; color: #fff; }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(140deg, #1C9C95, #0B7A75); display: grid; place-items: center; font-weight: 700; font-size: 1.3rem; color: #fff; }
.brand-name { font-weight: 600; font-size: 1.1rem; letter-spacing: .02em; }
.brand-sub { font-size: .75rem; color: var(--sidebar-ink); opacity: .8; }
.nav-group { font-size: .78rem; color: #7F93A8; padding: 14px 10px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px; border-radius: 12px;
  color: var(--sidebar-ink); font-weight: 500; font-size: .95rem;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: rgba(255,255,255,.1); color: #fff; }
.nav-icon {
  width: 36px; height: 36px; border-radius: 10px; flex: 0 0 36px;
  display: grid; place-items: center; font-size: 20px;
  background: rgba(255,255,255,.07); color: var(--tile, #fff);
}
.nav-link.active .nav-icon { background: var(--tile); color: #fff; }
.nav-count { margin-inline-start: auto; background: var(--danger); color: #fff; font-size: .72rem; font-weight: 600; border-radius: 99px; padding: 1px 8px; }
.sidebar-foot { margin-top: auto; padding-top: 16px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 28px; background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar .menu-btn { display: none; }
.page-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-title .tile { width: 44px; height: 44px; font-size: 24px; }
.page-title h1 { font-size: 1.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.content { padding: 24px 28px 48px; max-width: 1400px; width: 100%; }

.lang-switch { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.lang-switch a { padding: 4px 10px; border-radius: 8px; color: var(--muted); font-size: .85rem; font-weight: 500; }
.lang-switch a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 12px; }
.user-chip:hover { background: var(--surface-2); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-ink); font-weight: 600; font-size: .85rem; flex: 0 0 auto; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 84px; height: 84px; font-size: 1.6rem; border-radius: 22px; }

/* Module colour tiles: the big, clear icons */
.tile { display: grid; place-items: center; border-radius: 12px; background: var(--tile-soft); color: var(--tile); flex: 0 0 auto; }
.t-teal   { --tile: var(--primary); --tile-soft: var(--primary-soft); }
.t-violet { --tile: var(--violet);  --tile-soft: var(--violet-soft); }
.t-blue   { --tile: var(--blue);    --tile-soft: var(--blue-soft); }
.t-saffron{ --tile: var(--saffron); --tile-soft: var(--saffron-soft); }
.t-red    { --tile: var(--danger);  --tile-soft: var(--danger-soft); }
.t-green  { --tile: var(--success); --tile-soft: var(--success-soft); }
.t-pink   { --tile: var(--pink);    --tile-soft: var(--pink-soft); }
.t-slate  { --tile: var(--ink-2);   --tile-soft: var(--slate-soft); }

/* ---------- Surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h2 { font-size: 1.05rem; }
.panel-head .tile { width: 38px; height: 38px; font-size: 20px; }
.panel-body { padding: 20px; }
.panel-body.flush { padding: 0; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

.stat { display: flex; align-items: center; gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--ink); }
a.stat:hover { border-color: var(--tile); color: var(--ink); }
.stat .tile { width: 54px; height: 54px; font-size: 28px; border-radius: 16px; }
.stat-value { font-size: 1.5rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: .88rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: 11px;
  border: 1px solid transparent; background: var(--surface-2); color: var(--ink);
  font: inherit; font-weight: 500; font-size: .93rem; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn .ti { font-size: 20px; }
.btn:hover { background: var(--slate-soft); color: var(--ink); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-ink); color: #fff; }
.btn-money { background: var(--saffron); color: #241600; }
.btn-money:hover { background: #CC8705; color: #241600; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-outline { background: var(--surface); border-color: var(--line); }
.btn-outline:hover { border-color: var(--primary); background: var(--surface); color: var(--primary); }
.btn-ghost { background: transparent; }
.btn-sm { height: 34px; padding: 0 12px; font-size: .85rem; border-radius: 9px; }
.btn-sm .ti { font-size: 17px; }
.btn-lg { height: 52px; padding: 0 22px; font-size: 1rem; border-radius: 13px; }
.btn-icon { width: 42px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }
.btn[disabled], .btn.loading { opacity: .6; pointer-events: none; }
.btn.loading .ti { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px 16px; }
.col-12 { grid-column: span 12; } .col-9 { grid-column: span 9; } .col-8 { grid-column: span 8; } .col-7 { grid-column: span 7; } .col-6 { grid-column: span 6; } .col-5 { grid-column: span 5; }
.col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-2 { grid-column: span 2; }
.field label, .label { display: block; font-size: .86rem; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 13px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface);
  font: inherit; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 92px; padding: 10px 13px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .82rem; margin-top: 4px; }
.hint { color: var(--muted); font-size: .8rem; margin-top: 4px; }
.input-icon { position: relative; }
.input-icon .ti { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 19px; }
.input-icon .input { padding-inline-start: 40px; }
.form-section { display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; grid-column: span 12; padding-top: 10px; border-top: 1px dashed var(--line); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-section .tile { width: 32px; height: 32px; font-size: 18px; border-radius: 9px; }
.form-section h3 { font-size: .98rem; }

/* Searchable selects (Tom Select) styled like the other fields */
.ts-wrapper.select { height: auto; padding: 0; border: 0; background: none; box-shadow: none; }
.ts-wrapper.single .ts-control, .ts-wrapper .ts-control { min-height: 44px; border: 1px solid var(--line); border-radius: 11px; padding: 10px 13px; font: inherit; color: var(--ink); background: var(--surface); box-shadow: none; display: flex; align-items: center; }
.ts-wrapper.single .ts-control::after { inset-inline-end: 14px; right: auto; }
[dir=ltr] .ts-wrapper.single .ts-control::after { right: 14px; }
.ts-wrapper.focus .ts-control { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.ts-wrapper .ts-control input { font: inherit; color: var(--ink); }
.ts-dropdown { border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px -12px rgba(16,35,58,.3); font: inherit; margin-top: 6px; overflow: hidden; z-index: 90; }
.ts-dropdown .option, .ts-dropdown .optgroup-header, .ts-dropdown .no-results { padding: 9px 13px; }
.ts-dropdown .optgroup-header { font-weight: 600; color: var(--muted); font-size: .8rem; background: var(--surface-2); }
.ts-dropdown .active { background: var(--primary-soft); color: var(--primary-ink); }
.ts-dropdown .selected { font-weight: 600; }
.ts-wrapper.is-invalid .ts-control, select.is-invalid + .ts-wrapper .ts-control { border-color: var(--danger); }
.ts-wrapper.is-rtl .ts-control, .ts-wrapper.is-rtl + .ts-dropdown { text-align: right; }
.toolbar .ts-wrapper { min-width: 200px; }

/* Weekly slot row: day, start, end, teacher, remove */
.slot-row { display: grid; grid-template-columns: 1.2fr .9fr .9fr 1.6fr auto; gap: 8px; align-items: center; }
@media (max-width: 640px) { .slot-row { grid-template-columns: 1fr 1fr; } .slot-row > select:first-child, .slot-row .ts-wrapper { grid-column: span 2; } }

/* Segmented choice (radio pills) */
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label {
  margin: 0; display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface); font-weight: 500; color: var(--ink-2);
}
.choice label .ti { font-size: 19px; }
.choice input:checked + label { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); }
.choice input:focus-visible + label { outline: 3px solid var(--primary-soft); }
.choice.levels label { min-width: 52px; justify-content: center; font-weight: 600; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 99px; background: #C9D2DB; position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: inset-inline-start .15s; }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { inset-inline-start: 21px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: start; font-weight: 500; color: var(--muted); font-size: .82rem; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FAFCFC; }
.table .person { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 500; }
.table .person small { display: block; color: var(--muted); font-weight: 400; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 99px; font-size: .8rem; font-weight: 500; white-space: nowrap; background: var(--slate-soft); color: var(--ink-2); }
.badge .ti { font-size: 15px; }
.b-green { background: var(--success-soft); color: var(--success); }
.b-red { background: var(--danger-soft); color: var(--danger); }
.b-amber { background: var(--saffron-soft); color: #9A6500; }
.b-blue { background: var(--blue-soft); color: var(--blue); }
.b-violet { background: var(--violet-soft); color: var(--violet); }
.b-teal { background: var(--primary-soft); color: var(--primary-ink); }
.level { display: inline-grid; place-items: center; min-width: 34px; height: 26px; padding: 0 6px; border-radius: 7px; background: var(--ink); color: #fff; font-size: .78rem; font-weight: 600; letter-spacing: .02em; }

.progress { height: 8px; border-radius: 99px; background: var(--slate-soft); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.progress.money > span { background: var(--saffron); }

/* ---------- Alerts / empty ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); background: var(--blue-soft); color: #1B4CA3; margin-bottom: 16px; }
.alert .ti { font-size: 22px; flex: 0 0 auto; }
.alert-warning { background: var(--saffron-soft); color: #7A5000; }
.alert-danger { background: var(--danger-soft); color: #9A2C24; }
.alert-success { background: var(--success-soft); color: #156B40; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .tile { width: 64px; height: 64px; font-size: 32px; margin: 0 auto 12px; border-radius: 18px; }
.empty strong { display: block; color: var(--ink); font-size: 1.02rem; margin-bottom: 4px; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .input-icon { flex: 1 1 260px; max-width: 420px; }
.toolbar .select { width: auto; min-width: 160px; }

/* ---------- Modal ---------- */
.modal { overscroll-behavior: contain; position: fixed; inset: 0; z-index: 60; display: none; align-items: flex-start; justify-content: center; padding: 6vh 16px; background: rgba(16, 35, 58, .45); overflow-y: auto; }
.modal.open { display: flex; }
.modal-box { background: var(--surface); border-radius: 20px; width: 100%; max-width: 620px; box-shadow: 0 30px 60px -20px rgba(16,35,58,.45); animation: pop .18s ease-out; }
.modal-box.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head .tile { width: 40px; height: 40px; font-size: 22px; }
.modal-head .btn { margin-inline-start: auto; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 20px 20px; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: 22px; inset-inline-end: 22px; z-index: 80; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 14px; background: var(--ink); color: #fff; box-shadow: 0 12px 30px -10px rgba(0,0,0,.4); min-width: 260px; max-width: 420px; animation: pop .2s ease-out; }
.toast .ti { font-size: 22px; }
.toast.ok .ti { color: #5BD99A; }
.toast.err { background: #8E2A23; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--muted); font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; cursor: pointer; background: none; border-top: 0; border-inline: 0; font: inherit; }
.tab .ti { font-size: 19px; }
.tab.on { color: var(--primary-ink); border-bottom-color: var(--primary); }

/* ---------- Building board (dashboard signature) ---------- */
.building { display: flex; flex-direction: column; gap: 10px; }
.floor { display: grid; grid-template-columns: 74px 1fr; gap: 10px; align-items: stretch; }
.floor-label { display: flex; flex-direction: column; justify-content: center; align-items: center; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 600; font-size: 1.35rem; line-height: 1; }
.floor-label small { font-size: .68rem; font-weight: 400; opacity: .7; margin-top: 4px; }
.rooms-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.room-cell { border-radius: 14px; padding: 12px 14px; border: 2px dashed var(--line); background: var(--surface); min-height: 96px; display: flex; flex-direction: column; gap: 4px; }
.room-cell .room-name { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: .92rem; }
.room-cell.busy { border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 10%, white); }
.room-cell.busy .now-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 25%, transparent); }
.room-cell .what { font-size: .88rem; font-weight: 500; }
.room-cell .meta { font-size: .8rem; color: var(--muted); }
.room-cell.free .what { color: var(--success); }

/* Timeline (today's sessions) */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); color: var(--ink); }
.tl-item:last-child { border-bottom: 0; }
a.tl-item:hover { background: var(--surface-2); color: var(--ink); }
.tl-time { font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tl-time small { display: block; color: var(--muted); font-weight: 400; }
.tl-main { border-inline-start: 4px solid var(--c, var(--primary)); padding-inline-start: 12px; min-width: 0; }
.tl-main strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-main span { display: block; color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-item.is-off { opacity: .6; }
.tl-item.is-off strong { text-decoration: line-through; }

/* Formation cards */
.f-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; color: var(--ink); }
.f-card:hover { border-color: var(--c); color: var(--ink); }
.f-card-top { padding: 16px 18px 12px; border-top: 5px solid var(--c); display: flex; gap: 12px; align-items: flex-start; }
.f-card-top .tile { width: 46px; height: 46px; font-size: 24px; background: color-mix(in srgb, var(--c) 14%, white); color: var(--c); }
.f-card h3 { font-size: 1.02rem; }
.f-card-body { padding: 0 18px 14px; display: flex; flex-direction: column; gap: 8px; font-size: .88rem; color: var(--ink-2); }
.f-card-body .ti { color: var(--muted); font-size: 17px; }
.f-card-foot { margin-top: auto; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); display: flex; align-items: center; gap: 10px; font-size: .85rem; }
.subject-group + .subject-group { margin-top: 28px; }
.subject-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.subject-head .dot { width: 12px; height: 12px; border-radius: 4px; background: var(--c); }

/* Attendance roll call */
.roll { display: flex; flex-direction: column; }
.roll-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.roll-row:last-child { border-bottom: 0; }
.roll-choice { display: flex; gap: 6px; flex-wrap: wrap; }
.roll-choice input { position: absolute; opacity: 0; pointer-events: none; }
.roll-choice label { margin: 0; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; font-weight: 500; font-size: .87rem; color: var(--ink-2); background: var(--surface); }
.roll-choice label .ti { font-size: 19px; }
.roll-choice input[value=present]:checked + label { background: var(--success); border-color: var(--success); color: #fff; }
.roll-choice input[value=absent]:checked + label { background: var(--danger); border-color: var(--danger); color: #fff; }
.roll-choice input[value=justified]:checked + label { background: var(--blue); border-color: var(--blue); color: #fff; }
.roll-choice input[value=late]:checked + label { background: var(--saffron); border-color: var(--saffron); color: #241600; }

/* Rooms day board */
.dayboard { display: grid; grid-template-columns: 150px repeat(var(--cols), minmax(56px, 1fr)); min-width: 920px; }
.dayboard .hcell { font-size: .78rem; color: var(--muted); padding: 6px; border-inline-start: 1px solid var(--line); }
.dayboard .rcell { padding: 10px 12px; font-weight: 500; font-size: .9rem; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.dayboard .lane { grid-column: 2 / -1; position: relative; border-top: 1px solid var(--line); min-height: 56px; background-image: linear-gradient(to right, var(--line) 1px, transparent 1px); background-size: calc(100% / var(--cols)) 100%; }
[dir=rtl] .dayboard .lane { background-image: linear-gradient(to left, var(--line) 1px, transparent 1px); }
.dayboard .blk { position: absolute; top: 6px; bottom: 6px; border-radius: 9px; background: var(--c); color: #fff; padding: 4px 8px; font-size: .76rem; overflow: hidden; line-height: 1.3; }
.dayboard .blk strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Calendar tweaks */
.fc { --fc-border-color: var(--line); --fc-today-bg-color: #EAF6F5; --fc-button-bg-color: var(--surface); --fc-button-text-color: var(--ink); --fc-button-border-color: var(--line); --fc-button-hover-bg-color: var(--surface-2); --fc-button-hover-border-color: var(--primary); --fc-button-active-bg-color: var(--primary); --fc-button-active-border-color: var(--primary); font-size: .88rem; }
.fc .fc-button { border-radius: 10px !important; font-weight: 500; text-transform: none; padding: .45em .9em; }
.fc .fc-button-primary:not(:disabled).fc-button-active { color: #fff; }
.fc .fc-toolbar-title { font-size: 1.15rem; font-weight: 600; }
.fc-event { border-radius: 7px; padding: 1px 3px; cursor: pointer; }
.fc .ev-cancelled .fc-event-title, .fc .ev-postponed .fc-event-title { text-decoration: line-through; }

/* Definition list */
.dl { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 10px 18px; font-size: .93rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }

/* Profile header */
.profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.profile-head h2 { font-size: 1.4rem; }

/* Pagination */
.pager { display: flex; gap: 6px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 38px; height: 38px; display: grid; place-items: center; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: .88rem; }
.pager .on { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager .off { opacity: .45; }


/* ================= Login ================= */
.login-body { background: var(--surface); }
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, 1fr); }
.login-art {
  position: relative; overflow: hidden; color: #fff; background-color: var(--sidebar);
  background-image: radial-gradient(rgba(255,255,255,.075) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
  padding: 40px 48px 0; display: flex; flex-direction: column; gap: 28px;
}
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-brand-name { font-weight: 600; font-size: 1.25rem; letter-spacing: .01em; }
.login-brand-sub { color: #9FB2C6; font-size: .88rem; }
.login-hero { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 560px; }
.login-title { font-size: clamp(2.1rem, 3.6vw, 3.3rem); font-weight: 600; line-height: 1.08; letter-spacing: -.02em; max-width: 13ch; }
.login-lead { color: #B9C8D8; font-size: 1.05rem; margin-top: 16px; max-width: 44ch; }

/* The conversation: one orchestrated entrance, then still */
.chat { display: flex; flex-direction: column; gap: 10px; margin-top: 34px; max-width: 420px; }
.bubble {
  align-self: flex-start; padding: 10px 16px; border-radius: 18px 18px 18px 6px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12);
  font-weight: 500; font-size: .98rem; display: inline-flex; gap: 8px; align-items: center;
  animation: bubble-in .5s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--d, 0) * 1s);
}
.bubble.me { align-self: flex-end; border-radius: 18px 18px 6px 18px; background: #1FB5AC; border-color: transparent; color: #04211F; }
.bubble.b2 { background: #F2A922; color: #2A1A00; }
.bubble.ai { background: #fff; color: var(--ink); }
.bubble.b1 { --d: .15 } .bubble.b2 { --d: .45 } .bubble.b3 { --d: .75 } .bubble.b4 { --d: 1.05 } .bubble.b5 { --d: 1.35 } .bubble.b6 { --d: 1.65 }
[dir=rtl] .bubble { border-radius: 18px 18px 6px 18px; }
[dir=rtl] .bubble.me { border-radius: 18px 18px 18px 6px; }
@keyframes bubble-in { from { opacity: 0; transform: translateY(10px) scale(.96); } }

/* The climb from A1 to C2 */
.ladder { display: flex; align-items: flex-end; gap: 8px; height: 150px; margin: 0 -48px; padding: 0 48px; }
.ladder .step {
  flex: 1; height: calc(26px + var(--i) * 22px); border-radius: 12px 12px 0 0;
  background: color-mix(in srgb, #1FB5AC calc(30% + var(--i) * 12%), #1B3552);
  display: flex; align-items: flex-start; justify-content: center; padding-top: 8px;
  animation: grow .7s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(.2s + var(--i) * .08s); transform-origin: bottom;
}
.ladder .step:last-child { background: #F2A922; }
.ladder .step b { font-size: .9rem; color: #fff; }
.ladder .step:last-child b { color: #2A1A00; }
@keyframes grow { from { transform: scaleY(0); } }

.login-panel { display: flex; flex-direction: column; padding: 28px 40px; background: var(--surface); }
.login-top { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.login-mobile-brand { display: none; align-items: center; gap: 10px; margin-inline-end: auto; }
.login-card { width: 100%; max-width: 420px; margin: auto; padding: 24px 0; }
.login-card h2 { font-size: 1.9rem; font-weight: 600; letter-spacing: -.01em; margin-top: 14px; }
.login-wave { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; font-size: 28px; background: var(--saffron-soft); color: #B37400; }
.input-lg { height: 54px; font-size: 1.02rem; border-radius: 14px; }
.input-icon.has-action .input { padding-inline-end: 52px; }
.input-action { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.input-action:hover { background: var(--surface-2); color: var(--ink); }
.input-action .ti { position: static; transform: none; font-size: 21px; }
.btn-xl { height: 56px; width: 100%; font-size: 1.05rem; border-radius: 14px; box-shadow: 0 10px 24px -12px rgba(11,122,117,.7); }
.btn-xl:active { transform: translateY(1px); box-shadow: 0 4px 12px -8px rgba(11,122,117,.7); }
.login-help { margin-top: 22px; color: var(--muted); font-size: .9rem; display: flex; gap: 8px; align-items: center; }
.login-foot { color: var(--muted); font-size: .82rem; text-align: center; }

@media (min-width: 921px) {
  .login-art { height: 100vh; position: sticky; top: 0; }
}
@media (min-width: 921px) and (max-height: 880px) {
  .bubble.b3, .bubble.b5 { display: none; }
  .chat { margin-top: 24px; }
  .ladder { height: 116px; }
  .ladder .step { height: calc(32px + var(--i) * 15px); }
}
@media (max-width: 920px) {
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 22px 20px 0; gap: 14px; }
  .login-brand { display: none; }
  .login-title { font-size: 1.75rem; }
  .login-lead { font-size: .95rem; margin-top: 8px; }
  .chat { flex-direction: row; flex-wrap: wrap; margin-top: 16px; max-width: none; }
  .bubble, .bubble.me { align-self: auto; font-size: .85rem; padding: 7px 12px; }
  .bubble.b5, .bubble.b6 { display: none; }
  .ladder { height: 78px; margin: 0 -20px; padding: 0 20px; gap: 5px; }
  .ladder .step { height: calc(16px + var(--i) * 11px); padding-top: 3px; border-radius: 8px 8px 0 0; }
  .ladder .step b { font-size: .72rem; }
  .login-panel { padding: 16px 20px 24px; }
  .login-mobile-brand { display: flex; }
  .login-top .lang-switch { display: flex; }
  .login-card { padding: 20px 0; }
}

/* ================= Dashboard ================= */
.welcome {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center;
  padding: 26px 28px; margin-bottom: 18px; border-radius: 24px; color: #fff;
  background-color: var(--sidebar);
  background-image: radial-gradient(rgba(255,255,255,.07) 1.2px, transparent 1.2px);
  background-size: 20px 20px; position: relative; overflow: hidden;
}
.welcome::after { /* the logo's two voices, echoed large and quiet */
  content: ""; position: absolute; inset-inline-end: -40px; top: -40px; width: 220px; height: 220px; pointer-events: none;
  background: url("../images/logo-mark-lines.svg") no-repeat center / contain; opacity: .14;
}
.welcome-date { color: #9FB2C6; font-size: .9rem; }
.welcome h2 { font-size: 1.75rem; font-weight: 600; margin: 4px 0 6px; letter-spacing: -.01em; }
.welcome p { color: #C9D5E1; margin: 0; }
.quick { display: grid; grid-template-columns: repeat(3, minmax(108px, 1fr)); gap: 10px; position: relative; z-index: 1; }
.quick-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  min-height: 92px; padding: 12px 10px; border-radius: 18px; color: var(--ink); font-weight: 500; font-size: .86rem; line-height: 1.25;
  background: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, 0 8px 18px -10px rgba(0,0,0,.5);
  transition: transform .15s ease, box-shadow .15s ease;
}
.quick-btn:hover { color: var(--ink); transform: translateY(-2px); box-shadow: 0 14px 24px -12px rgba(0,0,0,.55); }
.quick-btn:active { transform: translateY(0); }
.quick-btn .tile { width: 44px; height: 44px; font-size: 24px; border-radius: 14px; }

.stat { box-shadow: 0 1px 2px rgba(16,35,58,.04), 0 10px 24px -18px rgba(16,35,58,.25); transition: transform .15s ease, box-shadow .15s ease, border-color .15s; }
a.stat:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -18px rgba(16,35,58,.35); }
.panel { box-shadow: 0 1px 2px rgba(16,35,58,.04), 0 12px 28px -22px rgba(16,35,58,.25); }

/* 14-day income bars */
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; align-items: end; height: 120px; margin-top: 16px; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bar span { width: 100%; max-width: 22px; border-radius: 6px 6px 3px 3px; background: var(--saffron-soft); box-shadow: inset 0 -2px 0 rgba(229,154,12,.35); }
.bar.today span { background: var(--saffron); }
.bar small { font-size: .68rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* "Now" marker in today's sessions */
.tl-item.is-now { background: color-mix(in srgb, var(--success) 7%, white); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 rgba(31,143,87,.5); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(31,143,87,0); } 100% { box-shadow: 0 0 0 0 rgba(31,143,87,0); } }

@media (max-width: 1180px) { .welcome { grid-template-columns: 1fr; } .quick { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .welcome { padding: 20px 18px; border-radius: 20px; }
  .welcome h2 { font-size: 1.35rem; }
  .quick { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .quick-btn { min-height: 84px; font-size: .78rem; }
  .bars { height: 96px; gap: 3px; }
}

/* Bottom nav (mobile) */
.bottom-nav { display: none; }
.backdrop { display: none; }

/* Print helpers */
.print-only { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-side { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px; z-index: 70; transform: translateX(-100%); transition: transform .22s ease; }
  [dir=rtl] .sidebar { transform: translateX(100%); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(16,35,58,.45); z-index: 65; }
  .topbar { padding: 10px 14px; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar .user-chip .who, .topbar .lang-switch { display: none; }
  .content { padding: 16px 16px 96px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .bottom-nav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; bottom: 0; inset-inline: 0; z-index: 50;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .7rem; color: var(--muted); padding: 4px 0; }
  .bottom-nav a .ti { font-size: 25px; }
  .bottom-nav a.active { color: var(--primary); }
}
@media (max-width: 640px) {
  .grid-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .stat .tile { width: 44px; height: 44px; font-size: 23px; }
  .stat-value { font-size: 1.2rem; }
  .form-grid > [class*="col-"] { grid-column: span 12; }
  .panel-body { padding: 16px; }
  .panel-head { padding: 14px 16px; }
  .roll-row { grid-template-columns: 1fr; }
  .roll-choice label span { display: none; }
  .roll-choice label { width: 48px; justify-content: center; padding: 0; }
  .tl-item { grid-template-columns: 54px 1fr; padding: 12px 16px; }
  .tl-item > :last-child { grid-column: 2; justify-self: start; }
  .floor { grid-template-columns: 52px 1fr; }
  .rooms-row { grid-template-columns: 1fr 1fr; }
  .page-title h1 { font-size: 1.1rem; }
  .page-title .tile { width: 38px; height: 38px; font-size: 21px; }
  .toolbar .select { flex: 1 1 140px; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 8px; }
  .modal { padding: 0; align-items: flex-end; }
  .modal-box { border-radius: 20px 20px 0 0; max-height: 92vh; overflow-y: auto; }
  .hide-sm { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .sidebar, .topbar, .bottom-nav, .no-print, .toasts { display: none !important; }
  .app { display: block; }
  .content { padding: 0; }
  .print-only { display: block; }
  body { background: #fff; }
}

/* Only the administrator may delete: hide every delete control for other roles. */
.no-delete [data-method="DELETE"], .no-delete [data-method="delete"], .no-delete [data-delete] { display: none !important; }
