/* ============================================================
   Taraskop Travel Tracker — "Atelier Zero" paper editorial theme
   Tokens diturunkan dari Open-Design-Landing (Atelier Zero)
   ============================================================ */

:root {
  --paper: #efe7d2;
  --paper-warm: #ece4cf;
  --paper-dark: #ddd2b6;
  --ink: #15140f;
  --ink-soft: #2a2620;
  --ink-mute: #5a5448;
  --ink-faint: #8b8676;
  --coral: #ed6f5c;
  --coral-soft: #f08e7c;
  --mustard: #e9b94a;
  --olive: #6e7448;
  --bone: #f7f1de;
  --line: rgba(21, 20, 15, 0.16);
  --line-soft: rgba(21, 20, 15, 0.08);
  --line-faint: rgba(21, 20, 15, 0.05);
  --shadow: 0 30px 60px -30px rgba(21, 20, 15, 0.18);
  --serif: 'Playfair Display', 'Times New Roman', serif;
  --sans: 'Inter Tight', 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --body: 'Inter', -apple-system, system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
}

/* DARK MODE */
[data-theme="dark"] {
  --paper: #1a1a16;
  --paper-warm: #22221c;
  --paper-dark: #2a2a24;
  --ink: #efe7d2;
  --ink-soft: #d6cdb0;
  --ink-mute: #9a9588;
  --ink-faint: #6e6b5e;
  --bone: #2a2a24;
  --line: rgba(239, 231, 210, 0.14);
  --line-soft: rgba(239, 231, 210, 0.07);
  --line-faint: rgba(239, 231, 210, 0.04);
  --shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] body::before { opacity: 0.15; }
[data-theme="dark"] .card, [data-theme="dark"] .stat-card, [data-theme="dark"] .chart-card { background: #232320; border-color: rgba(239,231,210,.07); }
[data-theme="dark"] .topbar { background: #1e1e1c; border-color: rgba(239,231,210,.08); }
[data-theme="dark"] .sidebar { background: #1e1e1c; }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: #2a2a24; color: var(--ink); border-color: var(--line); }

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { background: var(--paper); color: var(--ink); }

body {
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

/* ---- paper grain texture overlay ---- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(106, 92, 56, 0.07) 0, transparent 28%),
    radial-gradient(circle at 88% 72%, rgba(106, 92, 56, 0.06) 0, transparent 32%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.18  0 0 0 0 0.16  0 0 0 0 0.12  0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: auto, auto, 240px 240px;
  mix-blend-mode: multiply;
  opacity: 0.92;
}

.shell { position: relative; }
.shell.hidden { display: none !important; }
.container { max-width: 1480px; padding: 0 48px; margin: 0 auto; }

/* ---- top metadata strip ---- */
.topbar {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  background: var(--paper);
  position: relative;
  z-index: 10;
}
.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  flex-wrap: wrap;
}
.topbar-inner b { color: var(--ink); font-weight: 600; }
.topbar-inner .coral { color: var(--coral); }
.topbar-inner > span { white-space: nowrap; }
.topbar-inner .mid { display: inline-flex; gap: 26px; }
.topbar-inner .right { display: inline-flex; gap: 18px; align-items: center; }
.topbar .pulse {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--coral);
  display: inline-block;
  margin-right: 6px;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---- layout shell ---- */
.layout { display: flex; min-height: calc(100vh - 40px); }

/* ---- sidebar ---- */
.sidebar {
  width: 250px;
  background: var(--paper-warm);
  border-right: 1px solid var(--line);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 5;
  flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 13px; padding: 0 6px; }
.brand-mark {
  width: 42px; height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  border: none;
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-name {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.brand-sub {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 2px;
}

.menu { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 12px;
  border-radius: 12px;
  color: var(--ink-mute);
  text-decoration: none;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 14px;
  transition: color 0.18s ease, background 0.18s ease;
  position: relative;
}
.menu-item .idx {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
  width: 22px;
  flex-shrink: 0;
}
.menu-item svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.6; flex-shrink: 0; }
.menu-item:hover { color: var(--ink); background: rgba(21, 20, 15, 0.04); }
.menu-item.active {
  color: var(--coral);
  background: rgba(237, 111, 92, 0.08);
  font-weight: 600;
}
.menu-item.active .idx { color: var(--coral); }
.menu-item.active::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--coral);
}
.sidebar-foot {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: center;
  border-top: 1px dashed var(--line);
  padding-top: 18px;
}

/* ---- sub-menu expandable system ---- */
.has-submenu {
  cursor: pointer;
  user-select: none;
}
.has-submenu .sub-arrow {
  flex-shrink: 0;
  margin-left: auto;
  transition: transform 0.25s ease;
  color: var(--ink-faint);
}
.has-submenu.open .sub-arrow {
  transform: rotate(180deg);
  color: var(--coral);
}
.has-submenu.open {
  color: var(--coral);
  background: rgba(237, 111, 92, 0.08);
  font-weight: 600;
}

.sub-menu {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
  padding-left: 21px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sub-menu.open {
  max-height: 420px;
}

.sub-item {
  display: flex;
  align-items: center;
  padding: 10px 13px;
  border-radius: 10px;
  color: var(--ink-mute);
  text-decoration: none;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 13px;
  transition: color 0.18s ease, background 0.18s ease;
  position: relative;
  min-height: 44px;
}
.sub-item::before {
  content: '—';
  margin-right: 8px;
  color: var(--line);
  font-size: 10px;
}
.sub-item:hover {
  color: var(--ink);
  background: rgba(21, 20, 15, 0.04);
}
.sub-item.active {
  color: var(--coral);
  background: rgba(237, 111, 92, 0.08);
  font-weight: 600;
}
.sub-item.active::before {
  color: var(--coral);
}

/* Mobile: sub-menu full width, touch targets */
@media (max-width: 900px) {
  .sub-menu {
    padding-left: 13px;
  }
  .sub-item {
    padding: 12px 14px;
    min-height: 44px;
    font-size: 13px;
  }
}

/* hamburger hidden by default; shown in <=900px media query */
.menu-toggle { display: none; }

/* ---- main content ---- */
.content { flex: 1; padding: 40px 48px 60px; min-width: 0; }

.page { display: none; }
.page.active { display: block; animation: fade 0.3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- page head ---- */
.page-head { margin-bottom: 28px; }
.label {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--coral);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.label::before { content: ''; width: 22px; height: 1px; background: var(--coral); }
.page-head h1 {
  font-family: var(--serif);
  font-size: clamp(34px, 4.4vw, 56px);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.05;
  margin: 10px 0 8px;
}
.muted { color: var(--ink-mute); font-family: var(--body); font-size: 15px; }

/* ---- stat cards ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin: 24px 0 20px;
}
.stat-card {
  background: var(--bone);
  border-radius: 18px;
  padding: 24px 24px 22px;
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(21, 20, 15, 0.06);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 46px; height: 46px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-radius: 0 18px 0 0;
}
.stat-label {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.stat-value {
  font-family: var(--mono);
  font-size: clamp(15px, 2.8vw, 28px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-top: 10px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
.stat-sub {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 8px;
}

/* ---- dashboard row ---- */
.dash-row {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

/* ---- card / panel ---- */
.card {
  background: var(--bone);
  border-radius: 18px;
  padding: 26px 28px;
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(21, 20, 15, 0.06);
  margin-bottom: 18px;
}
.card-title {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.card-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.card-head .card-title { flex: 1; margin-bottom: 0; }
.card-head .btn { flex-shrink: 0; padding: 8px 18px; font-size: 12px; }
.chart-card { min-height: 300px; }

/* ---- bar chart ---- */
.bar-chart { display: flex; flex-direction: column; gap: 12px; }
.bar-row {
  display: grid;
  grid-template-columns: 92px 1fr 120px;
  gap: 12px;
  align-items: center;
}
.bar-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-track { background: rgba(21, 20, 15, 0.07); border-radius: 6px; height: 20px; overflow: hidden; }
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--coral), var(--coral-soft));
  border-radius: 6px;
  transition: width 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.bar-row:nth-child(3n+2) .bar-fill { background: linear-gradient(90deg, var(--olive), #8b925f); }
.bar-row:nth-child(3n) .bar-fill { background: linear-gradient(90deg, var(--mustard), #f2cf7a); }
.bar-val {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---- donut ---- */
.donut-wrap { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.donut {
  width: 150px; height: 150px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}
.donut::after {
  content: '';
  position: absolute;
  inset: 38px;
  background: var(--bone);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(21, 20, 15, 0.06);
}
.legend { display: flex; flex-direction: column; gap: 10px; }
.legend-item { display: flex; align-items: center; gap: 9px; font-family: var(--sans); font-size: 13.5px; color: var(--ink); }
.legend-dot { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.legend-val { font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap.tall { max-height: 540px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  position: sticky; top: 0;
  background: var(--bone);
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  z-index: 1;
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
  color: var(--ink-soft);
}
tbody tr:hover { background: rgba(237, 111, 92, 0.05); }
tbody td:first-child { font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); }
td.num {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--ink);
}
th.num { text-align: right; }
td.mono, td.inv-no { font-family: var(--mono); font-size: 12px; }

.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--coral); }
.arrow { font-size: 9px; margin-left: 3px; color: var(--coral); }

/* ---- status badges (pills) ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1px solid;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.selesai { color: var(--olive); border-color: rgba(110, 116, 72, 0.4); background: rgba(110, 116, 72, 0.08); }
.badge.pending { color: var(--coral); border-color: rgba(237, 111, 92, 0.4); background: rgba(237, 111, 92, 0.08); }
.badge.pisah { color: #a9791a; border-color: rgba(233, 185, 74, 0.5); background: rgba(233, 185, 74, 0.14); }
.badge.linked { color: var(--olive); border-color: rgba(110, 116, 72, 0.4); background: rgba(110, 116, 72, 0.08); }
.badge.unlinked { color: var(--coral); border-color: rgba(237, 111, 92, 0.4); background: rgba(237, 111, 92, 0.08); }
.nav-badge { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; color: #fff; }
.nav-badge-overdue { background: var(--coral); }
.nav-badge-soon { background: #e9b94a; color: var(--ink); }

.import-drop {
  border: 1.5px dashed var(--line); border-radius: 10px; padding: 10px 16px;
  text-align: center; font-size: 12.5px; color: var(--ink-faint); background: var(--bone);
  margin-top: 8px; transition: border-color .15s, background .15s, color .15s;
}
.import-drop.drag-over { border-color: var(--coral); background: rgba(237,111,92,.07); color: var(--coral); }
.overdue-banner { background: rgba(237,111,92,.09); border: 1px solid rgba(237,111,92,.3); color: var(--coral); border-radius: 8px; padding: 8px 14px; margin-top: 8px; font-size: 12.5px; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.overdue-banner[hidden] { display:none !important; }
.bulk-bar { background: var(--ink); color: var(--bone); border-radius: 10px; padding: 10px 14px; margin-top: 8px; display:flex; align-items:center; gap:10px; flex-wrap:wrap; font-size: 12.5px; }
.bulk-bar[hidden] { display:none !important; }
.bulk-bar .btn { font-size: 12px; padding: 5px 10px; }

/* toggle badge: clickable status switch */
.badge-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 13px; border-radius: 999px;
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em; border: 1px solid;
  cursor: pointer; background: transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.badge-toggle::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-toggle:hover { transform: scale(1.06); box-shadow: 0 0 0 3px rgba(0,0,0,0.06); }
.badge-toggle:active { transform: scale(0.96); }
.badge-toggle.selesai { color: var(--olive); border-color: rgba(110, 116, 72, 0.4); background: rgba(110, 116, 72, 0.08); }
.badge-toggle.pending { color: var(--coral); border-color: rgba(237, 111, 92, 0.4); background: rgba(237, 111, 92, 0.08); }

/* ---- toolbar ---- */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 20px 0; }
.search {
  flex: 1; min-width: 220px;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 11px 20px;
  font-family: var(--sans);
  font-size: 14px;
}
.search::placeholder { color: var(--ink-faint); }
.search:focus, .select:focus { outline: none; border-color: var(--coral); }
.select {
  background: var(--paper-warm);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 11px 38px 11px 18px;
  font-family: var(--sans);
  font-size: 13.5px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 L6 7.5 L9 4.5' fill='none' stroke='%2315140f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 12px;
}
.input-sm {
  background: var(--paper-warm);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 16px;
  font-family: var(--sans);
  font-size: 13px;
}
.input-sm::placeholder { color: var(--ink-faint); }
.input-sm:focus { outline: none; border-color: var(--coral); box-shadow: 0 0 0 3px rgba(237,111,92,0.12); }
.select-sm {
  background: var(--paper-warm);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 36px 8px 14px;
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 L6 7.5 L9 4.5' fill='none' stroke='%2315140f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 12px;
}
.select-sm:focus { outline: none; border-color: var(--coral); box-shadow: 0 0 0 3px rgba(237,111,92,0.12); }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 11px 22px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}
.btn:hover { background: var(--coral); border-color: var(--coral); color: #fff; }

/* ---- status summary chips (klik untuk filter) ---- */
.status-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 0 0 20px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.16s ease;
  user-select: none;
}
.chip:hover { border-color: var(--coral); transform: translateY(-1px); }
.chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.chip .n { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }
.chip.active .n { color: var(--paper); opacity: 0.75; }

/* ---- inline cell editing ---- */
td[contenteditable="true"],
[contenteditable="true"] { cursor: text; outline: none; border-radius: 6px; }
td[contenteditable="true"]:hover,
[contenteditable="true"]:hover { background: rgba(233, 185, 74, 0.18); }
td[contenteditable="true"]:focus,
[contenteditable="true"]:focus {
  background: var(--bone);
  box-shadow: inset 0 0 0 1.5px var(--coral);
}
td.cell-num[contenteditable="true"] { text-align: right; font-family: var(--mono); }

/* kwitansi table: prevent overflow, allow horizontal scroll on wrap */
#kwitansi-body td,
#reimburse-body td { white-space: nowrap; }
#kwitansi-body td.actions,
#reimburse-body td.actions { width: 30px; }

/* editable stat cards & periode label (Rekap CC) */
.stat-value[contenteditable="true"],
#cc-periode span[contenteditable="true"] {
  display: inline-block;
  padding: 4px 8px;
  margin: 2px -8px;
  border-radius: 8px;
  transition: background 0.16s ease, box-shadow 0.16s ease;
}
.stat-value[contenteditable="true"]:hover,
#cc-periode span[contenteditable="true"]:hover {
  background: rgba(233, 185, 74, 0.18);
}
.stat-value[contenteditable="true"]:focus,
#cc-periode span[contenteditable="true"]:focus {
  background: var(--bone);
  box-shadow: inset 0 0 0 1.5px var(--coral);
}
.stat-value[contenteditable="true"]::after,
#cc-periode span[contenteditable="true"]::after {
  content: ' ✎';
  font-family: var(--sans);
  font-size: 12px;
  color: var(--coral);
  opacity: 0;
  transition: opacity 0.16s ease;
  margin-left: 4px;
  vertical-align: 2px;
}
.stat-value[contenteditable="true"]:hover::after,
#cc-periode span[contenteditable="true"]:hover::after {
  opacity: 1;
}
td .edit-hint {
  display: none;
  font-size: 10px;
  color: var(--coral);
  letter-spacing: 0.04em;
  margin-left: 6px;
  font-family: var(--sans);
}
tr:hover td .edit-hint { display: inline; }

/* ---- table footer ---- */
.table-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 4px 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  flex-wrap: wrap;
}
.table-footer strong { color: var(--ink); }

/* ---- monthly recap (Fitur 1) ---- */
.recap-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.recap-item {
  background: var(--paper-warm);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: inset 0 0 0 1px var(--line-soft);
  min-width: 0;
}
.recap-val {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recap-label {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 4px;
}
.recap-cols {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 28px;
}
.recap-col .mini-head { margin-top: 0; }
@media (max-width: 700px) { .recap-cols { grid-template-columns: 1fr; } }

/* ---- empty state (Fitur 2) ---- */
.empty-row td { text-align: center; }
.empty-state { padding: 44px 20px; }
.empty-state .empty-ico { font-size: 30px; margin-bottom: 8px; }
.empty-state p { font-family: var(--sans); font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.empty-state .muted { font-size: 13px; }

/* ---- dupe highlight (Fitur 10) ---- */
tr.dupe td { background: rgba(237, 111, 92, 0.12); }
tr.dupe td:first-child { box-shadow: inset 3px 0 0 var(--coral); }

/* ---- user switcher (Fitur 12) ---- */
.user-switch { display: inline-flex; align-items: center; gap: 8px; }
.user-switch select {
  background: var(--paper-warm);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 5px 12px;
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: none;
  cursor: pointer;
}
.user-role { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }

/* ---- approval badge for invoice status (Fitur 12) ---- */
.badge.approval-draft { color: var(--ink-faint); border-color: var(--line); background: rgba(21,20,15,0.04); }
.badge.approval-diajukan { color: #a9791a; border-color: rgba(233,185,74,0.5); background: rgba(233,185,74,0.14); }
.badge.approval-disetujui { color: var(--olive); border-color: rgba(110,116,72,0.4); background: rgba(110,116,72,0.08); }
.badge.approval-dibayar { color: #2f6d4f; border-color: rgba(47,109,79,0.4); background: rgba(47,109,79,0.1); }

/* ---- COA: Chart of Accounts table ---- */
.coa-table tr.coa-header td {
  font-weight: 700;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(21, 20, 15, 0.04);
  border-bottom: 1px solid var(--line);
}
.coa-table tr.coa-header td:first-child { font-family: var(--mono); font-size: 11px; color: var(--ink-mute); }
.coa-table tr.coa-header .badge { display: none; } /* hide badge on header rows, show text instead */
.coa-header-badge {
  font-family: var(--sans) !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  letter-spacing: 0.18em;
  color: var(--ink) !important;
  background: rgba(21, 20, 15, 0.06) !important;
  border-color: rgba(21, 20, 15, 0.18) !important;
}

/* COA tipe badges */
.coa-tipe-aset,
.coa-tipe-piutang { color: var(--olive); border-color: rgba(110,116,72,0.4); background: rgba(110,116,72,0.08); }
.coa-tipe-kewajiban,
.coa-tipe-hutang { color: var(--coral); border-color: rgba(237,111,92,0.4); background: rgba(237,111,92,0.08); }
.coa-tipe-ekuitas,
.coa-tipe-modal { color: #2f6d4f; border-color: rgba(47,109,79,0.4); background: rgba(47,109,79,0.1); }
.coa-tipe-pendapatan { color: #4a6fa5; border-color: rgba(74,111,165,0.4); background: rgba(74,111,165,0.08); }
.coa-tipe-beban { color: #a9791a; border-color: rgba(233,185,74,0.5); background: rgba(233,185,74,0.14); }

/* COA inline edit: nama akun */
.coa-nama-editable {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.16s ease, box-shadow 0.16s ease;
  cursor: text;
}
.coa-nama-editable:hover { background: rgba(233,185,74,0.18); }
.coa-nama-editable:focus {
  background: var(--bone);
  box-shadow: inset 0 0 0 1.5px var(--coral);
  outline: none;
}

/* ── Jurnal Umum ── */
.jurnal-entries-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}
.jurnal-entries-head span {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.jurnal-entries-container { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.jurnal-entry-row {
  display: grid;
  grid-template-columns: 1.3fr 0.85fr 0.85fr 36px;
  gap: 8px;
  align-items: start;
}
.jurnal-entry-row select,
.jurnal-entry-row input {
  background: var(--paper-warm);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--sans);
  font-size: 13.5px;
}
.jurnal-entry-row select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 L6 7.5 L9 4.5' fill='none' stroke='%2315140f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
}
.jurnal-entry-row select:focus,
.jurnal-entry-row input:focus { outline: none; border-color: var(--coral); }
.jurnal-entry-row .jurnal-delete-row {
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  align-self: start;
  margin-top: 2px;
}
.jurnal-entry-row .jurnal-delete-row:hover { border-color: var(--coral); color: var(--coral); }
.jurnal-balance {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 16px;
  padding: 13px 16px;
  border-radius: 12px;
  background: rgba(21, 20, 15, 0.04);
  font-family: var(--sans);
  font-size: 12px;
  flex-wrap: wrap;
}
.jurnal-balance-label {
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-size: 10.5px;
}
.jurnal-balance-debit { color: var(--coral); }
.jurnal-balance-kredit { color: var(--olive); }
.jurnal-balance-debit b, .jurnal-balance-kredit b { font-family: var(--mono); font-size: 13px; }
.jurnal-balance-status {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 4px 12px;
  border-radius: 999px;
  margin-left: auto;
}
.jurnal-balance-status.balanced { color: var(--olive); background: rgba(110,116,72,0.1); }
.jurnal-balance-status.unbalanced { color: var(--coral); background: rgba(237,111,92,0.1); }
/* Mobile: jurnal entry rows stack */
@media (max-width: 600px) {
  .jurnal-entry-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 10px;
    background: var(--paper-warm);
    border-radius: 12px;
    border: 1px solid var(--line);
    position: relative;
  }
  .jurnal-entry-row .jurnal-delete-row {
    position: absolute;
    top: 8px; right: 8px;
    width: 28px; height: 28px;
  }
}

/* COA sub-menu legacy — merged into main .sub-menu above */
.sub-item {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-mute);
  text-decoration: none;
  transition: color 0.16s ease, background 0.16s ease;
}
.sub-item:hover { color: var(--ink); background: rgba(21,20,15,0.04); }
.sub-item.active {
  color: var(--coral);
  background: rgba(237,111,92,0.08);
  font-weight: 600;
}
.has-submenu .sub-arrow {
  margin-left: auto;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.has-submenu.open .sub-arrow { transform: rotate(180deg); }

/* ============================================================
   Buku Besar (General Ledger)
   ============================================================ */

/* toolbar: dropdown akun + date filters */
.bb-toolbar {
  display: flex;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;
  margin-bottom: 21px;
  padding-bottom: 21px;
  border-bottom: 1px solid var(--line-soft);
}
.bb-filter-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.bb-filter-label {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
}

/* running balance table */
.bb-table tbody tr:first-child td {
  border-top: none;
}
.bb-table tfoot td {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  padding: 13px 14px;
  border-top: 2px solid var(--line);
  color: var(--ink);
  background: var(--paper-warm);
}
.bb-table tfoot td.num {
  font-weight: 600;
  color: var(--ink);
}

/* debit / kredit number styling */
.bb-table td.bb-debit {
  color: var(--coral);
}
.bb-table td.bb-kredit {
  color: var(--olive);
}
.bb-table td.bb-saldo-neg {
  color: var(--coral);
}

/* empty state */
.bb-empty {
  display: block;
  padding: 34px;
  text-align: center;
  color: var(--ink-mute);
  font-family: var(--sans);
  font-size: 14px;
  font-style: italic;
  border: 1px dashed var(--line);
  border-radius: 12px;
}

/* mobile */
@media (max-width: 600px) {
  .bb-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .bb-filter-group {
    justify-content: space-between;
  }
  .bb-table tbody td,
  .bb-table thead th {
    padding: 8px 6px;
    font-size: 11.5px;
  }
  .bb-table tfoot td {
    padding: 8px 6px;
    font-size: 11px;
  }
}

/* ---- save button (topbar) ---- */
.btn-save {
  background: var(--ink, #0d0d0f);
  color: var(--paper, #f7f4ec);
  border: none;
  border-radius: 999px;
  padding: 5px 18px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.15s, transform 0.15s;
  line-height: 1.5;
  white-space: nowrap;
}
.btn-save:hover  { opacity: 0.85; }
.btn-save:active { transform: scale(0.96); }

/* saving spinner */
.btn-save.saving {
  cursor: wait;
  opacity: 0.75;
}
.btn-save.saving::before {
  content: "";
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid transparent;
  border-top-color: #fff;
  border-radius: 50%;
  animation: save-spin 0.6s linear infinite;
  margin-right: 2px;
}
@keyframes save-spin { to { transform: rotate(360deg); } }

/* saved flash */
.btn-save.saved {
  background: #2f6d4f;
  transition: background 0.8s;
}
.btn-save.saved::before {
  content: "✓";
  display: inline-block;
  font-weight: bold;
  margin-right: 2px;
}

/* ---- toast ---- */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--ink);
  color: var(--paper);
  padding: 13px 24px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 13.5px;
  opacity: 0;
  transition: 0.3s ease;
  z-index: 100;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .layout { flex-direction: column; }

  /* ---- hamburger off-canvas sidebar (HP & tablet) ---- */
  /* sidebar-close removed — no extra X button */
  .topbar-left { display: inline-flex; align-items: center; gap: 8px; }
  .menu-toggle {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 44px; height: 44px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bone);
    color: var(--ink);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    z-index: 9;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  .sidebar {
    position: fixed !important;
    top: 0; left: 0;
    width: 280px !important;
    height: 100vh !important;
    flex-direction: column !important;
    align-items: stretch;
    transform: translateX(-105%);
    transition: transform 0.28s ease;
    z-index: 100;
    border-right: 1px solid var(--line);
    box-shadow: var(--shadow);
    overflow-y: auto;
    padding: 28px 20px;
  }
  .sidebar.open { transform: translateX(0); }
  .brand { padding: 0; }
  .brand-text { flex: 1; }
  .menu { flex-direction: column !important; overflow: visible; gap: 2px; margin: 0; flex: 1; }
  .menu-item { padding: 12px 14px; white-space: nowrap; }
  .menu-item .idx { display: inline; }
  .menu-item.active::after { display: block; }
  .sidebar-foot { display: block; }

  .content { padding: 28px 20px 50px; }
  .container { padding: 0 20px; }
  .dash-row { grid-template-columns: 1fr; }
}

/* ---- trend chart (bulanan) ---- */
.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 170px;
  padding-top: 10px;
}
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; position: relative; }
.trend-val { font-family: var(--mono); font-size: 10px; color: var(--ink-mute); white-space: nowrap; }
.trend-bar-wrap { width: 100%; max-width: 64px; height: 110px; display: flex; align-items: flex-end; }
.trend-bar {
  width: 100%;
  background: linear-gradient(180deg, var(--coral), var(--coral-soft));
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  transition: height 0.5s ease;
}
.trend-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; color: var(--ink-faint); text-transform: uppercase; }

/* ---- hint ---- */
.hint { font-family: var(--body); font-size: 11px; letter-spacing: 0; text-transform: none; color: var(--ink-faint); font-weight: 400; }

/* ---- overdue ---- */
.overdue-note { font-size: 14px; margin-bottom: 14px; color: var(--ink-soft); }
.overdue-note b { color: var(--coral); }

/* ---- actions / mini buttons ---- */
.actions { display: inline-flex; gap: 6px; justify-content: flex-end; }
.mini {
  width: 26px; height: 26px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper-warm);
  color: var(--ink-mute);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.mini:hover { border-color: var(--coral); color: var(--coral); }
.mini.del:hover { border-color: #b04a3a; color: #b04a3a; }
.mini.cycle { margin-left: 6px; }
.mini.koreksi-btn { font-size: 11px; }
.mini.koreksi-btn.active { border-color: #b04a3a; color: #b04a3a; background: #fbeae8; }

/* ---- button variants ---- */
.btn-accent { background: var(--coral); border-color: var(--coral); color: #fff; }
.btn-accent:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---- modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(21, 20, 15, 0.4);
  backdrop-filter: blur(2px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--bone);
  border-radius: 20px;
  padding: 30px 32px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 40px 90px -30px rgba(21, 20, 15, 0.4);
  position: relative;
}
.modal-close {
  position: absolute;
  top: 16px; right: 18px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}
.modal-close:hover { border-color: var(--coral); color: var(--coral); }
.modal-title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  margin: 8px 0 22px;
}
.modal-form .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field span {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.field.wide { grid-column: 1 / -1; }
.field input, .field select {
  background: var(--paper-warm);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 10px;
  padding: 11px 14px;
  font-family: var(--sans);
  font-size: 14px;
}
.field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 L6 7.5 L9 4.5' fill='none' stroke='%2315140f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 12px;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--coral); }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

/* ============================================================
   TASK / KANBAN / KALENDER / MONITORING (modul baru)
   ============================================================ */
.modal-wide { max-width: 760px; }
textarea#task-f-deskripsi {
  background: var(--paper-warm);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 10px;
  padding: 11px 14px;
  font-family: var(--body);
  font-size: 14px;
  resize: vertical;
}
textarea#task-f-deskripsi:focus { outline: none; border-color: var(--coral); }

/* task table */
.task-title { font-family: var(--sans); font-weight: 600; color: var(--ink); font-size: 14px; white-space: normal; }
.task-sub { font-family: var(--body); font-size: 11.5px; color: var(--ink-faint); white-space: normal; max-width: 320px; }
.assignee-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-family: var(--sans); font-size: 11.5px; font-weight: 600;
  color: var(--ink-soft); background: var(--paper-warm); border: 1px solid var(--line);
}
.assignee-chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.due { font-family: var(--mono); font-size: 11.5px; color: var(--ink-mute); }
.due em { font-style: normal; font-size: 10px; color: var(--ink-faint); display: block; }
.due-over { color: #b04a3a; }
.due-over em { color: #b04a3a; }
.due-today { color: var(--coral); }

.prio-rendah { color: var(--olive); border-color: rgba(110,116,72,0.4); background: rgba(110,116,72,0.08); }
.prio-sedang { color: #a9791a; border-color: rgba(233,185,74,0.5); background: rgba(233,185,74,0.14); }
.prio-tinggi { color: #b04a3a; border-color: rgba(237,111,92,0.4); background: rgba(237,111,92,0.1); }

.approval-draft { color: var(--ink-faint); border-color: var(--line); background: rgba(21,20,15,0.04); }
.approval-menunggu { color: #a9791a; border-color: rgba(233,185,74,0.5); background: rgba(233,185,74,0.14); }
.approval-disetujui { color: var(--olive); border-color: rgba(110,116,72,0.4); background: rgba(110,116,72,0.08); }
.approval-ditolak { color: #b04a3a; border-color: rgba(237,111,92,0.4); background: rgba(237,111,92,0.1); }

.progress-mini { width: 90px; height: 7px; background: rgba(21,20,15,0.08); border-radius: 6px; overflow: hidden; display: inline-block; vertical-align: middle; }
.progress-mini-fill { height: 100%; background: linear-gradient(90deg, var(--coral), var(--mustard)); border-radius: 6px; }
.progress-num { font-family: var(--mono); font-size: 10.5px; color: var(--ink-mute); margin-left: 6px; }

/* task chips (hari ini & overdue) */
.task-chip {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 14px;
  background: var(--paper-warm); border: 1px solid var(--line);
  margin-bottom: 8px; cursor: pointer; transition: all 0.16s ease;
}
.task-chip:hover { border-color: var(--coral); transform: translateX(3px); }
.task-chip-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.task-chip-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.task-chip-main b { font-family: var(--sans); font-size: 13.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-chip-main span { font-family: var(--body); font-size: 11px; color: var(--ink-mute); }
.task-chip-prio { font-family: var(--sans); font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; }
.task-chip-prio.tinggi { color: #b04a3a; background: rgba(237,111,92,0.12); }
.task-chip-prio.sedang { color: #a9791a; background: rgba(233,185,74,0.18); }
.task-chip-prio.rendah { color: var(--olive); background: rgba(110,116,72,0.1); }
.task-chip.overdue { border-left: 3px solid #b04a3a; }
.mini-head { font-family: var(--sans); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-faint); margin: 14px 0 8px; }

/* reminder rows */
.reminder-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line-soft); font-family: var(--sans); font-size: 13.5px; }
.reminder-row:last-child { border-bottom: none; }
.reminder-date { font-family: var(--mono); font-size: 11px; color: var(--coral); min-width: 70px; }
.reminder-title { flex: 1; color: var(--ink); }
.reminder-who { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }

/* subtask editor */
.subtask-editor { margin-top: 20px; border-top: 1px dashed var(--line); padding-top: 16px; }
.subtask-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.subtask-head h3 { font-family: var(--sans); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-faint); }
.subtask-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.subtask-row input[type="text"] {
  flex: 1; background: var(--paper-warm); border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; padding: 9px 13px; font-family: var(--sans); font-size: 13.5px;
}
.subtask-row input[type="text"]:focus { outline: none; border-color: var(--coral); }
.subtask-row input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--coral); cursor: pointer; }

/* kanban */
.kanban-toolbar { margin: 20px 0; }
.kanban { display: flex; gap: 16px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; }

/* mobile-only elements: hidden on desktop */
.show-mobile { display: none; }
.kanban-col {
  flex: 0 0 280px; background: var(--paper-warm);
  border: 1px solid var(--line); border-radius: 16px; padding: 12px;
  min-height: 220px;
}
.kanban-col-head {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink); margin-bottom: 12px; cursor: pointer; padding: 2px 4px; border-radius: 8px;
}
.kanban-col-head:hover { background: rgba(21,20,15,0.04); }
.kanban-count { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); background: rgba(21,20,15,0.06); border-radius: 999px; padding: 2px 9px; }
.kanban-col-body { display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.kanban-card {
  background: var(--bone); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 13px; cursor: grab; transition: all 0.16s ease;
  box-shadow: 0 4px 12px -6px rgba(21,20,15,0.12);
}
.kanban-card:hover { border-color: var(--coral); transform: translateY(-2px); }
.kanban-card.dragging { opacity: 0.45; }
.kanban-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.kchip { display: inline-flex; align-items: center; gap: 5px; font-family: var(--sans); font-size: 10.5px; font-weight: 600; color: var(--ink-mute); }
.kchip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.kprio { font-family: var(--sans); font-size: 9.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.kprio.tinggi { color: #b04a3a; background: rgba(237,111,92,0.12); }
.kprio.sedang { color: #a9791a; background: rgba(233,185,74,0.18); }
.kprio.rendah { color: var(--olive); background: rgba(110,116,72,0.1); }
.kanban-card-title { font-family: var(--sans); font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 10px; line-height: 1.3; }
.kanban-card-foot { display: flex; align-items: center; justify-content: space-between; font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); }
.kprogress { color: var(--coral); }

/* kalender */
.kalender-nav { display: flex; gap: 10px; margin: 20px 0; }
.kalender { font-size: 13px; }
.cal-head-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.cal-head { text-align: center; font-family: var(--sans); font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); padding: 6px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  min-height: 96px; background: var(--paper-warm); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px; cursor: pointer; transition: all 0.15s ease; overflow: hidden;
}
.cal-cell:hover { border-color: var(--coral); }
.cal-cell.out { opacity: 0.4; }
.cal-cell.today { border-color: var(--coral); box-shadow: inset 0 0 0 1px var(--coral); }
.cal-num { font-family: var(--mono); font-size: 11px; color: var(--ink-mute); display: block; margin-bottom: 5px; }
.cal-cell.today .cal-num { color: var(--coral); font-weight: 700; }
.cal-task {
  font-family: var(--sans); font-size: 10.5px; color: var(--ink-soft);
  background: rgba(21,20,15,0.04); border-left: 3px solid var(--c);
  border-radius: 5px; padding: 2px 6px; margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-more { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); }

/* monitoring */
.aging-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 4px; border-bottom: 1px solid var(--line-soft); font-family: var(--sans); font-size: 13.5px; }
.aging-row:last-child { border-bottom: none; }
.aging-label { color: var(--ink-soft); }
.aging-n { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--coral); }

/* assignee / team management */
.assignee-list { display: flex; flex-direction: column; gap: 8px; }
.assignee-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px;
  background: var(--paper-warm); border: 1px solid var(--line);
}
.assignee-row:hover { border-color: var(--coral); }
.assignee-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(21,20,15,0.12); }
.assignee-name {
  flex: 1; min-width: 0; font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--ink);
  background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 6px 10px;
}
.assignee-name:hover { border-color: var(--line); }
.assignee-name:focus { outline: none; border-color: var(--coral); background: var(--bone); }
.assignee-taskcount { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); white-space: nowrap; }
.assignee-actions { display: inline-flex; gap: 6px; }
.assignee-color-btn {
  width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line);
  cursor: pointer; padding: 0; flex-shrink: 0;
}
.assignee-color-btn::-webkit-color-swatch-wrapper { padding: 3px; }
.assignee-color-btn::-webkit-color-swatch { border: none; border-radius: 6px; }
.assignee-add-row { display: flex; gap: 10px; margin-top: 12px; }
.assignee-add-row input[type="text"] {
  flex: 1; background: var(--paper-warm); border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; padding: 10px 14px; font-family: var(--sans); font-size: 14px;
}
.assignee-add-row input[type="text"]:focus { outline: none; border-color: var(--coral); }
.badge.aksi-buat { color: var(--olive); border-color: rgba(110,116,72,0.4); background: rgba(110,116,72,0.08); }
.badge.aksi-edit { color: #a9791a; border-color: rgba(233,185,74,0.5); background: rgba(233,185,74,0.14); }
.badge.aksi-hapus { color: #b04a3a; border-color: rgba(237,111,92,0.4); background: rgba(237,111,92,0.1); }
.badge.aksi-pindah { color: var(--ink-mute); border-color: var(--line); background: rgba(21,20,15,0.04); }
.badge.aksi-setujui { color: var(--olive); border-color: rgba(110,116,72,0.4); background: rgba(110,116,72,0.08); }
.badge.aksi-tolak { color: #b04a3a; border-color: rgba(237,111,92,0.4); background: rgba(237,111,92,0.1); }

/* ---- print (export PDF) ---- */
@media print {
  /* sembunyikan elemen UI interaktif */
  .topbar, .sidebar, .toolbar, .toast, .actions, .mini, .btn,
  .status-chips, .edit-hint, .hint, .modal-backdrop, #import-file,
  .menu, .brand, .sidebar-foot, .pulse { display: none !important; }

  body::before { display: none; }

  /* pastikan warna ikut tercetak */
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html, body { background: #fff !important; }
  .shell, .layout { display: block !important; }
  .content { margin: 0; padding: 0; max-width: 100%; }

  /* hanya cetak halaman yang sedang aktif */
  .page { display: none !important; }
  .page.active { display: block !important; animation: none; }

  /* rapikan kartu & hilangkan dekorasi bayangan */
  .card, .stat-card {
    box-shadow: none !important;
    border: 1px solid #ccc;
    break-inside: avoid;
    border-radius: 8px;
  }
  .stat-card::after, .card-title::after { display: none; }

  /* lepas sticky header & buka scroll dalam tabel */
  .table-wrap, .table-wrap.tall { overflow: visible !important; max-height: none !important; }
  thead th { position: static !important; background: #fff !important; }
  thead { display: table-header-group; }
  table { font-size: 11px; }
  tbody td, thead th { white-space: normal; padding: 7px 9px; }
  tr { break-inside: avoid; }

  /* hilangkan tanda edit (pensil) */
  [contenteditable]::after { display: none !important; }
  .no-print { display: none !important; }
}

/* ============================================================
   MOBILE RESPONSIVE — max 640px (handphone)
   ============================================================ */
/* hamburger toggle hidden on desktop, shown in <=900px media query below */
/* backdrop: JS toggles `hidden` attribute; no display:none so [hidden] works */
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(21,20,15,0.4); z-index: 6; }
.sidebar-backdrop[hidden] { display: none; }

@media (max-width: 640px) {
  /* ── Golden ratio scale: 5 | 8 | 13 | 21 | 34 ── */
  body { font-size: 13px; line-height: 1.5; }
  /* Safe area: iOS notch & home indicator */
  body { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 8px); padding-right: env(safe-area-inset-right, 8px); }
  .container { padding: 0 8px; max-width: 100vw; }

  /* topbar: bare minimum */
  .topbar { padding: 5px 0; }
  .topbar-inner { font-size: 8px; gap: 5px; letter-spacing: 0.08em; }
  .topbar-inner .mid { display: none; }
  .topbar-inner .right { gap: 5px; }
  .topbar-inner .right .btn { padding: 5px 10px; font-size: 10px; }
  .topbar-inner .right span { font-size: 9px; }

  /* hamburger & overlay sidebar */
  .menu-toggle { display: flex; width: 32px; height: 32px; font-size: 17px; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 100;
    width: 260px !important; height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    padding: 21px 13px; border-right: 1px solid var(--line);
    box-shadow: 0 0 30px rgba(0,0,0,.12);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-backdrop {
    display: none; position: fixed; inset: 0; z-index: 99;
    background: rgba(21,20,15,.35);
  }
  .menu-backdrop.show { display: block; }

  /* content: minimal breathing */
  .content { padding: 13px 8px 34px; }
  .page-head { margin-bottom: 13px; }
  .page-head h1 { font-size: 21px; letter-spacing: -.01em; }
  .page-head .label { font-size: 9px; letter-spacing: .14em; gap: 6px; }
  .page-head .label::before { width: 13px; }
  .page-head .muted { font-size: 11px; margin-top: 2px; }

  /* ── cards: ghost — just a line, no shadow ── */
  .card {
    padding: 13px;
    margin-bottom: 8px;
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
    border: 1px solid var(--line-soft);
    border-left: 2px solid var(--line);
  }
  .card-title { font-size: 10px; letter-spacing: .14em; margin-bottom: 8px; }
  .card-title::after { display: none; }
  .card-head { margin-bottom: 8px; gap: 8px; }
  .card-head .btn { padding: 5px 10px; font-size: 10px; }

  /* stat cards → compact rows */
  .stat-grid { grid-template-columns: 1fr !important; gap: 5px; }
  .stat-card {
    padding: 8px 13px; min-width: 0; border-radius: 6px;
    background: transparent; box-shadow: none;
    border: 1px solid var(--line-soft);
    display: flex; align-items: center; justify-content: space-between;
  }
  .stat-card::after { display: none; }
  .stat-card:hover { transform: none; }
  .stat-label { font-size: 8px; letter-spacing: .1em; }
  .stat-value {
    white-space: nowrap;
    margin-top: 0; font-weight: 700;
  }
  .stat-sub { display: none; }

  /* hide heavy dashboard cards */
  .hide-mobile { display: none !important; }
  .show-mobile { display: block; }

  /* dash-row → single column */
  .dash-row { grid-template-columns: 1fr !important; gap: 8px; margin-bottom: 8px; }
  .chart-card { min-height: auto; }

  /* bar chart → compact */
  .bar-row { grid-template-columns: 60px 1fr 80px; gap: 6px; }
  .bar-label { font-size: 9px; }
  .bar-track { height: 13px; border-radius: 4px; }
  .bar-val { font-size: 9px; }
  .bar-chart { gap: 6px; }

  /* donut → tiny */
  .donut { width: 80px; height: 80px; }
  .donut::after { inset: 21px; }
  .legend { gap: 5px; }
  .legend-item { font-size: 10px; gap: 5px; }
  .legend-dot { width: 8px; height: 8px; }
  .legend-val { font-size: 9px; }

  /* recap */
  .recap-summary { grid-template-columns: 1fr !important; gap: 5px; }
  .recap-item { padding: 8px 13px; border: 1px solid var(--line-soft); border-radius: 6px; background: transparent; }
  .recap-val { font-size: 13px; font-weight: 700; }
  .recap-label { font-size: 9px; margin-top: 0; }

  /* toolbar: ultra compact */
  .toolbar { gap: 5px; margin: 8px 0; }
  .toolbar .search, .toolbar .select { flex: 1 1 100%; min-width: 0; font-size: 11px; padding: 6px 8px; }
  .toolbar .btn { flex: 0 0 auto; padding: 6px 10px; font-size: 10px; }

  /* table: ghost mode */
  .table-wrap { -webkit-overflow-scrolling: touch; overflow-x: auto; }
  .table-wrap table { font-size: 10px; min-width: 420px; }
  .table-wrap th, .table-wrap td { padding: 5px 6px; white-space: nowrap; }
  .table-wrap .amount { white-space: nowrap; font-size: 10px; }
  .table-wrap::after {
    content: "← geser →"; display: block; text-align: center;
    font-size: 8px; color: var(--ink-faint); padding: 4px 0 0;
    letter-spacing: .08em; text-transform: uppercase;
  }
  .table-footer { font-size: 10px; padding: 5px 0; }
  thead th { background: var(--paper); }

  /* modal: bottom sheet */
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-width: 100%; border-radius: 13px 13px 0 0; max-height: 88vh; overflow-y: auto; padding: 16px 13px; }
  .modal .form-grid { grid-template-columns: 1fr !important; gap: 8px; }
  .modal .field.wide { grid-column: auto; }
  .modal-actions { flex-direction: row; gap: 5px; }
  .modal-actions .btn { flex: 1; font-size: 11px; padding: 8px; }

  /* kanban */
  .kanban { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .kanban-col { min-width: 200px; flex: 0 0 200px; }
  .kanban-col-head { font-size: 9px; }
  .kanban-card { padding: 8px 9px; }

  /* kalender */
  .kalender { font-size: 9px; }
  .kalender .day { min-height: 32px; }

  /* scan OCR page */
  .scan-upload-card { padding: 13px; }
  .scan-dropzone { padding: 16px 10px; border-radius: 8px; }
  .scan-dropzone-icon { font-size: 28px; }
  .scan-dropzone-text { font-size: 13px; }
  .scan-dropzone-sub { font-size: 10px; }
  .scan-mode-row { gap: 6px; margin-bottom: 10px; }
  .scan-mode-label { font-size: 10px; }
  .scan-mode-btn { font-size: 11px; padding: 5px 12px; }
  .scan-review-item { padding: 8px 10px; gap: 8px; }
  .scan-review-thumb { width: 40px; height: 40px; }
  .scan-review-info { font-size: 11px; }
  .scan-review-cb { width: 16px; height: 16px; }

  /* recurring / checklist */
  .recurring-card .btn { width: 100%; font-size: 10px; }

  /* touch: tappable rows */
  td[contenteditable="true"], [contenteditable="true"] { min-height: 36px; padding: 6px !important; }

  /* login */
  .login-card { padding: 34px 21px; max-width: 300px; }
  .login-title { font-size: 18px; }
  .login-input { padding: 10px 14px; font-size: 13px; }
  .login-btn { padding: 10px; font-size: 13px; }
}

/* ── Tablet breakpoint (768px+) ── */
@media (min-width: 768px) and (max-width: 1024px) {
  .container { padding: 0 21px; }
  .content { padding: 21px 21px 34px; }
  .card { padding: 18px 21px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .stat-value { font-size: 18px; }
  .dash-row { grid-template-columns: 1fr 1fr !important; }
  .sidebar { width: 200px; padding: 21px 13px; }
  .menu-item { font-size: 12px; padding: 8px 10px; }
  table { font-size: 12px; }
  .recap-cols { grid-template-columns: 1fr; }
  .hide-mobile { display: none !important; }
  .show-mobile { display: block; }
}

/* ── Touch targets: min 44px ── */
.btn, .btn-accent, .btn-ghost, .btn-save,
.menu-item, .select, .search,
td[contenteditable="true"], [contenteditable="true"],
.scan-mode-btn, .mini, .modal-actions .btn {
  min-height: 44px;
}
@media (max-width: 640px) {
  .btn, .btn-accent, .btn-ghost { min-height: 36px; padding: 6px 10px; }
}

/* ── Fluid typography ── */
.stat-value { font-size: clamp(13px, 5vw, 28px) !important; }
.page-head h1 { font-size: clamp(21px, 6vw, 56px); }

/* ---- login gate ---- */
.login-gate {
  position: fixed; inset: 0; z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper);
  font-family: var(--sans);
  transition: opacity 0.4s ease;
}
.login-gate[aria-hidden="true"] {
  opacity: 0; pointer-events: none;
}
.login-card {
  text-align: center; padding: 50px 40px;
  background: var(--paper-warm);
  border-radius: 20px;
  box-shadow: 0 4px 40px rgba(21, 20, 15, 0.08), 0 0 0 1px var(--line);
  max-width: 360px; width: 90%;
}
.login-logo { margin-bottom: 16px; }
.login-title {
  font-family: var(--serif);
  font-size: 24px; font-weight: 600;
  color: var(--ink); margin: 0 0 4px;
}
.login-question {
  font-size: 14px; color: var(--ink-mute);
  margin: 0 0 28px; font-style: italic;
}
.login-input {
  width: 100%; padding: 13px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-family: var(--mono); font-size: 15px;
  color: var(--ink); text-align: center;
  outline: none; box-sizing: border-box;
  transition: border-color 0.2s;
}
.login-input:focus { border-color: var(--coral); }
.login-btn {
  width: 100%; padding: 12px;
  border: none; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font-family: var(--sans); font-size: 14px;
  font-weight: 600; cursor: pointer;
  margin-top: 14px;
  transition: opacity 0.2s, transform 0.15s;
}
.login-btn:hover { opacity: 0.85; }
.login-btn:active { transform: scale(0.97); }
.login-err {
  margin: 14px 0 0; font-size: 13px;
  color: var(--coral); font-weight: 500;
}


/* ── OCR scan row ── */
.ocr-row { display:flex; align-items:center; gap:10px; margin-bottom:16px; padding:12px; border:1px dashed var(--border); border-radius:10px; background:var(--paper-warm) }
.ocr-btn { display:inline-flex; align-items:center; gap:6px; white-space:nowrap }
.ocr-status { font-size:13px; color:var(--muted); min-width:60px }

/* ── Bulk scan ── */
.btn-sm { font-size:12px; padding:4px 10px }
.bulk-item { display:flex; align-items:center; gap:10px; padding:8px; border-bottom:1px solid var(--border); font-size:13px }
.bulk-item:last-child { border-bottom:none }
.bulk-item-thumb { width:48px; height:48px; object-fit:cover; border-radius:6px; flex-shrink:0 }
.bulk-item-info { flex:1; line-height:1.4 }
.bulk-item-del { color:var(--coral); cursor:pointer; padding:4px 8px; border:none; background:none; font-size:16px }
.bulk-actions { display:flex; gap:8px; margin-top:8px; justify-content:flex-end }

/* ── Scan OCR Page ── */
.scan-upload-card { padding:28px 24px }
.scan-mode-row { display:flex; align-items:center; gap:10px; margin-bottom:20px }
.scan-mode-label { font-size:13px; font-weight:600; text-transform:uppercase; letter-spacing:.5px; color:var(--muted) }
.scan-mode-btn { font-size:13px; padding:6px 18px; border-radius:20px; border:1px solid var(--border); background:#fff; cursor:pointer; transition:all .2s }
.scan-mode-btn.active { background:var(--coral); color:#fff; border-color:var(--coral) }
.scan-dropzone { border:2px dashed var(--border); border-radius:12px; padding:32px 20px; text-align:center; cursor:pointer; transition:all .2s; background:var(--paper-warm) }
.scan-dropzone:hover, .scan-dropzone.drag-over { border-color:var(--coral); background:var(--rose) }
.scan-dropzone-icon { font-size:40px; display:block; margin-bottom:8px }
.scan-dropzone-text { font-size:15px; font-weight:600; margin:0 0 4px }
.scan-dropzone-sub { font-size:12px; color:var(--muted); margin:0 }
.scan-dropzone-btns { display:flex; gap:8px; margin-top:14px; justify-content:center; flex-wrap:wrap }
.scan-progress { margin-top:16px }
.scan-progress-bar { height:6px; background:var(--border); border-radius:3px; overflow:hidden; margin-bottom:6px }
.scan-progress-fill { height:100%; background:var(--coral); border-radius:3px; width:0%; transition:width .3s }
#scan-progress-text { font-size:12px; color:var(--muted) }

.scan-review-item { display:flex; align-items:center; gap:12px; padding:12px 16px; border-bottom:1px solid var(--border); transition:background .15s }
.scan-review-item:hover { background:var(--paper-warm) }
.scan-review-cb { flex-shrink:0; width:18px; height:18px; accent-color:var(--coral); cursor:pointer }
.scan-review-thumb { width:56px; height:56px; object-fit:cover; border-radius:6px; cursor:pointer; flex-shrink:0; border:1px solid var(--border); transition:transform .2s,max-width .2s,max-height .2s }
.scan-review-thumb.expanded { position:fixed; top:50%; left:50%; transform:translate(-50%,-50%); width:auto; height:auto; max-width:90vw; max-height:80vh; z-index:9999; border-radius:10px; box-shadow:0 0 40px rgba(0,0,0,.3) }
.scan-review-info { flex:1; min-width:0; font-size:13px; line-height:1.5 }
.scan-review-label { display:inline-block; font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:1px; padding:2px 8px; border-radius:4px; margin-right:8px; background:var(--border); color:var(--muted) }
.scan-review-reject { color:var(--coral); font-size:12px }
.scan-review-del { flex-shrink:0; width:28px; height:28px; border:none; background:none; color:var(--muted); font-size:20px; cursor:pointer; border-radius:50%; display:flex; align-items:center; justify-content:center; transition:all .15s }
.scan-review-del:hover { background:#fee; color:var(--coral) }

/* ── Jurnal Umum (my implementation: jurnal-rm, balance-line) ── */
.jurnal-entries-head {
  display: grid;
  grid-template-columns: 1.3fr 0.85fr 0.85fr 36px;
  gap: 8px;
  margin-top: 14px;
  padding: 0 2px;
}
.jurnal-entries-head span {
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-faint);
}
.jurnal-entry-row .jurnal-rm {
  width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--line); background: transparent;
  color: var(--ink-faint); cursor: pointer; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  align-self: start; transition: all .15s ease;
}
.jurnal-entry-row .jurnal-rm:hover { border-color: var(--coral); color: var(--coral); }
#jurnal-add-row { margin-top: 10px; }
.jurnal-balance-line { margin-top: 14px; padding: 12px 16px; border-radius: 12px; background: rgba(21,20,15,0.04); font-size: 13px; }
.jurnal-balance-line .jb-ok { color: var(--olive); font-weight: 600; }
.jurnal-balance-line .jb-bad { color: var(--coral); font-weight: 600; }
.jurnal-balance-line.balanced { background: rgba(110,116,72,0.1); }
.jurnal-balance-line.unbalanced { background: rgba(237,111,92,0.1); }

/* ── Neraca Saldo ── */
.ns-table tr.ns-header td { background: var(--paper-dark); font-weight: 700; letter-spacing: .08em; }
.ns-table tfoot td { border-top: 2px solid var(--ink); font-size: 13px; padding-top: 12px; }

/* ── Laba Rugi & Neraca ── */
.lr-toolbar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.lr-section { margin-bottom: 21px; }
.lr-sec-title { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-mute); margin: 0 0 8px; }
.lr-table { width: 100%; border-collapse: collapse; }
.lr-table td { padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.lr-table tr.lr-total td { border-top: 2px solid var(--ink); border-bottom: none; font-weight: 700; padding-top: 10px; }
.lr-result {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 21px; border-radius: 13px; margin-top: 8px;
  font-size: 15px; font-weight: 700;
}
.lr-result.laba { background: rgba(110,116,72,0.12); color: var(--olive); }
.lr-result.rugi { background: rgba(237,111,92,0.12); color: var(--coral); }
.lr-result strong { font-family: var(--mono); font-size: 20px; }
.lr-result .badge-toggle { font-weight: 600; }

@media (max-width: 600px) {
  .jurnal-entries-head { grid-template-columns: 1fr; }
  .jurnal-entries-head span:nth-child(n+2) { display: none; }
  .jurnal-entry-row { grid-template-columns: 1fr; }
  .lr-result { flex-direction: column; gap: 8px; text-align: center; }
}

/* ══ AI Chat Agent ══ */
.chat-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 1200;
  width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--coral), #d9553f);
  color: #fff; font-size: 24px; line-height: 1;
  box-shadow: 0 6px 20px rgba(237, 111, 92, 0.45), 0 2px 6px rgba(0,0,0,0.2);
  transition: transform .15s ease, box-shadow .15s ease;
}
.chat-fab:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 10px 26px rgba(237, 111, 92, 0.55); }
.chat-fab:active { transform: scale(0.96); }

.chat-panel {
  position: fixed; right: 20px; bottom: 88px; z-index: 1200;
  width: 372px; max-width: calc(100vw - 24px);
  height: 560px; max-height: calc(100vh - 120px);
  display: flex; flex-direction: column;
  background: var(--bone); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 18px 50px rgba(21, 20, 15, 0.35), 0 4px 12px rgba(0,0,0,0.12);
  overflow: hidden;
}
.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--ink); color: var(--bone);
}
.chat-head-left { display: flex; align-items: center; gap: 10px; }
.chat-avatar { display: none; } /* legacy sparkle — replaced by .chat-avatar-img */
.chat-avatar-img {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover;
  border: 1.5px solid rgba(247, 241, 222, 0.35); flex-shrink: 0;
}
.chat-title { font-weight: 700; font-size: 14.5px; letter-spacing: .02em; }
.chat-sub { font-size: 11.5px; color: rgba(247, 241, 222, 0.65); margin-top: 1px; }
.chat-close {
  background: none; border: none; color: var(--bone); font-size: 18px;
  cursor: pointer; padding: 10px 12px; border-radius: 10px; opacity: .9;
  min-width: 44px; min-height: 44px; /* touch target HP */
}
.chat-close:hover { opacity: 1; background: rgba(247,241,222,0.12); }

.chat-body {
  flex: 1; overflow-y: auto; padding: 14px 14px 8px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--paper);
}
.chat-msg { display: flex; }
.chat-msg-user { justify-content: flex-end; }
.chat-msg-ai { justify-content: flex-start; }
.chat-bubble {
  max-width: 84%; padding: 9px 13px; border-radius: 15px;
  font-size: 13.5px; line-height: 1.5; word-wrap: break-word;
}
.chat-bubble-user {
  background: var(--coral); color: #fff;
  border-bottom-right-radius: 5px;
}
.chat-bubble-ai {
  background: var(--paper-dark); color: var(--ink);
  border-bottom-left-radius: 5px;
}
.chat-typing-dot { display: inline-flex; gap: 4px; padding: 4px 2px; }
.chat-typing-dot span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint);
  animation: chatBlink 1.2s infinite;
}
.chat-typing-dot span:nth-child(2) { animation-delay: .2s; }
.chat-typing-dot span:nth-child(3) { animation-delay: .4s; }
@keyframes chatBlink { 0%, 70%, 100% { opacity: .25; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }

.chat-pending {
  padding: 10px 12px; border-top: 1px dashed var(--line);
  background: rgba(233, 185, 74, 0.14); font-size: 12.5px;
}
.chat-pending-title { font-weight: 700; margin-bottom: 6px; color: var(--ink-soft); }
.chat-pending-item { padding: 4px 8px; background: var(--bone); border: 1px solid var(--line-soft); border-radius: 8px; margin-bottom: 5px; font-size: 12.5px; }
.chat-pending-btns { display: flex; gap: 8px; margin-top: 8px; }

.chat-form {
  display: flex; gap: 8px; padding: 10px 12px; align-items: center;
  border-top: 1px solid var(--line); background: var(--bone);
}
.chat-input {
  flex: 1; border: 1px solid var(--line); border-radius: 20px;
  padding: 9px 14px; font-size: 13.5px; background: #fff;
  color: var(--ink); outline: none;
}
.chat-input:focus { border-color: var(--coral); }
.chat-send {
  width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--ink); color: var(--bone); font-size: 15px;
  transition: transform .12s ease, background .12s ease;
}
.chat-send:hover { background: var(--coral); transform: scale(1.06); }
.chat-send:active { transform: scale(0.94); }
.chat-send:disabled { opacity: .5; cursor: default; }

.chat-attach-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--bone); color: var(--ink-faint); cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background .14s ease, border-color .14s ease, color .14s ease, transform .12s ease;
}
.chat-attach-btn:hover { background: var(--paper-dark); border-color: var(--coral); color: var(--coral); }
.chat-attach-btn:active { transform: scale(0.94); }
.chat-attach-preview {
  display: flex; gap: 8px; padding: 8px 12px; flex-wrap: wrap;
  border-top: 1px solid var(--line); background: var(--paper);
}
.chat-attach-preview[hidden] { display: none !important; }
.chat-attach-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bone); border: 1px solid var(--line); border-radius: 20px;
  padding: 4px 8px 4px 10px; font-size: 12px; color: var(--ink-soft);
  max-width: 220px;
}
.chat-attach-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-attach-chip-x {
  width: 18px; height: 18px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--line); color: var(--ink-soft); font-size: 11px; line-height: 18px; text-align: center; flex-shrink: 0;
}
.chat-attach-chip-x:hover { background: var(--coral); color: #fff; }
.chat-attach-thumb { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; border: 1px solid var(--line); flex-shrink: 0; }
.chat-bubble-attach { margin-top: 6px; }
.chat-bubble-attach img { max-width: 180px; max-height: 140px; border-radius: 10px; border: 1px solid rgba(0,0,0,.08); }
.chat-bubble-attach .attach-file-label { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }

@media (max-width: 600px) {
  .chat-fab { right: 14px; bottom: 14px; width: 52px; height: 52px; }
  .chat-panel {
    right: 8px; left: 8px; bottom: 74px;
    width: auto; height: min(560px, calc(100vh - 100px));
    border-radius: 16px;
  }
}

/* Hidden WAJIB menang atas display:flex — tanpa ini tombol close tidak berfungsi */
.chat-panel[hidden], .chat-fab[hidden] { display: none !important; }

.view-only-banner {
  background: rgba(237,111,92,.10); border: 1px dashed rgba(237,111,92,.35); border-radius: 12px;
  padding: 10px 14px; margin: 0 0 14px 0; font-size: 13px; color: var(--ink-soft);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.view-only-banner[hidden] { display: none !important; }
.view-only-banner .btn { flex-shrink: 0; }

/* View-only lock: sebelum mantra "Frieren my bubub" semua edit terkunci */
html:not([data-edit="unlocked"]) [data-edit],
html:not([data-edit="unlocked"]) [data-del],
html:not([data-edit="unlocked"]) [data-cycle],
html:not([data-edit="unlocked"]) [data-koreksi],
html:not([data-edit="unlocked"]) [data-kw-del],
html:not([data-edit="unlocked"]) [data-reimb-del],
html:not([data-edit="unlocked"]) [data-cc-del],
html:not([data-edit="unlocked"]) [data-reimb-toggle],
html:not([data-edit="unlocked"]) [data-task-open],
html:not([data-edit="unlocked"]) [data-kanban-add],
html:not([data-edit="unlocked"]) #add-btn,
html:not([data-edit="unlocked"]) #kwitansi-add-btn,
html:not([data-edit="unlocked"]) #reimburse-add-btn,
html:not([data-edit="unlocked"]) #cc-add-btn,
html:not([data-edit="unlocked"]) #task-add-btn,
html:not([data-edit="unlocked"]) #kanban-add-col,
html:not([data-edit="unlocked"]) #assignee-add-btn,
html:not([data-edit="unlocked"]) #task-sub-add,
html:not([data-edit="unlocked"]) #import-file + label,
html:not([data-edit="unlocked"]) #hutang-add-btn,
html:not([data-edit="unlocked"]) [data-hutang-del],
html:not([data-edit="unlocked"]) [data-hutang-toggle],
html:not([data-edit="unlocked"]) #perkiraan-add-btn,
html:not([data-edit="unlocked"]) [data-perkiraan-del],
html:not([data-edit="unlocked"]) [data-perkiraan-toggle],
html:not([data-edit="unlocked"]) #alokasi-add-btn,
html:not([data-edit="unlocked"]) [data-alokasi-del],
html:not([data-edit="unlocked"]) #bulk-bar button,
html:not([data-edit="unlocked"]) #bulk-status {
  opacity: .35; pointer-events: none; filter: grayscale(.3);
}
html:not([data-edit="unlocked"]) [contenteditable] {
  pointer-events: none; opacity: .75;
}
html:not([data-edit="unlocked"]) [contenteditable]:focus {
  outline: none !important;
}
