﻿/* ============ Tokens ============ */
:root {
  --bg: #eef0fb;
  --surface: rgba(255, 255, 255, .86);
  --surface-solid: #ffffff;
  --surface-2: #f3f4fc;
  --text: #1b1f3b;
  --muted: #667094;
  --border: rgba(99, 102, 241, .16);
  --primary: #6366f1;
  --primary-text: #ffffff;
  --ring: rgba(99, 102, 241, .45);

  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #d946ef 100%);
  --grad-hero: linear-gradient(120deg, #4338ca 0%, #6d28d9 52%, #be185d 100%);
  --grad-ok: linear-gradient(135deg, #34d399, #059669);
  --grad-warn: linear-gradient(135deg, #fcd34d, #f59e0b);
  --grad-bad: linear-gradient(135deg, #fb7185, #e11d48);
  --grad-ln: linear-gradient(135deg, #f87171, #b91c1c);

  --ok: #047857;   --ok-bg: #d1fae5;
  --warn: #92400e; --warn-bg: #fef3c7;
  --bad: #be123c;  --bad-bg: #ffe4e6;
  --off: #64748b;  --off-bg: #e2e8f0;
  --holiday-cb: #fecdd3;
  --weekend-a: #eceefa; --weekend-b: #e2e5f6;

  --shadow: 0 1px 2px rgba(30, 27, 75, .05), 0 10px 30px -12px rgba(67, 56, 202, .22);
  --shadow-lg: 0 24px 60px -20px rgba(67, 56, 202, .45);
  --glow: 0 8px 22px -6px rgba(124, 58, 237, .65);
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d1f;
    --surface: rgba(28, 31, 66, .72);
    --surface-solid: #181b3a;
    --surface-2: #20244b;
    --text: #e8eafc;
    --muted: #9aa3d0;
    --border: rgba(139, 146, 255, .18);
    --primary: #8b8dfa;
    --ring: rgba(139, 146, 255, .55);

    --ok: #6ee7b7;   --ok-bg: rgba(16, 185, 129, .2);
    --warn: #fcd34d; --warn-bg: rgba(245, 158, 11, .2);
    --bad: #fda4af;  --bad-bg: rgba(244, 63, 94, .2);
    --off: #cbd5e1;  --off-bg: rgba(148, 163, 184, .2);
    --holiday-cb: #6b2437;
    --weekend-a: #1c2046; --weekend-b: #232853;

    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 34px -14px rgba(0, 0, 0, .7);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .8);
  }
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html { color-scheme: light dark; }
body {
  margin: 0; min-height: 100vh; color: var(--text); font: 14px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 520px at 8% -8%, rgba(99, 102, 241, .22), transparent 60%),
    radial-gradient(800px 520px at 100% 0%, rgba(217, 70, 239, .16), transparent 60%),
    radial-gradient(900px 600px at 50% 110%, rgba(6, 182, 212, .14), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.05rem; font-weight: 700; }
.page-head h1 {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  width: fit-content;
}
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
strong { font-weight: 700; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
main > * { animation: rise .4s ease both; }
main > *:nth-child(2) { animation-delay: .05s; }
main > *:nth-child(3) { animation-delay: .1s; }
main > *:nth-child(4) { animation-delay: .15s; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ============ Header ============ */
.topbar {
  display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; position: sticky; top: 0; z-index: 30;
  padding: .7rem 1.5rem; color: #fff; background: var(--grad-hero);
  box-shadow: 0 10px 34px -12px rgba(76, 29, 149, .7);
}
.topbar::after { /* kilau halus */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(420px 120px at 85% -40%, rgba(255, 255, 255, .28), transparent 70%);
}
.topbar > * { position: relative; z-index: 1; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.1rem; letter-spacing: -.02em; margin-right: .5rem; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; font-size: 18px;
  background: rgba(255, 255, 255, .2); border: 1px solid rgba(255, 255, 255, .35); backdrop-filter: blur(6px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4);
}
.nav { display: flex; gap: .3rem; flex-wrap: wrap; flex: 1; }
.nav a {
  padding: .45rem .9rem; border-radius: 99px; color: rgba(255, 255, 255, .82); text-decoration: none; font-weight: 600;
  transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.nav a.active { background: #fff; color: #5b21b6; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .45); }
.badge-count {
  display: inline-block; min-width: 1.4em; padding: 0 .45em; margin-left: .4em; border-radius: 99px;
  background: var(--grad-bad); color: #fff; font-size: 11px; font-weight: 700; text-align: center;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .85);
}
.userbox { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.userbox .muted { color: rgba(255, 255, 255, .85); font-weight: 500; }
.topbar button.small {
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .3); color: #fff; backdrop-filter: blur(6px);
}
.topbar button.small:hover { background: rgba(255, 255, 255, .28); }

main { max-width: 1200px; margin: 0 auto; padding: 1.6rem 1.25rem 3rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.page-head h1 { margin: 0; }

/* ============ Card ============ */
.card {
  position: relative; overflow: hidden; background: var(--surface); backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 1.15rem 1.3rem; margin-bottom: 1.1rem;
  box-shadow: var(--shadow);
}
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad); opacity: .85; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .85rem 1.1rem; }

/* ============ Form ============ */
label { display: block; font-weight: 600; margin-bottom: .25rem; font-size: 13px; }
input, select, textarea {
  width: 100%; padding: .6rem .75rem; font: inherit; color: var(--text);
  background: var(--surface-solid); border: 1px solid var(--border); border-radius: 11px;
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--ring); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
button:focus-visible, a:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
textarea { resize: vertical; min-height: 4.5rem; }
.field { margin-bottom: .9rem; }
.inline { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline > * { width: auto; }
.hint { font-size: 13px; margin-top: .4rem; min-height: 1.3em; color: var(--muted); }
.hint.err { color: var(--bad); font-weight: 600; }
.hint.ok { color: var(--ok); }

button, .btn {
  font: inherit; font-weight: 600; padding: .5rem 1rem; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-solid); color: var(--text);
  transition: transform .12s, box-shadow .15s, filter .15s, background .15s;
}
.btn { display: inline-block; text-decoration: none; line-height: 1.5; }
button:hover, .btn:hover { background: var(--surface-2); }
button:active, .btn:active { transform: translateY(1px); }
button.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--glow); }
button.primary:hover { background: var(--grad); filter: brightness(1.08) saturate(1.1); transform: translateY(-1px); }
button.ok { background: var(--grad-ok); border-color: transparent; color: #fff; box-shadow: 0 8px 20px -8px rgba(5, 150, 105, .8); }
button.danger { background: var(--grad-bad); border-color: transparent; color: #fff; box-shadow: 0 8px 20px -8px rgba(225, 29, 72, .7); }
button.ok:hover, button.danger:hover { background-blend-mode: normal; filter: brightness(1.08); transform: translateY(-1px); }
button.small { padding: .28rem .7rem; font-size: 12px; border-radius: 9px; box-shadow: none; }
button.small.ok, button.small.danger { box-shadow: none; }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; filter: grayscale(.4); }
button.block { width: 100%; padding: .75rem; margin-top: .35rem; font-size: 15px; }

/* ============ Tabel ============ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .65rem .75rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap; font-weight: 700; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: color-mix(in srgb, var(--primary) 7%, transparent); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
td.actions { white-space: nowrap; }
td.actions button { margin-right: .3rem; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .12rem .65rem; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
/* kolom pendek tidak boleh patah baris (mis. "Ad-hoc" jadi "Ad-" / "hoc"); kolom Alasan yang menyesuaikan */
table.stack td[data-label="Jenis"], table.stack td[data-label="Status"],
table.stack td[data-label="Hari kerja"], table.stack td[data-label="Tanggal"],
table.stack td[data-label="Developer"] { white-space: nowrap; }
table.stack td[data-label="Alasan"] { min-width: 200px; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.Approved { background: var(--ok-bg); color: var(--ok); }
.badge.Pending { background: var(--warn-bg); color: var(--warn); }
.badge.Rejected { background: var(--bad-bg); color: var(--bad); }
.badge.Cancelled { background: var(--off-bg); color: var(--off); }
.badge.type { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); font-weight: 600; }
.badge.type::before { display: none; }

/* ============ Statistik ============ */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.1rem; }
.stat {
  display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem; border-radius: var(--radius);
  background: var(--surface); backdrop-filter: blur(12px); border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat .icon {
  display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 14px; font-size: 22px;
  background: var(--grad); box-shadow: var(--glow);
}
.stat.ok .icon { background: var(--grad-ok); box-shadow: 0 8px 20px -6px rgba(5, 150, 105, .7); }
.stat.warn .icon { background: var(--grad-warn); box-shadow: 0 8px 20px -6px rgba(245, 158, 11, .7); }
.stat.bad .icon { background: var(--grad-bad); box-shadow: 0 8px 20px -6px rgba(225, 29, 72, .6); }
.stat .value { font-size: 1.7rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.stat .label { color: var(--muted); font-size: 12px; font-weight: 600; }

/* ============ Approval ============ */
.approval { display: grid; grid-template-columns: 1fr auto; gap: 1.25rem; align-items: start; transition: transform .18s, box-shadow .18s; }
.approval:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.approval .who { font-weight: 800; font-size: 1.1rem; display: flex; align-items: center; gap: .5rem; }
.approval .reason { margin: .45rem 0 .6rem; padding: .5rem .75rem; border-left: 3px solid var(--primary); background: var(--surface-2); border-radius: 0 10px 10px 0; }
.approval .decide { min-width: 270px; }
.approval .decide .inline { margin-top: .6rem; flex-wrap: nowrap; }
.approval .decide .inline button { flex: 1; padding: .6rem; }
@media (max-width: 720px) { .approval { grid-template-columns: 1fr; } .approval .decide { min-width: 0; } }

/* ============ Kalender ============ */
.cal-controls { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.cal-controls select { width: auto; font-weight: 600; }
.cal-controls button { min-width: 2.4rem; }
.cal-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(12px); }
table.cal { width: auto; min-width: 100%; border-collapse: separate; border-spacing: 0; }
table.cal th, table.cal td {
  padding: .28rem 0; min-width: 35px; text-align: center; font-size: 11px; border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border); text-transform: none; letter-spacing: 0; color: inherit;
}
table.cal tbody tr:hover { background: transparent; }
table.cal thead th { background: var(--surface-2); font-weight: 700; color: var(--text); }
table.cal .name {
  position: sticky; left: 0; z-index: 2; min-width: 140px; text-align: left; padding: .4rem .8rem;
  background: var(--surface-solid); font-size: 13px; font-weight: 600; white-space: nowrap; box-shadow: 4px 0 8px -6px rgba(30, 27, 75, .25);
}
table.cal thead .name { z-index: 3; background: var(--surface-2); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
table.cal .wfh-count { margin-left: .25rem; color: var(--muted); font-weight: 700; font-size: 12px; }
table.cal td.wfh { background: var(--grad-ok); color: #fff; font-weight: 800; text-shadow: 0 1px 1px rgba(0, 0, 0, .2); }
table.cal td.pending { background: var(--grad-warn); color: #422006; font-weight: 800; }
table.cal th.weekend, table.cal td.weekend {
  background: repeating-linear-gradient(45deg, var(--weekend-a) 0 5px, var(--weekend-b) 5px 10px); color: var(--muted);
}
table.cal th.ln, table.cal td.ln { background: var(--grad-ln); color: #fff; font-weight: 700; }
table.cal th.cb, table.cal td.cb { background: var(--holiday-cb); color: #9f1239; font-weight: 700; }
table.cal th.today { background: var(--grad); color: #fff; }
table.cal td.today { box-shadow: inset 2px 0 0 var(--primary), inset -2px 0 0 var(--primary); }
table.cal tr.total th, table.cal tr.total td { font-weight: 800; font-size: 12px; background: var(--surface-2); border-bottom: 0; }
table.cal tr.total .name { background: var(--surface-2); color: var(--text); text-transform: none; font-size: 13px; letter-spacing: 0; }
.legend { display: flex; gap: 1.1rem; flex-wrap: wrap; font-size: 13px; margin: 1rem 0 1.1rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: .45rem; }
.swatch { width: 18px; height: 18px; border-radius: 6px; border: 1px solid var(--border); display: inline-block; }
.swatch.wfh { background: var(--grad-ok); border: 0; } .swatch.pending { background: var(--grad-warn); border: 0; }
.swatch.weekend { background: repeating-linear-gradient(45deg, var(--weekend-a) 0 4px, var(--weekend-b) 4px 8px); }
.swatch.ln { background: var(--grad-ln); border: 0; } .swatch.cb { background: var(--holiday-cb); }
.chips { display: inline-flex; gap: .4rem; flex-wrap: wrap; vertical-align: middle; }
.chip { background: var(--grad-ok); color: #fff; padding: .15rem .75rem; border-radius: 99px; font-weight: 700; font-size: 13px; box-shadow: 0 6px 14px -8px rgba(5, 150, 105, .9); }

/* ============ Rekap (heatmap) ============ */
table.recap { min-width: 700px; }
table.recap td, table.recap th { text-align: center; }
table.recap td:first-child, table.recap th:first-child {
  text-align: left; font-weight: 600; position: sticky; left: 0; z-index: 1; background: var(--surface-solid);
  box-shadow: 4px 0 8px -6px rgba(30, 27, 75, .25);
}
table.recap tfoot td:first-child { background: var(--surface-2); }
table.recap td.zero { color: var(--muted); opacity: .45; }
table.recap td.h1 { background: color-mix(in srgb, var(--primary) 12%, transparent); }
table.recap td.h2 { background: color-mix(in srgb, var(--primary) 26%, transparent); font-weight: 600; }
table.recap td.h3 { background: color-mix(in srgb, var(--primary) 44%, transparent); font-weight: 700; }
table.recap td.h4 { background: var(--grad); color: #fff; font-weight: 800; }
table.recap tfoot td { font-weight: 800; border-top: 2px solid var(--border); background: var(--surface-2); }
table.recap td.total { font-weight: 800; }

/* ============ Login ============ */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; position: relative; overflow: hidden; background: var(--grad-hero); }
.login-page::before, .login-page::after { content: ""; position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; pointer-events: none; }
.login-page::before { width: 480px; height: 480px; background: #22d3ee; top: -160px; left: -120px; }
.login-page::after { width: 520px; height: 520px; background: #f472b6; bottom: -200px; right: -140px; }
.login { position: relative; z-index: 1; width: min(440px, 100%); }
.login-hero { text-align: center; color: #fff; margin-bottom: 1.4rem; }
.login-hero .brand-mark { width: 64px; height: 64px; font-size: 32px; margin: 0 auto .9rem; border-radius: 20px; }
.login-hero h1 { color: #fff; -webkit-text-fill-color: #fff; font-size: 2rem; margin-bottom: .25rem; }
.login-hero p { margin: 0; color: rgba(255, 255, 255, .8); }
.login .card { padding: 1.6rem; border-radius: 22px; box-shadow: var(--shadow-lg); background: var(--surface-solid); }
.role-select { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.role-option {
  display: flex; gap: .55rem; align-items: flex-start; margin: 0; padding: .7rem .8rem; cursor: pointer; font-weight: 400;
  border: 1.5px solid var(--border); border-radius: 13px; background: var(--surface-2); transition: border-color .15s, background .15s, transform .12s;
}
.role-option:hover { transform: translateY(-1px); border-color: var(--ring); }
.role-option input { width: auto; margin: .25rem 0 0; accent-color: #7c3aed; }
.role-option span { display: flex; flex-direction: column; line-height: 1.3; }
.role-option strong { font-size: 14px; }
.role-option small { color: var(--muted); font-size: 12px; }
.role-option:has(input:checked) { border-color: #8b5cf6; background: color-mix(in srgb, #8b5cf6 12%, var(--surface-solid)); box-shadow: 0 0 0 3px var(--ring); }
.role-option:has(input:focus-visible) { outline: 3px solid var(--ring); outline-offset: 2px; }

/* ============ Dialog, toast, tabs ============ */
dialog { border: 1px solid var(--border); border-radius: 20px; padding: 1.4rem; width: min(460px, 92vw); background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(20, 15, 60, .55); backdrop-filter: blur(4px); }
dialog[open] { animation: rise .25s ease both; }
dialog h2 { margin-bottom: .8rem; font-size: 1.15rem; }
dialog .buttons { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.1rem; }
#toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(180%); z-index: 100; max-width: 90vw;
  background: var(--grad-ok); color: #fff; font-weight: 600; padding: .7rem 1.2rem; border-radius: 14px;
  box-shadow: 0 16px 40px -12px rgba(5, 150, 105, .8); transition: transform .25s cubic-bezier(.2, .9, .3, 1.2);
}
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--grad-bad); box-shadow: 0 16px 40px -12px rgba(225, 29, 72, .7); }

.tabs { display: inline-flex; gap: .25rem; margin-bottom: 1.1rem; flex-wrap: wrap; padding: .3rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.tabs button { border: 0; background: transparent; }
.tabs button.active { background: var(--grad); color: #fff; box-shadow: var(--glow); }

ul { padding-left: 1.2rem; margin: .4rem 0 0; }
li { margin: .2rem 0; }

/* ============ Mobile ============ */
table.stack td:empty { display: none; }

@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
  .stat { padding: .8rem .9rem; gap: .7rem; }
  .stat .icon { width: 40px; height: 40px; font-size: 19px; border-radius: 12px; }
  .stat .value { font-size: 1.4rem; }
}

@media (max-width: 720px) {
  body { font-size: 15px; padding-bottom: env(safe-area-inset-bottom); }
  h1 { font-size: 1.35rem; }

  /* header 2 baris: [brand ..... akun] lalu menu yang bisa digeser */
  .topbar { padding: .55rem .9rem .5rem; gap: .45rem .75rem; padding-top: calc(.55rem + env(safe-area-inset-top)); }
  .brand { order: 1; margin: 0; font-size: 1rem; }
  .brand-mark { width: 30px; height: 30px; font-size: 16px; border-radius: 10px; }
  .userbox { order: 2; margin-left: auto; width: auto; gap: .35rem; flex-wrap: nowrap; }
  .userbox .muted { display: none; }
  .topbar > .nav {
    order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; gap: .35rem; padding-bottom: .15rem;
    margin: 0 -.9rem; padding-inline: .9rem; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .topbar > .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; padding: .5rem .95rem; flex: none; }

  main { padding: 1rem .85rem 2.5rem; }
  .page-head { gap: .6rem; margin-bottom: .85rem; }
  .card { padding: 1rem; border-radius: 14px; }

  /* >=16px mencegah iOS zoom otomatis saat fokus ke input; target sentuh lebih besar */
  input, select, textarea { font-size: 16px; padding: .7rem .8rem; }
  button, .btn { min-height: 42px; }
  button.small { min-height: 34px; padding: .35rem .8rem; font-size: 13px; }
  .topbar button.small { min-height: 34px; padding: .3rem .65rem; }

  .page-head > .inline, .cal-controls { width: 100%; }
  .page-head > .inline > * { flex: 1 1 140px; }
  .cal-controls { gap: .4rem; }
  .cal-controls select { flex: 1 1 0; min-width: 0; }
  .cal-controls .btn { flex: 1 0 100%; text-align: center; }

  /* tabel -> kartu bertumpuk */
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr {
    margin-bottom: .8rem; padding: .3rem .95rem; background: var(--surface-solid);
    border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
  }
  table.stack tr:hover { background: var(--surface-solid); }
  table.stack td {
    display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; text-align: right;
    padding: .5rem 0; border-bottom: 1px dashed var(--border);
  }
  table.stack td:last-child { border-bottom: 0; }
  table.stack td::before { content: attr(data-label); flex: none; text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; }
  table.stack td.cell-main { font-weight: 700; font-size: 1rem; }
  table.stack td.actions { justify-content: flex-end; flex-wrap: wrap; gap: .4rem; padding-top: .7rem; }
  table.stack td.actions::before { display: none; }
  table.stack td.actions button { margin: 0; }

  /* rekap: 14 kolom tidak muat di HP, jadi digeser horizontal (kolom nama tetap menempel) */
  .table-wrap { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  table.recap th, table.recap td { padding: .55rem .5rem; font-size: 13px; }
  table.recap th:first-child, table.recap td:first-child { min-width: 92px; padding-left: .7rem; }

  /* kalender: kolom nama lebih ramping, tetap bisa digeser horizontal */
  table.cal .name { min-width: 92px; padding: .35rem .55rem; font-size: 12px; }
  table.cal th, table.cal td { min-width: 32px; }
  .legend { gap: .5rem .9rem; font-size: 12px; }

  .approval .decide .inline { flex-wrap: nowrap; }
  .tabs { display: flex; }
  .tabs button { flex: 1; }
  #toast { bottom: calc(1rem + env(safe-area-inset-bottom)); width: calc(100% - 2rem); text-align: center; }
  dialog { padding: 1.1rem; border-radius: 18px; }
  dialog .buttons button { flex: 1; }
}

@media (max-width: 400px) {
  .role-select { grid-template-columns: 1fr; }
  .stats { gap: .6rem; }
  .stat { flex-direction: column; align-items: flex-start; gap: .4rem; }
}
