:root {
  --plum: #4a1f3d;
  --plum-2: #6b2f59;
  --rose: #c0507f;
  --rose-2: #d9709b;
  --rose-soft: #fbe8f0;
  --lav: #efe7f7;
  --lav-2: #8a6bb8;
  --bg: #fbf6f8;
  --card: #ffffff;
  --ink: #2b1a26;
  --muted: #8a7584;
  --line: #f0e3ea;
  --ok: #2f9e6e;
  --ok-soft: #e3f6ed;
  --warn: #c98a12;
  --warn-soft: #fdf3dc;
  --bad: #d0435a;
  --bad-soft: #fde6ea;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(74, 31, 61, .04), 0 6px 24px rgba(74, 31, 61, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--rose); text-decoration: none; }

/* layout */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--plum) 0%, #3a1830 100%);
  color: #f6e9f0; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; font-weight: 800; font-size: 18px; letter-spacing: -.2px; }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--rose-2), var(--lav-2)); display: grid; place-items: center; color: #fff; font-size: 16px; }
.brand small { display: block; font-weight: 500; font-size: 11px; opacity: .6; letter-spacing: .3px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; opacity: .45; padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: #f2dde8; opacity: .82; font-weight: 500; transition: background .15s, opacity .15s;
}
.nav a:hover { background: rgba(255,255,255,.06); opacity: 1; }
.nav a.active { background: rgba(255,255,255,.12); opacity: 1; color: #fff; }
.nav a .count { margin-left: auto; background: var(--rose); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; }
.nav svg { width: 18px; height: 18px; flex: none; }
.sidebar .foot { margin-top: auto; font-size: 11px; opacity: .45; padding: 12px; }

.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: rgba(251,246,248,.85);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--line);
}
.topbar .menu-btn { display: none; }
.topbar h1 { font-size: 18px; margin: 0; font-weight: 700; }
.topbar .spacer { flex: 1; }
.role-switch { display: flex; background: var(--lav); border-radius: 99px; padding: 3px; }
.role-switch button { border: 0; background: transparent; padding: 6px 14px; border-radius: 99px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--plum-2); }
.role-switch button.on { background: #fff; box-shadow: var(--shadow); color: var(--rose); }
.me { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.me .meta { line-height: 1.2; }
.me .meta b { display: block; font-size: 13px; }
.me .meta span { font-size: 11px; color: var(--muted); }

.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 13px; flex: none; }
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }

.content { padding: 24px 28px 48px; max-width: 1240px; }

/* cards */
.grid { display: grid; gap: 18px; }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-main { grid-template-columns: 1.6fr 1fr; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; border: 1px solid var(--line); }
.card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card h3 .link { margin-left: auto; font-size: 12px; font-weight: 600; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .label { color: var(--muted); font-size: 12px; font-weight: 500; }
.stat .value { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.stat .sub { font-size: 12px; color: var(--muted); }
.stat .ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 8px; }
.stat .ico svg { width: 20px; height: 20px; }

.hero {
  background: linear-gradient(120deg, var(--plum-2) 0%, var(--rose) 60%, var(--rose-2) 100%);
  color: #fff; border: 0; position: relative; overflow: hidden;
}
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.08); }
.hero .greet { font-size: 13px; opacity: .85; }
.hero .name { font-size: 22px; font-weight: 800; margin: 2px 0 14px; }
.hero .clock { font-size: 40px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.hero .date { opacity: .85; font-size: 13px; }
.hero .shift { display: flex; gap: 22px; margin: 16px 0; font-size: 12px; }
.hero .shift b { display: block; font-size: 16px; }
.hero .actions { display: flex; gap: 10px; position: relative; z-index: 1; }
.btn-light { background: #fff; color: var(--rose); }
.btn-ghost-light { background: rgba(255,255,255,.15); color: #fff; }

/* buttons */
.btn { border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: transform .08s, filter .15s; }
.btn:active { transform: scale(.98); }
.btn:hover { filter: brightness(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--rose); color: #fff; }
.btn-soft { background: var(--rose-soft); color: var(--rose); }
.btn-outline { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn-ok { background: var(--ok-soft); color: var(--ok); }
.btn-bad { background: var(--bad-soft); color: var(--bad); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }

/* table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fdf9fb; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-bad { background: var(--bad-soft); color: var(--bad); }
.b-info { background: var(--lav); color: var(--lav-2); }
.b-muted { background: #f3eef1; color: var(--muted); }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.input, select.input, textarea.input {
  border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; width: 100%; outline: none; transition: border .15s, box-shadow .15s;
}
.input:focus { border-color: var(--rose-2); box-shadow: 0 0 0 3px var(--rose-soft); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 600; color: var(--plum-2); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li .t { font-weight: 600; font-size: 13px; }
.li .s { color: var(--muted); font-size: 12px; }
.li .r { margin-left: auto; text-align: right; }

.empty { text-align: center; padding: 32px 12px; color: var(--muted); }
.empty .e-ico { width: 52px; height: 52px; border-radius: 16px; background: var(--rose-soft); color: var(--rose); display: grid; place-items: center; margin: 0 auto 10px; }
.empty .e-ico svg { width: 24px; height: 24px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--rose); border-color: var(--rose); }

.balance { border-radius: 14px; padding: 16px; background: var(--rose-soft); }
.balance:nth-child(2) { background: var(--lav); }
.balance:nth-child(3) { background: var(--ok-soft); }
.balance .v { font-size: 28px; font-weight: 800; }
.bar { height: 6px; background: rgba(0,0,0,.06); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--rose); border-radius: 99px; }

.ann { padding: 14px 0; border-bottom: 1px solid var(--line); }
.ann:last-child { border-bottom: 0; }
.ann .t { font-weight: 700; }
.ann .m { font-size: 12px; color: var(--muted); margin: 2px 0 6px; }
.ann p { margin: 0; color: #5a4553; }

.dir-card { text-align: center; }
.dir-card .avatar { margin: 0 auto 10px; width: 56px; height: 56px; font-size: 18px; }
.dir-card .n { font-weight: 700; }
.dir-card .j { color: var(--muted); font-size: 12px; }

/* payslip */
.slip { max-width: 720px; }
.slip-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--plum); padding-bottom: 12px; margin-bottom: 16px; }
.slip-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.slip-cols h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.slip-line { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.slip-total { display: flex; justify-content: space-between; margin-top: 18px; padding: 14px 16px; background: var(--rose-soft); border-radius: 12px; font-weight: 800; font-size: 16px; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(43, 26, 38, .45); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 20px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; padding: 24px; animation: pop .18s ease-out; }
.modal.wide { max-width: 780px; }
.modal h2 { margin: 0 0 16px; font-size: 18px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--plum); color: #fff; padding: 12px 20px; border-radius: 12px; box-shadow: var(--shadow); z-index: 60; font-weight: 600; animation: pop .2s; }

/* login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login .art { background: linear-gradient(140deg, var(--plum) 0%, var(--rose) 70%, var(--rose-2) 100%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login .art h2 { font-size: 36px; line-height: 1.15; margin: 0 0 12px; letter-spacing: -.5px; }
.login .art p { opacity: .85; max-width: 420px; }
.login .form { display: grid; place-items: center; padding: 32px; }
.login .box { width: 100%; max-width: 380px; }
.login .box h1 { font-size: 24px; margin: 0 0 4px; }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.pick button { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px; cursor: pointer; text-align: left; }
.pick button.on { border-color: var(--rose); background: var(--rose-soft); }
.pick b { display: block; font-size: 13px; }
.pick span { font-size: 11px; color: var(--muted); }

.muted { color: var(--muted); }
.mt { margin-top: 18px; }
.flex { display: flex; align-items: center; gap: 10px; }

@media (max-width: 980px) {
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .g-3, .g-main { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .topbar { padding: 12px 16px; }
  .topbar .menu-btn { display: inline-flex; border: 0; background: none; padding: 4px; cursor: pointer; }
  .topbar .menu-btn svg { width: 22px; height: 22px; }
  .me .meta { display: none; }
  .content { padding: 16px; }
  .g-4 { grid-template-columns: 1fr 1fr; }
  .row2, .slip-cols { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login .art { padding: 32px 20px; }
  .login .art h2 { font-size: 26px; }
  .role-switch button { padding: 6px 10px; }
}
@media print {
  .sidebar, .topbar, .no-print, .modal-bg .foot { display: none !important; }
  .modal-bg { position: static; background: none; }
  .modal { box-shadow: none; max-height: none; }
  body > #app { display: none; }
}

/* absen: kamera + lokasi */
.presence-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: #f7f1f4; color: var(--plum-2); font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.presence-row svg { width: 18px; height: 18px; flex: none; }
.presence-row.ok { background: var(--ok-soft); color: var(--ok); }
.presence-row.bad { background: var(--bad-soft); color: var(--bad); }
.cam { position: relative; aspect-ratio: 4 / 3; background: #2b1a26; border-radius: 16px; overflow: hidden; margin-bottom: 10px; }
.cam video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.cam-ring { position: absolute; left: 50%; top: 50%; width: 52%; aspect-ratio: 3 / 4; transform: translate(-50%, -50%); border: 3px dashed rgba(255,255,255,.55); border-radius: 50%; transition: border-color .2s; pointer-events: none; }
.cam-ring.on { border: 3px solid #5fd3a0; }
img.selfie { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; transform: scaleX(-1); cursor: zoom-in; background: var(--lav); }
@media (display-mode: standalone) { .topbar { padding-top: max(12px, env(safe-area-inset-top)); } }

/* jadwal shift */
.sched-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 12px; }
table.sched { border-collapse: separate; border-spacing: 0; font-size: 11px; }
table.sched th, table.sched td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 4px 3px; text-align: center; white-space: nowrap; }
table.sched thead th { position: sticky; top: 0; background: #fff; z-index: 2; font-size: 11px; color: var(--ink); text-transform: none; letter-spacing: 0; }
table.sched thead th span { color: var(--muted); font-weight: 500; }
table.sched th.we { background: #fdf1f5; color: var(--rose); }
table.sched .sticky { position: sticky; left: 0; background: #fff; z-index: 1; text-align: left; min-width: 190px; max-width: 220px; white-space: normal; }
table.sched thead .sticky { z-index: 3; }
table.sched td.sc { min-width: 44px; height: 34px; cursor: pointer; font-weight: 700; color: var(--plum); user-select: none; }
table.sched td.sc:hover { outline: 2px solid var(--rose-2); outline-offset: -2px; }
table.sched td.tal { background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(255,255,255,.55) 6px 8px); }
.shift-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; max-height: 50vh; overflow: auto; }
.shift-pick button { flex-direction: column; align-items: flex-start; gap: 0; }
.shift-pick button span { font-size: 11px; font-weight: 500; color: var(--muted); }

@media (max-width: 760px) { .holgrid { grid-template-columns: 1fr !important; } }

.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; }
.kv > div { display: flex; flex-direction: column; border-bottom: 1px dashed var(--line); padding: 4px 0; }
.kv span { font-size: 11px; color: var(--muted); }
.kv b { font-size: 13px; font-weight: 600; word-break: break-word; }
.letter p { line-height: 1.7; }
