:root {
  --bg: #f5f7f8; --panel: #ffffff; --ink: #14212b; --muted: #5d6b76; --line: #dfe5e9;
  --accent: #0f766e; --accent-ink: #ffffff; --accent-soft: #e0f2f0;
  --ok: #15803d; --ok-soft: #dcf5e4; --warn: #a16207; --warn-soft: #fdf1cc;
  --bad: #b42318; --bad-soft: #fde4e1; --info: #1d5fa8; --info-soft: #e1edfb; --off-soft: #eceff1;
  --radius: 10px; --shadow: 0 1px 2px rgba(20,33,43,.06), 0 4px 14px rgba(20,33,43,.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1619; --panel: #172025; --ink: #e8eef1; --muted: #93a3ad; --line: #26343b;
    --accent: #2dd4bf; --accent-ink: #062a27; --accent-soft: #123532;
    --ok: #4ade80; --ok-soft: #123222; --warn: #facc15; --warn-soft: #3a3210;
    --bad: #f87171; --bad-soft: #3b1816; --info: #7db4f2; --info-soft: #14283f; --off-soft: #222d33;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif; line-height: 1.45; }
h1 { font-size: 1.45rem; margin: 0; } h2 { font-size: 1.1rem; margin: 0; } h3 { font-size: 1rem; margin: 0 0 .5rem; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); } .right { text-align: right; } .nowrap { white-space: nowrap; }

/* shell */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow: auto; display: flex; flex-direction: column; }
.brand { font-weight: 700; font-size: 1.1rem; padding: 4px 10px 14px; color: var(--accent); }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: .78rem; margin-top: 2px; }
.nav a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; margin-bottom: 2px; }
.nav a:hover { background: var(--off-soft); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side .who { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: .85rem; }
.main { padding: 22px 26px 60px; min-width: 0; max-width: 1400px; }
.topbar { display: none; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .sub { color: var(--muted); font-size: .9rem; margin-top: 2px; }

/* controls */
.btn { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 13px; cursor: pointer; min-height: 36px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.small { padding: 3px 9px; min-height: 28px; font-size: .85rem; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted); }
input, select, textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-height: 36px; max-width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 14px; }
.tfield { display: flex; flex-direction: column; gap: 3px; font-size: .8rem; color: var(--muted); }
.tfield input, .tfield select { color: var(--ink); }
.spacer { flex: 1; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; padding: 9px 14px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* cards and tables */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .n { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: .85rem; }
.stat.ok .n { color: var(--ok); } .stat.warn .n { color: var(--warn); } .stat.bad .n { color: var(--bad); }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: var(--bg); white-space: nowrap; position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--accent-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 36px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--off-soft); color: var(--muted); white-space: nowrap; }
.s-present, .s-active, .s-online, .s-approved, .s-done { background: var(--ok-soft); color: var(--ok); }
.s-half_day, .s-pending, .s-on_duty, .s-sent, .s-not_arrived, .s-scheduled { background: var(--info-soft); color: var(--info); }
.s-absent, .s-rejected, .s-failed, .s-offline, .s-suspended { background: var(--bad-soft); color: var(--bad); }
.s-incomplete, .s-never_seen, .s-trial { background: var(--warn-soft); color: var(--warn); }
.tag { display: inline-block; font-size: .72rem; padding: 1px 7px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); margin-left: 4px; }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.pager { display: flex; gap: 10px; align-items: center; margin-top: 12px; color: var(--muted); }

/* modal and forms */
.overlay { position: fixed; inset: 0; background: rgba(10,18,24,.5); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px; z-index: 50; overflow: auto; }
.modal { background: var(--panel); border-radius: 12px; width: min(520px, 100%); box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 16px 18px; max-height: 68vh; overflow: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: .82rem; color: var(--muted); }
.field.inline { flex-direction: row; align-items: center; gap: 8px; } .field.inline input { min-height: 0; }
.field small { color: var(--muted); font-size: .78rem; }
.req { color: var(--bad); }
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; gap: 5px; align-items: center; padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; color: var(--ink) !important; cursor: pointer; }
.chip input { min-height: 0; }
@media (max-width: 560px) { .form { grid-template-columns: 1fr; } }
#toasts { position: fixed; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 80; max-width: min(380px, calc(100vw - 28px)); }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast.error { background: var(--bad); color: #fff; } .toast.ok { background: var(--ok); color: #fff; }
.note { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }
.note.info { background: var(--info-soft); color: var(--info); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }

/* roster */
.roster td, .roster th { padding: 5px 6px; text-align: center; }
.roster td:first-child, .roster th:first-child { text-align: left; min-width: 170px; position: sticky; left: 0; background: var(--panel); z-index: 1; }
.cell { width: 100%; min-width: 86px; border: 1px dashed var(--line); border-radius: 6px; background: none; cursor: pointer; padding: 6px 4px; font-size: .82rem; color: var(--muted); }
.cell.set { border-style: solid; border-color: transparent; color: #fff; font-weight: 600; }
.cell.off { background: var(--off-soft); color: var(--muted); border-color: transparent; }
.cell:hover { outline: 2px solid var(--accent); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(380px, 100%); padding: 26px; }
.login h1 { color: var(--accent); margin-bottom: 4px; }
.login .field { margin-top: 14px; }
.login .btn { width: 100%; margin-top: 18px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; width: 250px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  .main { padding: 16px 14px 60px; }
}
@media (max-width: 640px) {
  table.stack thead { display: none; }
  table.stack td { display: flex; justify-content: space-between; gap: 12px; border-bottom: 0; padding: 4px 12px; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; }
  table.stack tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); }
}
@media print { .side, .topbar, .toolbar, .btn { display: none !important; } .shell { display: block; } .main { padding: 0; } }

/* payroll */
.pay-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.pay-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.pay-col h3 { margin: 0 0 6px; font-size: .95rem; }
.pay-table { width: 100%; border-collapse: collapse; }
.pay-table td { padding: 5px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.pay-total { display: flex; justify-content: space-between; padding-top: 8px; }
.pay-net { display: flex; justify-content: space-between; margin-top: 16px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft, rgba(15,118,110,.1)); font-size: 1.15rem; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.section-title { margin: 22px 0 8px; font-size: 1rem; }
@media (max-width: 640px) { .pay-cols { grid-template-columns: 1fr; } }
@media print {
  #root { display: none !important; }
  .overlay { position: static !important; background: none !important; display: block !important; padding: 0 !important; }
  .modal, .modal.wide { box-shadow: none !important; width: 100% !important; }
  .modal-actions, .modal-head .icon-btn, .no-print { display: none !important; }
  .modal-body { max-height: none !important; overflow: visible !important; }
}

/* my day / phone home */
.home { max-width: 640px; }
.home .hero { padding: 16px 18px; margin-bottom: 12px; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.quick .btn { text-decoration: none; }
.weeklist { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.weekrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.weekrow:last-child { border-bottom: 0; }

/* right-to-left (Urdu) */
[dir="rtl"] body { font-family: "Noto Naskh Arabic", "Segoe UI", "Urdu Typesetting", Tahoma, system-ui, sans-serif; line-height: 1.7; }
[dir="rtl"] th, [dir="rtl"] td { text-align: right; }
[dir="rtl"] td.num, [dir="rtl"] th.num, [dir="rtl"] .right { text-align: left; }
[dir="rtl"] .side { border-right: 0; border-left: 1px solid var(--line); }
[dir="rtl"] .tag { margin-left: 0; margin-right: 4px; }
[dir="rtl"] #toasts { right: auto; left: 14px; }
[dir="rtl"] .roster td:first-child, [dir="rtl"] .roster th:first-child { text-align: right; left: auto; right: 0; }
[dir="rtl"] input[type="number"], [dir="rtl"] input[type="date"], [dir="rtl"] input[type="time"] { direction: ltr; text-align: right; }
@media (max-width: 860px) { [dir="rtl"] .side { transform: translateX(100%); right: 0; left: auto; } [dir="rtl"] .side.open { transform: none; } }

/* notification bell */
.bell-wrap { position: relative; display: inline-block; }
.bell { position: relative; }
.bell-n { position: absolute; top: -6px; inset-inline-end: -6px; background: var(--bad, #c0392b); color: #fff; border-radius: 10px; font-size: .68rem; padding: 0 5px; line-height: 16px; min-width: 16px; text-align: center; }
.bell-panel { position: fixed; top: 110px; inset-inline-start: 12px; width: min(340px, 86vw); max-height: 70vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(0,0,0,.2); z-index: 90; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.bell-item { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.bell-item.unread { background: var(--ok-soft, rgba(13,148,136,.08)); }
.bell-item .small { font-size: .75rem; }
.topbar .bell-wrap { margin-inline-start: auto; }
.topbar .bell-panel { top: 52px; inset-inline-start: auto; inset-inline-end: 8px; }
.side-bell { padding: 0 6px 10px; }
@media (max-width: 860px) { .side-bell { display: none; } }

/* employee pictures */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--line); color: var(--muted); font-weight: 600; background-size: cover; background-position: center; flex: none; }

/* ===== visual refresh ===== */
:root {
  --bg: #f1f4f2; --ink: #10242a; --muted: #566a6e; --line: #dce3df;
  --accent: #0b7a6f; --accent-soft: #dcf0ec;
  --side-bg: #10242a; --side-ink: #d9e6e3; --side-muted: #8aa4a1; --side-hover: rgba(255,255,255,.07); --side-active: rgba(61,214,192,.14); --side-mark: #3dd6c0;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,36,42,.05);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #0c1417; --side-bg: #0a1114; --side-ink: #d9e6e3; } }
html { font-size: 15.5px; }
body { font-family: var(--font); letter-spacing: -.005em; }
h1 { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; }
h3 { font-weight: 650; }
.page-head { margin-bottom: 20px; }
.page-head .sub { font-size: .92rem; }

/* sidebar */
.side { background: var(--side-bg); border-right: 0; padding: 18px 12px 14px; }
.brand { color: #fff; font-size: 1.12rem; letter-spacing: -.01em; padding: 2px 10px 16px; }
.brand small { color: var(--side-muted); }
.nav a { display: flex; align-items: center; gap: 11px; color: var(--side-ink); padding: 9px 12px; border-radius: 9px; margin-bottom: 1px; position: relative; transition: background .12s; }
.nav a:hover { background: var(--side-hover); }
.nav a.active { background: var(--side-active); color: #fff; font-weight: 600; }
.nav a.active::before { content: ""; position: absolute; inset-inline-start: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--side-mark); }
.ico { display: inline-flex; flex: none; opacity: .85; } .nav a.active .ico { opacity: 1; color: var(--side-mark); }
.side .who { border-top-color: rgba(255,255,255,.12); color: var(--side-ink); }
.side .who .muted { color: var(--side-muted); }
.side .btn { background: transparent; color: var(--side-ink); border-color: rgba(255,255,255,.2); }
.side .btn:hover { border-color: var(--side-mark); }
.side .bell { color: var(--side-ink); }
.side-bell { padding: 0 6px 12px; }

/* controls */
.btn { border-radius: 9px; transition: border-color .12s, background .12s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn.primary { box-shadow: 0 1px 0 rgba(0,0,0,.12); }
.btn.primary:hover { filter: brightness(1.08); }
input, select, textarea { border-radius: 9px; }

/* cards, tables, badges */
.stat, .card, .table-wrap { border-color: var(--line); }
th { text-transform: none; letter-spacing: 0; font-size: .82rem; font-weight: 600; }
tbody tr { transition: background .1s; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.note { border-radius: 10px; display: flex; gap: 8px; align-items: center; }

/* Today board */
.board-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.board-tools input[type="search"] { min-width: 220px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg-btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 5px 13px 5px 6px; cursor: pointer; color: var(--ink); transition: border-color .12s, background .12s; }
.seg-btn:hover { border-color: var(--accent); }
.seg-n { min-width: 26px; height: 26px; border-radius: 999px; display: inline-grid; place-items: center; font-weight: 700; font-size: .85rem; background: var(--off-soft); font-variant-numeric: tabular-nums; }
.seg-btn.ok .seg-n { background: var(--ok-soft); color: var(--ok); } .seg-btn.bad .seg-n { background: var(--bad-soft); color: var(--bad); }
.seg-btn.warn .seg-n { background: var(--warn-soft); color: var(--warn); } .seg-btn.wait .seg-n { background: var(--info-soft); color: var(--info); }
.seg-btn.on { background: var(--ink); color: var(--bg); border-color: var(--ink); } .seg-btn.on .seg-n { background: rgba(255,255,255,.18); color: inherit; }
.tl { --tlw: 210px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tl-head { display: grid; grid-template-columns: var(--tlw) 1fr; border-bottom: 1px solid var(--line); background: var(--bg); }
.tl-axiswrap { position: relative; height: 30px; margin-inline-end: 18px; }
.tl-axis span { position: absolute; top: 7px; transform: translateX(-50%); font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-body { position: relative; max-height: 62vh; overflow: auto; }
.tl-row { display: grid; grid-template-columns: var(--tlw) 1fr; align-items: center; border-bottom: 1px solid var(--line); min-height: 46px; cursor: default; }
.tl-row:last-child { border-bottom: 0; } .tl-row:hover { background: var(--accent-soft); }
.tl-who { padding: 6px 12px; display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.tl-who strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; } .tl-who span { font-size: .78rem; }
.tl-track { position: relative; height: 46px; margin-inline-end: 18px; }
.tl-track i, .tl-track b { position: absolute; }
.tl-grid { top: 0; bottom: 0; width: 1px; background: var(--line); opacity: .6; }
.tl-plan { top: 14px; height: 18px; border-radius: 5px; background: var(--accent-soft); outline: 1px dashed color-mix(in srgb, var(--accent) 40%, transparent); }
.tl-late { top: 14px; height: 18px; background: repeating-linear-gradient(135deg, var(--warn-soft) 0 4px, transparent 4px 8px); border-radius: 5px 0 0 5px; }
.tl-bar { top: 17px; height: 12px; border-radius: 6px; min-width: 6px; }
.tl-bar.live::after { content: ""; position: absolute; inset-inline-end: -3px; top: -2px; width: 16px; height: 16px; border-radius: 50%; background: inherit; opacity: .35; animation: tl-pulse 1.8s ease-out infinite; }
@keyframes tl-pulse { from { transform: scale(.6); opacity: .5; } to { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tl-bar.live::after { animation: none; } }
.tl-q { top: 12px; width: 20px; height: 20px; margin-inline-start: -2px; border-radius: 50%; background: var(--warn); color: #fff; display: grid; place-items: center; font-size: .75rem; z-index: 2; }
.tl-nowwrap { position: absolute; top: 0; bottom: 0; inset-inline-start: var(--tlw); inset-inline-end: 18px; pointer-events: none; }
.tl-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); opacity: .7; }
@media (max-width: 640px) { .tl { --tlw: 118px; } .tl-who span { display: none; } .board-tools input[type="search"] { width: 100%; } }

/* phone: tab bar */
.tabbar { display: none; }
@media (max-width: 860px) {
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset-inline: 0; bottom: 0; z-index: 35; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; font-size: .7rem; color: var(--muted); text-decoration: none; }
  .tabbar a.active { color: var(--accent); font-weight: 600; }
  .main { padding-bottom: 84px; }
  .side { background: var(--side-bg); }
  #toasts { bottom: 78px; }
}

/* loading */
.skel { border-radius: 10px; background: linear-gradient(90deg, var(--off-soft) 25%, var(--line) 50%, var(--off-soft) 75%); background-size: 200% 100%; animation: skel 1.3s linear infinite; }
@keyframes skel { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }
.tl-note { position: absolute; top: 13px; margin-inline-start: 8px; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.tl-note.bad { color: var(--bad); font-weight: 600; }
.side .bell-wrap .bell { background: transparent; border-color: rgba(255,255,255,.2); }
.shell > div { min-width: 0; } .tl-body { overflow-x: hidden; overflow-y: auto; }

/* ===== modern shell (v3) ===== */
:root { --radius: 14px; --ring: color-mix(in srgb, var(--accent) 24%, transparent); --bar-bg: color-mix(in srgb, var(--bg) 82%, transparent); }
:root[data-theme="dark"] {
  --bg: #0c1417; --panel: #152024; --ink: #e6eef0; --muted: #93a6ab; --line: #24343a;
  --accent: #34d3be; --accent-ink: #062a27; --accent-soft: #12332f;
  --ok: #4ade80; --ok-soft: #123222; --warn: #facc15; --warn-soft: #3a3210; --bad: #f87171; --bad-soft: #3b1816; --info: #7db4f2; --info-soft: #14283f; --off-soft: #1e2b30;
  --side-bg: #0a1114; --shadow: none;
}
.shell { grid-template-columns: 244px minmax(0, 1fr); transition: grid-template-columns .2s ease; }
.shell.rail { grid-template-columns: 72px minmax(0, 1fr); }
.col { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }
.main { width: 100%; max-width: 1440px; margin: 0 auto; padding: 8px 28px 60px; }
.page-head h1 { font-size: 1.55rem; }

.bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; height: 62px; padding: 0 28px; background: var(--bar-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.bar-title { font-size: 1.02rem; font-weight: 650; letter-spacing: -.01em; margin: 0 14px 0 0; white-space: nowrap; }
.bar .spacer { flex: 1; }
.bar-btn, .bar .bell { width: 38px; height: 38px; min-height: 38px; padding: 0; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid transparent; background: transparent; color: var(--ink); cursor: pointer; position: relative; transition: background .12s; }
.bar-btn:hover, .bar .bell:hover { background: var(--off-soft); }
.bar .bell { font-size: 1.05rem; }
.menu-btn { display: none; }
.searchbtn { display: flex; align-items: center; gap: 10px; min-width: 300px; height: 38px; padding: 0 8px 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.searchbtn:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.searchbtn .st { flex: 1; text-align: start; }
kbd { font: inherit; font-size: .72rem; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); }
.umenu-wrap { position: relative; }
.bar-btn.user { width: 40px; height: 40px; }
.bar-btn.user .avatar { width: 34px; height: 34px; background: var(--accent); color: var(--accent-ink); font-size: .8rem; }
.umenu { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); width: 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.18); padding: 6px; z-index: 60; animation: pop .14s ease-out; }
.umenu-who { padding: 10px 12px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.umenu-item { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; text-align: start; padding: 9px 12px; border-radius: 8px; cursor: pointer; color: var(--ink); }
.umenu-item:hover { background: var(--off-soft); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }

/* sidebar, rail mode */
.side { padding: 16px 12px 12px; width: 244px; transition: width .2s ease; }
.shell.rail .side { width: 72px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 18px; }
.mark { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 11px; background: var(--side-mark); color: #0a2a27; font-weight: 800; }
.brand-t { line-height: 1.2; min-width: 0; } .brand-t small { display: block; }
.nav-t { white-space: nowrap; overflow: hidden; }
.shell.rail .brand-t, .shell.rail .nav-t { display: none; }
.shell.rail .brand { justify-content: center; padding-inline: 0; }
.shell.rail .nav a, .shell.rail .rail-btn { justify-content: center; padding-inline: 0; }
.rail-btn { margin-top: auto; display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; border: 0; background: none; color: var(--side-muted); cursor: pointer; }
.rail-btn:hover { background: var(--side-hover); color: var(--side-ink); }
.shell.rail .nav a.active::before { inset-inline-start: -12px; }

/* controls */
.btn { min-height: 38px; border-radius: 10px; font-weight: 550; }
.btn.small { min-height: 30px; }
input, select, textarea { min-height: 40px; border-radius: 10px; transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.btn:focus-visible, .nav a:focus-visible, .bar-btn:focus-visible, .searchbtn:focus-visible, tr.click:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tabs { border-bottom: 0; background: var(--off-soft); padding: 4px; border-radius: 12px; display: inline-flex; margin-bottom: 18px; gap: 2px; }
.tabs button { border: 0; border-radius: 9px; padding: 7px 14px; font-weight: 550; }
.tabs button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* surfaces */
.card, .stat, .table-wrap, .tl, .weeklist { border-radius: var(--radius); box-shadow: none; }
.table-wrap { background: var(--panel); }
th { padding: 11px 14px; background: color-mix(in srgb, var(--bg) 60%, var(--panel)); }
td { padding: 11px 14px; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th[aria-sort="ascending"]::after { content: " ↑"; color: var(--accent); } th[aria-sort="descending"]::after { content: " ↓"; color: var(--accent); }
tr.click { cursor: pointer; }
.avatar { background: var(--accent-soft); color: var(--accent); }
.avatar.big { width: 64px; height: 64px; font-size: 1.3rem; }
.empty { border-radius: var(--radius); padding: 44px 20px; }

/* dialogs and toasts */
.overlay { background: rgba(8,16,20,.5); backdrop-filter: blur(3px); }
.modal { border-radius: 16px; animation: pop .16s ease-out; }
.modal-head { border-bottom: 0; padding: 18px 22px 6px; } .modal-body { padding: 8px 22px 16px; } .modal-actions { border-top: 0; padding: 8px 22px 18px; }
.toast { border-radius: 12px; padding: 12px 16px; border-inline-start: 4px solid var(--accent); animation: pop .16s ease-out; }
.toast.error { border-inline-start-color: #fff; } .toast.ok { border-inline-start-color: #fff; }

/* side panel (person) */
.scrim { position: fixed; inset: 0; z-index: 70; background: rgba(8,16,20,.42); backdrop-filter: blur(2px); display: flex; justify-content: flex-end; animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drawer { width: min(440px, 100%); height: 100%; background: var(--panel); border-inline-start: 1px solid var(--line); overflow: auto; position: relative; animation: slide-in .2s ease-out; }
@keyframes slide-in { from { transform: translateX(32px); opacity: .4; } to { transform: none; opacity: 1; } }
[dir="rtl"] .drawer { animation-name: slide-in-rtl; } @keyframes slide-in-rtl { from { transform: translateX(-32px); opacity: .4; } to { transform: none; opacity: 1; } }
.dr-close { position: absolute; top: 12px; inset-inline-end: 14px; }
.dr-body { padding: 26px 24px 30px; }
.dr-head { display: flex; gap: 16px; align-items: center; margin-bottom: 8px; } .dr-head h2 { font-size: 1.25rem; letter-spacing: -.01em; }
.dr-h { margin: 24px 0 10px; font-size: .9rem; color: var(--muted); font-weight: 600; }
.strip { display: grid; grid-template-columns: repeat(15, 1fr); gap: 5px; }
.strip .dot { aspect-ratio: 1; border-radius: 5px; background: var(--off-soft); display: block; }
.strip .dot.s-present { background: var(--ok); } .strip .dot.s-half_day { background: var(--info); } .strip .dot.s-absent { background: var(--bad); }
.strip .dot.s-incomplete { background: var(--warn); } .strip .dot.s-on_duty { background: var(--accent); } .strip .dot.s-leave { background: #8b7cf0; }
.strip .dot.s-weekly_off, .strip .dot.s-holiday { background: var(--line); }
.dr-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.dr-stats div { background: var(--off-soft); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; } .dr-stats strong { font-size: 1.15rem; } .dr-stats span { font-size: .75rem; color: var(--muted); }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); } .kv span:last-child { text-align: end; }
.dr-actions { display: flex; gap: 8px; margin-top: 24px; flex-wrap: wrap; } .dr-actions .btn { text-decoration: none; }

/* search palette */
.scrim.top { align-items: flex-start; justify-content: center; padding-top: 12vh; }
.palette { width: min(640px, calc(100vw - 24px)); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.35); overflow: hidden; animation: pop .14s ease-out; align-self: flex-start; }
.pal-input { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.pal-input input { flex: 1; border: 0; box-shadow: none; background: transparent; font-size: 1.05rem; color: var(--ink); min-height: 34px; padding: 0; }
.pal-input input:focus { box-shadow: none; }
.pal-list { max-height: min(56vh, 460px); overflow: auto; padding: 6px; }
.pal-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.pal-item.on { background: var(--accent-soft); }
.pal-item > div { flex: 1; min-width: 0; } .pal-kind { margin-inline-start: auto; }
.pal-item .ico { color: var(--muted); } .small { font-size: .8rem; }

/* sign-in */
.login { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); padding: 0; place-items: stretch; }
.login-art { background: var(--side-bg); color: #fff; padding: 56px 52px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art h2 { font-size: 2.1rem; line-height: 1.12; letter-spacing: -.025em; max-width: 15ch; margin: 0 0 14px; }
.login-art p { color: var(--side-muted); max-width: 36ch; margin: 0; }
.login-bars { display: grid; gap: 12px; margin: 38px 0; opacity: .95; }
.login-bars i { display: block; height: 14px; border-radius: 7px; background: var(--side-mark); }
.login-bars i:nth-child(2n) { background: #7be0cf; } .login-bars i:nth-child(3n) { background: #f2b84b; }
.login-form { display: grid; place-items: center; padding: 28px; }
.login-form .card { width: min(380px, 100%); border: 0; box-shadow: none; background: transparent; padding: 0; }
.login-form h1 { color: var(--ink); font-size: 1.7rem; }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; } .login-art { display: none; }
  .shell, .shell.rail { grid-template-columns: minmax(0, 1fr); }
  .side, .shell.rail .side { width: 260px; }
  .shell.rail .brand-t, .shell.rail .nav-t { display: inline; } .shell.rail .nav a { justify-content: flex-start; padding-inline: 12px; }
  .rail-btn { display: none; }
  .bar { padding: 0 14px; height: 56px; } .menu-btn { display: inline-grid; }
  .searchbtn { min-width: 0; width: 38px; padding: 0; justify-content: center; } .searchbtn .st, .searchbtn kbd { display: none; }
  .bar-title { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; }
  .main { padding: 6px 14px 90px; }
  .topbar { display: none; }
}
@media (prefers-reduced-motion: reduce) { .modal, .toast, .umenu, .drawer, .palette, .scrim { animation: none; } .shell { transition: none; } }
input[type="checkbox"], input[type="radio"] { min-height: 0; width: 18px; height: 18px; padding: 0; accent-color: var(--accent); cursor: pointer; }
.tfield input[type="checkbox"] { margin: 8px 0; }

/* ===== v22: shared widgets and screen layouts ===== */
.avatar.tint { background: hsl(var(--hue, 200) 70% 90%); color: hsl(var(--hue, 200) 55% 30%); }
:root[data-theme="dark"] .avatar.tint { background: hsl(var(--hue, 200) 35% 24%); color: hsl(var(--hue, 200) 80% 80%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar.tint { background: hsl(var(--hue, 200) 35% 24%); color: hsl(var(--hue, 200) 80% 80%); } }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .pn { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.person .pn strong, .person .pn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-size: .82rem; font-weight: 600; cursor: default; }
button.chip { cursor: pointer; transition: transform .12s, background .12s; }
button.chip:hover { transform: translateY(-1px); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.ok { color: var(--ok); } .chip.warn { color: var(--warn); } .chip.bad { color: var(--bad); } .chip.info { color: var(--info); }
.chip.on.ok, .chip.on.warn, .chip.on.bad, .chip.on.info { color: var(--accent-ink); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0 0 16px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.kpi .kl { color: var(--muted); font-size: .8rem; } .kpi strong { font-size: 1.5rem; line-height: 1.2; } .kpi .ks { color: var(--muted); font-size: .78rem; }
.kpi.ok strong { color: var(--ok); } .kpi.warn strong { color: var(--warn); } .kpi.bad strong { color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--bad); }
.okc { color: var(--ok); font-weight: 600; } b.bad { color: var(--bad); }
.small { font-size: .8rem; } .nowrap { white-space: nowrap; }
.sec { margin: 18px 0 10px; font-size: .95rem; color: var(--muted); font-weight: 600; }

/* request cards */
.rgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.rcard { display: flex; flex-direction: column; gap: 8px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); transition: box-shadow .15s, transform .15s; }
.rcard:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.rc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rc-title { font-size: 1rem; } .rc-meta { color: var(--muted); font-size: .85rem; }
.rcard blockquote { margin: 0; padding: 8px 12px; border-inline-start: 3px solid var(--line); color: var(--muted); font-size: .88rem; }
.rc-actions { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.pair { display: inline-flex; gap: 6px; align-items: baseline; margin-inline-start: 10px; font-variant-numeric: tabular-nums; }
.pair i { font-style: normal; color: var(--muted); font-size: .75rem; }

/* devices */
.dgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.dcard { padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; gap: 12px; }
.dc-top { display: flex; align-items: center; gap: 12px; } .dc-name { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.dc-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .dc-facts div { display: flex; flex-direction: column; font-size: .85rem; } .dc-facts span { color: var(--muted); font-size: .75rem; } .dc-facts b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.dc-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pulse { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--muted); }
.pulse.on { background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 2s infinite; }
.pulse.warn { background: var(--warn); } .pulse.bad { background: var(--bad); }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .pulse.on { animation: none; } }

/* payslips (employee) */
.hero-pay { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 22px; border-radius: var(--radius); background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #000)); color: var(--accent-ink); }
.hero-pay > div { display: flex; flex-direction: column; gap: 4px; } .hero-pay .muted { color: inherit; opacity: .8; } .hero-pay strong { font-size: 2rem; }
.hero-pay .btn { background: #fff; color: #111; border-color: #fff; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.pcard { display: flex; flex-direction: column; gap: 4px; text-align: start; padding: 14px; font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; transition: transform .12s, box-shadow .12s; }
.pcard:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.08); } .pcard strong { font-size: 1.25rem; }

/* audit */
.aitem { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.adot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--info); } .adot.ok { background: var(--ok); } .adot.bad { background: var(--bad); }
.ab { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* payroll */
.stepper { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 16px; flex-wrap: wrap; }
.stepper li { flex: 1; min-width: 150px; display: flex; gap: 10px; align-items: center; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--muted); }
.stepper li div { display: flex; flex-direction: column; line-height: 1.25; } .stepper li span:not(.sn) { font-size: .75rem; }
.stepper .sn { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--line); font-weight: 700; font-size: .8rem; flex: none; }
.stepper .done .sn { background: var(--ok); color: #fff; } .stepper .now { border-color: var(--accent); color: var(--text); } .stepper .now .sn { background: var(--accent); color: var(--accent-ink); }
.costbar { margin: 0 0 16px; } .costbar .cbar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--line); gap: 2px; }
.seg.a, .sw.a { background: var(--ok); } .seg.b, .sw.b { background: var(--warn); } .seg.c, .sw.c { background: var(--info); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: .8rem; color: var(--muted); } .legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.rungrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.runcard { text-align: start; font: inherit; color: var(--text); padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; display: flex; flex-direction: column; gap: 12px; transition: transform .12s, box-shadow .12s; }
.runcard:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.rc-h { display: flex; justify-content: space-between; gap: 8px; align-items: center; } .rc-net { display: flex; flex-direction: column; } .rc-net strong { font-size: 1.6rem; }
.rc-f { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }

/* attendance calendar */
.cal-bar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.cal-nav { display: flex; align-items: center; gap: 10px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.ch { text-align: center; font-size: .75rem; color: var(--muted); padding: 4px 0; }
.cd { display: flex; flex-direction: column; gap: 2px; min-height: 76px; padding: 6px 8px; font: inherit; text-align: start; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; overflow: hidden; }
.cd.blank { visibility: hidden; border: 0; } .cd:disabled { cursor: default; } .cd:not(:disabled):hover { border-color: var(--accent); }
.cd.today { outline: 2px solid var(--accent); } .cd b { font-size: .85rem; } .cd .ct { font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; } .cd .late { font-size: .66rem; color: var(--warn); font-style: normal; }
.cd.c-present, .sw.c-present { background: var(--ok-soft); } .cd.c-half_day, .sw.c-half_day { background: var(--info-soft); } .cd.c-absent, .sw.c-absent { background: var(--bad-soft); }
.cd.c-incomplete, .sw.c-incomplete { background: var(--warn-soft); } .cd.c-leave, .sw.c-leave { background: color-mix(in srgb, #8b7cf0 18%, var(--panel)); }
.cd.c-weekly_off, .cd.c-holiday, .cd.c-future, .sw.c-weekly_off { background: var(--off-soft); } .cd.c-future { opacity: .55; }
.cd.c-absent b { color: var(--bad); }
@media (max-width: 640px) { .cd { min-height: 56px; padding: 4px; } .cd .ct { display: none; } .rgrid, .dgrid { grid-template-columns: 1fr; } }
