/* Deewan HR: layout and components. Colours, type and sizes come from tokens.css (no hard-coded colours here). */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: var(--fs)/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.015em; margin: 0 0 .25rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; color: var(--text); }
h2 { font-size: 1.08rem; font-weight: 650; letter-spacing: -.005em; margin: 0 0 .75rem; }
h3 { font-size: .95rem; font-weight: 650; margin: 1rem 0 .5rem; }
::selection { background: var(--accent-soft); }

/* Accessible focus: a clear ring on everything that can be reached with the keyboard. */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 5px var(--focus-halo); border-radius: var(--radius-xs); }
.skip { position: absolute; inset-inline-start: 8px; top: -60px; z-index: 50; background: var(--card); color: var(--text); padding: 8px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.skip:focus { top: 8px; }

/* ------------------------------------------------------------------ sidebar navigation */
.topbar { background: linear-gradient(180deg, var(--side-bg-2), var(--side-bg)); color: var(--side-text); z-index: 20; }
.topbar a, .topbar .link { color: var(--side-muted); }
.side-top { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--side-text) !important; white-space: nowrap; min-width: 0; text-decoration: none !important; }
.brand-mark { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent); color: var(--side-bg); font-weight: 800; font-size: 1.1rem; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text b { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { color: var(--accent); font-size: .74rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.topbar .logo { height: 36px; width: auto; max-width: 120px; border-radius: 8px; background: var(--card); padding: 3px; margin: 0; }
.side-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.side-switch { display: grid; gap: 8px; padding: 0 16px 14px; border-bottom: 1px solid var(--side-line); }
.company-switch { margin: 0; }
.company-switch select { width: 100%; margin: 0; padding: 7px 10px; font-size: .88rem; background-color: var(--side-hover); color: var(--side-text); border-color: var(--side-line); }
.company-switch select option { color: var(--text); background: var(--card); }
.topbar nav { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; overflow-y: auto; flex: 1; }
.topbar nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm); font-size: .92rem; color: var(--side-muted); position: relative; text-decoration: none; }
.topbar nav a:hover { background: var(--side-hover); color: var(--side-text); }
.topbar nav a.on { background: var(--side-active); color: var(--side-text); font-weight: 600; }
.topbar nav a.on::before { content: ""; position: absolute; inset-inline-start: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.topbar nav a .ico { color: var(--accent); opacity: .75; }
.topbar nav a.on .ico, .topbar nav a:hover .ico { opacity: 1; }
.topbar nav .count { margin-inline-start: auto; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; padding: 12px 18px 18px; border-top: 1px solid var(--side-line); font-size: .88rem; }
.side-foot .who { flex-basis: 100%; color: var(--side-text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .link { color: var(--side-muted); font-size: .88rem; display: inline-flex; align-items: center; gap: 6px; }
.side-foot .link:hover { color: var(--side-text); }
.count { background: var(--notify); color: #fff; border-radius: 999px; padding: 0 7px; font-size: .74rem; font-weight: 700; line-height: 1.6; }
.topbar input.nav-toggle { position: absolute; opacity: 0; width: 1px; height: 1px; }
.nav-burger { display: none; }

@media (min-width: 1025px) {
  body.has-nav { padding-inline-start: var(--sidebar-w); }
  .topbar { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar-w); display: flex; flex-direction: column; }
}
@media (max-width: 1024px) {
  .topbar { position: sticky; top: 0; box-shadow: var(--shadow); display: flex; flex-wrap: wrap; align-items: center; }
  .side-top { padding: 10px 16px; flex: 1; min-width: 0; }
  .side-body { flex-basis: 100%; }
  .nav-burger { display: grid; place-items: center; margin-inline-end: 10px; width: 42px; height: 42px; border-radius: var(--radius-sm); cursor: pointer; color: var(--side-text); }
  .nav-burger:hover { background: var(--side-hover); }
  .nav-toggle:focus-visible + .nav-burger { outline: 2px solid var(--accent); }
  .side-body { display: none; max-height: calc(100vh - 62px); overflow-y: auto; }
  .nav-toggle:checked ~ .side-body { display: flex; }
  .side-switch { grid-template-columns: 1fr 1fr; padding-top: 4px; }
}

/* ------------------------------------------------------------------ page frame */
.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 28px 56px; }
@media (max-width: 700px) { .wrap { padding: 18px 14px 40px; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
@media (max-width: 700px) { .card { padding: 16px; } }
.card.narrow { max-width: 560px; margin: 24px auto; }
.card.wide-form { max-width: 820px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .card, .grid2 + section { margin-top: 18px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }

/* Sign-in pages */
body.auth { min-height: 100vh; background: radial-gradient(1200px 500px at 85% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.login { margin-top: 9vh !important; padding: 32px; border-top: 4px solid var(--accent); }
.login h1 { font-size: 1.5rem; }
.login .brand-mark { margin-bottom: 14px; width: 48px; height: 48px; font-size: 1.4rem; border-radius: 14px; color: var(--side-bg); }
.login-links { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }

.muted { color: var(--muted); }
.small { font-size: .86rem; }
.pre { white-space: pre-wrap; }
.nowrap { white-space: nowrap; }
.warn-text { color: var(--warn); }
.danger-text { color: var(--danger) !important; }

/* ------------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--card); color: var(--text); padding: 8px 18px; border-radius: 999px; font: inherit; font-weight: 550; font-size: .92rem; line-height: 1.4; cursor: pointer; text-decoration: none !important; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s; }
.btn:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: 0 1px 2px rgba(58, 42, 28, .15); }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: var(--on-brand); }
.btn.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: var(--card); border-color: var(--danger); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.wide { width: 100%; padding-block: 11px; }
.link { background: none; border: 0; padding: 0; color: var(--link); font: inherit; cursor: pointer; }
.link:hover { text-decoration: underline; text-underline-offset: 2px; }
.inline { display: inline; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.month { min-width: 9em; text-align: center; }

/* ------------------------------------------------------------------ forms */
form label { display: block; margin-bottom: 14px; font-size: .88rem; font-weight: 550; color: var(--muted); }
input, select, textarea { display: block; width: 100%; margin-top: 5px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--card); color: var(--text); font: inherit; font-weight: 400; transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus-halo); }
select { appearance: none; -webkit-appearance: none; padding-inline-end: 34px; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
html[dir="rtl"] select { background-position: 12px 55%, 17px 55%; }
select[multiple], select[size] { background-image: none; padding-inline-end: 12px; }
input[type=color] { padding: 3px; height: 42px; }
input[type=file] { padding: 7px; background: var(--surface-2); }
input[type=checkbox], input[type=radio] { display: inline; width: 16px; height: 16px; margin: 0 8px 0 0; accent-color: var(--brand); flex: none; }
html[dir="rtl"] input[type=checkbox], html[dir="rtl"] input[type=radio] { margin: 0 0 0 8px; }
.actions input { width: auto; margin: 0; }
label.check { display: inline-flex; align-items: center; color: var(--text); font-weight: 400; margin-inline-end: 14px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 0 0 16px; padding: 14px 16px 4px; }
legend { font-weight: 650; padding: 0 6px; color: var(--text); }
.checks { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 10px; }
.row2, .row3, .row4 { display: grid; gap: 0 14px; }
.row4 { grid-template-columns: repeat(4, 1fr); }
.row2 { grid-template-columns: 1fr 1fr; }
.row3 { grid-template-columns: repeat(3, 1fr); }
.align-end { display: flex; align-items: flex-end; padding-bottom: 12px; }
@media (max-width: 760px) { .row3, .row4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .row2, .row3, .row4 { grid-template-columns: 1fr; } }
details.add { margin-top: 14px; border-top: 1px dashed var(--line-strong); padding-top: 12px; }
details.add summary, details > summary { cursor: pointer; color: var(--link); font-weight: 550; }
details.add summary { margin-bottom: 10px; }

/* ------------------------------------------------------------------ messages */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid; border-inline-start-width: 4px; background: var(--card); }
.flash.success { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); border-inline-start-color: var(--ok); }
.flash.error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); border-inline-start-color: var(--danger); }
.flash.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); border-inline-start-color: var(--info); }
.flash:not(.success):not(.error):not(.info) { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); border-inline-start-color: var(--warn); }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: start; color: var(--muted); font-weight: 600; font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; background: var(--surface-2); border-bottom: 1px solid var(--line); padding: 10px 12px; white-space: nowrap; }
html[dir="rtl"] th { text-transform: none; letter-spacing: 0; font-size: .86rem; }
thead th:first-child { border-start-start-radius: var(--radius-xs); border-end-start-radius: var(--radius-xs); }
thead th:last-child { border-start-end-radius: var(--radius-xs); border-end-end-radius: var(--radius-xs); }
td { border-bottom: 1px solid var(--line); padding: 11px 12px; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--brand-soft) 55%, transparent); }
tr.rowlink { cursor: pointer; }
tr.rowlink:hover td { background: var(--brand-soft); }
tr.inactive td { opacity: .55; }
td.clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge { display: inline-block; font-size: .74rem; font-weight: 650; padding: 2px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); border: 0; vertical-align: middle; }
.s-pending, .s-issued, .s-planned { color: var(--warn); background: var(--warn-soft); }
.s-approved, .s-acknowledged, .s-confirmed, .s-taught { color: var(--ok); background: var(--ok-soft); }
.s-refused { color: var(--danger); background: var(--danger-soft); }
.s-cancelled { color: var(--muted); background: var(--surface-2); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-inline-end: 6px; vertical-align: baseline; }
.dot.big { width: 14px; height: 14px; }

/* ------------------------------------------------------------------ dashboard */
.dash-head { align-items: center; }
.dash-head .sub { color: var(--muted); margin: 2px 0 0; font-size: .95rem; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin: -4px 0 20px; }
.quick a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--text); font-size: .9rem; font-weight: 550; box-shadow: var(--shadow); text-decoration: none; }
.quick a .ico { color: var(--brand); }
.quick a:hover { border-color: var(--brand); color: var(--brand-dark); box-shadow: var(--shadow-hover); }
.balances { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.balance { background: color-mix(in srgb, var(--c) 14%, var(--card)); border: 1px solid color-mix(in srgb, var(--c) 30%, var(--line)); border-radius: var(--radius-sm); padding: 14px 16px; }
a.balance { display: block; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
a.balance:hover, a.balance:focus-visible { border-color: color-mix(in srgb, var(--c) 70%, var(--line)); transform: translateY(-1px); }
.b-name { font-size: .85rem; color: var(--muted); font-weight: 550; }
.b-num { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; }
.b-sub { font-size: .8rem; color: var(--muted); }

.approval { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.approval:last-child { border-bottom: 0; }
ul.plain { list-style: none; padding: 0; margin: 0 0 8px; }
ul.plain li { padding: 6px 0; }
.notes li.unread a { font-weight: 650; }
.notes li.unread::before { content: "•"; color: var(--notify); margin-inline-end: 6px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0 0 14px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
@media (max-width: 500px) { dl.facts { grid-template-columns: 1fr; gap: 0; } dl.facts dd { margin-bottom: 8px; } }
.rule-box h3 { margin-top: 0; }
.rule-box ul { margin: 0 0 14px; padding-inline-start: 20px; }
.decide { border-top: 1px solid var(--line); padding-top: 12px; margin-bottom: 12px; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.tabs a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-size: .9rem; font-weight: 550; text-decoration: none; }
.tabs a:hover { color: var(--brand-dark); background: var(--brand-soft); }
.tabs a.on { background: var(--brand); color: var(--on-brand); }
.tabs a.right { margin-inline-start: auto; }
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; position: sticky; top: 0; background: var(--bg); padding: 8px 0; z-index: 4; }
@media (max-width: 1024px) { .subnav { top: 62px; } }
.subnav a { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: .85rem; }
.subnav a:hover { background: var(--brand-soft); color: var(--brand-dark); text-decoration: none; }
section[id] { scroll-margin-top: 80px; }

/* ------------------------------------------------------------------ calendar */
.cal-card { overflow-x: auto; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(90px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; min-width: 640px; }
.cal-h { background: var(--surface-2); text-align: center; font-size: .78rem; font-weight: 600; color: var(--muted); padding: 8px 6px; }
.cal-d { background: var(--card); min-height: 96px; padding: 5px 6px; }
.cal-d.weekend, .cal-d.empty { background: var(--surface-2); }
.cal-d.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-d.today .cal-n { background: var(--brand); color: var(--on-brand); border-radius: 999px; display: inline-block; padding: 0 7px; }
.cal-n { font-size: .8rem; color: var(--muted); font-weight: 600; }
.cal-hol { font-size: .72rem; color: var(--danger); background: var(--danger-soft); border-radius: 4px; padding: 0 4px; }
.cal-e { font-size: .75rem; background: color-mix(in srgb, var(--c) 28%, var(--card)); border-inline-start: 3px solid var(--c); border-radius: 4px; padding: 1px 5px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.cal-e { display: block; color: inherit; text-decoration: none; }
a.cal-e:hover, a.cal-e:focus-visible { outline: 1px solid var(--c, var(--line)); }
.cal-e.pending { background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--c) 28%, var(--card)) 0 5px, var(--card) 5px 10px); }
.cal-e.other { --c: var(--other-leave); }

/* ------------------------------------------------------------------ appearance settings */
.logo { height: 26px; width: auto; vertical-align: middle; margin-inline-end: 8px; border-radius: 6px; }
.login-logo { max-height: 64px; max-width: 200px; display: block; margin-bottom: 14px; }
.logo-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-preview { max-height: 56px; max-width: 180px; border-radius: 8px; border: 1px solid var(--line); padding: 4px; background: var(--card); }
.logo-row input[type=file] { width: auto; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.preset { margin: 0 !important; }
.preset input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 2px solid var(--line); background: var(--sg, var(--card)); color: var(--text); cursor: pointer; font-size: .9rem; }
.swatch.custom { padding-inline-start: 12px; }
.swatch i { width: 22px; height: 22px; border-radius: 50%; background: var(--sb); display: inline-block; }
.preset input:checked + .swatch { border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus-halo); }
.preset input:focus-visible + .swatch { outline: 2px solid var(--focus); }
.sticky-save { position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 40%); z-index: 3; }

.dash { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.dash > * { margin: 0; }
.dash-full { grid-column: 1 / -1; }
@media (max-width: 860px) { .dash { grid-template-columns: 1fr; } .dash-half { grid-column: 1 / -1; } }
.reorder { list-style: none; padding: 0; margin: 0 0 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.reorder li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--card); flex-wrap: wrap; }
.reorder li:last-child { border-bottom: 0; }
.reorder .grow { flex: 1; min-width: 160px; margin: 0; }
.reorder label.check { margin: 0; }
.reorder .narrow-select { width: auto; margin: 0; }
.handle { display: inline-flex; flex-direction: column; gap: 2px; }
.arrow { border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); border-radius: 6px; font-size: .6rem; line-height: 1; padding: 3px 6px; cursor: pointer; }
.arrow:hover { color: var(--brand-dark); border-color: var(--brand); }
.replace-head, .replace-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.replace-head { font-size: .85rem; color: var(--muted); margin-bottom: 2px; }
.replace-row input { margin: 0 0 8px; }

/* Settings: forms, lists, notifications, pages */
.field-row { display: grid; grid-template-columns: 2fr 1fr 2fr; gap: 0 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.field-row:has(select[name=f_scope]) { grid-template-columns: 2fr 1fr 2fr 1.4fr; }
.field-flags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.field-flags .check, .list-row .check { margin: 0; }
.list-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.list-row input[name=label] { flex: 1 1 220px; margin: 0; }
.msg-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.msg-row textarea { margin: 6px 0 0; }
input.short { max-width: 120px; }
.prose h2, .prose h3 { margin: 1em 0 .4em; }
.prose > :first-child { margin-top: 0; }
.prose ul { padding-inline-start: 1.3em; }
.announce { border-inline-start: 4px solid var(--accent); background: linear-gradient(90deg, var(--accent-soft), var(--card) 60%); }
html[dir="rtl"] .announce { background: linear-gradient(270deg, var(--accent-soft), var(--card) 60%); }
.foot { text-align: center; padding: 8px 16px 24px; }
.foot p { margin: 0; }
@media (max-width: 700px) {
  .field-row, .field-row:has(select[name=f_scope]) { grid-template-columns: 1fr; }
}
.stack label.check { display: flex; margin: 6px 0; }

/* Attendance, payroll, checklists, reviews */
.checkin { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.inline-edit form { min-width: 220px; }
.inline-edit input { margin: 4px 0; }
.payslip { max-width: 680px; margin: 0 auto; }
.payslip table td:last-child, .payslip table th:last-child { text-align: end; }
.payslip .total td { font-weight: 700; border-top: 2px solid var(--line-strong); }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist li.done .task { text-decoration: line-through; color: var(--muted); }
.checklist form { margin: 0; }
.task.grow { flex: 1; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; min-width: 80px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); }
.stars { color: var(--accent); letter-spacing: 2px; }
.bar-row { display: grid; grid-template-columns: 160px 1fr 60px; gap: 8px; align-items: center; margin: 4px 0; }
a.bar-row { color: inherit; text-decoration: none; border-radius: 6px; padding: 2px 4px; margin-inline: -4px; }
a.bar-row:hover, a.bar-row:focus-visible { background: var(--line); }
@media (max-width: 500px) { .bar-row { grid-template-columns: 1fr 60px; } .bar-row > :first-child { grid-column: 1 / -1; } }
.bar { height: 14px; border-radius: 6px; background: var(--brand-soft); }
.bar span { display: block; height: 100%; border-radius: 6px; background: var(--brand); }
.tick { background: none; border: 0; font-size: 1.3em; line-height: 1; cursor: pointer; color: var(--brand); padding: 0; }
.tick:disabled { cursor: default; color: var(--muted); }
.goal { border-bottom: 1px solid var(--line); padding: 10px 0; }
.goal summary { cursor: pointer; list-style: none; color: var(--text); font-weight: 400; }
.goal summary .progress { margin-top: 6px; }

/* Arabic, right to left */
html[dir="rtl"] body { font-family: var(--font-ar); line-height: 1.75; }
html[dir="rtl"] input[type="email"], html[dir="rtl"] input[type="number"], html[dir="rtl"] input[type="date"], html[dir="rtl"] input[type="time"], html[dir="rtl"] code { direction: ltr; text-align: end; }
/* Text people type (pages, announcements, notes) follows its own language's direction. */
html[dir="rtl"] .prose, html[dir="rtl"] .announce, html[dir="rtl"] td.clip, html[dir="rtl"] .pre { unicode-bidi: plaintext; text-align: start; }
html[dir="rtl"] .topbar nav a.on::before { border-radius: 3px 0 0 3px; }

/* Teaching */
.lessons { list-style: none; margin: 0; padding: 0; }
.lessons > li { border-block-start: 1px solid var(--line); padding: 10px 0; display: grid; gap: 6px; }
.lessons > li:first-child { border-block-start: 0; }
.lesson-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.lesson-time { font-weight: 650; font-variant-numeric: tabular-nums; min-width: 6.5em; color: var(--brand-dark); }
.lesson-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.lesson-form label { margin: 0; }
.lesson-form input[name="topic"] { min-width: 14em; }
.lesson-form input[name="present"] { width: 6em; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week-day { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; min-height: 90px; background: var(--card); }
.week-day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.week-day h3 { font-size: .85rem; margin: 0 0 6px; }
.week-day .slot { font-size: .8rem; border-radius: 6px; padding: 4px 6px; margin-bottom: 4px; background: var(--brand-soft); border-inline-start: 3px solid var(--brand); }
.week-day .slot.off { background: var(--surface-2); color: var(--muted); text-decoration: line-through; border-color: var(--line-strong); }
@media (max-width: 760px) { .week { grid-template-columns: 1fr; } .week-day { min-height: 0; } }
.lessons > li.lesson-date { border: 0; padding: 12px 0 0; }
html[dir="rtl"] td[dir="ltr"] { text-align: right; }

/* Statistic cards */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.stat { position: relative; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px 12px; text-decoration: none !important; color: inherit; display: block; background: var(--card); overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s; }
.stat::before { content: ""; position: absolute; inset-block-start: 0; inset-inline: 0; height: 3px; background: var(--accent); opacity: .7; }
.stat b { display: block; font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; color: var(--brand-dark); line-height: 1.25; }
.stat span { font-size: .84rem; color: var(--muted); }
a.stat:hover { border-color: var(--brand); box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.stat.attn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: color-mix(in srgb, var(--warn-soft) 60%, var(--card)); }
.stat.attn::before { background: var(--warn); opacity: 1; }
.stat.attn b { color: var(--warn); }
.stat.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.stat b.small-b { font-size: 1.05rem; padding-block: 8px; }

/* Group overview */
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills a { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line-strong); text-decoration: none; color: var(--text); font-size: .85rem; }
.pills a:hover { border-color: var(--brand); }
.pills a.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
table.compact th, table.compact td { padding-inline: 8px; }
.bar { display: block; height: 4px; border-radius: 2px; background: var(--brand); width: var(--w); min-width: 2px; margin-top: 4px; opacity: .7; }
tr.total th { border-top: 2px solid var(--line-strong); text-align: start; }
.alerts { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.alerts li { border-inline-start: 4px solid var(--info); padding: 8px 12px; background: var(--info-soft); border-radius: var(--radius-xs); }
.alerts li a { color: var(--text); }
.alerts li.alert-warn { border-color: var(--warn); background: var(--warn-soft); }
table.matrix th[scope="row"] { color: var(--text); font-weight: 650; text-transform: none; letter-spacing: 0; font-size: .9rem; background: transparent; }
table.matrix .center, table.matrix th.center { text-align: center; }
table.matrix th.center { white-space: normal; font-size: .74rem; min-width: 70px; }
fieldset.plain { border: 0; padding: 0; margin: 0; }
.sensitive label.check { gap: 6px; }
.role-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 600px) { .role-row { grid-template-columns: 1fr; } }
.role-row label { margin-bottom: 4px; }
.role-locked { padding: 8px 0; margin: 0; border-bottom: 1px solid var(--line); }
.letter-pick { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
.letter-pick label { flex: 1 1 220px; margin: 0; }
.letter { max-width: 760px; margin: 0 auto; }
.letter .letterhead { display: flex; align-items: center; gap: 14px; border-bottom: 2px solid var(--accent); padding-bottom: 12px; margin-bottom: 24px; }
.letter .letterhead img { max-height: 56px; }
.letter .letter-body { line-height: 1.7; }
.letter .letter-body p { margin: 0 0 1em; }
.placeholders { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 16px; }
.placeholders code { direction: ltr; unicode-bidi: isolate; }
.overview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.overview-grid .card { margin: 0; border-top: 3px solid var(--accent); }
.overview-grid h3 { margin: 0 0 6px; font-size: 1rem; }
.overview-grid ul { margin: 6px 0 0; padding-inline-start: 18px; }
.overview-grid li { margin: 2px 0; }
.overview-grid li::marker { color: var(--accent); }
.event-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 16px; }
.event-list label.check { align-items: flex-start; }
.secret { direction: ltr; unicode-bidi: isolate; word-break: break-all; }
code { background: var(--surface-2); border-radius: 4px; padding: 1px 5px; font-size: .88em; }
pre { background: var(--surface-2); border-radius: var(--radius-xs); padding: 10px 12px; overflow-x: auto; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media print {
  .topbar, .no-print, .foot, .skip { display: none !important; }
  body, body.has-nav { background: #fff; color: #000; padding: 0; }
  .card { box-shadow: none; border: 0; }
  .letter .letterhead { border-color: #c8a868; }
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.theme-toggle .tm { display: none; }
:root:not([data-theme]) .theme-toggle .tm-auto, :root[data-theme="light"] .theme-toggle .tm-light, :root[data-theme="dark"] .theme-toggle .tm-dark { display: inline; }
/* Focus on the dark sidebar uses gold so it stays visible. */
.topbar :focus-visible { outline-color: var(--accent); box-shadow: none; }
.topbar select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(200, 168, 104, .35); }

/* Several small forms inside one expandable block (escalate / reassign). */
details.add form + form { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px dashed var(--line); }
/* HR desk: announcements, employee requests, cases and history lists. */
ul.news li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
ul.news li:last-child { border-bottom: 0; }
.desk-item { padding: var(--space-4) 0; border-bottom: 1px solid var(--line); }
.desk-item:last-child { border-bottom: 0; }
.desk-item .meta { color: var(--muted); font-size: .875rem; }
.case { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--space-4); margin: var(--space-3) 0; background: var(--surface-2); }
.case ol { margin: var(--space-2) 0 var(--space-3); padding-inline-start: 1.2em; }
.case li { margin: var(--space-2) 0; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-end; padding: var(--space-3) 0; }
.bulk-bar details { flex: 1 1 260px; }
td.pick, th.pick { width: 2.2em; }

/* Employee self-service: photo, services grid on the home page, schedule, approve/refuse rows. */
.person-head { display: flex; align-items: center; gap: var(--space-3); }
.avatar { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; flex: none; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.3rem; }
.row-form { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-top: var(--space-2); }
.row-form input { flex: 1 1 200px; width: auto; margin: 0; }
.services .svc-cards { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.services .stat span:first-child { display: block; }
.svc-title { margin: var(--space-4) 0 var(--space-3); font-size: 1rem; }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: var(--space-3); }
.svc-grid a { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); text-align: center; font-size: .86rem; color: inherit; text-decoration: none; padding: var(--space-2) var(--space-1); border-radius: var(--radius-sm); min-height: 44px; }
.svc-grid a:hover { background: var(--surface-2); }
.svc-ico { display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand-dark); }
@media (max-width: 600px) { .svc-grid { grid-template-columns: repeat(3, 1fr); gap: var(--space-2); } }
ul.schedule { list-style: none; margin: 0; padding: 0; }
ul.schedule li { display: grid; grid-template-columns: 64px 1fr; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--line); align-items: start; }
ul.schedule li:last-child { border-bottom: 0; }
ul.schedule li.off .when { color: var(--muted); }
ul.schedule li.today .when b { color: var(--brand-dark); }
ul.schedule .when { display: flex; flex-direction: column; line-height: 1.2; }
ul.schedule .when span { font-size: .84rem; color: var(--muted); }
ul.schedule .what { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: center; }
ul.schedule .what .small { flex-basis: 100%; }
/* Teacher quality: competency bars and score pickers. */
.qbar { display: block; height: 12px; border-radius: 6px; background: var(--brand-soft); overflow: hidden; }
.qbar span { display: block; height: 100%; background: var(--brand); }
.scores { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-2) var(--space-4); }
.scores label { margin: 0; }
.score-list { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); font-size: .875rem; margin: var(--space-2) 0; }

/* Interviews on a candidate page */
.ivw { border-top: 1px solid var(--line); padding: var(--space-3) 0; display: grid; gap: var(--space-2); }
.ivw:first-of-type { border-top: 0; padding-top: 0; }
.list-row input.list-text { flex: 2 1 320px; margin: 0; }
.subnav a.active { background: var(--brand-soft); color: var(--brand-dark); border-color: transparent; font-weight: 600; }
.report-nav { position: static; }
.filters { padding: var(--space-4); }
.report-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-3); }
.report-list a { display: block; padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: var(--text); }
.report-list a:hover { background: var(--brand-soft); text-decoration: none; }
.report-list span { display: block; color: var(--muted); font-size: .85rem; }
.section-top { margin-top: 2rem; }
