/* Dr Filler — attendance portal. Light, corporate, RTL. */

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

:root {
  --font: "Vazirmatn", "Segoe UI", Tahoma, system-ui, sans-serif;

  --bg: #f4f6f6;
  --surface: #ffffff;
  --surface-2: #f7f9f9;
  --surface-3: #eef2f2;
  --border: #e2e8e7;
  --border-strong: #cdd6d5;
  --text: #102221;
  --text-2: #475756;
  --text-3: #667674;

  --brand: #0b6b64;
  --brand-hover: #09594f;
  --brand-ink: #074640;
  --brand-soft: #e2f1ee;
  --brand-softer: #f0f8f6;

  /* one hue per state — never two states on the same hue */
  --present: #16784a;  --present-soft: #e4f4eb;     /* green  — حاضر */
  --late: #9a5300;     --late-soft: #fdf0dc;        /* amber  — تأخیر */
  --absent: #b42318;   --absent-soft: #fdebe9;      /* red    — غیبت ناموجه */
  --leave: #3b52c4;    --leave-soft: #eaedfb;       /* indigo — مرخصی */
  --sick: #0369a1;     --sick-soft: #e2f0fa;        /* blue   — استعلاجی */
  --remote: #0e7490;   --remote-soft: #ddf2f7;      /* cyan   — دورکاری */
  --overtime: #7340b8; --overtime-soft: #f1eafb;    /* violet — اضافه‌کاری */
  --holiday: #a8295b;  --holiday-soft: #fbe9f0;     /* rose   — تعطیل رسمی */
  --incomplete: #52606d; --incomplete-soft: #eceff2;/* slate  — تردد ناقص */
  --off: #667674;      --off-soft: #eef1f1;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-pop: 0 12px 32px -8px rgba(16, 34, 33, 0.18), 0 2px 6px rgba(16, 34, 33, 0.06);
  --shadow-drawer: 0 0 48px rgba(16, 34, 33, 0.16);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --sidebar-w: 256px;
  --topbar-h: 64px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  direction: rtl;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--brand);
}
::selection { background: #bfe3dc; color: var(--brand-ink); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 700; letter-spacing: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 24px; height: 24px; }
.icon.flip { transform: scaleX(-1); }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); font-size: 0.8125rem; }
.nowrap { white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 14px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; text-decoration: none; color: inherit; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 0.95rem; letter-spacing: 0.02em; direction: ltr;
}
.brand-name { display: flex; flex-direction: column; line-height: 1.25; }
.brand-name strong { font-size: 1rem; }
.brand-name span { font-size: 0.75rem; color: var(--text-3); direction: ltr; text-align: right; letter-spacing: 0.04em; }

.nav-group { margin-top: 8px; }
.nav-group + .nav-group { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.nav-title { font-size: 0.75rem; color: var(--text-3); padding: 0 12px 6px; font-weight: 500; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin: 2px 0; border-radius: 10px;
  color: var(--text-2); text-decoration: none; font-weight: 500; font-size: 0.9375rem;
  transition: background-color 150ms, color 150ms;
}
.nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.nav-link[aria-current="page"] .icon { color: var(--brand); }
.nav-link .count {
  margin-inline-start: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px;
  background: var(--brand); color: #fff; font-size: 0.75rem; font-weight: 600; display: grid; place-items: center;
}
.sidebar-foot { margin-top: auto; padding-top: 16px; }
.device-pill { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 0.8125rem; color: var(--text-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--off); flex: none; }
.dot.online { background: var(--present); box-shadow: 0 0 0 3px var(--present-soft); }
.dot.offline, .dot.error { background: var(--absent); box-shadow: 0 0 0 3px var(--absent-soft); }
.dot.live { background: var(--present); animation: pulse 2s var(--ease-out) infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(22, 120, 74, 0.45); } 70% { box-shadow: 0 0 0 7px rgba(22, 120, 74, 0); } 100% { box-shadow: 0 0 0 0 rgba(22, 120, 74, 0); } }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 32px;
  background: rgba(244, 246, 246, 0.92); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent; transition: border-color 200ms;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar-title { font-size: 1.0625rem; font-weight: 700; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-spacer { flex: 1; }
.clock { font-size: 0.875rem; color: var(--text-2); display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.clock b { color: var(--text); font-weight: 600; font-size: 0.9375rem; }
.icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 10px; border: 1px solid transparent; background: transparent;
  display: grid; place-items: center; color: var(--text-2); cursor: pointer; transition: background-color 150ms, color 150ms;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .badge {
  position: absolute; top: 5px; left: 5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--absent); color: #fff; font-size: 0.6875rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg);
}
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 12px; border-radius: 12px; border: 1px solid transparent; background: none; cursor: pointer; }
.user-chip:hover { background: var(--surface-3); }
.user-chip .who { display: flex; flex-direction: column; line-height: 1.25; text-align: right; }
.user-chip .who strong { font-size: 0.875rem; }
.user-chip .who span { font-size: 0.75rem; color: var(--text-3); }
.menu-btn { display: none; }

.page { padding: 8px 32px 48px; max-width: 1440px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 12px 0 22px; }
.page-head h1 { font-size: 1.625rem; }
.page-head p { color: var(--text-2); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.bottom-nav { display: none; }

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.panel-head h2 { font-size: 1rem; }
.panel-head .subtle { margin-top: 2px; }
.panel-body { padding: 20px; }
.panel-body.flush { padding: 0; }
.grid { display: grid; gap: 20px; align-items: start; }
.grid.two { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.grid.halves { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 20px; }
.stack.tight { gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }

/* ledger: one strip of related figures separated by hairlines */
.ledger { display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.ledger > * { padding: 14px 18px; border-inline-start: 1px solid var(--border); min-width: 0; }
.ledger > :first-child { border-inline-start: 0; }
.ledger .label { font-size: 0.8125rem; color: var(--text-2); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.ledger .value { font-size: 1.25rem; font-weight: 700; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ledger .value small { display: block; font-size: 0.75rem; font-weight: 500; color: var(--text-3); line-height: 1.3; white-space: normal; }
.ledger button.cell { all: unset; box-sizing: border-box; padding: 14px 18px; border-inline-start: 1px solid var(--border); cursor: pointer; transition: background-color 150ms; }
.ledger button.cell:first-child { border-inline-start: 0; }
.ledger button.cell:hover { background: var(--surface-2); }
.ledger button.cell[aria-pressed="true"] { background: var(--brand-softer); box-shadow: inset 0 -2px 0 var(--brand); }
.ledger button.cell:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 0.9rem; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color 150ms, border-color 150ms, color 150ms, transform 120ms;
}
.btn:hover { background: var(--surface-2); border-color: #b9c4c3; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.danger { color: var(--absent); }
.btn.danger:hover { background: var(--absent-soft); border-color: #f0b8b2; }
.btn.danger-solid { background: var(--absent); border-color: var(--absent); color: #fff; }
.btn.success { background: var(--present); border-color: var(--present); color: #fff; }
.btn.success:hover { background: #12623d; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 0.8125rem; border-radius: 8px; }
.btn.block { width: 100%; }
.btn[disabled], .btn[aria-busy="true"] { opacity: 0.55; cursor: not-allowed; pointer-events: none; }
.btn[aria-busy="true"]::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.field .hint { font-size: 0.8125rem; color: var(--text-3); }
.field .error { font-size: 0.8125rem; color: var(--absent); }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); transition: border-color 150ms, box-shadow 150ms; font-size: 0.9375rem;
}
.textarea { min-height: 88px; resize: vertical; line-height: 1.7; }
.input::placeholder, .textarea::placeholder { color: #7f8d8b; }
.input:hover, .select:hover, .textarea:hover { border-color: #b3bfbd; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 107, 100, 0.16); }
.input[aria-invalid="true"] { border-color: var(--absent); }
.input.ltr-input { direction: ltr; text-align: right; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23475756' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='4 6 8 10 12 6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 12px center; padding-left: 36px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.input-affix { position: relative; }
.input-affix .input { padding-left: 44px; }
.input-affix .affix { position: absolute; left: 4px; top: 50%; transform: translateY(-50%); }

/* segmented control */
.segmented { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: 11px; gap: 2px; flex-wrap: wrap; }
.segmented button {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 0.875rem;
  color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: background-color 150ms, color 150ms, box-shadow 150ms;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 34, 33, 0.12); }
.segmented .count { font-size: 0.75rem; background: var(--brand); color: #fff; border-radius: 9px; padding: 0 6px; min-width: 18px; }

/* choice cards (overtime kind, device mode) */
.choices { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 10px; }
.choice { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; background: var(--surface); transition: border-color 150ms, background-color 150ms, box-shadow 150ms; text-align: right; }
.choice:hover { border-color: #aab7b5; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice .icon { color: var(--text-3); }
.choice strong { font-size: 0.9375rem; }
.choice span { font-size: 0.8125rem; color: var(--text-2); }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-softer); box-shadow: 0 0 0 1px var(--brand); }
.choice:has(input:checked) .icon { color: var(--brand); }
.choice:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.9375rem; }
.switch input { appearance: none; width: 40px; height: 24px; border-radius: 12px; background: var(--border-strong); position: relative; cursor: pointer; transition: background-color 160ms; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 200ms var(--ease-out); }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(-16px); }

.daypick { display: flex; gap: 6px; flex-wrap: wrap; }
.daypick label { cursor: pointer; }
.daypick input { position: absolute; opacity: 0; }
.daypick span { display: inline-grid; place-items: center; min-width: 64px; height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border-strong); font-size: 0.875rem; font-weight: 600; color: var(--text-2); transition: all 150ms; }
.daypick input:checked + span { background: var(--holiday-soft); border-color: var(--holiday); color: var(--holiday); }
.daypick input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- avatar ---------- */
.avatar { --size: 40px; width: var(--size); height: var(--size); border-radius: 50%; flex: none; overflow: hidden; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; font-size: calc(var(--size) * 0.36); position: relative; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sq { border-radius: 14px; }
.avatar[data-tone="1"] { background: #e6eefb; color: #2b4a8f; }
.avatar[data-tone="2"] { background: #f7ebe0; color: #7a4a14; }
.avatar[data-tone="3"] { background: #efe8f8; color: #5b3a8c; }
.avatar[data-tone="4"] { background: #e3f2ea; color: #1e5e3d; }
.avatar[data-tone="5"] { background: #f9e6ec; color: #86294c; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person .meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.person .meta strong { font-size: 0.9375rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .meta span { font-size: 0.8125rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- status chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 0.8125rem; font-weight: 600; white-space: nowrap; background: var(--off-soft); color: var(--off); }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.plain::before { display: none; }
.chip.present, .chip.approved { background: var(--present-soft); color: var(--present); }
.chip.late, .chip.pending { background: var(--late-soft); color: var(--late); }
.chip.absent, .chip.rejected { background: var(--absent-soft); color: var(--absent); }
.chip.leave { background: var(--leave-soft); color: var(--leave); }
.chip.sick { background: var(--sick-soft); color: var(--sick); }
.chip.remote { background: var(--remote-soft); color: var(--remote); }
.chip.overtime { background: var(--overtime-soft); color: var(--overtime); }
.chip.holiday { background: var(--holiday-soft); color: var(--holiday); }
.chip.incomplete { background: var(--incomplete-soft); color: var(--incomplete); }
.chip.in_office { background: var(--brand-soft); color: var(--brand); }
.chip.in_office::before { animation: pulse 2s var(--ease-out) infinite; }
.chip.cancelled, .chip.weekend, .chip.not_yet, .chip.no_data, .chip.future, .chip.not_employed { background: var(--off-soft); color: var(--off); }

/* ---------- banners ---------- */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); background: var(--late-soft); color: #6d3f00; border: 1px solid #f1d4a8; }
.banner .icon { margin-top: 2px; color: var(--late); }
.banner strong { display: block; margin-bottom: 2px; }
.banner.info { background: var(--brand-softer); color: var(--brand-ink); border-color: #cfe6e1; }
.banner.info .icon { color: var(--brand); }
.banner.error { background: var(--absent-soft); color: #7c1a12; border-color: #f2c1bb; }
.banner.error .icon { color: var(--absent); }
.banner .btn { margin-inline-start: auto; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.9rem; }
.table th { text-align: right; font-weight: 600; font-size: 0.8125rem; color: var(--text-2); padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; transition: background-color 120ms; }
.table tbody tr.clickable:hover { background: var(--surface-2); }
.table tbody tr.dim td { color: var(--text-3); }
.table tbody tr.off td { background: #fafbfb; }
.table .n { text-align: left; direction: ltr; unicode-bidi: plaintext; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border-strong); padding: 12px 16px; }
.table th:first-child { border-top-right-radius: var(--radius); }
.table th:last-child { border-top-left-radius: var(--radius); }

/* ---------- empty / skeleton ---------- */
.empty { text-align: center; padding: 48px 24px; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .icon { width: 36px; height: 36px; color: var(--border-strong); stroke-width: 1.5; }
.empty strong { color: var(--text); font-size: 1rem; }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 0%, #f6f8f8 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- toast ---------- */
.toasts { position: fixed; bottom: 24px; left: 24px; z-index: 100; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; min-width: 280px; max-width: 420px; padding: 12px 14px; border-radius: 12px; background: #13302d; color: #fff; box-shadow: var(--shadow-pop); animation: toast-in 320ms var(--ease-out); }
.toast .icon { margin-top: 2px; color: #7fd6c3; }
.toast.error { background: #5b1710; }
.toast.error .icon { color: #ffb4a9; }
.toast strong { display: block; font-size: 0.9375rem; }
.toast p { font-size: 0.8125rem; opacity: 0.85; }
.toast .avatar { --size: 36px; }
.toast.leaving { animation: toast-out 200ms ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- drawer & dialog ---------- */
.scrim { position: fixed; inset: 0; background: rgba(16, 34, 33, 0.32); z-index: 60; animation: fade 200ms ease-out; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 61; width: min(560px, 100vw); background: var(--surface);
  display: flex; flex-direction: column; box-shadow: var(--shadow-drawer); animation: drawer-in 320ms var(--ease-out);
}
.drawer.wide { width: min(760px, 100vw); }
@keyframes drawer-in { from { transform: translateX(-100%); } }
.drawer.leaving { animation: drawer-out 200ms ease-in forwards; }
@keyframes drawer-out { to { transform: translateX(-100%); } }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 1.125rem; }
.drawer-head p { color: var(--text-2); font-size: 0.875rem; margin-top: 2px; }
.drawer-head .icon-btn { margin-inline-start: auto; margin-top: -6px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 24px; }
.drawer-foot { display: flex; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); background: var(--surface-2); }
.drawer-foot .spacer { flex: 1; }

dialog.modal { border: 0; padding: 0; border-radius: var(--radius-lg); width: min(440px, calc(100vw - 32px)); box-shadow: var(--shadow-pop); color: var(--text); }
dialog.modal::backdrop { background: rgba(16, 34, 33, 0.36); }
dialog.modal[open] { animation: pop 260ms var(--ease-out); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.modal-body h2 { font-size: 1.125rem; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-start; padding: 16px 24px; background: var(--surface-2); border-top: 1px solid var(--border); }

.popover { position: fixed; z-index: 80; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); animation: pop 200ms var(--ease-out); }

/* ---------- notifications ---------- */
.notif-panel { width: min(380px, calc(100vw - 24px)); max-height: 70vh; display: flex; flex-direction: column; }
.notif-panel header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.notif-list { overflow-y: auto; }
.notif { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.notif:hover { background: var(--surface-2); }
.notif:last-child { border-bottom: 0; }
.notif.unread { background: var(--brand-softer); }
.notif .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--text-2); }
.notif .ico.approved { background: var(--present-soft); color: var(--present); }
.notif .ico.rejected { background: var(--absent-soft); color: var(--absent); }
.notif .ico.request { background: var(--late-soft); color: var(--late); }
.notif strong { font-size: 0.875rem; display: block; }
.notif p { font-size: 0.8125rem; color: var(--text-2); white-space: pre-line; }
.notif time { font-size: 0.75rem; color: var(--text-3); }

.menu { min-width: 220px; padding: 6px; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; border: 0; background: none; text-decoration: none; color: var(--text); cursor: pointer; font-size: 0.9rem; text-align: right; }
.menu a:hover, .menu button:hover { background: var(--surface-3); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
.login-side { position: relative; background: var(--brand-ink); color: #e8f4f1; padding: 48px; display: flex; flex-direction: column; overflow: hidden; }
.login-side .brand-mark { background: #fff; color: var(--brand-ink); }
.login-side h2 { font-size: 2rem; line-height: 1.4; margin-top: auto; max-width: 16ch; color: #fff; }
.login-side p { margin-top: 14px; color: #b9d8d2; max-width: 44ch; }
.login-clock { margin-top: 36px; display: flex; gap: 28px; flex-wrap: wrap; }
.login-clock div { display: flex; flex-direction: column; }
.login-clock b { font-size: 2.5rem; font-weight: 600; color: #fff; line-height: 1.2; }
.login-clock span { color: #9cc7bf; font-size: 0.875rem; }
.login-dial { position: absolute; top: -140px; left: -140px; width: 460px; height: 460px; opacity: 0.16; }
.login-main { display: grid; place-items: center; padding: 32px 24px; }
.login-card { width: min(400px, 100%); }
.login-card h1 { font-size: 1.625rem; }
.login-card > p { color: var(--text-2); margin: 6px 0 28px; }
.login-card form { display: flex; flex-direction: column; gap: 18px; }
.login-help { margin-top: 24px; font-size: 0.8125rem; color: var(--text-3); line-height: 1.8; }

/* ---------- employee home ---------- */
.today { display: grid; grid-template-columns: minmax(0, 1fr); }
.today-top { display: flex; gap: 20px; align-items: center; padding: 22px 24px; flex-wrap: wrap; }
.today-top .avatar { --size: 72px; }
.today-top .hello { flex: 1; min-width: 200px; }
.today-top .hello h1 { font-size: 1.375rem; }
.today-top .hello p { color: var(--text-2); margin-top: 2px; }
.today-figures { display: flex; gap: 0; }
.today-figures > div { padding: 0 22px; border-inline-start: 1px solid var(--border); display: flex; flex-direction: column; }
.today-figures > div:first-child { border-inline-start: 0; }
.today-figures span { font-size: 0.8125rem; color: var(--text-2); }
.today-figures b { font-size: 1.5rem; font-weight: 700; line-height: 1.35; }
.today-figures b.live-count { color: var(--brand); }

.ribbon { padding: 18px 24px 22px; border-top: 1px solid var(--border); }
.ribbon-track { position: relative; height: 44px; margin-top: 30px; }
.ribbon-rail { position: absolute; inset: 18px 0; height: 8px; border-radius: 4px; background: var(--surface-3); }
.ribbon-shift { position: absolute; top: 14px; height: 16px; border-radius: 4px; background: repeating-linear-gradient(90deg, transparent 0 calc(11.11% - 1px), rgba(16, 34, 33, 0.08) calc(11.11% - 1px) 11.11%), #e6ecec; }
.ribbon-auto { position: absolute; top: 14px; height: 16px; background: var(--overtime-soft); border: 1px solid #d9c9f0; }
.ribbon-presence { position: absolute; top: 16px; height: 12px; border-radius: 6px; background: var(--brand); }
.ribbon-presence.ongoing::after { content: ""; position: absolute; left: -5px; top: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); transform: translateY(-50%); animation: pulse-brand 1.8s var(--ease-out) infinite; }
@keyframes pulse-brand { 0% { box-shadow: 0 0 0 0 rgba(11, 107, 100, 0.5); } 80% { box-shadow: 0 0 0 10px rgba(11, 107, 100, 0); } 100% { box-shadow: 0 0 0 0 rgba(11, 107, 100, 0); } }
.ribbon-ot { position: absolute; top: 12px; height: 20px; border-radius: 5px; border: 1.5px dashed var(--overtime); background: rgba(115, 64, 184, 0.08); }
.ribbon-ot.approved { border-style: solid; }
.ribbon-mark { position: absolute; top: -26px; transform: translateX(50%); display: flex; flex-direction: column; align-items: center; font-size: 0.75rem; font-weight: 600; color: var(--text); white-space: nowrap; }
.ribbon-mark::after { content: ""; width: 2px; height: 30px; background: var(--brand-ink); margin-top: 2px; border-radius: 1px; }
.ribbon-mark.fresh { animation: mark-in 900ms var(--ease-out); }
@keyframes mark-in { 0% { opacity: 0; transform: translateX(50%) translateY(-10px); } 60% { opacity: 1; } }
.ribbon-scale { position: relative; height: 18px; margin-top: 6px; }
.ribbon-scale span { position: absolute; transform: translateX(50%); font-size: 0.75rem; color: var(--text-3); }
.ribbon-now { position: absolute; top: 6px; bottom: 6px; width: 2px; background: var(--absent); border-radius: 1px; }
.ribbon-now::before { content: ""; position: absolute; top: -3px; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--absent); }
.ribbon-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: 0.8125rem; color: var(--text-2); }
.ribbon-legend i { display: inline-block; width: 14px; height: 8px; border-radius: 3px; margin-inline-end: 6px; vertical-align: middle; }

.req-row { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.req-row:last-child { border-bottom: 0; }
.req-row .ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.req-row .ico.leave { background: var(--leave-soft); color: var(--leave); }
.req-row .ico.overtime { background: var(--overtime-soft); color: var(--overtime); }
.req-row .ico.remote { background: var(--remote-soft); color: var(--remote); }
.req-row .body { flex: 1; min-width: 0; }
.req-row .body strong { font-size: 0.9375rem; font-weight: 600; display: block; }
.req-row .body span { font-size: 0.8125rem; color: var(--text-2); }
.req-row .note { margin-top: 6px; font-size: 0.8125rem; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); color: var(--text-2); }

.meter { height: 10px; background: var(--surface-3); border-radius: 5px; overflow: hidden; display: flex; }
.meter i { display: block; height: 100%; background: var(--leave); }
.meter i.warn { background: var(--late); }

/* ---------- month switcher ---------- */
.month-switch { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px; }
.month-switch .label { display: flex; flex-direction: column; align-items: center; min-width: 190px; padding: 0 8px; line-height: 1.3; }
.month-switch .label strong { font-size: 0.9375rem; }
.month-switch .label span { font-size: 0.75rem; color: var(--text-3); }
.month-switch .icon-btn { width: 36px; height: 36px; }

/* ---------- calendar (attendance month) ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-head { font-size: 0.8125rem; color: var(--text-2); font-weight: 600; text-align: center; padding-bottom: 2px; }
.cal-head.off { color: var(--holiday); }
.cal-day {
  position: relative; min-height: 118px; padding: 10px 10px 8px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); text-align: right; cursor: pointer; display: flex; flex-direction: column; gap: 4px;
  transition: border-color 150ms, box-shadow 150ms, transform 150ms;
}
.cal-day:hover { border-color: var(--border-strong); box-shadow: 0 4px 14px -6px rgba(16, 34, 33, 0.16); }
.cal-day.blank { visibility: hidden; }
.cal-day .d { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; }
.cal-day .d b { font-size: 1.125rem; font-weight: 700; line-height: 1; }
.cal-day .d span { font-size: 0.6875rem; color: var(--text-3); white-space: nowrap; }
.cal-day .times { font-size: 0.8125rem; color: var(--text); font-weight: 500; direction: ltr; text-align: right; }
.cal-day .worked { font-size: 0.75rem; color: var(--text-3); }
.cal-day .tag { margin-top: auto; font-size: 0.75rem; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.cal-day .tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.cal-day .extras { display: flex; gap: 4px; flex-wrap: wrap; }
.cal-day .extras em { font-style: normal; font-size: 0.6875rem; font-weight: 600; padding: 0 6px; border-radius: 6px; }
.cal-day .extras .ot { background: var(--overtime-soft); color: var(--overtime); }
.cal-day .extras .df { background: var(--absent-soft); color: var(--absent); }
.cal-day .extras .hl { background: var(--leave-soft); color: var(--leave); }
.cal-day .extras .pd { background: var(--late-soft); color: var(--late); }
.cal-day.weekend, .cal-day.holiday { background: var(--surface-2); }
.cal-day.weekend .d b, .cal-day.holiday .d b { color: var(--holiday); }
.cal-day.today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.cal-day.future { background: transparent; border-style: dashed; }
.cal-day.future .d b { color: var(--text-3); }
.cal-day.not_employed { opacity: 0.5; }
.tag.present { color: var(--present); } .tag.late { color: var(--late); } .tag.absent { color: var(--absent); }
.tag.leave { color: var(--leave); } .tag.holiday { color: var(--holiday); } .tag.weekend { color: var(--off); }
.tag.incomplete { color: var(--incomplete); } .tag.remote { color: var(--remote); } .tag.sick { color: var(--sick); } .tag.in_office { color: var(--brand); } .tag.not_yet, .tag.no_data, .tag.future, .tag.not_employed { color: var(--text-3); }
.cal-day.absent { background: #fffafa; border-color: #f3d0cc; }
.cal-day.remote { background: #f7fcfd; border-color: #bfe4ed; }
.cal-day.leave { background: #fafbff; border-color: #cdd4f6; }
.cal-day.leave.sick { background: #f7fbfe; border-color: #bcd9ee; }
.cal-day.incomplete { border-style: dashed; border-color: var(--border-strong); }
.cal-day .extras .rm { background: var(--remote-soft); color: var(--remote); }

/* ---------- presence board ---------- */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; padding: 16px; }
.tile { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-align: right; transition: border-color 150ms, background-color 400ms; width: 100%; }
.tile:hover { border-color: var(--border-strong); }
.tile .meta { flex: 1; min-width: 0; }
.tile .meta strong { display: block; font-size: 0.9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .meta span { font-size: 0.8125rem; color: var(--text-2); display: flex; gap: 6px; align-items: center; }
.tile .avatar { --size: 42px; }
.tile .avatar::after { content: ""; position: absolute; bottom: 1px; left: 1px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; background: var(--off); }
.tile.s-in_office .avatar::after { background: var(--present); }
.tile.s-present .avatar::after, .tile.s-late .avatar::after, .tile.s-incomplete .avatar::after { background: #9aa6a4; }
.tile.s-absent .avatar::after { background: var(--absent); }
.tile.s-leave .avatar::after { background: var(--leave); }
.tile.s-remote .avatar::after { background: var(--remote); }
.tile.flash { background: var(--brand-softer); border-color: var(--brand); }

.feed { max-height: 520px; overflow-y: auto; }
.feed-item { display: flex; gap: 12px; align-items: center; padding: 10px 20px; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: 0; }
.feed-item .t { margin-inline-start: auto; text-align: left; font-weight: 600; font-size: 0.875rem; }
.feed-item .t span { display: block; font-weight: 400; font-size: 0.75rem; color: var(--text-3); }
.feed-item.fresh { animation: feed-in 700ms var(--ease-out); background: var(--brand-softer); transition: background-color 2s; }
@keyframes feed-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- request inbox ---------- */
.inbox-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.inbox-item:last-child { border-bottom: 0; }
.inbox-item .what { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.inbox-item .when { font-weight: 600; }
.inbox-item .reason { margin-top: 8px; color: var(--text-2); font-size: 0.9rem; }
.inbox-item .context { margin-top: 10px; display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.8125rem; color: var(--text-2); padding: 8px 12px; background: var(--surface-2); border-radius: 8px; }
.inbox-item .context b { color: var(--text); font-weight: 600; }
.inbox-item .decide { display: flex; flex-direction: column; gap: 8px; align-items: stretch; min-width: 150px; }
.inbox-item .reject-box { grid-column: 1 / -1; display: flex; gap: 10px; align-items: flex-start; }
.inbox-item .reject-box .textarea { min-height: 44px; }
.inbox-item.done { animation: done-out 450ms var(--ease-out) forwards; }
@keyframes done-out { to { opacity: 0; transform: translateX(-24px); } }

/* ---------- attendance matrix ---------- */
.matrix-wrap { overflow: auto; max-height: calc(100vh - 250px); border-radius: 0 0 var(--radius) var(--radius); }
table.matrix { border-collapse: separate; border-spacing: 0; font-size: 0.75rem; }
.matrix th, .matrix td { border-bottom: 1px solid var(--border); border-inline-start: 1px solid var(--border); padding: 0; text-align: center; }
.matrix thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); font-weight: 600; min-width: 42px; padding: 6px 2px; line-height: 1.25; }
.matrix thead th.off { color: var(--holiday); background: #f8eff2; }
.matrix thead th small { display: block; font-weight: 400; color: var(--text-3); font-size: 0.6875rem; }
.matrix thead th.today-col { box-shadow: inset 0 -3px 0 var(--brand); }
.matrix .name { position: sticky; right: 0; z-index: 1; background: var(--surface); text-align: right; padding: 6px 14px; min-width: 200px; border-inline-start: 0; box-shadow: -1px 0 0 var(--border); }
.matrix thead .name { z-index: 3; background: var(--surface-2); }
.matrix .sum { padding: 6px 10px; white-space: nowrap; background: var(--surface-2); font-weight: 600; min-width: 64px; }
.mcell { width: 42px; height: 40px; border: 0; background: transparent; cursor: pointer; font: inherit; font-size: 0.6875rem; font-weight: 700; display: grid; place-items: center; }
.mcell:hover { outline: 2px solid var(--brand); outline-offset: -2px; }
.mcell.present { background: var(--present-soft); color: var(--present); }
.mcell.late { background: var(--late-soft); color: var(--late); }
.mcell.absent { background: var(--absent-soft); color: var(--absent); }
.mcell.leave { background: var(--leave-soft); color: var(--leave); }
.mcell.holiday, .mcell.weekend { background: #f6f3f4; color: #b9a3ab; }
.mcell.incomplete { background: var(--incomplete-soft); color: var(--incomplete); }
.mcell.remote { background: var(--remote-soft); color: var(--remote); }
.mcell.in_office { background: var(--brand-soft); color: var(--brand); }
.mcell.not_yet, .mcell.no_data, .mcell.future, .mcell.not_employed { color: var(--border-strong); }
.mcell .otdot { width: 5px; height: 5px; border-radius: 50%; background: var(--overtime); margin-top: 1px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.8125rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

/* ---------- payroll ---------- */
.pay-table td, .pay-table th { padding-inline: 10px; }
.pay-table td.money { direction: ltr; text-align: left; white-space: nowrap; }
.pay-table td.neg { color: var(--absent); }
.pay-table td.pos { color: var(--present); }
.pay-table td.net { font-weight: 700; font-size: 0.9375rem; }
.pay-table tr.expanded td { background: var(--brand-softer); }
.pay-detail td { background: var(--surface-2) !important; padding: 0 !important; }
.pay-breakdown { position: sticky; right: 0; max-width: calc(100vw - var(--sidebar-w) - 70px); display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; padding: 20px 24px; }
.calc-lines { display: flex; flex-direction: column; }
.calc-line { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px dashed var(--border-strong); font-size: 0.875rem; }
.calc-line:last-child { border-bottom: 0; }
.calc-line .how { color: var(--text-3); font-size: 0.75rem; display: block; }
.calc-line b { direction: ltr; white-space: nowrap; }
.calc-line.total { border-top: 1px solid var(--text); border-bottom: 0; margin-top: 4px; padding-top: 12px; font-size: 1rem; }
.warn-list { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- date picker ---------- */
.datefield { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; text-align: right; transition: border-color 150ms, box-shadow 150ms; }
.datefield:hover { border-color: #b3bfbd; }
.datefield[aria-expanded="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 107, 100, 0.16); }
.datefield .icon { color: var(--text-3); }
.datefield .v { display: flex; flex-direction: column; line-height: 1.3; }
.datefield .v b { font-weight: 600; font-size: 0.9375rem; }
.datefield .v span { font-size: 0.75rem; color: var(--text-3); }
.datefield .ph { color: #7f8d8b; }
.picker { width: 332px; padding: 14px; }
.picker-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.picker-head .ttl { flex: 1; text-align: center; line-height: 1.3; }
.picker-head .ttl strong { display: block; font-size: 0.9375rem; }
.picker-head .ttl span { font-size: 0.75rem; color: var(--text-3); }
.picker-head .icon-btn { width: 34px; height: 34px; }
.picker-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.picker-grid .wd { font-size: 0.6875rem; color: var(--text-3); text-align: center; padding: 4px 0; }
.picker-grid .wd.off { color: var(--holiday); }
.pday { height: 42px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; font-weight: 600; font-size: 0.875rem; }
.pday small { font-size: 0.625rem; font-weight: 400; color: var(--text-3); }
.pday:hover { background: var(--surface-3); }
.pday.off { color: var(--holiday); }
.pday.today { box-shadow: inset 0 0 0 1px var(--brand); }
.pday[aria-selected="true"] { background: var(--brand); color: #fff; }
.pday[aria-selected="true"] small { color: #cde9e4; }
.pday.in-range { background: var(--brand-soft); border-radius: 0; }
.pday:disabled { opacity: 0.3; cursor: not-allowed; }
.picker-foot { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }

/* mini timeline inside overtime form */
.mini-line { position: relative; height: 34px; margin: 22px 0 6px; }
.mini-line .rail { position: absolute; top: 14px; left: 0; right: 0; height: 6px; border-radius: 3px; background: var(--surface-3); }
.mini-line .shift { position: absolute; top: 12px; height: 10px; border-radius: 3px; background: #cfdad9; }
.mini-line .req { position: absolute; top: 9px; height: 16px; border-radius: 4px; background: var(--overtime); opacity: 0.85; transition: all 300ms var(--ease-out); }
.mini-line .tick { position: absolute; top: -18px; transform: translateX(50%); font-size: 0.6875rem; color: var(--text-3); }
.calc-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--overtime-soft); color: var(--overtime); font-weight: 600; font-size: 0.875rem; }
.calc-pill.leave { background: var(--leave-soft); color: var(--leave); }
.calc-pill.remote { background: var(--remote-soft); color: var(--remote); }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 20px; font-size: 0.9rem; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 500; }

.punch-list { display: flex; flex-direction: column; gap: 6px; }
.punch { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.punch b { font-size: 1rem; direction: ltr; }
.punch .src { font-size: 0.75rem; color: var(--text-3); }
.punch .btn { margin-inline-start: auto; }

.copy-box { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--brand-softer); border: 1px dashed var(--brand); }
.copy-box code { font-size: 1.25rem; font-weight: 700; letter-spacing: 0.08em; direction: ltr; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; color: var(--brand-ink); }
.copy-box .btn { margin-inline-start: auto; }

.dropzone { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 20px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); text-align: center; cursor: pointer; transition: border-color 150ms, background-color 150ms; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-softer); }
.dropzone .icon { width: 28px; height: 28px; color: var(--brand); }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 10px; }
.steps li { counter-increment: s; display: flex; gap: 12px; font-size: 0.9rem; }
.steps li::before { content: counter(s, persian); flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-size: 0.75rem; font-weight: 700; }
.steps code { direction: ltr; unicode-bidi: isolate; background: var(--surface-3); padding: 1px 6px; border-radius: 5px; font-size: 0.85em; }

.device-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.device-card:last-child { border-bottom: 0; }
.device-card .ico { width: 48px; height: 48px; border-radius: 12px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-2); }
.device-card .ico.online { background: var(--present-soft); color: var(--present); }
.device-card .facts { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.8125rem; color: var(--text-2); margin-top: 4px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 20px; overflow-x: auto; overflow-y: hidden; }
.tabs button { border: 0; background: none; padding: 12px 12px; font-weight: 600; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--brand-ink); border-bottom-color: var(--brand); }

.settings-section { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: 32px; padding: 26px 24px; border-bottom: 1px solid var(--border); }
.settings-section:last-child { border-bottom: 0; }
.settings-section > div:first-child p { color: var(--text-2); font-size: 0.875rem; margin-top: 4px; }

.search { position: relative; }
.search .icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search .input { padding-right: 40px; min-width: 240px; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.boot .brand-mark { animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(0.92); opacity: 0.7; } }

/* ---------- responsive ---------- */
@media (max-width: 1320px) {
  .grid.two { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1180px) {
  .ledger { --cols: 3 !important; }
  .ledger > :nth-child(3n + 1), .ledger button.cell:nth-child(3n + 1) { border-inline-start: 0; }
  .ledger > :nth-child(n + 4) { border-top: 1px solid var(--border); }
  .pay-breakdown { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: 0; right: 0; z-index: 70; width: 280px; transform: translateX(100%); transition: transform 280ms var(--ease-out); box-shadow: none; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-drawer); }
  .menu-btn { display: grid; }
  .topbar { padding: 0 16px; }
  .page { padding: 4px 16px 96px; }
  .pay-breakdown { max-width: calc(100vw - 36px); }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-side { padding: 28px 24px; min-height: auto; }
  .login-side h2 { font-size: 1.375rem; margin-top: 28px; }
  .login-clock { margin-top: 18px; }
  .login-clock b { font-size: 1.75rem; }
  .settings-section { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: rgba(255, 255, 255, 0.97); border-top: 1px solid var(--border); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); backdrop-filter: blur(8px); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: 0.6875rem; font-weight: 600; color: var(--text-3); text-decoration: none; border-radius: 10px; position: relative; }
  .bottom-nav a[aria-current="page"] { color: var(--brand); }
  .bottom-nav a .count { position: absolute; top: 2px; left: calc(50% - 20px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--absent); color: #fff; font-size: 0.625rem; display: grid; place-items: center; padding: 0 4px; }
  .toasts { left: 12px; right: 12px; bottom: 84px; }
  .toast { min-width: 0; max-width: none; }
  .clock .date-part { display: none; }
  .user-chip .who { display: none; }
}
@media (max-width: 720px) {
  h1, .page-head h1 { font-size: 1.3rem; }
  .ledger { --cols: 2 !important; }
  .ledger > *, .ledger button.cell { padding: 12px 14px; }
  .ledger > :nth-child(3n + 1), .ledger button.cell:nth-child(3n + 1) { border-inline-start: 1px solid var(--border); }
  .ledger > :nth-child(2n + 1), .ledger button.cell:nth-child(2n + 1) { border-inline-start: 0; }
  .ledger > :nth-child(n + 3) { border-top: 1px solid var(--border); }
  .ledger .value { font-size: 1.0625rem; }
  .form-grid, .grid.halves { grid-template-columns: minmax(0, 1fr); }
  .choices { --n: 1 !important; }
  .today-top { padding: 18px; }
  .today-top .avatar { --size: 56px; }
  .today-figures { width: 100%; }
  .today-figures > div { flex: 1; padding: 0 12px; }
  .today-figures > div:first-child { padding-inline-start: 0; }
  .today-figures b { font-size: 1.125rem; }
  .ribbon { padding: 14px 18px 18px; }
  .cal { gap: 4px; }
  .cal-day { min-height: 66px; padding: 6px; border-radius: 9px; gap: 2px; }
  .cal-day .d { flex-direction: column; align-items: flex-start; gap: 0; }
  .cal-day .d b { font-size: 0.9375rem; }
  .cal-day .times, .cal-day .worked, .cal-day .extras { display: none; }
  .cal-day .tag { font-size: 0; }
  .cal-day .tag::before { width: 8px; height: 8px; }
  .cal-day .d span { font-size: 0.5625rem; }
  .cal-head { font-size: 0.6875rem; }
  .inbox-item { grid-template-columns: minmax(0, 1fr); }
  .inbox-item .decide { flex-direction: row; }
  .inbox-item .decide .btn { flex: 1; }
  .drawer-body { padding: 18px; }
  .drawer-head, .drawer-foot { padding: 14px 18px; }
  .page-head { margin: 8px 0 16px; }
  .month-switch { width: 100%; justify-content: space-between; }
  [data-switch] { flex: 1 1 100%; }
  .hide-sm { display: none; }
  .month-switch .label { min-width: 0; }
  .search .input { min-width: 0; }
  .search { flex: 1; }
  .device-card { grid-template-columns: auto minmax(0, 1fr); }
  .device-card > .actions { grid-column: 1 / -1; }
  .picker { width: min(332px, calc(100vw - 24px)); }
  .req-row { flex-wrap: wrap; }
  .topbar-title { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}


/* ---------- year calendar ---------- */
.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 16px; }
.ym { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 12px 12px 10px; }
.ym h3 { font-size: 0.9375rem; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ym h3 span { font-size: 0.75rem; font-weight: 500; color: var(--text-3); }
.ym .wd-row, .ym .days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.ym .wd-row div { font-size: 0.6875rem; color: var(--text-3); text-align: center; padding-bottom: 4px; }
.ym .wd-row div.off { color: var(--holiday); }
.yd { position: relative; aspect-ratio: 1; border-radius: 7px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; font-size: 0.8125rem; font-weight: 600; border: 1px solid transparent; }
.yd small { font-size: 0.5625rem; font-weight: 400; color: var(--text-3); }
.yd.blank { visibility: hidden; }
.yd.weekend { color: var(--off); background: var(--surface-2); }
.yd.holiday { background: var(--holiday-soft); color: var(--holiday); border-color: #f0c6d6; }
.yd.today { outline: 2px solid var(--brand); outline-offset: -2px; }
.yd.s-present, .yd.s-late, .yd.s-in_office, .yd.s-incomplete { background: var(--present-soft); color: var(--present); }
.yd.s-late { background: var(--late-soft); color: var(--late); }
.yd.s-absent { background: var(--absent-soft); color: var(--absent); }
.yd.s-leave { background: var(--leave-soft); color: var(--leave); }
.yd.s-remote { background: var(--remote-soft); color: var(--remote); }
.yd.s-leave small, .yd.s-remote small, .yd.s-absent small, .yd.s-late small, .yd.s-present small { color: inherit; opacity: 0.75; }
.holiday-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.holiday-list div { display: flex; gap: 10px; align-items: baseline; padding: 10px 12px; border-radius: 10px; background: var(--holiday-soft); color: #7a1c41; }
.holiday-list b { white-space: nowrap; color: var(--holiday); }
@media (max-width: 720px) { .year-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); } }

/* ---- reports ---------------------------------------------------------- */
.report-period { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 2px 2px 0;
  font-size: 0.9375rem; color: var(--text); }
.report-period svg { color: var(--brand); }
.report-period .subtle { margin-inline-start: auto; }

/* ---- salary sheet ----------------------------------------------------------- */
.salary-table { font-size: 0.875rem; }
.salary-table th, .salary-table td { padding: 8px 10px; }
.salary-table th.c, .salary-table td.c { text-align: center; }
.salary-table thead tr.grp th { background: var(--brand-softer, #eef6f5); color: var(--text); border-bottom: 1px solid var(--border); }
.salary-table thead th small { font-weight: 500; color: var(--text-3); }
.salary-table td.n { direction: ltr; unicode-bidi: plaintext; white-space: nowrap; font-variant-numeric: tabular-nums; }
.salary-table td.neg { color: var(--absent); }
.salary-table td.pos { color: var(--overtime); }
.salary-table .strong { font-weight: 700; }
.salary-table td.pay { color: var(--brand-ink, var(--brand)); background: var(--brand-softer, #eef6f5); }
.salary-table .sticky { position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 2; min-width: 190px; box-shadow: -1px 0 0 var(--border) inset; }
.salary-table thead .sticky { background: var(--surface-2); z-index: 3; }
.salary-table tfoot .sticky { background: var(--surface-2); }
.salary-table .cell {
  width: 100%; min-width: 84px; font: inherit; color: var(--text); text-align: center;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  font-variant-numeric: tabular-nums; transition: border-color 120ms, box-shadow 120ms;
}
.salary-table .cell.wide { min-width: 120px; }
.salary-table .cell.note { min-width: 150px; text-align: right; }
.salary-table .cell.cur { min-width: 76px; padding-inline: 4px; }
.salary-table .cell:hover { border-color: var(--border-strong); }
.salary-table .cell:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.salary-table .cell[aria-invalid="true"] { border-color: var(--absent); box-shadow: 0 0 0 3px var(--absent-soft); }
.salary-table .cell[aria-busy="true"] { opacity: 0.6; }
.salary-table .cell::placeholder { color: var(--text-3); opacity: 1; }
.salary-table .hcell { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.salary-table .hcell .auto { font-size: 0.6875rem; color: var(--text-3); }
.salary-table .hcell.manual { flex-direction: row; }
.salary-table .hcell.manual .cell { border-color: var(--late); background: var(--late-soft); }
.salary-table .reset { all: unset; cursor: pointer; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: var(--text-3); }
.salary-table .reset:hover { background: var(--surface-3); color: var(--text); }
.salary-table .warn { color: var(--late); display: inline-flex; vertical-align: middle; cursor: help; }
.salary-table tbody tr.saved td { animation: saved-flash 900ms var(--ease-out, ease-out); }
@keyframes saved-flash { from { background: var(--present-soft); } }
@media (prefers-reduced-motion: reduce) { .salary-table tbody tr.saved td { animation: none; } }
