:root {
  /* Clearway HR brand: near-black with a lime accent. --lime is for dark backgrounds only;
     --bronze (deep green) is the accent that is readable on white. Old token names are kept. */
  --lime: #c6f432;
  --navy: #111111;
  --navy-2: #1f1f1f;
  --teal: #4d7c0f;
  --bronze: #4d7c0f;
  --bronze-dark: #3f6212;
  --bronze-soft: #f2f9dc;
  --bg: #f6f5f3;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --border: #e3e5e8;
  --text: #20242b;
  --muted: #626b78;
  --primary: #111111;
  --primary-hover: #2e2e2e;
  --danger: #c2410c;
  --danger-bg: #fff1eb;
  --ok: #047857;
  --ok-bg: #e7f7f0;
  --warn: #92400e;
  --warn-bg: #fef6e4;
  --info-bg: #f2f9dc;
  --weekend: #eef1f5;
  --holiday: #fdf0d5;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .025);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); }
h1 { font-size: clamp(1.6rem, 2.2vw, 2.1rem); margin: 0; letter-spacing: -.035em; line-height: 1.2; font-weight: 650; }
h2 { font-size: 1.02rem; margin: 0 0 12px; }
h3 { font-size: .95rem; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--navy); color: #f7f7f7; padding: 24px 14px 14px; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: block; padding: 0 12px; color: #fff; text-decoration: none; }
.brand-wordmark { display: block; font-size: 26px; font-weight: 400; letter-spacing: .17em; line-height: 1.2; }
.brand-tagline { display: block; text-transform: uppercase; font-size: 9px; letter-spacing: .21em; color: #b7b9bb; margin-top: 7px; }
.brand-logo { display: block; width: 100%; height: auto; }
.brand-sub { display: block; font-size: .95rem; font-weight: 600; color: #f3f3f3; padding: 20px 0 14px; border-top: 1px solid #ffffff20; margin-top: 20px; margin-bottom: 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 7px; color: #e0e2e4; text-decoration: none; margin-bottom: 5px; transition: background .15s, color .15s; }
.nav a:hover { background: #ffffff0d; color: #fff; }
.nav a.active { background: var(--lime); color: #111; font-weight: 600; }
.nav a.active svg { color: #111; }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .count { margin-left: auto; background: var(--lime); color: #111; border-radius: 999px; font-size: .72rem; padding: 1px 7px; font-weight: 700; }
.nav-label { font-size: .64rem; text-transform: uppercase; letter-spacing: .1em; color: #adb1b5; padding: 22px 12px 10px; margin-top: 14px; border-top: 1px solid #ffffff18; }
.side-account { display: flex; gap: 10px; align-items: center; padding: 18px 5px 4px; margin-top: auto; border-top: 1px solid #ffffff20; color: #f6f6f6; text-decoration: none; }
.side-account > div:nth-child(2) { flex: 1; min-width: 0; }
.side-account strong { display: block; font-size: .86rem; overflow-wrap: anywhere; font-weight: 500; }
.side-account span { display: block; font-size: .77rem; color: #b9bfc4; text-transform: capitalize; }
.side-account .avatar { background: var(--lime); color: #111; width: 38px; height: 38px; }
.nav { padding-bottom: 24px; }
.nav-scrim { display: none; }
.breadcrumb { display: flex; align-items: center; gap: 14px; font-size: .85rem; color: var(--muted); }
.breadcrumb strong { font-weight: 500; color: var(--text); }
.workspace-year { border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; font-variant-numeric: tabular-nums; font-size: .85rem; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 28px; min-height: 64px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.top .spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip strong { display: block; font-size: .9rem; }
.user-chip span { font-size: .78rem; color: var(--muted); text-transform: capitalize; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--info-bg); color: var(--navy); display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: none; }
.view { padding: 30px 28px 60px; max-width: 1680px; width: 100%; margin: 0 auto; }

.icon-btn { background: none; border: 1px solid transparent; border-radius: 8px; width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer; color: var(--text); position: relative; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .66rem; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.text-btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; }
.text-btn:hover { background: var(--surface-2); border-color: var(--bronze); }
.text-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }

/* ---------- Common ---------- */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); min-width: 0; }
.panel + .panel { margin-top: 18px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid2 .panel + .panel { margin-top: 0; }
.stack > * + * { margin-top: 18px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 7px; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn svg { width: 18px; height: 18px; flex: none; }
:focus-visible { outline: 3px solid #b58960; outline-offset: 3px; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--danger); border-color: #f3c7b3; }
.btn.danger:hover { background: var(--danger-bg); }
.btn.ghost { border-color: transparent; }
.btn.sm { padding: 5px 10px; font-size: .84rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.badge.pending { background: var(--warn-bg); color: var(--warn); }
.badge.approved { background: var(--ok-bg); color: var(--ok); }
.badge.rejected { background: var(--danger-bg); color: var(--danger); }
.badge.cancelled { background: #f1f5f9; color: var(--muted); }
.badge.cancel_requested { background: #f3e8ff; color: #6b21a8; }
.badge.neutral { background: #f1f5f9; color: #334155; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }

.alert { border-radius: 8px; padding: 10px 12px; margin: 10px 0; font-size: .9rem; }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.error { background: var(--danger-bg); color: var(--danger); }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.info { background: var(--info-bg); color: var(--navy); }
.alert ul { margin: 0; padding-left: 18px; }

.empty { text-align: center; color: var(--muted); padding: 28px 10px; }
.loading { color: var(--muted); padding: 30px 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: .74rem; color: var(--muted); font-weight: 600; padding: 11px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
table.data td { padding: 14px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data tbody tr:hover { background: #fafafa; }
table.data tr:last-child td { border-bottom: none; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.inactive td { color: var(--muted); }
table.data .link { background: none; border: none; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; padding: 0; text-align: left; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 5px; }
.field > span, .field > label > span { font-weight: 600; font-size: .86rem; }
.field small { color: var(--muted); font-size: .8rem; }
input, select, textarea { font: inherit; color: inherit; border: 1px solid #cbd5e1; border-radius: 8px; padding: 8px 10px; background: #fff; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #d9f08a; outline-offset: 0; border-color: var(--primary); }
table.cal td.we.leave, table.cal td.we.am, table.cal td.we.pm { background: var(--weekend); }
input[type=color] { padding: 2px; height: 38px; width: 70px; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--primary); }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input[type=checkbox] { width: 22px; height: 22px; min-width: 22px; margin: 0; flex-shrink: 0; cursor: pointer; }
.check span { padding-top: 1px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.segmented { display: inline-flex; border: 1px solid #cbd5e1; border-radius: 8px; overflow: hidden; }
.segmented label { padding: 7px 14px; cursor: pointer; border-right: 1px solid #cbd5e1; font-size: .9rem; }
.segmented label:last-child { border-right: none; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented label:focus-within { outline: 2px solid var(--primary); outline-offset: -3px; }
.segmented label:has(input:checked) { background: var(--primary); color: #fff; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar select, .toolbar input { width: auto; }
.toolbar .grow { flex: 1; }

/* ---------- Dashboard ---------- */
.cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; margin: 2px 0; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: .78rem; color: var(--muted); }
.stat.accent { background: var(--navy); border-color: var(--navy); color: #fff; }
.stat.accent .label, .stat.accent .hint { color: #d9c3ab; }
.stat.accent { border-bottom: 4px solid var(--lime); }
button.stat { font: inherit; color: inherit; text-align: left; width: 100%; cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; }
button.stat:hover { transform: translateY(-2px); border-color: var(--bronze); box-shadow: 0 6px 18px rgba(43, 43, 43, .12); }
button.stat:focus-visible { outline: 3px solid var(--bronze); outline-offset: 2px; }
.list li.clickable { cursor: pointer; border-radius: 8px; }
.list li.clickable:hover, .list li.clickable:focus-visible { background: var(--bronze-soft); outline: none; }
dl.breakdown { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; margin: 0 0 12px; }
dl.breakdown dt { color: var(--muted); }
dl.breakdown dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.meter { height: 10px; background: #e8edf3; border-radius: 999px; overflow: hidden; display: flex; }
.meter span { display: block; height: 100%; }
.meter-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: 8px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: none; }
.list .primary { font-weight: 600; }
.banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--info-bg); border: 1px solid #e6d3bf; color: var(--text); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; flex-wrap: wrap; }

/* ---------- Request form ---------- */
.grid-request { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-request .panel + .panel { margin-top: 0; }
.summary .big { font-size: 2.4rem; font-weight: 700; letter-spacing: -.02em; }
.summary dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 14px 0 0; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Approvals ---------- */
.approval { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; }
.approval .who { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.approval .facts { display: flex; gap: 18px; flex-wrap: wrap; margin: 8px 0; font-size: .9rem; }
.approval .facts b { display: block; font-size: .74rem; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.approval textarea { min-height: 70px; }

/* ---------- Calendar ---------- */
.cal-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
table.cal { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .8rem; }
table.cal th, table.cal td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: center; min-width: 28px; height: 32px; padding: 0; }
table.cal th { background: var(--surface-2); font-weight: 600; position: sticky; top: 0; }
table.cal th .dow { display: block; font-size: .66rem; color: var(--muted); font-weight: 500; }
table.cal .name { position: sticky; left: 0; background: var(--surface); text-align: left; padding: 0 12px; min-width: 170px; white-space: nowrap; z-index: 2; font-weight: 600; }
table.cal th.name { z-index: 3; background: var(--surface-2); }
table.cal tr.dept td { background: var(--surface-2); text-align: left; padding: 6px 12px; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
table.cal tr.dept td.name { background: var(--surface-2); }
table.cal .we { background: var(--weekend); }
table.cal .hol { background: var(--holiday); }
table.cal .today { box-shadow: inset 0 0 0 2px var(--primary); }
table.cal td.leave { background: var(--c); }
table.cal td.am { background: linear-gradient(90deg, var(--c) 50%, transparent 50%); }
table.cal td.pm { background: linear-gradient(90deg, transparent 50%, var(--c) 50%); }
table.cal td.pending { opacity: .5; background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.55) 0 3px, transparent 3px 7px); }
table.cal tr.totals td { font-weight: 700; color: var(--muted); background: var(--surface-2); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: 12px; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; border: 1px solid rgba(0,0,0,.06); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--primary); border-color: var(--primary); }

/* ---------- Modal, toast, notifications ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; padding: 16px; z-index: 100; }
.modal { background: var(--surface); border-radius: 12px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal.wide { width: min(860px, 100%); }
.doc-view { max-height: 65vh; overflow: auto; }
.doc-view .docx-wrapper { padding: 12px; }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal header h2 { margin: 0; }
.modal .body { padding: 18px 20px; }
.modal footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 12px 12px; }
.email-preview { width: 100%; height: 520px; border: 1px solid var(--border); border-radius: 8px; background: #f6f4f1; }
.welcome-tips { counter-reset: tip; list-style: none; margin: 8px 0 14px; padding: 0; }
.welcome-tips li { counter-increment: tip; display: grid; grid-template-columns: 30px 1fr; column-gap: 10px; margin-bottom: 12px; line-height: 1.5; }
.welcome-tips li::before { content: counter(tip); grid-row: span 2; width: 26px; height: 26px; border-radius: 50%; background: var(--bronze); color: #fff; font-weight: 700; font-size: .85rem; display: grid; place-items: center; }
.welcome-tips li span { color: var(--muted); }
.qr { display: block; width: 220px; height: 220px; margin: 8px auto 14px; background: #fff; padding: 8px; border: 1px solid var(--border); border-radius: 8px; }
.steps { margin: 0 0 12px; padding-left: 20px; line-height: 1.55; }
.steps li { margin-bottom: 6px; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.codes code { font-family: Consolas, monospace; font-size: 1.05rem; background: var(--surface-2); border: 1px dashed #94a3b8; padding: 8px 10px; border-radius: 8px; text-align: center; user-select: all; }
code.secret { display: inline-block; font-size: 1rem; padding: 4px 8px; word-break: break-all; }
.secret { font-family: Consolas, monospace; font-size: 1.15rem; background: var(--surface-2); border: 1px dashed #94a3b8; padding: 10px 14px; border-radius: 8px; user-select: all; }

#toasts { position: fixed; bottom: 18px; right: 18px; display: grid; gap: 8px; z-index: 200; }
.toast { background: var(--text); color: #fff; padding: 11px 16px; border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,.2); max-width: 380px; animation: pop .2s ease-out; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

.notif-panel { position: absolute; right: 0; top: 46px; width: 360px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 16px 40px rgba(0,0,0,.15); z-index: 50; max-height: 70vh; overflow: auto; }
.notif-panel header { padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 700; }
.notif-panel a { display: block; padding: 11px 16px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); font-size: .88rem; }
.notif-panel a.unread { background: var(--info-bg); }
.notif-panel a small { display: block; color: var(--muted); margin-top: 2px; }
.notif-wrap { position: relative; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login .hero { background: var(--navy); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; border-right: 6px solid var(--lime); }
.login .hero h1 { font-size: 2.3rem; line-height: 1.15; max-width: 420px; }
.login .hero h1 em { font-style: normal; color: var(--lime); }
.login .hero p { color: #c9cbc4; max-width: 420px; }
.login .hero ul { padding-left: 18px; color: #e6e8e1; }
.login .hero li::marker { color: var(--lime); }
.login .hero .eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--lime); }
.login-logo { display: block; width: min(260px, 100%); height: auto; margin-bottom: 14px; }
.login .form-side { display: grid; place-items: center; padding: 32px 16px; }
.login form { width: min(380px, 100%); }

/* ---------- Responsive ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.dashboard-summary { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.dashboard-summary .panel + .panel, .dashboard-team .panel + .panel { margin-top: 0; }
.dashboard-summary h2, .dashboard-team h2, .recent-panel h2 { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.dashboard-summary h2 svg, .dashboard-team h2 svg, .recent-panel h2 svg { width: 20px; height: 20px; flex: none; stroke-width: 1.7; }
.balance-panel h2 svg, .action-panel h2 svg { color: var(--primary); }
.balance-value { display: block; border: 0; padding: 0; background: none; color: var(--text); font: inherit; font-size: 2.6rem; line-height: 1.15; font-weight: 650; letter-spacing: -.045em; cursor: pointer; border-radius: 4px; }
.balance-value:hover, .next-date:hover { color: var(--primary); }
.balance-caption { margin: 5px 0 20px; font-size: .85rem; }
.balance-panel .meter { height: 14px; background: #c6dcc8; margin-bottom: 12px; }
.balance-panel .meter span + span { border-left: 1px solid #ffffffb3; }
.balance-breakdown { display: flex; gap: 5px 12px; flex-wrap: wrap; margin-bottom: 10px; }
.balance-breakdown button { display: inline-flex; align-items: center; gap: 5px; border: 0; border-radius: 4px; background: none; padding: 3px 0; font: inherit; font-size: .75rem; cursor: pointer; color: var(--muted); }
.balance-breakdown button:hover { color: var(--primary); text-decoration: underline; }
.balance-breakdown strong { color: var(--text); font-weight: 600; }
.balance-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--bronze-dark); }
.balance-dot.booked { background: #a8c66c; }
.balance-dot.pending { background: #eddaac; }
.balance-dot.total { background: #aab2ba; }
.next-date { display: block; border: none; background: none; padding: 3px 0 0; text-align: left; font: inherit; font-size: 1.16rem; font-weight: 650; letter-spacing: -.02em; color: var(--text); cursor: pointer; }
.next-leave p { margin: 6px 0; }
.next-leave .badge { margin-top: 14px; }
.action-link { display: flex; align-items: center; gap: 12px; padding: 14px 0; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border); }
.action-link:last-child { border-bottom: 0; padding-bottom: 0; }
.action-link:hover strong { color: var(--primary); }
.action-link > svg { width: 21px; height: 21px; flex: none; stroke-width: 1.5; }
.action-link > span:nth-child(2) { flex: 1; }
.action-link strong { font-size: .85rem; font-weight: 600; }
.action-link small { display: block; margin-top: 3px; font-size: .75rem; color: var(--muted); }
.all-clear { display: flex; flex-direction: column; gap: 8px; align-items: center; padding: 23px 0; }
.all-clear svg { width: 28px; height: 28px; color: var(--ok); }
.dashboard-team { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 18px; margin-bottom: 18px; }
.section-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-heading h2 { margin-bottom: 0; }
.section-heading p { margin: 4px 0 0; }
.section-heading a { white-space: nowrap; }
.panel-link { display: inline-block; font-weight: 600; font-size: .85rem; margin-top: 18px; text-underline-offset: 4px; }
.week-scroll { overflow-x: auto; position: relative; }
.week-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.week-table td, .week-table th { padding: 9px 5px; border-bottom: 1px solid var(--border); text-align: center; }
.week-table thead th { font-weight: 500; color: var(--muted); min-width: 60px; }
.week-table thead th span { display: block; font-size: .73rem; margin-top: 3px; }
.week-table thead .is-today { background: var(--bronze-soft); color: var(--text); border-radius: 5px 5px 0 0; font-weight: 600; }
.week-table tbody th { text-align: left; font-weight: 500; min-width: 150px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.week-person { display: flex; align-items: center; gap: 9px; }
.week-person .avatar { width: 29px; height: 29px; background: #eef0f2; font-size: .65rem; }
.week-block { display: block; position: relative; height: 24px; border-radius: 3px; background: #c6dcc8; }
.week-block.nonworking { background: var(--weekend); }
.week-block.away { background: var(--absence-color, var(--bronze)); }
.week-block.half-am { background: linear-gradient(90deg, var(--absence-color, var(--bronze)) 50%, #c6dcc8 50%); }
.week-block.half-pm { background: linear-gradient(90deg, #c6dcc8 50%, var(--absence-color, var(--bronze)) 50%); }
.week-block.pending { background-image: repeating-linear-gradient(45deg, #ffffff90 0 3px, transparent 3px 7px); }
.week-block.pending.half-am { background-image: repeating-linear-gradient(45deg, #ffffff90 0 3px, transparent 3px 7px), linear-gradient(90deg, var(--absence-color, var(--bronze)) 50%, #c6dcc8 50%); }
.week-block.pending.half-pm { background-image: repeating-linear-gradient(45deg, #ffffff90 0 3px, transparent 3px 7px), linear-gradient(90deg, #c6dcc8 50%, var(--absence-color, var(--bronze)) 50%); }
.recent-panel { margin-bottom: 18px; }
.recent-panel .table-wrap { position: relative; }
.recent-panel table.data { min-width: 600px; }
.recent-panel table.data td { vertical-align: middle; }
.top .user-chip { display: none; }
/* Inside the phone app: keep clear of the notch and the home bar */
html.native .top { padding-top: calc(10px + env(safe-area-inset-top)); }
html.native .side { padding-top: env(safe-area-inset-top); }
html.native .form-side { padding-top: calc(24px + env(safe-area-inset-top)); }
.bio-btn { width: 100%; }

/* Legal links and the Your data tab */
.legal-links a { color: inherit; }
.landing-foot .legal-links { flex: 1; text-align: center; }
.danger-zone { border-color: #f3c7b3; }
.danger-zone h2 { color: var(--danger); }

/* Plan banner above every page, and the Billing page */
.plan-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 28px; font-size: .92rem; border-bottom: 1px solid var(--border); }
.plan-banner.warn { background: var(--warn-bg); color: var(--warn); }
.plan-banner.danger { background: var(--danger-bg); color: var(--danger); }
.billing-panel h2 { display: flex; align-items: center; gap: 8px; }
.billing-panel h2 svg { width: 20px; height: 20px; flex: none; stroke-width: 1.7; color: var(--primary); }
.plan-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 24px; margin: 6px 0 16px; }
.plan-facts dt { font-size: .8rem; color: var(--muted); font-weight: 600; }
.plan-facts dd { margin: 2px 0 0; font-weight: 600; }
.plan-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin: 4px 0 16px; }
.plan-card { position: relative; display: grid; gap: 4px; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; background: var(--surface); }
.plan-card.on { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.plan-card input { position: absolute; opacity: 0; pointer-events: none; }
.plan-card:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.plan-card strong { display: flex; align-items: center; gap: 8px; }
.plan-price { font-size: 1.35rem; font-weight: 700; }
.plan-price small { font-size: .8rem; font-weight: 500; color: var(--muted); }
.badge.plan-trial, .badge.plan-past_due { background: var(--warn-bg); color: var(--warn); }
.badge.plan-active, .badge.plan-free { background: var(--ok-bg); color: var(--ok); }
.badge.plan-read_only, .badge.plan-suspended { background: var(--danger-bg); color: var(--danger); }

@media (max-width: 1250px) {
  .dashboard-summary { grid-template-columns: 1fr 1fr; }
  .dashboard-summary .balance-panel { grid-column: 1 / -1; }
  .dashboard-team { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .approval { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; width: 250px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .app.nav-open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .nav-scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 50; border: 0; background: #10182066; }
  .menu-btn { display: inline-flex; }
  .top { padding: 10px 16px; }
  .user-chip div { display: none; }
  .view { padding: 20px 16px 50px; }
  .grid2, .grid-request { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login { grid-template-columns: 1fr; }
  .login .hero { padding: 32px 20px; }
  .login .hero ul { display: none; }
  .table-wrap { margin: 0 -22px; }
  .breadcrumb { gap: 8px; }
  .breadcrumb > span:first-child, .breadcrumb > span:nth-child(2) { display: none; }
}
/* Phones and the installed app: respect notches/home bars and stop iOS zooming into form fields. */
@supports (padding: env(safe-area-inset-top)) {
  .top { padding-top: max(10px, env(safe-area-inset-top)); }
  .side { padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: env(safe-area-inset-bottom); }
  .view { padding-bottom: calc(50px + env(safe-area-inset-bottom)); }
  #toasts { bottom: calc(18px + env(safe-area-inset-bottom)); }
}
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px; }
  .btn { min-height: 40px; }
  .nav a { padding: 11px 12px; }
}
@media (max-width: 480px) {
  .dashboard-summary { grid-template-columns: minmax(0, 1fr); }
  .dashboard-summary .balance-panel { grid-column: auto; }
  .panel { padding: 18px; }
  .table-wrap { margin: 0 -18px; padding: 0 18px; }
  .breadcrumb { font-size: .75rem; }
  .top { gap: 6px; }
  .top .text-btn { padding: 0 8px; }
  .back-btn span:last-child { display: none; }
  .workspace-year { padding: 5px 8px; font-size: .75rem; }
  .section-heading { flex-wrap: wrap; }
  .row2 { grid-template-columns: 1fr; }
  .stat .value { font-size: 1.5rem; }
}
@media print {
  .side, .top, .btn, .toolbar, .nav-scrim { display: none !important; }
  .app { display: block; }
  .panel { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Public landing page ---------- */
.landing { min-height: 100vh; background: var(--bg); }
.landing-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px clamp(16px, 5vw, 64px); background: var(--surface); border-bottom: 1px solid var(--border); }
.landing-top nav { display: flex; gap: 8px; }
.landing-logo { display: block; height: 34px; width: auto; }
.landing-hero { background: var(--navy); color: #fff; padding: clamp(48px, 9vw, 110px) clamp(16px, 5vw, 64px); border-bottom: 6px solid var(--lime); }
.landing-hero .eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--lime); }
.landing-hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1.08; margin: 14px 0; max-width: 720px; }
.landing-hero h1 em { font-style: normal; color: var(--lime); }
.landing-hero p { color: #d3d5ce; max-width: 620px; font-size: 1.08rem; line-height: 1.55; }
.landing-hero .small { font-size: .88rem; color: #b7b9b2; }
.btn.lg { padding: 13px 22px; font-size: 1rem; }
.landing-hero .btn.primary { background: var(--lime); border-color: var(--lime); color: #111; }
.landing-hero .btn.primary:hover { background: #d4f86a; }
.btn.on-dark { background: transparent; border-color: #ffffff55; color: #fff; }
.btn.on-dark:hover { background: #ffffff14; }
.landing-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; padding: clamp(32px, 6vw, 64px) clamp(16px, 5vw, 64px); max-width: 1200px; margin: 0 auto; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.feature svg { width: 26px; height: 26px; color: var(--bronze); }
.feature h2 { font-size: 1.05rem; margin: 10px 0 6px; }
.feature p { margin: 0; color: var(--muted); line-height: 1.5; }
.landing-steps { max-width: 1200px; margin: 0 auto; padding: 0 clamp(16px, 5vw, 64px) clamp(40px, 7vw, 72px); }
.landing-steps ol { padding-left: 20px; line-height: 1.7; margin-bottom: 20px; }
.landing-foot { display: flex; justify-content: space-between; gap: 16px; padding: 22px clamp(16px, 5vw, 64px); border-top: 1px solid var(--border); color: var(--muted); font-size: .88rem; }
@media (max-width: 560px) {
  .landing-top { flex-wrap: wrap; }
  .landing-top nav .btn { padding: 8px 12px; }
  .landing-logo { height: 28px; }
}

/* ---------- Company branding ---------- */
.company-badge { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-weight: 600; }
.company-badge img { max-height: 40px; max-width: 140px; object-fit: contain; }
.brand-sub { display: flex; align-items: center; gap: 10px; }
.company-logo { max-height: 30px; max-width: 72px; object-fit: contain; background: #fff; border-radius: 5px; padding: 3px; flex: none; }
.brand-editor { display: grid; grid-template-columns: 180px 1fr; gap: 20px; align-items: start; }
.brand-preview { display: grid; place-items: center; min-height: 110px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface-2); padding: 12px; }
.brand-preview img { max-width: 100%; max-height: 90px; object-fit: contain; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; font: inherit; padding: 9px 11px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); }
@media (max-width: 640px) { .brand-editor { grid-template-columns: 1fr; } }

/* ---------- Company set-up steps ---------- */
.wizard-steps { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; padding: 0; margin: 0 0 16px; }
.wizard-steps li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
.wizard-steps span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); font-weight: 700; font-size: .8rem; }
.wizard-steps li.current { color: var(--text); font-weight: 600; }
.wizard-steps li.current span { background: var(--navy); border-color: var(--navy); color: var(--lime); }
.wizard-steps li.done span { background: var(--bronze-soft); border-color: var(--bronze); color: var(--bronze-dark); }
.wizard h3 { font-size: 1rem; margin: 22px 0 10px; }
.wizard-nav { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.wizard-nav .grow { flex: 1; }
.choice-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin: 12px 0; }
.choice { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; background: var(--surface); }
.choice:has(input:checked) { border-color: var(--bronze); background: var(--bronze-soft); font-weight: 600; }
.dept-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; max-width: 520px; }
.dept-list li { display: flex; gap: 8px; }
.dept-list input, #deptAdd input { flex: 1; min-width: 0; font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; }
#deptAdd { max-width: 520px; }
.invite-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.invite-options h3 { margin-top: 0; }
