/* ==========================================================================
   MES Attendance & Leave - design system
   ========================================================================== */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e4e8ef;
  --border-strong: #d3d9e3;
  --text: #0f1729;
  --text-2: #475467;
  --muted: #6b7689;
  /* MES brand blue (from the official logo, #0072B2) */
  --primary: #0072b2;
  --primary-hover: #005d92;
  --primary-soft: #e5f1f8;
  --brand-light: #1c9ad8;
  --brand-deep: #00476f;
  --success: #12875a;
  --danger: #c8323c;
  --warning: #b86e00;
  --side-bg: #ffffff;
  --side-text: #475467;
  --side-active: #e5f1f8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;

  /* tag palette: [fg, bg] */
  --blue-fg: #0068a3;   --blue-bg: #e3f1fa;
  --green-fg: #137a52;  --green-bg: #e3f6ed;
  --rose-fg: #c0344f;   --rose-bg: #fdebef;
  --amber-fg: #a75f00;  --amber-bg: #fdf1dc;
  --violet-fg: #6b3fd1; --violet-bg: #f1ebff;
  --teal-fg: #0f7a80;   --teal-bg: #e0f5f5;
  --slate-fg: #4a5568;  --slate-bg: #edf0f4;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020; --surface: #121a2e; --surface-2: #0f1628; --border: #222c44; --border-strong: #2d3956;
    --text: #e8ecf5; --text-2: #b4bdd0; --muted: #8590a8; --primary: #3fa9e6; --primary-hover: #63bbee;
    --primary-soft: #0f2c42; --side-bg: #0d1526; --side-text: #b4bdd0; --side-active: #0f2c42;
    --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 12px 32px -8px rgba(0,0,0,.6);
    --blue-fg: #7cc4ef;   --blue-bg: #0f2c42;
    --green-fg: #5fd3a2;  --green-bg: #0f3327;
    --rose-fg: #ff8fa5;   --rose-bg: #3d1622;
    --amber-fg: #f5b955;  --amber-bg: #3a2810;
    --violet-fg: #bba2ff; --violet-bg: #2a1d52;
    --teal-fg: #5fd0d4;   --teal-bg: #0f3133;
    --slate-fg: #b4bdd0;  --slate-bg: #222b40;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
small { font-size: 12px; }
button, input, select, textarea { font: inherit; color: inherit; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.block { display: block; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.link { color: var(--primary); font-weight: 500; font-size: 13px; }
.link:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* --------------------------------------------------------------- shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 252px; background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; z-index: 40; transition: transform .2s ease; border-right: 1px solid var(--border); }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 22px 22px 14px; border-bottom: 1px solid var(--border); }
.brand-logo { display: block; width: 196px; height: auto; }
.brand-tag { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--primary); background: var(--primary-soft); padding: 3px 8px; border-radius: 6px; }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 16px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--side-text); font-weight: 500; margin-bottom: 2px; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--side-active); color: var(--primary); font-weight: 600; box-shadow: inset 3px 0 0 var(--primary); }
.nav-count { margin-left: auto; background: #e5484d; color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.sidebar-foot { display: flex; align-items: center; gap: 8px; padding: 14px 14px 14px 16px; border-top: 1px solid var(--border); }
.me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; border-radius: var(--radius-sm); padding: 4px; }
.me:hover { background: var(--surface-2); }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.me-text strong { color: var(--text); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.scrim { display: none; }

.main { flex: 1; margin-left: 252px; display: flex; flex-direction: column; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 18px 32px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid transparent; }
.topbar-title { flex: 1; min-width: 0; }
.topbar h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.menu-btn { display: none; }
.content { padding: 8px 32px 32px; flex: 1; width: 100%; max-width: 1320px; }
.foot { padding: 16px 32px 24px; color: var(--muted); font-size: 12px; }

/* --------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn .icon { width: 17px; height: 17px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(0,114,178,.3); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-light { background: #fff; color: #00507e; }
.btn-light:hover { background: #e5f1f8; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.08); }
.btn-danger-soft { background: var(--rose-bg); color: var(--rose-fg); }
.btn-danger-soft:hover { filter: brightness(.97); }
.btn-ghost-danger { background: transparent; border-color: var(--border-strong); color: var(--danger); }
.btn-ghost-danger:hover { background: var(--rose-bg); border-color: transparent; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row.center { justify-content: center; margin-top: 20px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--border); color: var(--text); }
.icon-btn.danger:hover { background: var(--rose-bg); color: var(--danger); }

/* --------------------------------------------------------------- cards & layout */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2 { font-size: 15px; font-weight: 650; }
.card-body { padding: 20px; }
.card-body.center { text-align: center; padding: 36px 28px; }
.card-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); flex-wrap: wrap; }
.grid { display: grid; gap: 20px; margin-bottom: 24px; }
.grid-hero { grid-template-columns: minmax(280px, 340px) 1fr; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-form { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.grid-balances { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.narrow { max-width: 620px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 12px; }
.section-head h2 { font-size: 16px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.count { background: var(--primary-soft); color: var(--primary); font-size: 12px; padding: 1px 8px; border-radius: 999px; font-weight: 700; }

/* --------------------------------------------------------------- check-in hero */
.checkin { background: radial-gradient(120% 120% at 100% 0%, var(--brand-light) 0%, #0072b2 45%, var(--brand-deep) 100%); color: #fff; border: 0; position: relative; overflow: hidden; }
.checkin::after { content: ""; position: absolute; right: -24px; bottom: -18px; width: 190px; height: 140px; background: url("../img/mes-mark-white.svg") no-repeat center / contain; opacity: .1; }
.checkin .card-body { position: relative; z-index: 1; }
.eyebrow { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; opacity: .8; }
.clock { font-size: 40px; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 16px; font-variant-numeric: tabular-nums; }
.checkin-times { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.checkin-times div { background: rgba(255,255,255,.12); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; }
.checkin-times small { opacity: .75; }
.checkin-times strong { font-size: 16px; }
.done { display: flex; align-items: center; gap: 8px; font-weight: 600; background: rgba(255,255,255,.14); padding: 10px 12px; border-radius: var(--radius-sm); }

/* --------------------------------------------------------------- stats */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.stat { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat small { color: var(--muted); display: block; }
.stat strong { font-size: 26px; font-weight: 700; line-height: 1.2; }
.stat-link:hover { border-color: var(--primary); }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.stat-icon .icon { width: 22px; height: 22px; }

/* --------------------------------------------------------------- balances */
.balance { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.balance-top { display: flex; justify-content: space-between; align-items: center; }
.balance-num strong { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.balance-num span { color: var(--muted); margin-left: 6px; }
.meter { height: 6px; border-radius: 99px; background: var(--border); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--fg); transition: width .6s ease; }
.balance-meta { display: flex; gap: 24px; margin: 0; }
.balance-meta div { display: flex; gap: 6px; }
.balance-meta dt { color: var(--muted); }
.balance-meta dd { margin: 0; font-weight: 600; }

/* --------------------------------------------------------------- tags / badges */
.tag-blue { --fg: var(--blue-fg); --bgc: var(--blue-bg); }
.tag-green { --fg: var(--green-fg); --bgc: var(--green-bg); }
.tag-rose { --fg: var(--rose-fg); --bgc: var(--rose-bg); }
.tag-amber { --fg: var(--amber-fg); --bgc: var(--amber-bg); }
.tag-violet { --fg: var(--violet-fg); --bgc: var(--violet-bg); }
.tag-teal { --fg: var(--teal-fg); --bgc: var(--teal-bg); }
.tag-slate { --fg: var(--slate-fg); --bgc: var(--slate-bg); }
.pill, .stat-icon { color: var(--fg); background: var(--bgc); }
.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--fg); flex: none; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-pending { color: var(--amber-fg); background: var(--amber-bg); }
.badge-approved { color: var(--green-fg); background: var(--green-bg); }
.badge-rejected { color: var(--rose-fg); background: var(--rose-bg); }
.badge-cancelled { color: var(--slate-fg); background: var(--slate-bg); }
.role { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.role-admin { color: var(--violet-fg); background: var(--violet-bg); }
.role-manager { color: var(--teal-fg); background: var(--teal-bg); }
.role-employee { color: var(--slate-fg); background: var(--slate-bg); }
.att { font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 6px; white-space: nowrap; }
.att-present { color: var(--green-fg); background: var(--green-bg); }
.att-leave { color: var(--blue-fg); background: var(--blue-bg); }
.att-absent { color: var(--rose-fg); background: var(--rose-bg); }
.att-holiday { color: var(--amber-fg); background: var(--amber-bg); }
.att-weekend, .att-upcoming { color: var(--muted); background: transparent; padding-left: 0; font-weight: 500; }
.att-today { color: var(--slate-fg); background: var(--slate-bg); }
.event { text-transform: capitalize; font-weight: 600; font-size: 12.5px; }
.event-warn { color: var(--danger); }
.event-info { color: var(--text-2); }

/* --------------------------------------------------------------- avatar / person */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-size: 13px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--brand-light), #0072b2); letter-spacing: .02em; }
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.person { display: flex; align-items: center; gap: 10px; }
.person div { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }

/* --------------------------------------------------------------- lists */
.list { list-style: none; margin: 0; padding: 6px 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 20px; }
.list-row + .list-row { border-top: 1px solid var(--border); }
.list-row > div { display: flex; flex-direction: column; line-height: 1.4; }
.list-row.past { opacity: .55; }
.date-chip { width: 46px; height: 48px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; flex: none; }
.date-chip b { font-size: 17px; }
.date-chip small { text-transform: uppercase; color: var(--primary); font-weight: 700; font-size: 10.5px; letter-spacing: .05em; }

/* --------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th.num { text-align: right; }
.table th.center { text-align: center; }
.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:hover td { background: var(--surface-2); }
.table td.clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.table td.actions { text-align: right; white-space: nowrap; }
.table td.actions form { display: inline; }
.table tr.inactive td { opacity: .55; }
.table tr.row-weekend td, .table tr.row-upcoming td { color: var(--muted); }
.table tr.row-weekend td { background: var(--surface-2); }
.table-report th.group { border-left: 1px solid var(--border); }
.card > .table-wrap:first-child .table th:first-child { border-top-left-radius: var(--radius); }
.card > .table-wrap:first-child .table th:last-child { border-top-right-radius: var(--radius); }

/* --------------------------------------------------------------- forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field legend { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 0; margin-bottom: 6px; }
.field > span { margin-bottom: 0; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], input:not([type]), select, textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
textarea { height: auto; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.inline select { width: auto; height: 38px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.field-check { align-self: end; height: 40px; }
.hint { font-size: 12.5px; color: var(--muted); }
.summary { margin-right: auto; font-size: 13px; color: var(--text-2); }
.summary b { color: var(--primary); }
.type-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.type-option input { position: absolute; opacity: 0; pointer-events: none; }
.type-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1.5px solid var(--border-strong); border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s; height: 100%; }
.type-card small { color: var(--muted); }
.type-card:hover { border-color: var(--primary); }
.type-option input:checked + .type-card { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary); }
.type-option input:focus-visible + .type-card { outline: 2px solid var(--primary); outline-offset: 2px; }
.alloc-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.alloc-row + .alloc-row { border-top: 1px solid var(--border); }
.num-input { width: 84px !important; text-align: right; }
.search { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 420px; position: relative; }
.search .icon { position: absolute; left: 12px; color: var(--muted); }
.search input { padding-left: 38px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); }
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.active { background: var(--primary-soft); color: var(--primary); }
.pager { display: flex; align-items: center; gap: 6px; }

/* --------------------------------------------------------------- flashes / callouts */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--radius-sm); font-weight: 500; border: 1px solid; }
.flash span { flex: 1; }
.flash-success { color: var(--green-fg); background: var(--green-bg); border-color: color-mix(in srgb, var(--green-fg) 22%, transparent); }
.flash-error { color: var(--rose-fg); background: var(--rose-bg); border-color: color-mix(in srgb, var(--rose-fg) 22%, transparent); }
.flash-close { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 2px; display: grid; opacity: .7; }
.flash-close:hover { opacity: 1; }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius); font-size: 13px; line-height: 1.55; }
.callout-info { background: var(--primary-soft); color: var(--text-2); }
.callout-info > .icon { color: var(--primary); margin-top: 1px; }

/* --------------------------------------------------------------- approvals */
.approval-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 28px; }
.approval { display: grid; grid-template-columns: 220px 1fr 300px; gap: 20px; padding: 18px 20px; align-items: center; }
.approval-who { display: flex; align-items: center; gap: 12px; }
.approval-who div { display: flex; flex-direction: column; line-height: 1.35; }
.approval-what { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.approval-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.reason { color: var(--text-2); font-style: italic; }
.approval-actions { display: flex; flex-direction: column; gap: 8px; }
.approval-actions input { height: 34px; }
.approval-actions .btn-row .btn { flex: 1; }

/* --------------------------------------------------------------- misc */
.summary-strip { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.summary-item { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px; box-shadow: var(--shadow); }
.summary-item div { display: flex; flex-direction: column; line-height: 1.3; }
.summary-item small { color: var(--muted); }
.summary-item strong { font-size: 18px; }
.summary-item strong span { font-size: 12px; font-weight: 500; }
.empty { text-align: center; padding: 40px 20px; }
.empty-icon { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.empty-icon .icon { width: 24px; height: 24px; }
.empty-title { font-weight: 650; font-size: 15px; margin-bottom: 4px; }
.profile-head { display: flex; align-items: center; gap: 16px; padding: 24px 20px; border-bottom: 1px solid var(--border); }
.profile-head h2 { font-size: 19px; }
.details { margin: 0; padding: 8px 20px 12px; }
.details div { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 10px 0; }
.details div + div { border-top: 1px solid var(--border); }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.success-icon { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--green-bg); color: var(--green-fg); }
.success-icon .icon { width: 28px; height: 28px; }
.card-body.center h2 { font-size: 19px; margin-bottom: 8px; }
.cred { margin: 22px 0 12px; text-align: left; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.cred div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; flex-wrap: wrap; }
.cred div + div { border-top: 1px solid var(--border); }
.cred dt { color: var(--muted); }
.cred dd { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.error-page { text-align: center; padding: 64px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.error-code { font-size: 64px; font-weight: 800; letter-spacing: -.04em; color: var(--primary); line-height: 1; }
.error-page h2 { font-size: 22px; }
.error-page .btn { margin-top: 12px; }

/* --------------------------------------------------------------- auth */
.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-hero { position: relative; overflow: hidden; background: radial-gradient(90% 70% at 100% 0%, var(--brand-light) 0%, transparent 60%), radial-gradient(80% 60% at 0% 100%, var(--brand-deep) 0%, transparent 65%), #0072b2; color: #e3f1fa; padding: 40px 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-hero::after { content: ""; position: absolute; right: -60px; bottom: 40px; width: 360px; height: 262px; background: url("../img/mes-mark-white.svg") no-repeat center / contain; opacity: .08; pointer-events: none; }
.auth-hero > * { position: relative; z-index: 1; }
.auth-logo { display: block; width: 280px; max-width: 100%; height: auto; }
.auth-logo-sm { display: none; width: 220px; height: auto; margin-bottom: 8px; }
.auth-hero-body h2 { color: #fff; font-size: 38px; line-height: 1.15; letter-spacing: -.02em; font-weight: 750; margin-bottom: 16px; }
.auth-hero-body > p { font-size: 16px; max-width: 440px; opacity: .85; }
.auth-points { list-style: none; padding: 0; margin: 32px 0 0; display: flex; flex-direction: column; gap: 14px; }
.auth-points li { display: flex; align-items: center; gap: 12px; font-weight: 500; }
.auth-points .icon { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.1); color: #fff; }
.auth-hero-foot { font-size: 12px; opacity: .6; }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-panel.solo { min-height: 100vh; background: var(--bg); }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.auth-card h1 { font-size: 26px; letter-spacing: -.01em; }
.auth-card .muted { margin-top: -10px; }
.auth-help { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 12.5px; margin-top: 0 !important; }
.auth-help .icon { width: 15px; height: 15px; }

/* --------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .approval { grid-template-columns: 1fr; gap: 12px; }
  .grid-form { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(8, 12, 24, .45); z-index: 30; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 14px 16px; }
  .content { padding: 4px 16px 24px; }
  .foot { padding: 12px 16px 20px; }
  .grid-hero, .grid-2 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-logo-sm { display: block; }
}
@media (max-width: 560px) {
  .hide-sm { display: none; }
  .topbar h1 { font-size: 18px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; gap: 10px; }
  .stat strong { font-size: 21px; }
  .stat-icon { width: 36px; height: 36px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .card-foot .summary { flex-basis: 100%; }
  .details div { grid-template-columns: 1fr; gap: 2px; }
  .list-row { padding: 10px 14px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* --------------------------------------------------------------- MES policy additions */
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 7px 14px; border: 1.5px solid var(--border-strong); border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--text-2); }
.seg input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.seg input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
#category-field[hidden] { display: none; }
.adj-form { border-top: 1px solid var(--border); }
.att-short { color: var(--amber-fg); background: var(--amber-bg); }

/* --------------------------------------------------------------- leave register */
.att-untracked { color: var(--muted); background: transparent; padding-left: 0; font-weight: 500; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.filters select { width: auto; height: 38px; }
.filters .search input { min-width: 200px; }
.table-register td, .table-register th { padding: 10px 10px; }
.table-register td { vertical-align: top; }
.table-register th:first-child, .table-register td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); padding-left: 16px; min-width: 210px; }
.table-register thead th:first-child, .table-register tfoot th:first-child { background: var(--surface-2); }
.table-register tbody tr:hover td:first-child { background: var(--surface-2); }
.table-register a.person { color: inherit; text-decoration: none; }
.table-register a.person:hover strong { color: var(--primary); text-decoration: underline; }
.table-register tfoot th { border-top: 1px solid var(--border); border-bottom: 0; color: var(--text-2); }
.reg-cell { text-align: center; min-width: 64px; }
.reg-cell b { display: block; font-size: 14px; }
.reg-cell small { display: block; font-size: 11px; line-height: 1.35; color: var(--text-2); max-width: 96px; margin: 2px auto 0; }
.reg-cell small.undated { color: var(--amber-fg); }
.register-note { padding: 12px 20px 16px; margin: 0; }
.date-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.dpill { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; color: var(--blue-fg); background: var(--blue-bg); cursor: default; }
.dpill-portal { color: var(--fg); background: var(--bgc); box-shadow: inset 0 0 0 1px var(--fg); }
.dpill-offday { color: var(--green-fg); background: var(--green-bg); }
.dpill-undated { color: var(--amber-fg); background: var(--amber-bg); }
.leave-months td { vertical-align: top; }
.auth-tag { align-self: flex-start; margin: -6px 0 4px; }
a.stat { color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
a.stat:hover { transform: translateY(-1px); }
a.stat:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
a.person-link { color: inherit; text-decoration: none; }
a.person-link:hover strong { color: var(--primary); text-decoration: underline; }
.tab .count { margin-left: 4px; }

/* --------------------------------------------------------------- punching machine */
.kv { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.kv > div { display: grid; grid-template-columns: 170px 1fr; gap: 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.text-danger { color: var(--danger); }
.card-pad { padding: 12px 20px 0; margin: 0; }
.link-form { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.link-form select { max-width: 240px; }
.src-machine { font-size: 11px; font-weight: 600; color: var(--muted); margin-left: 6px; }
@media (max-width: 640px) { .kv > div { grid-template-columns: 1fr; gap: 2px; } .link-form { flex-wrap: wrap; } }
.checkin-note { margin: 12px 0 0; font-size: 12.5px; opacity: .8; }
.att-remote { color: var(--teal-fg); background: var(--teal-bg); }
.checkin-link { display: inline-block; margin-left: 6px; color: inherit; font-weight: 600; text-decoration: underline; }
.table th.group { border-left: 1px solid var(--border); text-align: center; }
.table td.group { border-left: 1px solid var(--border); }
.table tfoot th { border-top: 1px solid var(--border); background: var(--surface-2); }

/* --------------------------------------------------------------- TeamLogger progress */
.prog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--border); border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; }
.prog { background: var(--surface); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.prog small { color: var(--muted); font-weight: 600; }
.prog strong { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.prog span { font-size: 12px; }
.prog-ahead strong { color: var(--green-fg); }
.prog-behind strong { color: var(--rose-fg); }
.bal-ahead { color: var(--green-fg); font-weight: 600; }
.bal-behind { color: var(--rose-fg); font-weight: 600; }
.prog-card { margin-bottom: 24px; }

/* Simple "Today" card: two big figures + one line of office times */
.today-figs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 14px; }
.today-figs > div { background: rgba(255,255,255,.12); border-radius: var(--radius-sm); padding: 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.today-figs small { opacity: .8; font-weight: 600; }
.today-figs strong { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.today-figs span { font-size: 12.5px; opacity: .8; }
.today-figs .bal-pill { opacity: 1; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.bal-pill-behind { background: #ffe1e6; color: #a3132e; }
.bal-pill-ahead { background: #d9f7e6; color: #0f6b3a; }
.bal-pill-ok { background: rgba(255,255,255,.9); color: var(--brand-deep); }
.today-line { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; opacity: .95; }
.today-line svg { flex: none; width: 16px; height: 16px; }
.checkin > .card-body > .checkin-link { display: inline-block; margin: 12px 0 0; }

/* Dashboard first row: today card | leave balance (+ stats for admins, compact holidays for employees) */
.home-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.home-side .section-head { margin-top: 0; }
.home-side .grid-balances { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.holidays-mini { padding: 14px 18px; }
.holidays-mini-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.holidays-mini-head h2 { font-size: 15px; font-weight: 650; margin: 0; }
.holidays-mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 24px; }
.holidays-mini-list li { display: flex; align-items: center; gap: 10px; }
.holidays-mini-list li div { display: flex; flex-direction: column; }
.holidays-mini-list .date-chip { width: 40px; height: 42px; }
/* Keep "25h 03m" on one line in the today card */
.today-figs strong { white-space: nowrap; font-size: clamp(22px, 2.1vw, 30px); }
.grid-hero { grid-template-columns: minmax(300px, 400px) 1fr; align-items: start; }
@media (max-width: 960px) { .grid-hero { grid-template-columns: 1fr; } }

/* ---- Summary tiles (white cards; replaced the blue "Today" card) ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 14px; }
.tiles-gap { margin-bottom: 20px; }
.tile { display: flex; flex-direction: column; gap: 3px; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; color: var(--text); }
.tile small { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.tile strong { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tile > span, .tile-val + span { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-val { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tile-val .muted { font-size: 13px; }
.tile .meter { margin: 4px 0 2px; }
a.tile-link { text-decoration: none; transition: border-color .15s, box-shadow .15s; }
a.tile-link:hover { border-color: var(--primary); }
.tile .bal-pill { font-size: 11.5px; font-weight: 700; padding: 1px 9px; border-radius: 999px; align-self: center; white-space: nowrap; }
.bal-pill-ok { background: var(--surface-2); color: var(--text-2); }
.tile-counts { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; margin-top: 4px; font-size: 13px; color: var(--muted); }
.tile-counts b { color: var(--text); font-size: 16px; margin-right: 3px; }
@media (prefers-color-scheme: dark) {
  .bal-pill-behind { background: #4a1220; color: #ffb3c0; }
  .bal-pill-ahead { background: #0f3a24; color: #9be8bd; }
}

/* ---- Dashboard ---- */
.dash { display: flex; flex-direction: column; gap: 16px; }
.stats-row { grid-template-columns: repeat(4, 1fr); }
.dash-cards { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 16px; }
.dash-card { display: flex; flex-direction: column; min-height: 0; }
.dash-card .card-head { padding: 12px 18px; }
.dash-card .list-row { padding: 9px 18px; }
.dash-scroll { overflow-y: auto; max-height: 340px; }
.dash-empty { display: flex; align-items: center; gap: 10px; padding: 18px; color: var(--muted); font-size: 13px; }
.dash-empty .icon { flex: none; width: 20px; height: 20px; color: var(--primary); }
/* Laptop/desktop: the employee dashboard fits one screen - cards fill the remaining height
   (viewport minus topbar, tiles and padding) and their lists scroll inside. */
@media (min-width: 961px) and (min-height: 520px) {
  .dash-fit .dash-cards { height: calc(100vh - 255px); min-height: 220px; }
  .dash-fit .dash-scroll { max-height: none; flex: 1; min-height: 0; }
}
@media (max-width: 1180px) { .stats-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 960px) {
  .dash-cards { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 12px; }
  .tile strong { font-size: 20px; }
  .tile > span, .tile-val + span { white-space: normal; }
}
@media (min-width: 961px) and (min-height: 520px) {
  .content:has(.dash-fit) { padding-bottom: 16px; }
  .main:has(.dash-fit) > .foot { display: none; }
}
@media (min-width: 961px) and (min-height: 520px) {
  .dash-fit .dash-cards { height: calc(100vh - 262px); max-height: 560px; }
}
/* One or two tiles (e.g. directors exempt from attendance): keep normal tile width instead of stretching. */
.tiles:not(:has(> :nth-child(3))) { grid-template-columns: repeat(auto-fill, minmax(220px, 280px)); }
@media (max-width: 560px) { .tiles:not(:has(> :nth-child(3))) { grid-template-columns: 1fr 1fr; } }

/* ---- Admin sidebar: collapsible groups (native <details>, no JavaScript needed) ---- */
.nav-group { margin-top: 6px; }
.nav-group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; user-select: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); margin-right: 4px; transition: transform .15s; }
.nav-group[open] > summary::after { transform: rotate(45deg); }
.nav-group > summary:hover { color: var(--text); }

/* ---- Hours & salary page ---- */
.download-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.callout-warn { background: #fff4e5; color: #7a4a00; margin-bottom: 16px; align-items: center; }
.callout-warn > .icon { color: #c77700; }
@media (prefers-color-scheme: dark) { .callout-warn { background: #3a2a10; color: #ffd8a1; } }
details.tools { margin-top: 16px; }
details.tools > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; font-weight: 650; flex-wrap: wrap; }
details.tools > summary::-webkit-details-marker { display: none; }
details.tools > summary > span:first-child { display: flex; align-items: center; gap: 8px; }
details.tools[open] > summary { border-bottom: 1px solid var(--border); }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; padding: 18px 20px; }
.tools-grid form { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.tools-grid h3, .tools-link h3 { font-size: 14px; font-weight: 650; margin: 0; }
.tools-grid .field { width: 100%; }
.tools-link { border-top: 1px solid var(--border); padding: 14px 0 6px; }
.tools-link h3 { padding: 0 20px 6px; }

/* Admin forms on a person's month: record emailed leave, correct TeamLogger hours */
.tl-fix-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 16px 20px; }
.tl-fix-form .field { min-width: 140px; margin: 0; }
.tl-fix-form .field.grow { flex: 1 1 260px; }
.tl-fix-form .field.check { flex-direction: row; align-items: center; gap: 6px; min-width: 0; padding-bottom: 10px; }
#record-leave, #tl-corrections { margin-top: 20px; }

/* ---- Casual Leave used up: red negative number, red bar, red banner ---- */
.tile-alert { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); background: color-mix(in srgb, var(--danger) 6%, var(--surface)); }
.tile .text-danger { font-weight: 600; }
.tile > span.text-danger { color: var(--danger); white-space: normal; }
.tile-val strong.text-danger { color: var(--danger); }
.meter.meter-danger span { background: var(--danger); }
.callout-danger { background: var(--rose-bg); color: var(--text); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); margin-bottom: 16px; align-items: center; }
.callout-danger > .icon { color: var(--danger); }
.summary-alert { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); background: color-mix(in srgb, var(--danger) 6%, var(--surface)); }
.summary-item strong.text-danger { color: var(--danger); }
.summary-item small.muted { display: block; }

/* ---- My leaves: clickable summary, CL summary, salary cuts ---- */
a.summary-link { text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
a.summary-link:hover { border-color: var(--primary); }
.cl-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--border); border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; }
.cl-summary > div { background: var(--surface); padding: 14px 18px; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.cl-summary small { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.cl-summary strong { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.cl-summary span { font-size: 12px; }
.cl-summary .cl-red strong { color: var(--danger); }
.cl-summary .bal-pill { font-size: 11.5px; font-weight: 700; padding: 1px 9px; border-radius: 999px; }
.dpill-cut { background: var(--rose-bg) !important; color: var(--danger) !important; border-color: color-mix(in srgb, var(--danger) 35%, transparent) !important; }
.dpill small { font-size: 10.5px; font-weight: 700; opacity: .8; }
details.imported { border-top: 1px solid var(--border); }
details.imported > summary { cursor: pointer; padding: 10px 20px; color: var(--muted); font-size: 13px; }
:target { scroll-margin-top: 90px; }

/* ---- 12-month tables: blank months stay quiet; one line per deduction reason ---- */
.leave-months tr.month-empty td { padding-top: 8px; padding-bottom: 8px; }
.leave-months tr.month-empty td strong { color: var(--muted); font-weight: 500; }
.cut-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 2px 0; }
.cut-line + .cut-line { border-top: 1px dashed var(--border); margin-top: 4px; padding-top: 6px; }
.cut-why { font-weight: 600; }
.cut-line .date-pills { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* ---- Tabs made from the summary boxes (My leaves, admin person page) ---- */
.view-tabs { margin-bottom: 14px; }
.view-tabs a.summary-item.is-active { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent); }
.view-tabs a.summary-item.summary-alert.is-active { border-color: var(--danger); box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 25%, transparent); }
/* compact 12-month tables so a whole year fits on a laptop screen */
.leave-months th, .leave-months td { padding-top: 7px; padding-bottom: 7px; }
.leave-months tr.month-empty td { padding-top: 6px; padding-bottom: 6px; }
.cl-summary > div { padding: 10px 16px; }
.cl-summary strong { font-size: 20px; }

/* ---- 12 months as a 4 x 3 grid (fits one laptop screen) ---- */
.month-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--border); }
.month-box { background: var(--surface); padding: 9px 14px 10px; min-height: 62px; display: flex; flex-direction: column; gap: 5px; }
.month-box .month-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.month-box .month-head strong { font-size: 13.5px; }
.month-box .month-head b { font-size: 13px; }
.month-box.month-empty .month-head strong { color: var(--muted); font-weight: 500; }
.month-box .date-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.month-box .dpill { font-size: 12px; padding: 1px 7px; }
.month-split { font-size: 11.5px; }
.month-box .cut-line { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 0; border: 0; margin: 0; }
.month-box .cut-line + .cut-line { border-top: 1px dashed var(--border); padding-top: 4px; }
.month-box .cut-why { font-size: 12.5px; }
@media (max-width: 1100px) { .month-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .month-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .month-grid { grid-template-columns: 1fr; } }
/* My leaves / person page: no footer below the tabbed content on laptops */
@media (min-width: 961px) { .main:has(.view-tabs) > .foot { display: none; } .content:has(.view-tabs) { padding-bottom: 16px; } }

/* ---- Salaries (admin) ---- */
.amounts-masked .amt { filter: blur(7px); user-select: none; }
.amounts-masked .amt-block { filter: blur(9px); pointer-events: none; user-select: none; }
.pct-up { color: var(--green-fg); font-weight: 600; }
.pct-down { color: var(--danger); font-weight: 600; }
.salary-grid { align-items: start; }
.chart-wrap { padding: 12px 16px 6px; }
.salary-chart { width: 100%; height: auto; display: block; color: var(--primary); }
.salary-chart .chart-grid { stroke: var(--border); stroke-width: 1; }
.salary-chart .chart-axis { stroke: var(--border-strong); stroke-width: 1; }
.salary-chart .chart-label { fill: var(--muted); font-size: 11px; }
.salary-chart .chart-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.salary-chart .chart-dot { fill: currentColor; stroke: var(--surface); stroke-width: 2; }
.salary-chart .chart-hit { fill: transparent; }
.salary-chart .chart-point:hover .chart-dot { r: 6; }
.compare-table td.num small { font-size: 11.5px; }
.schedule-exception { border-top: 1px solid var(--border); }

/* ---- Payslips ---- */
.tds-form { display: inline-flex; gap: 6px; align-items: center; }
.tds-form input { width: 90px; height: 32px; padding: 0 8px; text-align: right; }
.amounts-masked .tds-form input.amt { filter: blur(6px); }
.payslip { max-width: 860px; padding: 26px 30px; }
.payslip-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 2px solid var(--primary); padding-bottom: 14px; }
.payslip-head h2 { font-size: 22px; text-align: right; }
.payslip-head p { text-align: right; color: var(--muted); font-weight: 600; }
.payslip-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 20px; margin: 18px 0; }
.payslip-facts dt { color: var(--muted); font-size: 12px; }
.payslip-facts dd { margin: 0; font-weight: 600; }
.payslip-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.payslip-table { border: 1px solid var(--border); border-radius: var(--radius-sm); }
.payslip-net { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 18px; padding: 14px 18px; border-radius: var(--radius-sm); background: var(--primary-soft); }
.payslip-net small { display: block; color: var(--muted); font-weight: 600; }
.payslip-net strong { font-size: 26px; }
.payslip-net p { margin: 0; font-weight: 600; text-align: right; }
.payslip-foot { margin-top: 14px; }
@media (max-width: 700px) { .payslip-facts { grid-template-columns: 1fr 1fr; } .payslip-cols { grid-template-columns: 1fr; } }
@media print {
  .sidebar, .topbar .topbar-actions, .menu-btn, .foot, .flashes, .scrim { display: none !important; }
  .main { margin: 0 !important; }
  .topbar { position: static; padding: 0 0 8px; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .payslip { box-shadow: none; border: 0; max-width: none; padding: 0; }
  .payslip-net { background: #eef4fa; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Employee documents ---------- */
.docs-layout { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 16px; }
.docs-layout aside { position: sticky; top: 16px; }
@media (max-width: 1000px) { .docs-layout { grid-template-columns: 1fr; } .docs-layout aside { position: static; } }
.doc-list { margin: 0; padding: 0; list-style: none; }
.doc-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 12px; padding: 9px 16px; border-top: 1px solid var(--border); align-items: center; }
.doc-row:first-child { border-top: 0; }
.doc-type { display: flex; align-items: center; gap: 10px; }
.doc-files { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.doc-file { display: flex; align-items: center; gap: 8px; min-width: 0; }
.doc-file > .icon { flex: none; color: var(--muted); }
.doc-file .grow { min-width: 0; }
.doc-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.doc-file form { margin: 0; }
.doc-yes { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 999px; background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); flex: none; }
.doc-yes .icon { width: 14px; height: 14px; }
.doc-no { display: inline-grid; place-items: center; width: 22px; height: 22px; color: var(--muted); flex: none; }
.doc-grid th.center, .doc-grid td.center { text-align: center; }
.doc-grid th { font-size: 11.5px; white-space: nowrap; }
.inline-form { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.inline-form .field { margin: 0; }
.stack-sm > * + * { margin-top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 640px) { .doc-row { grid-template-columns: 1fr; } }
.doc-grid td:first-child .person strong { white-space: nowrap; }
.doc-grid td { padding-top: 6px; padding-bottom: 6px; }
.doc-grid th, .doc-grid td { padding-left: 8px; padding-right: 8px; }

.doc-history { margin-top: 4px; }
.doc-history summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
.doc-history .doc-file { margin-top: 6px; }
.doc-old .doc-name { color: var(--muted); }
.pill-latest, .pill-old { padding: 1px 7px; font-size: 10.5px; vertical-align: 1px; }
.pill-latest { color: var(--success); background: color-mix(in srgb, var(--success) 14%, transparent); }
.pill-old { color: var(--muted); background: color-mix(in srgb, var(--muted) 14%, transparent); }

.radio-col { display: flex; flex-direction: column; gap: 6px; }

/* ---------- Employee page tabs ---------- */
.person-tabs { margin: 0 0 16px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.person-tabs .tab { display: inline-flex; align-items: center; gap: 6px; }
.person-tabs .tab .icon { width: 16px; height: 16px; }
