/* ==========================================================
   KAS NEGARA - Linear / Raycast Inspired Matte Dark Design
   Human-Crafted, High-Craftsmanship, Zero-Slop Architecture
   ========================================================== */

:root {
  /* Linear Neutral Palette (Zinc / Charcoal Matte) */
  --bg-app: #0c0d0e;
  --bg-surface: #141517;
  --bg-surface-raised: #18191c;
  --bg-surface-hover: #1e2024;
  --bg-subtle: #22242a;
  
  --border-subtle: #222429;
  --border-default: #282a30;
  --border-strong: #383a42;
  
  --text-primary: #f4f4f6;
  --text-secondary: #9ea3ae;
  --text-muted: #6b7280;
  --text-dim: #4b5260;
  
  /* Precision Functional Accents (Non-neon, calibrated) */
  --emerald: #10b981;
  --emerald-bg: rgba(16, 185, 129, 0.08);
  --emerald-border: rgba(16, 185, 129, 0.2);
  --emerald-text: #34d399;
  
  --rose: #f43f5e;
  --rose-bg: rgba(244, 63, 94, 0.08);
  --rose-border: rgba(244, 63, 94, 0.2);
  --rose-text: #fb7185;
  
  --blue: #38bdf8;
  --blue-bg: rgba(56, 189, 248, 0.08);
  --blue-border: rgba(56, 189, 248, 0.2);
  --blue-text: #7dd3fc;
  
  --amber: #fbbf24;
  --amber-bg: rgba(251, 191, 36, 0.08);
  --amber-border: rgba(251, 191, 36, 0.2);
  --amber-text: #fde68a;

  --purple: #c084fc;
  --purple-bg: rgba(192, 132, 252, 0.08);
  
  /* Shadow: Crisp inner highlight + subtle depth */
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-subtle);
  --shadow-modal: 0 16px 36px -4px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--border-strong);
  
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* NAVBAR */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-app);
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 24px;
}

.nav-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon {
  font-size: 16px;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text-primary);
}

.brand-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
}

.clock-badge {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--text-secondary);
}

/* MAIN CONTENT */
.main-content {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px;
}

/* TOP KPI GRID */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.15s ease;
}

.kpi-card:hover {
  border-color: var(--border-default);
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.kpi-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
}

.badge-cyan { background: var(--blue-bg); color: var(--blue-text); border-color: var(--blue-border); }
.badge-emerald { background: var(--emerald-bg); color: var(--emerald-text); border-color: var(--emerald-border); }
.badge-amber { background: var(--amber-bg); color: var(--amber-text); border-color: var(--amber-border); }

.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 12px;
}

.currency-symbol {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-number {
  font-size: clamp(1.6rem, 2.2vw, 2.1rem);
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.kpi-sub-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.sub-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
}

.sub-dot { width: 6px; height: 6px; border-radius: 50%; }
.dot-emerald { background: var(--emerald); }
.dot-blue { background: var(--blue); }
.dot-purple { background: var(--purple); }

.sub-label { color: var(--text-muted); }
.sub-val { font-weight: 600; font-family: 'JetBrains Mono', monospace; color: var(--text-secondary); }

.kpi-formula-bar {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.formula-chip {
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.74rem;
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  gap: 4px;
}

.chip-neg { background: var(--rose-bg); color: var(--rose-text); border: 1px solid var(--rose-border); }
.chip-pos { background: var(--emerald-bg); color: var(--emerald-text); border: 1px solid var(--emerald-border); }

/* LOAN PROGRESS */
.loan-progress-wrap { margin-bottom: 10px; }
.loan-progress-text { display: flex; justify-content: space-between; font-size: 0.76rem; margin-bottom: 6px; color: var(--text-secondary); }
.percent-label { font-weight: 600; color: var(--amber-text); }
.progress-bar-bg { width: 100%; height: 6px; background: var(--bg-surface-raised); border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--amber); border-radius: 3px; transition: width 0.3s ease; }
.loan-sub-info { display: flex; justify-content: space-between; align-items: center; font-size: 0.76rem; color: var(--text-muted); }

/* DASHBOARD 3-COLUMN / 2-COLUMN GRID */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 0.95fr;
  gap: 16px;
}

.col-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  min-width: 0;
  min-height: 560px;
  display: flex;
  flex-direction: column;
}

.col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.col-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.col-icon { font-size: 1.1rem; }
.col-title { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.2px; }
.col-actions { display: flex; gap: 6px; }

/* CATEGORY TABS (Linear Segmented Control) */
.category-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding: 3px;
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.cat-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.cat-tab:hover {
  color: var(--text-secondary);
}

.cat-tab.active {
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* ACCOUNTS LIST */
.accounts-list-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  max-height: 480px;
  padding-right: 4px;
}

.account-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.account-item:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-default);
}

.acc-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.acc-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
}

.cat-cash { background: var(--emerald-bg); color: var(--emerald-text); border: 1px solid var(--emerald-border); }
.cat-bank { background: var(--blue-bg); color: var(--blue-text); border: 1px solid var(--blue-border); }
.cat-server { background: var(--amber-bg); color: var(--amber-text); border: 1px solid var(--amber-border); }
.cat-ewallet { background: var(--purple-bg); color: var(--purple); border: 1px solid rgba(192, 132, 252, 0.2); }
.cat-other { background: var(--bg-subtle); color: var(--text-secondary); border: 1px solid var(--border-default); }

.acc-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.acc-category { font-size: 0.68rem; color: var(--text-dim); text-transform: uppercase; }

.acc-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.acc-balance {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* FAMILY STRIP */
.family-summary-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.f-strip-card {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
}

.f-green { background: var(--emerald-bg); border: 1px solid var(--emerald-border); }
.f-red { background: var(--rose-bg); border: 1px solid var(--rose-border); }

.f-label { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.5px; }
.f-green .f-label { color: var(--emerald-text); }
.f-red .f-label { color: var(--rose-text); }

.f-val { font-family: 'JetBrains Mono', monospace; font-size: 0.98rem; font-weight: 700; margin: 2px 0; }
.f-green .f-val { color: var(--emerald-text); }
.f-red .f-val { color: var(--rose-text); }
.f-sub { font-size: 0.66rem; color: var(--text-muted); }

/* FAMILY LIST (2-Row Layout, Never Overlaps) */
.family-list-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  max-height: 420px;
  padding-right: 4px;
}

.family-card-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  min-width: 0;
}

.family-card-item:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-default);
}

.fam-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.fam-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.fam-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-status {
  font-size: 0.66rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid transparent;
}

.badge-titip { background: var(--emerald-bg); color: var(--emerald-text); border-color: var(--emerald-border); }
.badge-talang { background: var(--rose-bg); color: var(--rose-text); border-color: var(--rose-border); }
.badge-lunas { background: var(--bg-subtle); color: var(--text-muted); border-color: var(--border-default); }

.fam-balance {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.fam-row-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-top: 5px;
  border-top: 1px solid var(--border-subtle);
  min-width: 0;
}

.fam-notes {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.fam-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* COLUMN 3: OPERASIONAL & CLOSING */
.brilink-live-box {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 12px;
}

.b-box-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.b-badge { font-size: 0.7rem; font-family: 'JetBrains Mono', monospace; color: var(--blue-text); }
.b-status-pill { font-size: 0.68rem; color: var(--emerald-text); background: var(--emerald-bg); border: 1px solid var(--emerald-border); padding: 1px 6px; border-radius: var(--radius-xs); }
.b-stats-row { display: flex; justify-content: space-between; }
.b-stat-lbl { font-size: 0.75rem; color: var(--text-muted); }
.b-stat-val { font-family: 'JetBrains Mono', monospace; font-size: 0.88rem; margin-left: 4px; }

.latest-closing-box {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 14px;
}

.box-title { font-size: 0.78rem; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.c-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.c-info-item { display: flex; flex-direction: column; gap: 2px; }
.c-lbl { font-size: 0.7rem; color: var(--text-dim); }
.c-val { font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; font-weight: 700; }

.closing-cta-card {
  margin-top: auto;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}

.closing-cta-card h4 { font-size: 0.92rem; font-weight: 700; margin-bottom: 3px; color: var(--text-primary); }
.closing-cta-card p { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 10px; }

/* BUTTONS (Crisp Linear/Apple style) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

/* Primary Button: Solid White (High contrast against dark) */
.btn-primary {
  background: #ffffff;
  color: #0c0d0e;
  border-color: #ffffff;
  font-weight: 700;
}

.btn-primary:hover {
  background: #e4e4e7;
  border-color: #e4e4e7;
}

.btn-primary.btn-glow {
  /* remove blur glow, use sharp contrast */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.btn-secondary {
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.btn-outline:hover {
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn-sm { padding: 4px 8px; font-size: 0.74rem; }
.btn-xs { padding: 2px 7px; font-size: 0.7rem; border-radius: var(--radius-xs); }
.btn-lg { padding: 10px 16px; font-size: 0.88rem; }
.btn-block { width: 100%; }
.btn-icon-only { width: 26px; height: 26px; padding: 0; border-radius: var(--radius-xs); font-size: 1rem; }

/* MODALS */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-lg { max-width: 680px; }
.modal-xl { max-width: 820px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 { font-size: 0.98rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.2px; }
.modal-close { background: none; border: none; font-size: 1.25rem; color: var(--text-muted); cursor: pointer; }
.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 18px; overflow-y: auto; }
.modal-footer { padding: 12px 18px; border-top: 1px solid var(--border-subtle); display: flex; justify-content: flex-end; gap: 8px; }

/* FORMS (Linear Style: Solid Slate Inputs) */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; }

.form-control {
  width: 100%;
  background: var(--bg-app);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: #6366f1;
}

.form-control-lg { font-size: 1.15rem; font-family: 'JetBrains Mono', monospace; font-weight: 700; padding: 8px 12px; }
.input-rupiah { font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.form-hint { font-size: 0.7rem; color: var(--text-dim); display: block; margin-top: 4px; }

/* RADIO TOGGLE GROUP */
.radio-toggle-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.radio-btn {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: var(--bg-surface-raised);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.radio-btn input { display: none; }
.radio-btn:has(input:checked).radio-green { background: var(--emerald-bg); border-color: var(--emerald); color: var(--emerald-text); }
.radio-btn:has(input:checked).radio-red { background: var(--rose-bg); border-color: var(--rose); color: var(--rose-text); }

/* BULK UPDATE GRID */
.bulk-inputs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-height: 400px; overflow-y: auto; padding-right: 4px; }
.bulk-item { background: var(--bg-surface-raised); padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-subtle); }
.bulk-item-label { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }

/* CLOSING MODAL LAYOUT */
.closing-step-indicator { display: flex; justify-content: space-between; align-items: center; background: var(--bg-app); border: 1px solid var(--border-subtle); padding: 8px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; }
.inline-date-input { background: var(--bg-surface); border: 1px solid var(--border-default); color: #fff; padding: 4px 8px; border-radius: var(--radius-xs); font-family: inherit; font-size: 0.8rem; margin-left: 6px; }

.toggle-switch { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.78rem; color: var(--text-secondary); }
.toggle-switch input { display: none; }
.toggle-slider { width: 32px; height: 18px; background: var(--border-strong); border-radius: 999px; position: relative; transition: 0.2s; }
.toggle-slider::before { content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: 0.2s; }
.toggle-switch input:checked + .toggle-slider { background: #6366f1; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(14px); }

.closing-layout-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; }
.section-heading { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; letter-spacing: 0.5px; text-transform: uppercase; }
.entry-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.entry-row span { font-size: 0.78rem; color: var(--text-secondary); }
.entry-row .form-control { width: 150px; }
.calc-box { background: var(--bg-app); border: 1px solid var(--border-default); border-radius: var(--radius-sm); padding: 12px; }
.calc-line { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 6px; }
.calc-line strong { font-family: 'JetBrains Mono', monospace; }
.calc-divider { border: 0; border-top: 1px solid var(--border-subtle); margin: 8px 0; }
.highlight-line { font-size: 0.88rem; font-weight: 700; color: #fff; }
.net-profit-line { font-size: 0.95rem; font-weight: 800; padding-top: 4px; }

/* DATA TABLES (Crisp High-Density) */
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; text-align: left; }
.data-table th { padding: 8px 10px; background: var(--bg-app); color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border-default); }
.data-table td { padding: 8px 10px; border-bottom: 1px solid var(--border-subtle); font-family: 'JetBrains Mono', monospace; }
.data-table tr:hover td { background: var(--bg-surface-raised); }

/* TOAST */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-modal);
  z-index: 2000;
  font-size: 0.82rem;
  font-weight: 600;
  display: none;
}

.toast.show { display: block; }

/* UTILITY COLORS */
.text-emerald { color: var(--emerald-text) !important; }
.text-cyan { color: var(--blue-text) !important; }
.text-amber { color: var(--amber-text) !important; }
.text-rose { color: var(--rose-text) !important; }
.mt-3 { margin-top: 10px; }
.mt-4 { margin-top: 14px; }

/* ==========================================================
   CASH CALCULATOR & TAPE ACCUMULATOR (LINEAR MATTE)
   ========================================================== */
.calc-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.calc-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.calc-tab-btn:hover {
  color: var(--text-secondary);
}

.calc-tab-btn.active {
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.tape-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.tape-input {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--emerald-text);
}

.tape-list-container {
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tape-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', monospace;
}

.tape-item:hover {
  background: var(--bg-surface-hover);
}

.tape-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tape-index {
  color: var(--text-dim);
  font-size: 0.7rem;
  min-width: 18px;
}

.tape-amount {
  font-weight: 700;
  color: var(--text-primary);
}

.tape-item-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tape-subtotal {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.tape-del-btn {
  background: none;
  border: none;
  color: var(--rose-text);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 1px 5px;
  border-radius: 3px;
}

.tape-del-btn:hover {
  background: var(--rose-bg);
}

.tape-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.76rem;
  padding: 18px;
}

.quick-chip-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
}

.chip-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-weight: 600;
  margin-right: 4px;
}

.btn-chip {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-chip:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.btn-chip-clear {
  margin-left: auto;
  background: var(--rose-bg);
  border-color: var(--rose-border);
  color: var(--rose-text);
}

.calc-textarea {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-app);
  border: 1px solid var(--border-default);
  padding: 10px 12px;
}

.sheet-counter-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 10px;
}

.sheet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
}

.denom-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 85px;
}

.denom-100k { color: #fb7185; }
.denom-50k { color: #60a5fa; }
.denom-20k { color: #34d399; }
.denom-10k { color: #c084fc; }
.denom-5k { color: #fde68a; }
.denom-2k { color: #a1a1aa; }
.denom-1k { color: #38bdf8; }
.denom-coin { color: #fbbf24; }

.sheet-input-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sheet-qty {
  width: 70px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  padding: 3px 6px;
}

.sheet-unit {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.sheet-subtotal {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  min-width: 100px;
  text-align: right;
  color: var(--text-primary);
}

.calc-result-display {
  background: var(--bg-app);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  margin-top: 12px;
}

.result-top-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.result-number-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin: 3px 0;
}

.result-currency {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
}

.result-amount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.result-parsed-formula {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem;
  color: var(--text-dim);
}

/* ==========================================================
   RESPONSIVENESS (1044PX, TABLETS, MOBILE)
   ========================================================== */

/* Laptop / Medium Desktop (<= 1200px, includes 1044px) */
@media (max-width: 1200px) {
  .navbar {
    padding: 8px 16px;
  }
  .nav-container {
    gap: 10px;
  }
  .main-content {
    padding: 14px 16px;
  }

  /* 2-column KPI Grid at 1044px */
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .card-loan {
    grid-column: span 2;
  }

  /* 2-column Dashboard Grid at 1044px */
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .col-daily {
    grid-column: span 2;
    min-height: auto;
  }

  /* Horizontal layout inside Operasional & Closing when spanning 2 cols */
  .col-daily .col-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    min-height: auto;
  }
  .col-daily .col-header {
    grid-column: span 2;
    margin-bottom: 6px;
  }
  .col-daily .brilink-live-box {
    margin-bottom: 0;
  }
  .col-daily .latest-closing-box {
    margin-bottom: 0;
  }
  .col-daily .closing-cta-card {
    grid-column: span 2;
    margin-top: 4px;
  }
}

/* Tablet Portrait & Small Screens (<= 768px) */
@media (max-width: 768px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .card-loan {
    grid-column: span 1;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .col-daily {
    grid-column: span 1;
  }
  .col-daily .col-card {
    display: flex;
    flex-direction: column;
  }

  .closing-layout-grid {
    grid-template-columns: 1fr;
  }

  .header-status {
    gap: 6px;
  }
  .clock-badge {
    display: none;
  }
}

/* Mobile Screens (<= 540px) */
@media (max-width: 540px) {
  .navbar {
    padding: 8px 12px;
  }
  .brand-logo {
    width: 28px;
    height: 28px;
  }
  .logo-icon {
    font-size: 14px;
  }
  .brand-title {
    font-size: 0.95rem;
  }
  .brand-sub {
    display: none;
  }
  .status-pill {
    display: none;
  }
  .btn-sm {
    padding: 4px 8px;
    font-size: 0.72rem;
  }
  .bulk-inputs-grid {
    grid-template-columns: 1fr;
  }
}


/* Tap + Hold & Drag Reorder Styles */
.account-item {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.account-item:active {
  cursor: grabbing;
}

.account-item.dragging {
  opacity: 0.85;
  transform: scale(1.02);
  background: var(--bg-surface-hover) !important;
  border-color: #6366f1 !important;
  box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.7), 0 0 0 1px #6366f1;
  z-index: 50;
}

.account-item.drag-over {
  border-top: 2px solid #6366f1 !important;
}

.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 1rem;
  margin-right: 4px;
  cursor: grab;
  transition: color 0.15s ease;
}

.account-item:hover .drag-handle {
  color: var(--text-muted);
}


/* Holding Balance Styles */
.holding-subtext {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}

.holding-badge {
  font-size: 0.65rem;
  color: var(--amber-text);
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  margin-left: 4px;
}

.bulk-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.bulk-calc-helper {
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--emerald-text);
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
}


.acc-edit-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  transition: all 0.15s ease;
  margin-left: 6px;
  opacity: 0.6;
}

.account-item:hover .acc-edit-btn {
  opacity: 1;
  color: var(--text-secondary);
}

.acc-edit-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}
