/* Timesheet Finance Team — Ivosights */
:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --line: #e3e8f0;
  --ink: #14213d;
  --ink-2: #4a5872;
  --ink-3: #7a879c;
  --brand: #14213d;
  --accent: #1a8fd0;
  --accent-ink: #ffffff;
  --accent-soft: #e4f3fc;
  --rex: #46b37c;
  --rex-soft: #e3f5eb;
  --good: #0c7a43; --good-bg: #e2f5ea;
  --warn: #9a6200; --warn-bg: #fdf1d8;
  --bad: #b42323;  --bad-bg: #fde6e6;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #9aa3b2;
  --q0: #eef2f7; --q1: #cde2fb; --q2: #86b6ef; --q3: #3987e5; --q4: #1c5cab; --q5: #0d366b;
  --shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 4px 16px rgba(20, 33, 61, .06);
  --radius: 16px;
  --logo: url("logo-navy.png");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1522; --surface: #172033; --surface-2: #1c2740; --line: #2a3650;
    --ink: #eef2f8; --ink-2: #b8c2d4; --ink-3: #8794ab;
    --accent: #3aa6e6; --accent-ink: #0b1220; --accent-soft: #16324a;
    --rex-soft: #173527;
    --good: #5fd39a; --good-bg: #133524; --warn: #f2c063; --warn-bg: #3a2c10; --bad: #ff8a8a; --bad-bg: #3d1a1d;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #0ca30c; --s7: #9085e9; --s8: #6f7a8e;
    --q0: #1f2a40; --q1: #184f95; --q2: #256abf; --q3: #3987e5; --q4: #6da7ec; --q5: #b7d3f6;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    --logo: url("logo-white.png");
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1522; --surface: #172033; --surface-2: #1c2740; --line: #2a3650;
  --ink: #eef2f8; --ink-2: #b8c2d4; --ink-3: #8794ab;
  --accent: #3aa6e6; --accent-ink: #0b1220; --accent-soft: #16324a;
  --rex-soft: #173527;
  --good: #5fd39a; --good-bg: #133524; --warn: #f2c063; --warn-bg: #3a2c10; --bad: #ff8a8a; --bad-bg: #3d1a1d;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #0ca30c; --s7: #9085e9; --s8: #6f7a8e;
  --q0: #1f2a40; --q1: #184f95; --q2: #256abf; --q3: #3987e5; --q4: #6da7ec; --q5: #b7d3f6;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  --logo: url("logo-white.png");
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.5 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.hidden { display: none !important; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { max-width: 1240px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; }
.logo { width: 128px; height: 32px; background: var(--logo) left center / contain no-repeat; flex: none; }
.app-title { font-weight: 700; font-size: 15px; line-height: 1.2; padding-left: 14px; border-left: 1px solid var(--line); }
.app-title small { display: block; font-weight: 500; color: var(--ink-3); font-size: 12px; }
.spacer { flex: 1; }
.icon-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; width: 38px; height: 38px; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: var(--surface-2); }
.user-chip { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: var(--accent); flex: none; }
.user-chip .who { line-height: 1.15; text-align: left; }
.user-chip .who b { font-size: 13px; display: block; }
.user-chip .who span { font-size: 11px; color: var(--ink-3); }
.menu { position: absolute; right: 16px; top: 58px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 190px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.menu button:hover { background: var(--surface-2); }

.tabs { max-width: 1240px; margin: 0 auto; padding: 0 16px; display: flex; gap: 4px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--ink-2); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

main { max-width: 1240px; margin: 0 auto; padding: 20px 16px 60px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card h2 { font-size: 16px; margin: 0 0 4px; }
.card .sub { color: var(--ink-3); font-size: 13px; margin: 0 0 14px; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.g-2e { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 960px) { .g-2, .g-2e { grid-template-columns: minmax(0, 1fr); } .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .app-title { display: none; } .user-chip .who { display: none; } .user-chip { padding: 4px; } }

/* hero */
.hero { display: flex; align-items: center; gap: 18px; background: linear-gradient(120deg, var(--rex-soft), var(--accent-soft)); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 22px; margin-bottom: 16px; position: relative; overflow: hidden; }
.hero .trex { flex: none; animation: bob 3.2s ease-in-out infinite; transform-origin: bottom center; }
.hero h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
.hero p { margin: 4px 0 0; color: var(--ink-2); }
.bubble { position: relative; display: inline-block; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; margin-top: 10px; font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow); }
.bubble::before { content: ""; position: absolute; left: -7px; top: 12px; width: 12px; height: 12px; background: var(--surface); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); transform: rotate(45deg); }
.hero-stats { margin-left: auto; display: flex; gap: 12px; }
.ring { width: 96px; text-align: center; }
.ring svg { display: block; margin: 0 auto; }
.ring b { display: block; font-size: 12px; color: var(--ink-2); font-weight: 600; margin-top: 2px; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-4px) rotate(-1deg); } }
@media (prefers-reduced-motion: reduce) { .hero .trex { animation: none; } }
@media (max-width: 760px) { .hero { flex-wrap: wrap; } .hero .trex { width: 90px; height: auto; } .hero-stats { margin-left: 0; width: 100%; justify-content: space-around; } }

/* ---------- form ---------- */
label.f { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 12px 0 6px; }
.in, select.in, textarea.in { width: 100%; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; outline: none; }
.in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
textarea.in { resize: vertical; min-height: 64px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { flex: 1; border: 0; background: var(--surface-2); padding: 9px 6px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.btn { border: 0; border-radius: 10px; padding: 11px 18px; font-weight: 700; cursor: pointer; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn.danger { background: var(--bad); color: #fff; }
.btn.block { width: 100%; }
.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.task-hint { background: var(--surface-2); border: 1px dashed var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: none; }

/* week strip */
.week-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.week-nav .lbl { font-weight: 700; flex: 1; text-align: center; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 14px; }
.day { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 8px 4px; text-align: center; cursor: pointer; }
.day small { display: block; font-size: 11px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; }
.day b { display: block; font-size: 16px; }
.day .h { font-size: 11.5px; color: var(--ink-2); }
.day .bar { height: 4px; border-radius: 4px; background: var(--q0); margin: 6px 6px 0; overflow: hidden; }
.day .bar i { display: block; height: 100%; background: var(--rex); border-radius: 4px; }
.day.weekend { opacity: .7; }
.day.today { border-color: var(--accent); }
.day[aria-selected="true"] { background: var(--accent-soft); border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* entries */
.entries { display: flex; flex-direction: column; gap: 8px; }
.entry { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.entry .stripe { width: 4px; align-self: stretch; border-radius: 4px; flex: none; }
.entry .body { flex: 1; min-width: 0; }
.entry .t { font-weight: 700; overflow-wrap: anywhere; }
.entry .meta { font-size: 12.5px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 2px; }
.entry .note { font-size: 13px; color: var(--ink-2); margin-top: 4px; overflow-wrap: anywhere; }
.entry .dur { font-weight: 800; font-size: 15px; white-space: nowrap; }
.entry .acts { display: flex; gap: 4px; }
.entry .acts button { border: 0; background: none; cursor: pointer; padding: 4px; border-radius: 6px; color: var(--ink-3); }
.entry .acts button:hover { background: var(--surface-2); color: var(--ink); }
.status { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; }
.status.Selesai { color: var(--good); background: var(--good-bg); }
.status.Dalam { color: var(--warn); background: var(--warn-bg); }
.status.Tertunda { color: var(--bad); background: var(--bad-bg); }
.empty { text-align: center; padding: 22px 10px; color: var(--ink-3); }
.empty .trex { opacity: .9; }

/* KPI */
.kpi .lbl { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.kpi .val { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.kpi .val small { font-size: 14px; font-weight: 600; color: var(--ink-3); margin-left: 4px; }
.kpi .foot { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.filters .in { width: auto; padding: 8px 12px; }

/* charts */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 12px; }
.hbar { display: grid; grid-template-columns: 74px minmax(0, 1fr) 58px; align-items: center; gap: 10px; margin: 8px 0; }
.hbar .n { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { display: flex; gap: 2px; height: 22px; }
.hbar .seg-b { height: 100%; min-width: 2px; }
.hbar .seg-b:first-child { border-radius: 4px 0 0 4px; }
.hbar .seg-b:last-child { border-radius: 0 4px 4px 0; }
.hbar .seg-b:only-child { border-radius: 4px; }
.hbar .v { font-size: 13px; font-weight: 700; text-align: right; }
.cols { display: flex; align-items: flex-end; gap: 3px; height: 170px; border-bottom: 1px solid var(--line); position: relative; padding-top: 8px; }
.cols .c { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; cursor: default; }
.cols .c i { display: block; background: var(--s1); border-radius: 4px 4px 0 0; min-height: 0; }
.cols .c.we i { background: var(--s8); }
.cols .c:hover i { filter: brightness(1.12); }
.cols-x { display: flex; gap: 3px; margin-top: 4px; }
.cols-x span { flex: 1; text-align: center; font-size: 10.5px; color: var(--ink-3); }
.gridline { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); font-size: 10.5px; color: var(--ink-3); pointer-events: none; }
.gridline span { position: absolute; right: 0; top: -15px; background: var(--surface); padding-left: 4px; }

.heat-wrap { overflow-x: auto; }
.heat { display: grid; gap: 3px; min-width: 640px; }
.heat .hn { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 6px; }
.heat .hd { font-size: 10.5px; color: var(--ink-3); text-align: center; }
.heat .cell { height: 24px; border-radius: 4px; background: var(--q0); min-width: 14px; }
.heat .cell.we { background: repeating-linear-gradient(135deg, var(--q0), var(--q0) 3px, transparent 3px, transparent 6px); }
.heat .cell.fut { opacity: .45; }
.heat .cell.today { outline: 2px solid var(--ink); outline-offset: 1px; }
.heat .cell:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
.scale { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-3); margin-top: 10px; }
.scale i { width: 16px; height: 12px; border-radius: 3px; display: inline-block; }

/* today panel */
.people { display: flex; flex-direction: column; gap: 8px; }
.person { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.person .nm { flex: 1; min-width: 0; }
.person .nm b { display: block; font-size: 13.5px; }
.person .nm span { font-size: 12px; color: var(--ink-3); }

/* tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 12px; color: var(--ink-3); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl tr:last-child td { border-bottom: 0; }
.pbar { height: 8px; background: var(--q0); border-radius: 8px; overflow: hidden; min-width: 80px; }
.pbar i { display: block; height: 100%; background: var(--s1); border-radius: 8px; }

/* tooltip, toast, modal */
#tip { position: fixed; z-index: 100; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12.5px; padding: 7px 10px; border-radius: 8px; max-width: 260px; box-shadow: var(--shadow); opacity: 0; transition: opacity .08s; }
#tip.on { opacity: 1; }
#tip b { display: block; }
#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 12px; font-weight: 600; opacity: 0; transition: .2s; z-index: 120; max-width: calc(100% - 32px); }
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.modal-bg { position: fixed; inset: 0; background: rgba(10, 16, 30, .5); display: grid; place-items: center; z-index: 110; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 22px; width: 100%; max-width: 420px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.modal h3 { margin: 0 0 6px; }
.modal .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.pin-big { font-size: 34px; font-weight: 800; letter-spacing: .2em; text-align: center; background: var(--surface-2); border-radius: 12px; padding: 12px; margin: 12px 0; }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(900px 500px at 10% 0%, var(--rex-soft), transparent 60%),
  radial-gradient(900px 500px at 100% 100%, var(--accent-soft), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 520px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 26px; }
.login-head { display: flex; align-items: center; gap: 14px; }
.login-head .trex { flex: none; animation: bob 3.2s ease-in-out infinite; }
.login-card .logo { width: 150px; height: 38px; margin-bottom: 8px; }
.login-card h1 { font-size: 22px; margin: 0; }
.people-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 18px; }
.pp { border: 1px solid var(--line); background: var(--surface-2); border-radius: 14px; padding: 12px 8px; cursor: pointer; text-align: center; }
.pp .avatar { margin: 0 auto 6px; width: 40px; height: 40px; font-size: 15px; }
.pp b { display: block; font-size: 14px; }
.pp span { display: block; font-size: 11.5px; color: var(--ink-3); line-height: 1.3; }
.pp:hover { border-color: var(--accent); }
.pp[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft); }
.pin-in { letter-spacing: .5em; text-align: center; font-size: 22px; font-weight: 700; }
.err { color: var(--bad); font-size: 13.5px; font-weight: 600; margin-top: 10px; min-height: 20px; }
