/* ArsipKantor — design tokens & component styles (mengikuti storyboard) */
:root {
  --bg: #F3F4EF;
  --surface: #FFFFFF;
  --surface-2: #F8F9F6;
  --ink: #1A1F1B;
  --muted: #5B655E;
  --line: #D9DDD5;
  --line-soft: #EEF0EA;
  --field: #C9CFC6;
  --accent: #1E6B47;
  --accent-ink: #154D33;
  --accent-soft: #E3F0E8;
  --blue: #1F4E8C;
  --blue-soft: #E8EEF8;
  --amber: #9A5B00;
  --amber-soft: #F6EBDD;
  --amber-bg: #FBF4E6;
  --red: #A3302B;
  --red-soft: #FBE5E3;
  --dark: #1A1F1B;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
  --radius: 12px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
a:hover { color: var(--accent-ink); }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; font-weight: 800; }
h1 { font-size: 32px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
p { margin: 0; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
.bold { font-weight: 700; }
.xbold { font-weight: 800; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Layout */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; }
.sidebar {
  flex: 0 0 250px; background: var(--surface); border-right: 1px solid var(--line);
  padding: 24px 16px; display: flex; flex-direction: column; gap: 6px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 22px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); display: flex; align-items: center; justify-content: center; color: #fff; }
.brand-name { font-size: 18px; font-weight: 800; }
.nav-item {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px;
  border-radius: 10px; color: var(--ink); font-weight: 600; text-decoration: none;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.nav-item svg { flex: 0 0 auto; }
.nav-spacer { flex: 1 1 auto; }
.nav-item.subtle { color: var(--muted); font-size: 15px; min-height: 44px; }
.main { flex: 999 1 560px; min-width: 0; padding: 36px 44px; display: flex; flex-direction: column; gap: 24px; }
@media (max-width: 720px) {
  .sidebar { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; padding: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 6px 10px; flex: 1 1 100%; }
  .nav-item { min-height: 44px; padding: 0 10px; font-size: 15px; }
  .nav-spacer { display: none; }
  .main { padding: 20px 16px; }
}

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.page-title { display: flex; flex-direction: column; gap: 6px; }
.back { font-size: 14px; font-weight: 700; text-decoration: none; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 10px; border: 2px solid var(--field);
  background: var(--surface); color: var(--ink); font-weight: 700; font-size: 15px; text-decoration: none;
}
.btn:hover { background: var(--surface-2); color: var(--ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 800; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn-dark { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn-dark:hover { background: #000; color: #fff; }
.btn-danger { color: var(--red); border-color: #E9C2BF; }
.btn-danger:hover { background: var(--red-soft); }
.btn-lg { min-height: 56px; font-size: 18px; padding: 0 28px; border-radius: 12px; }
.btn-sm { min-height: 40px; font-size: 14px; padding: 0 12px; border-radius: 8px; border-width: 1px; }
.btn-block { width: 100%; }
.btn-dashed { border-style: dashed; color: var(--accent); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-icon { width: 44px; height: 44px; padding: 0; min-height: 0; }
.btn-link { background: none; border: none; color: var(--accent); font-weight: 700; padding: 0; min-height: 0; font-size: 14px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.col-side { flex: 1 1 260px; max-width: 320px; }
.col-main { flex: 999 1 460px; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }

.tile {
  display: flex; flex-direction: column; gap: 14px; padding: 22px; min-height: 150px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  color: var(--ink); text-decoration: none;
}
.tile:hover { border-color: var(--accent); color: var(--ink); }
.tile-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.tile-title { font-size: 19px; font-weight: 800; }
.tile-desc { color: var(--muted); font-size: 15px; }
.tile-dark { background: var(--dark); color: #fff; border-color: var(--dark); justify-content: center; gap: 8px; }
.tile-dark .label { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; color: #B9C4BC; }

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; display: flex; flex-direction: column; gap: 2px; }
.stat .label { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.stat .value { font-family: var(--mono); font-size: 20px; font-weight: 600; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label, .label-text { font-weight: 700; font-size: 15px; }
.hint { font-size: 13px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; padding: 12px 14px; border: 2px solid var(--field); border-radius: 10px;
  background: var(--surface); color: var(--ink); min-height: 48px; font-size: 16px;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.invalid { border-color: #D9A84B; background: #FFF8E6; }
.input-sm { min-height: 40px; padding: 8px 10px; font-size: 15px; }
.textarea { resize: vertical; min-height: 80px; }
.check { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: 16px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; flex: 0 0 auto; }
.choice {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 2px solid var(--line);
  border-radius: 10px; cursor: pointer; font-weight: 600; background: var(--surface);
}
.choice.selected { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.choice input { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; }

/* Stepper */
.stepper { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.step { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-weight: 700; font-size: 15px; }
.step-num { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--field); display: flex; align-items: center; justify-content: center; font-size: 14px; }
.step.done { color: var(--accent); }
.step.done .step-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.step.current { background: var(--dark); border-color: var(--dark); color: #fff; }
.step.current .step-num { background: #fff; border-color: #fff; color: var(--dark); }

/* Tags / badges */
.tag { display: inline-flex; align-items: center; font-size: 12px; font-weight: 800; padding: 4px 8px; border-radius: 6px; background: var(--line-soft); color: var(--muted); white-space: nowrap; letter-spacing: 0.02em; }
.tag-green { background: var(--accent-soft); color: var(--accent); }
.tag-blue { background: var(--blue-soft); color: var(--blue); }
.tag-amber { background: var(--amber-soft); color: var(--amber); }
.tag-red { background: var(--red-soft); color: var(--red); }
.tag-sm { font-size: 11px; padding: 2px 6px; border-radius: 5px; }
.pill { min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; font-size: 15px; }
.pill.active { background: var(--dark); border-color: var(--dark); color: #fff; font-weight: 800; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { padding: 12px 14px; font-weight: 700; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); background: var(--bg); text-align: left; white-space: nowrap; }
.table td { padding: 10px 14px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.table tr.group td { font-weight: 800; background: var(--surface); }
.table tr.subtotal td { background: var(--surface-2); font-weight: 700; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table tr.selected td { background: var(--accent-soft); }
.table tr.warn td { background: #FFF8E6; }
.table .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.table .cell-input { width: 100%; min-width: 0; padding: 6px 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; font: inherit; }
.table .cell-input:hover { border-color: var(--field); background: var(--surface); }
.table .cell-input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.table .cell-input.num { text-align: right; font-family: var(--mono); }
.totals { padding: 18px 20px; background: var(--bg); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.totals-lines { display: flex; flex-direction: column; gap: 4px; font-size: 15px; min-width: 260px; }
.totals-lines > div { display: flex; justify-content: space-between; gap: 24px; color: var(--muted); }
.totals-lines > div.grand { color: var(--ink); font-weight: 800; font-size: 19px; }

/* Notices */
.notice { padding: 14px 16px; border-radius: var(--radius); display: flex; gap: 10px; font-size: 15px; align-items: flex-start; }
.notice svg { flex: 0 0 auto; margin-top: 2px; }
.notice-warn { background: var(--amber-bg); border: 1px solid #EAD9B8; color: #6B4300; }
.notice-ok { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.notice-info { background: var(--blue-soft); color: var(--blue); }
.notice-err { background: var(--red-soft); color: var(--red); }

/* Drop zone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  min-height: 220px; border: 3px dashed var(--accent); border-radius: 16px; background: var(--surface);
  cursor: pointer; text-align: center; padding: 24px;
}
.dropzone.over { background: var(--accent-soft); }
.dropzone-icon { width: 64px; height: 64px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.dropzone-title { font-size: 22px; font-weight: 800; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(26, 31, 27, 0.55); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 50; }
.modal { width: 100%; max-width: 600px; background: var(--surface); border-radius: 16px; padding: 32px; display: flex; flex-direction: column; gap: 22px; max-height: calc(100vh - 48px); overflow: auto; }
.modal-wide { max-width: 900px; }
.save-opt { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px 12px; min-height: 130px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); }
.save-opt:hover, .save-opt.selected { border-color: var(--accent); background: var(--accent-soft); }
.save-opt .ic { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; }

/* Toast */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 60; }
.toast { background: var(--dark); color: #fff; padding: 14px 18px; border-radius: 12px; font-weight: 700; font-size: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.25); max-width: 420px; }
.toast-err { background: var(--red); }
.toast-ok { background: var(--accent); }

/* List rows (arsip, agenda) */
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--line-soft); }
.list-row:first-child { border-top: 0; }
.list-row .grow { flex: 1 1 auto; min-width: 0; }
.list-row .title { font-weight: 700; }
.list-row .sub { font-size: 13px; color: var(--muted); }
.type-tag { width: 76px; text-align: center; justify-content: center; }

/* Login */
.login { min-height: 100vh; display: flex; flex-wrap: wrap; }
.login-side { flex: 1 1 420px; background: var(--accent); color: #fff; padding: 64px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 48px; }
.login-side h1 { font-size: 40px; line-height: 1.15; max-width: 440px; }
.login-side p { font-size: 18px; max-width: 440px; color: #DCEDE3; }
.login-form { flex: 999 1 520px; display: flex; align-items: center; justify-content: center; padding: 48px 32px; }
.login-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 40px; display: flex; flex-direction: column; gap: 22px; }
@media (max-width: 720px) { .login-side { padding: 32px 24px; } .login-side h1 { font-size: 30px; } }

/* Calendar */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-dow { font-size: 13px; font-weight: 800; color: var(--muted); text-align: center; }
.cal-day { min-height: 72px; padding: 8px; border-radius: 8px; background: var(--surface-2); font-size: 15px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; border: 2px solid transparent; text-align: left; font-weight: 600; }
.cal-day.weekend { background: transparent; color: var(--muted); }
.cal-day.other { opacity: 0.35; }
.cal-day.today { border-color: var(--accent); }
.cal-day.selected { background: var(--dark); color: #fff; }
.cal-day:hover { border-color: var(--accent); }
.cal-ev { font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; gap: 12px; border-left: 6px solid var(--accent); }
.agenda.red { border-left-color: var(--red); }
.agenda.amber { border-left-color: var(--amber); }
.agenda.blue { border-left-color: var(--blue); }

/* PDF pages */
.pdf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.pdf-page { display: flex; flex-direction: column; gap: 8px; }
.pdf-thumb { position: relative; aspect-ratio: 210 / 297; border: 2px solid var(--line); border-radius: 6px; background: var(--surface); overflow: hidden; display: flex; align-items: center; justify-content: center; cursor: grab; }
.pdf-thumb img, .pdf-thumb canvas { max-width: 100%; max-height: 100%; }
.pdf-thumb.selected { border: 3px solid var(--red); }
.pdf-thumb .src { position: absolute; top: 8px; left: 8px; width: 10px; height: 10px; border-radius: 2px; }
.pdf-thumb .chk { position: absolute; top: 6px; right: 6px; }
.pdf-thumb.drag-over { outline: 3px solid var(--accent); }

/* Preview (document-like) */
.paper { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 44px 48px; font-size: 14px; max-width: 640px; }
.paper table { width: 100%; border-collapse: collapse; }
.paper th, .paper td { border: 1px solid var(--ink); padding: 6px 8px; text-align: left; vertical-align: top; }

/* Misc */
.kbd-steps { font-size: 13px; color: var(--muted); }
.divider { height: 1px; background: var(--line-soft); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.swatch { width: 36px; height: 36px; border-radius: 8px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; flex: 0 0 auto; }
.progress { height: 8px; border-radius: 4px; background: var(--line-soft); overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); }
.print-only { display: none; }
@media print {
  .sidebar, .no-print { display: none !important; }
  .main { padding: 0; }
  body { background: #fff; }
}

.table-dense th { padding: 10px 8px; }
.table-dense td { padding: 6px 8px; }
.table-dense .cell-input { padding: 6px 6px; font-size: 14px; }
.table-dense .num { font-size: 14px; }
.table-dense select.cell-input { padding-right: 2px; }
