/* CAF Retail — App Stylesheet
 * Generated 2026-07-13 (v1), polished 2026-07-14 (v2)
 * Stitch-inspired + Material 3 tokens from Design/DESIGN.md
 * Inter font + Material Symbols loaded via Google Fonts in header.php
 */

/* === Tokens (from DESIGN.md) === */
:root {
  --surface:                #fbf8ff;
  --surface-dim:            #dbd9e2;
  --surface-container-lowest: #ffffff;
  --surface-container-low:  #f4f2fc;
  --surface-container:      #efedf6;
  --surface-container-high: #e9e7f0;
  --surface-container-highest: #e3e1ea;
  --on-surface:             #1a1b22;
  --on-surface-variant:     #454652;
  --inverse-surface:        #2f3037;
  --inverse-on-surface:     #f2eff9;
  --outline:                #757684;
  --outline-variant:        #c5c5d4;
  --surface-tint:           #4355b9;
  --primary:                #24389c;
  --on-primary:             #ffffff;
  --primary-container:      #3f51b5;
  --on-primary-container:   #cacfff;
  --inverse-primary:        #bac3ff;
  --secondary:              #505f76;
  --on-secondary:           #ffffff;
  --secondary-container:    #d0e1fb;
  --on-secondary-container: #54647a;
  --tertiary:               #6c3400;
  --on-tertiary:            #ffffff;
  --tertiary-container:     #8f4700;
  --on-tertiary-container:  #ffc7a2;
  --error:                  #ba1a1a;
  --on-error:               #ffffff;
  --error-container:        #ffdad6;
  --on-error-container:     #93000a;
  --primary-fixed:          #dee0ff;
  --primary-fixed-dim:      #bac3ff;
  --on-primary-fixed:       #00105c;
  --on-primary-fixed-variant: #293ca0;
  --background:             #fbf8ff;
  --on-background:          #1a1b22;
  --surface-variant:        #e3e1ea;

  /* Semantic colors */
  --success:                #2bae66;
  --success-50:             #d1fae5;
  --success-700:            #047857;
  --warning:                #f4a93c;
  --warning-50:             #fef3c7;
  --warning-700:            #92400e;
  --danger:                 #ba1a1a;
  --danger-50:              #fee2e2;
  --danger-700:             #b91c1c;
  --info:                   #2563eb;
  --info-50:                #dbeafe;
  --info-700:               #1e40af;
}

/* === Reset === */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-family: 'Inter', system-ui, -apple-system, sans-serif; -webkit-text-size-adjust: 100%; }
body { font-size: 14px; line-height: 1.5; color: var(--on-surface); background: var(--surface); }
.material-symbols-outlined { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; vertical-align: middle; user-select: none; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* === Type scale === */
.headline-lg { font-size: 32px; font-weight: 700; line-height: 40px; letter-spacing: -0.02em; }
.headline-md { font-size: 20px; font-weight: 600; line-height: 28px; }
.headline-sm { font-size: 16px; font-weight: 600; line-height: 24px; }
.body-lg     { font-size: 16px; font-weight: 400; line-height: 24px; }
.body-md     { font-size: 14px; font-weight: 400; line-height: 20px; }
.label-md    { font-size: 12px; font-weight: 600; line-height: 16px; letter-spacing: 0.05em; text-transform: uppercase; }

/* === Utility colors === */
.bg-surface                { background: var(--surface); }
.bg-surface-container-lowest, .bg-surface-container-lowest { background: #ffffff; }
.bg-surface-container-low  { background: var(--surface-container-low); }
.bg-surface-container      { background: var(--surface-container); }
.bg-surface-container-high { background: var(--surface-container-high); }
.bg-primary                { background: var(--primary); }
.bg-primary-container      { background: var(--primary-container); }
.text-on-surface           { color: var(--on-surface); }
.text-on-surface-variant   { color: var(--on-surface-variant); }
.text-on-primary           { color: var(--on-primary); }
.text-on-primary-container { color: var(--on-primary-container); }
.text-primary              { color: var(--primary); }
.border-outline            { border-color: var(--outline); }
.border-outline-variant    { border-color: var(--outline-variant); }

.bg-amber-100 { background: #fef3c7; } .text-amber-900 { color: #78350f; }
.bg-blue-100  { background: #dbeafe; } .text-blue-900  { color: #1e3a8a; }
.bg-red-100   { background: #fee2e2; } .text-red-900   { color: #7f1d1d; }
.bg-emerald-100 { background: #d1fae5; } .text-emerald-900 { color: #064e3b; }
.bg-indigo-100 { background: #e0e7ff; } .text-indigo-900 { color: #312e81; }
.bg-gray-100  { background: #f3f4f6; } .text-gray-900  { color: #111827; }
.bg-amber-500 { background: #f59e0b; }
.bg-indigo-500 { background: #6366f1; }
.bg-red-500   { background: #ef4444; }
.bg-amber-600 { background: #d97706; }
.bg-emerald-600 { background: #059669; }
.bg-emerald-700 { background: #047857; }
.bg-red-600   { background: #dc2626; }
.bg-red-700   { background: #b91c1c; }
.bg-indigo-600 { background: #4f46e5; }
.bg-indigo-700 { background: #4338ca; }
.bg-blue-600  { background: #2563eb; }
.bg-blue-700  { background: #1d4ed8; }
.text-white   { color: #fff; }
.text-success { color: var(--success-700); }
.text-danger  { color: var(--danger-700); }
.text-warning { color: var(--warning-700); }
.text-info    { color: var(--info-700); }
.text-muted   { color: var(--on-surface-variant); }

/* === Layout === */
.min-h-screen { min-height: 100vh; }
.flex { display: flex; } .inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0%; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; } .items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.space-y-1 > * + * { margin-top: 4px; }
.space-y-2 > * + * { margin-top: 8px; }
.space-y-3 > * + * { margin-top: 12px; }
.space-y-4 > * + * { margin-top: 16px; }
.space-y-6 > * + * { margin-top: 24px; }
.sticky { position: sticky; } .top-0 { top: 0; } .top-16 { top: 64px; }
.fixed { position: fixed; } .relative { position: relative; } .absolute { position: absolute; }
.z-40 { z-index: 40; } .z-50 { z-index: 50; }
.hidden { display: none; } .block { display: block; }
.w-full { width: 100%; } .w-7 { width: 28px; } .w-9 { width: 36px; } .w-16 { width: 64px; }
.w-32 { width: 128px; } .w-40 { width: 160px; } .w-60 { width: 240px; }
.h-7  { height: 28px; } .h-9 { height: 36px; } .h-16 { height: 64px; }
.max-w-md { max-width: 448px; } .max-w-7xl { max-width: 1280px; } .max-w-4xl { max-width: 896px; }
.min-w-0 { min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-auto { margin-top: auto; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.ml-2 { margin-left: 8px; } .-ml-2 { margin-left: -8px; } .mr-xs { margin-right: 4px; }
.p-2 { padding: 8px; } .p-3 { padding: 12px; } .p-4 { padding: 16px; }
.p-6 { padding: 24px; } .p-8 { padding: 32px; }
.px-2 { padding-left: 8px; padding-right: 8px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.px-6 { padding-left: 24px; padding-right: 24px; }
.py-1 { padding-top: 4px; padding-bottom: 4px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-2\.5 { padding-top: 10px; padding-bottom: 10px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.py-6 { padding-top: 24px; padding-bottom: 24px; }
.pt-2 { padding-top: 8px; } .pt-3 { padding-top: 12px; } .pt-4 { padding-top: 16px; }
.pb-2 { padding-bottom: 8px; } .pb-4 { padding-bottom: 16px; }

/* === Border / radius / shadow === */
.border { border: 1px solid var(--outline-variant); }
.border-t { border-top: 1px solid var(--outline-variant); }
.border-b { border-bottom: 1px solid var(--outline-variant); }
.border-r { border-right: 1px solid var(--outline-variant); }
.border-l-4 { border-left: 4px solid; }
.rounded    { border-radius: 4px; }
.rounded-md { border-radius: 6px; }
.rounded-lg { border-radius: 8px; }
.rounded-xl { border-radius: 12px; }
.rounded-2xl { border-radius: 16px; }
.rounded-full { border-radius: 9999px; }
.shadow { box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.shadow-lg { box-shadow: 0 10px 15px rgba(0,0,0,0.08); }

/* === Text === */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-xs { font-size: 12px; } .text-sm { font-size: 14px; } .text-base { font-size: 16px; }
.text-lg { font-size: 18px; } .text-xl { font-size: 20px; } .text-2xl { font-size: 24px; } .text-3xl { font-size: 30px; }
.font-medium { font-weight: 500; } .font-semibold { font-weight: 600; } .font-bold { font-weight: 700; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.05em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leading-tight { line-height: 1.25; }
.capitalize { text-transform: capitalize; }

/* === Buttons & inputs === */
.transition { transition: all 0.15s ease; }
.hover\:bg-surface-container:hover { background: var(--surface-container); }
.hover\:bg-surface-container-high:hover { background: var(--surface-container-high); }
.hover\:opacity-90:hover { opacity: 0.9; }
.focus\:border-primary:focus { border-color: var(--primary); outline: none; }
.focus\:ring-2:focus { box-shadow: 0 0 0 3px rgba(36, 56, 156, 0.2); }
.outline-none { outline: none; }

/* === Card (basic) === */
.card {
  background: #fff;
  border: 1px solid var(--outline-variant);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--outline-variant); }
.card-body { padding: 20px; }

/* === Stat cards (basic — used in karyawan dashboard) === */
.stat-card {
  background: #fff;
  border: 1px solid var(--outline-variant);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.stat-card .label { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; color: var(--on-surface-variant); text-transform: uppercase; }
.stat-card .value { font-size: 28px; font-weight: 700; line-height: 36px; margin-top: 8px; color: var(--on-surface); font-variant-numeric: tabular-nums; }
.stat-card .footer { font-size: 12px; color: var(--on-surface-variant); margin-top: 8px; }

/* === Tables === */
.table-wrapper { overflow-x: auto; background: #fff; border: 1px solid var(--outline-variant); border-radius: 12px; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table thead { background: var(--surface-container); }
table.data-table th { padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--on-surface-variant); border-bottom: 1px solid var(--outline-variant); }
table.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--outline-variant); }
table.data-table tbody tr:last-child td { border-bottom: 0; }
table.data-table tbody tr:hover { background: var(--surface-container-low); }
table.data-table td.numeric, table.data-table th.numeric { text-align: right; font-variant-numeric: tabular-nums; }
table.data-table td.truncate-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.data-table td.truncate-cell:hover { position: relative; }
table.data-table td.truncate-cell:hover::after {
  content: attr(data-full);
  position: absolute;
  left: 0; top: 100%;
  background: var(--inverse-surface); color: var(--inverse-on-surface);
  padding: 6px 10px; border-radius: 6px;
  font-size: 12px; white-space: normal;
  max-width: 360px; z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.table-wrapper.sticky-header { max-height: 600px; overflow: auto; }
.table-wrapper.sticky-header table.data-table thead th {
  position: sticky; top: 0;
  background: var(--surface-container); z-index: 1;
  box-shadow: 0 1px 0 var(--outline-variant);
}

.tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

/* === Code === */
code { font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace; font-size: 13px; }

/* === Responsive grid === */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: 1fr; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* Mobile: md: classes have no effect (default state) */
@media (max-width: 768px) {
  .md\:grid-cols-3 { grid-template-columns: 1fr; }
  .md\:grid-cols-2 { grid-template-columns: 1fr; }
  .md\:block { display: block; }
  .md\:flex { display: flex; }
  /* .md\:hidden intentionally NOT set — keeps element visible on mobile */
  .grid-cols-1-sm { grid-template-columns: 1fr !important; }
}
/* FIX: min-width breakpoints for md: classes (Tailwind-style) */
@media (min-width: 769px) {
  .md\:block { display: block; }
  /* !important needed to override .appbar-icon-btn (display:inline-flex) etc */
  .md\:hidden { display: none !important; }
  .md\:flex { display: flex; }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ============================================================ */
/* CAF Retail — Polish v4 (Stitch-matched, 2026-07-14)            */
/* Reference: D:\Nugraha Group\CAF retail\stitch_simplified_retail_caf */
/* ============================================================ */

/* Stitch-style tokens */
:root {
  --stitch-navy:          #1E2A5E;
  --stitch-navy-hover:    #142047;
  --stitch-lavender-bg:   #F5F7FB;
  --stitch-lavender-active: #E8ECF7;
  --stitch-cream:          #FDFCF7;
  --stitch-border:         #E5E7EB;
  --stitch-charcoal:       #1F2937;
  --stitch-gray-500:       #6B7280;
  --stitch-gray-400:       #9CA3AF;
  --stitch-red:            #DC2626;
  --stitch-red-bg:         #FEE2E2;
  --stitch-blue:           #2563EB;
  --stitch-green:          #047857;
  --stitch-green-bg:       #D1FAE5;
}

/* Page header (Stitch-style: H1 + subtitle left, controls right) */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--stitch-charcoal);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 4px;
}
.page-subtitle {
  font-size: 14px;
  color: var(--stitch-gray-500);
  line-height: 1.4;
}
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Pill button (period chip + export) */
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface-container-lowest);
  border: 1px solid var(--stitch-border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--stitch-charcoal);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.pill-btn:hover { background: var(--stitch-lavender-bg); border-color: var(--stitch-blue); text-decoration: none; }
.pill-btn.primary { color: var(--stitch-blue); }
.pill-btn.primary:hover { background: var(--stitch-lavender-active); }
.pill-btn .material-symbols-outlined { font-size: 18px; }
.pill-btn .chevron { font-size: 16px; }

/* KPI row: 3 equal columns (Stitch pattern) */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}
@media (max-width: 900px) {
  .kpi-row { grid-template-columns: 1fr; }
}

/* KPI card (Stitch cream surface) */
.kpi-card {
  position: relative;
  background: var(--stitch-cream);
  border: 1px solid var(--stitch-border);
  border-radius: 8px;
  padding: 24px;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi-card .kpi-icon {
  position: absolute;
  top: 18px;
  right: 18px;
  font-size: 22px;
  color: var(--stitch-gray-400);
}
.kpi-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--stitch-gray-500);
  text-transform: uppercase;
  margin: 0;
}
.kpi-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--stitch-charcoal);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  margin: 8px 0;
}
.kpi-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--stitch-gray-500);
  margin-top: auto;
}
.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.kpi-trend.up   { background: var(--stitch-green-bg); color: var(--stitch-green); }
.kpi-trend.down { background: var(--stitch-red-bg); color: var(--stitch-red); }
.kpi-info-icon { font-size: 14px; color: var(--stitch-gray-400); }

/* Two-column section (Stitch: gap analysis 2/3 + activity 1/3) */
.two-col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
}

/* Card (base for both gap analysis & activity) */
.two-col .card { margin-bottom: 0; }
.two-col .card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  padding: 20px;
}
.two-col .card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--stitch-charcoal);
  margin-bottom: 2px;
}
.two-col .card-subtitle {
  font-size: 12px;
  color: var(--stitch-gray-500);
}
.two-col .card-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--stitch-blue);
  text-decoration: none;
}
.two-col .card-link:hover { text-decoration: underline; }

/* Variance pill (Stitch-style red badge) */
.variance-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--stitch-red-bg);
  color: var(--stitch-red);
}
.variance-pill.under {
  background: var(--stitch-green-bg);
  color: var(--stitch-green);
}

/* ID link (Stitch-style blue) */
.id-link {
  color: var(--stitch-blue);
  font-weight: 500;
  text-decoration: none;
}
.id-link:hover { text-decoration: underline; }

/* Activity feed */
.activity-feed {
  list-style: none;
  padding: 0 20px 20px 20px;
  margin: 0;
}
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--stitch-border);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.activity-icon .material-symbols-outlined { font-size: 18px; }
.activity-icon-success { background: var(--stitch-blue); }
.activity-icon-danger  { background: var(--stitch-red); }
.activity-icon-info    { background: var(--stitch-blue); }
.activity-body { flex: 1; min-width: 0; }
.activity-text {
  font-size: 13px;
  color: var(--stitch-charcoal);
  line-height: 1.4;
  margin-bottom: 2px;
}
.activity-time {
  font-size: 11px;
  color: var(--stitch-gray-500);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 24px;
}
.empty-state .empty-icon {
  font-size: 40px;
  color: var(--stitch-gray-400);
  display: block;
  margin-bottom: 12px;
}
.empty-state h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--stitch-charcoal);
  margin-bottom: 4px;
}
.empty-state p {
  font-size: 12px;
  color: var(--stitch-gray-500);
  max-width: 280px;
  margin: 0 auto;
}

/* Sidebar refinements (Stitch lavender bg) */
aside#sidebar {
  background: var(--stitch-lavender-bg) !important;
  border-right: 1px solid var(--stitch-border);
}
.nav-item.active {
  background: var(--stitch-lavender-active) !important;
  color: var(--stitch-navy) !important;
}
.nav-item.active::before { background: var(--stitch-navy) !important; }
.nav-item:hover { background: var(--stitch-lavender-active); }
.nav-section-label { color: var(--stitch-gray-500); }

/* Table refinements (Stitch: warm white) */
.two-col .data-table thead { background: var(--stitch-lavender-bg); }
.two-col .data-table th { color: var(--stitch-gray-500); }
.two-col .data-table td.numeric { color: var(--stitch-charcoal); }
.two-col .card .data-table { border: none; }

/* Appbar (Stitch-style simple) */
.appbar {
  background: #fff !important;
  border-bottom: 1px solid var(--stitch-border) !important;
  height: 64px !important;
}

/* ============================================================ */
/* Polish v5 — Layout alignment (2026-07-14)                     */
/* Fix: navbar + sidebar + main alignment via fixed sidebar +     */
/* padded main. Header content lives in constrained container.   */
/* ============================================================ */

:root {
  --sidebar-width: 240px;
  --sidebar-width-collapsed: 0px;
  --appbar-height: 64px;
}

body {
  display: block;
}

/* Appbar — full width, hamburger + actions only (brand moved to sidebar) */
.appbar {
  background: #fff;
  border-bottom: 1px solid var(--stitch-border);
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--appbar-height);
  display: flex;
  align-items: center;
}
.appbar-inner {
  width: 100%;
  height: 100%;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
@media (min-width: 901px) {
  .appbar-inner { padding: 0 24px; }
}

.appbar-left, .appbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}
.appbar-right { gap: 4px; }

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--stitch-navy);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(30, 42, 94, 0.2);
}
.brand-mark .material-symbols-outlined { font-size: 20px; }
.brand-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.brand-name { font-size: 15px; font-weight: 700; color: var(--stitch-charcoal); line-height: 1.1; white-space: nowrap; }
.brand-host { font-size: 11px; color: var(--stitch-gray-500); line-height: 1.2; white-space: nowrap; }
@media (max-width: 640px) {
  .brand-host { display: none; }
}

/* Appbar icon buttons (bell, logout) */
.appbar-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 10px;
  color: var(--stitch-gray-500);
  cursor: pointer;
  transition: all 0.15s ease;
  background: transparent;
  border: none;
  text-decoration: none;
}
.appbar-icon-btn:hover { background: var(--stitch-lavender-bg); color: var(--stitch-charcoal); text-decoration: none; }
.appbar-icon-btn .material-symbols-outlined { font-size: 22px; }

.notif-badge {
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
}

/* User chip */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border-radius: 9999px;
  background: var(--stitch-lavender-active);
  color: var(--stitch-navy);
  text-decoration: none;
  transition: all 0.15s ease;
  margin-left: 4px;
}
.user-chip:hover { background: #d8def0; text-decoration: none; }
.user-chip .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--stitch-navy);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.user-meta { display: flex; flex-direction: column; gap: 0; line-height: 1.2; }
.user-name { font-size: 13px; font-weight: 600; color: var(--stitch-navy); white-space: nowrap; }
.user-role { font-size: 10px; color: var(--stitch-gray-500); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; white-space: nowrap; }
@media (max-width: 640px) {
  .user-meta { display: none; }
}

/* Sidebar — fixed-position, full height below appbar */
.layout {
  display: block; /* simple block layout; sidebar is fixed */
  min-height: calc(100vh - var(--appbar-height));
}
aside#sidebar {
  position: fixed;
  top: var(--appbar-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--appbar-height));
  background: var(--stitch-lavender-bg) !important;
  border-right: 1px solid var(--stitch-border);
  overflow-y: auto;
  z-index: 40;
  transition: transform 0.25s ease;
}
/* Tailwind .hidden wins specificity in mobile, override for desktop */
@media (min-width: 901px) {
  aside#sidebar.hidden { display: block !important; }
}
/* On mobile: hidden by Tailwind .hidden; can be toggled open via JS .open class */
@media (max-width: 900px) {
  aside#sidebar { transform: translateX(-100%); }
  aside#sidebar.open { transform: translateX(0); display: block; }
}

/* Brand in sidebar (Stitch pattern: logo at top of left nav) */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  text-decoration: none;
  border-bottom: 1px solid var(--stitch-border);
  background: var(--stitch-lavender-bg);
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--stitch-navy);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(30, 42, 94, 0.2);
}
.sidebar-brand-mark .material-symbols-outlined { font-size: 20px; }
.sidebar-brand-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sidebar-brand-name {
  font-size: 15px; font-weight: 700;
  color: var(--stitch-charcoal);
  line-height: 1.1; white-space: nowrap;
}
.sidebar-brand-host {
  font-size: 11px;
  color: var(--stitch-gray-500);
  line-height: 1.2; white-space: nowrap;
}

/* Main content offset by sidebar width on desktop */
.main-area {
  display: block;
  min-height: calc(100vh - var(--appbar-height));
  padding-left: 0;
}
@media (min-width: 901px) {
  .main-area { padding-left: var(--sidebar-width); }
}

.main-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

/* Flash message */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid;
}
.flash .material-symbols-outlined { font-size: 20px; flex-shrink: 0; }
.flash-success { background: var(--stitch-green-bg); color: var(--stitch-green); border-color: rgba(4, 120, 87, 0.3); }
.flash-error   { background: var(--stitch-red-bg); color: var(--stitch-red); border-color: rgba(220, 38, 38, 0.3); }
.flash-info    { background: #dbeafe; color: #1e40af; border-color: rgba(30, 64, 175, 0.3); }

/* Appfoot */
.appfoot {
  margin-left: 0;
  background: #fff;
  border-top: 1px solid var(--stitch-border);
  padding: 12px 24px;
}
@media (min-width: 901px) {
  .appfoot { margin-left: var(--sidebar-width); }
}
.appfoot-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 11px;
  color: var(--stitch-gray-500);
}
.appfoot-inner strong { color: var(--stitch-charcoal); font-weight: 600; }
@media (max-width: 640px) {
  .appfoot-inner { flex-direction: column; align-items: flex-start; }
}

/* Items table (request detail) — column widths aligned */
.data-table-items col,
.data-table-items colgroup { display: none; }
.data-table-items th,
.data-table-items td { vertical-align: top; }
.data-table-items .col-item {
  text-align: left;
  width: 38%;
  min-width: 200px;
}
.data-table-items .col-kat {
  text-align: left;
  width: 14%;
  min-width: 100px;
}
.data-table-items .col-qty {
  text-align: right;
  width: 10%;
  min-width: 80px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.data-table-items .col-harga {
  text-align: right;
  width: 14%;
  min-width: 110px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.data-table-items .col-realized {
  text-align: right;
  width: 14%;
  min-width: 140px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.data-table-items .col-gap {
  text-align: right;
  width: 10%;
  min-width: 100px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
/* Realized input styling — matches table cell */
.realized-input {
  width: 100%;
  max-width: 140px;
  padding: 6px 10px;
  border: 1px solid var(--stitch-border);
  border-radius: 6px;
  background: var(--surface-container-lowest);
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-size: 13px;
  color: var(--stitch-charcoal);
  transition: all 0.15s ease;
}
.realized-input:hover { border-color: var(--stitch-gray-400); }
.realized-input:focus {
  outline: none;
  border-color: var(--stitch-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.realized-input::placeholder { color: var(--stitch-gray-400); }

/* Search bar (Notion/Linear-style: compact, subtle, single-line) */
.search-form {
  margin-bottom: 20px;
  max-width: 480px;
}
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 14px;
  background: var(--surface-container-lowest);
  border: 1px solid var(--stitch-border);
  border-radius: 10px;
  transition: all 0.15s ease;
  cursor: text;
}
.search-bar:hover {
  border-color: var(--stitch-gray-400);
  background: #fff;
}
.search-bar:focus-within {
  border-color: var(--stitch-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background: #fff;
}
.search-icon {
  color: var(--stitch-gray-500);
  font-size: 18px;
  flex-shrink: 0;
}
.search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: var(--stitch-charcoal);
  padding: 6px 0;
  min-width: 0;
}
.search-input::placeholder {
  color: var(--stitch-gray-400);
}
.search-clear,
.search-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--stitch-gray-500);
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.search-clear:hover {
  background: var(--stitch-red-bg);
  color: var(--stitch-red);
}
.search-submit {
  background: var(--stitch-navy);
  color: #fff;
}
.search-submit:hover {
  background: var(--stitch-navy-hover);
}
.search-submit .material-symbols-outlined {
  font-size: 18px;
}
.search-clear .material-symbols-outlined {
  font-size: 18px;
}

/* Old appbar styles - kept for backward compat, override with v5 */
header.bg-surface-container-lowest {
  background: #fff !important;
}

/* Hero greeting block (Stitch-inspired) */
.hero {
  background: linear-gradient(135deg, var(--primary-container) 0%, var(--surface-container-low) 100%);
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 20px;
  border: 1px solid var(--outline-variant);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -100%; right: -10%;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(36, 56, 156, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: 26px; font-weight: 700; color: var(--on-surface); margin-bottom: 4px; letter-spacing: -0.02em; line-height: 1.2; }
.hero .subtitle { font-size: 13px; color: var(--on-surface-variant); line-height: 1.5; }
.hero .greeting-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--primary); color: var(--on-primary);
  font-size: 24px; margin-bottom: 12px;
}

/* Read-only banner */
.banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 12px;
  background: var(--tertiary-container); color: var(--on-tertiary-container);
  font-size: 13px; margin-bottom: 20px;
  border: 1px solid rgba(143, 71, 0, 0.2);
}
.banner .material-symbols-outlined { font-size: 18px; }
.banner strong { font-weight: 600; }

/* Status chips (pill badges) */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 9999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  text-transform: uppercase; white-space: nowrap;
  border: 1px solid transparent; line-height: 1;
}
.chip .material-symbols-outlined { font-size: 13px; }
.chip-success { background: #d1fae5; color: #065f46; border-color: rgba(6, 95, 70, 0.2); }
.chip-warning { background: #fef3c7; color: #92400e; border-color: rgba(146, 64, 14, 0.2); }
.chip-danger  { background: #fee2e2; color: #991b1b; border-color: rgba(153, 27, 27, 0.2); }
.chip-info    { background: #dbeafe; color: #1e40af; border-color: rgba(30, 64, 175, 0.2); }
.chip-neutral { background: var(--surface-container); color: var(--on-surface-variant); }

/* Stat card v2 — icon + value + delta chip + sparkline */
.stat-card-v2 {
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  display: flex; flex-direction: column; gap: 12px;
  position: relative; overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.stat-card-v2:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); transform: translateY(-1px); }
.stat-card-v2.primary {
  background: linear-gradient(135deg, var(--primary) 0%, #1a2870 100%);
  color: var(--on-primary); border-color: transparent;
}
.stat-card-v2.primary .label,
.stat-card-v2.primary .footer { color: rgba(255, 255, 255, 0.8); }
.stat-card-v2.primary .value { color: #fff; }
.stat-card-v2 .header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.stat-card-v2 .icon-wrap {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--primary-container); color: var(--on-primary-container);
  flex-shrink: 0;
}
.stat-card-v2.primary .icon-wrap { background: rgba(255, 255, 255, 0.15); color: #fff; }
.stat-card-v2 .icon-wrap .material-symbols-outlined { font-size: 22px; }
.stat-card-v2 .label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
  color: var(--on-surface-variant); text-transform: uppercase;
  line-height: 1.3; flex: 1; padding-top: 4px;
}
.stat-card-v2 .value {
  font-size: 32px; font-weight: 700; line-height: 1.1;
  color: var(--on-surface); font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-card-v2 .value.lg { font-size: 28px; }
.stat-card-v2 .footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--on-surface-variant); }
.stat-card-v2 .delta-chip {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.stat-card-v2 .delta-up   { color: #047857; background: #d1fae5; }
.stat-card-v2 .delta-down { color: #b91c1c; background: #fee2e2; }
.stat-card-v2 .delta-flat { color: var(--on-surface-variant); background: var(--surface-container-high); }

/* Sparkline (inline SVG) — disabled in current build but kept safe if re-enabled */
.sparkline { height: 36px; width: 100%; max-width: 100%; display: block; margin-top: 4px; flex-shrink: 0; }
.sparkline path { fill: none; stroke: var(--primary); stroke-width: 1.5; }
.stat-card-v2.primary .sparkline path { stroke: rgba(255, 255, 255, 0.8); }
.sparkline .area { fill: rgba(36, 56, 156, 0.08); stroke: none; }
.stat-card-v2.primary .sparkline .area { fill: rgba(255, 255, 255, 0.12); }

/* Period picker chip */
.period-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: 10px; font-size: 13px; font-weight: 500;
  color: var(--on-surface); cursor: pointer;
  transition: all 0.15s ease;
}
.period-chip:hover { background: var(--surface-container-low); border-color: var(--primary); }
.period-chip .material-symbols-outlined { font-size: 18px; color: var(--on-surface-variant); }

/* Nav item v2 — active item with left rail */
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  color: var(--on-surface); transition: background 0.15s ease, color 0.15s ease;
  text-decoration: none;
}
.nav-item:hover { background: var(--surface-container-high); text-decoration: none; }
.nav-item.active { background: var(--primary-container); color: var(--on-primary-container); }
.nav-item.active::before {
  content: ''; position: absolute;
  left: -16px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 24px;
  background: var(--primary); border-radius: 0 2px 2px 0;
}
.nav-section-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--on-surface-variant);
  padding: 16px 12px 6px 12px;
}

/* Top app bar refinements */
.appbar {
  background: var(--surface-container-lowest);
  border-bottom: 1px solid var(--outline-variant);
  position: sticky; top: 0; z-index: 50;
  height: 64px; display: flex; align-items: center;
}
.appbar .container { max-width: 1280px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; }
.appbar .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.appbar .brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: var(--on-primary); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.appbar .brand-text { min-width: 0; }
.appbar .brand-text .name { font-size: 15px; font-weight: 700; color: var(--on-surface); line-height: 1.2; }
.appbar .brand-text .host { font-size: 11px; color: var(--on-surface-variant); line-height: 1.2; opacity: 0.8; }
.appbar .right { display: flex; align-items: center; gap: 8px; }
.appbar-icon-btn { position: relative; padding: 8px; border-radius: 10px; color: var(--on-surface-variant); transition: background 0.15s ease; }
.appbar-icon-btn:hover { background: var(--surface-container); color: var(--on-surface); }
.appbar-icon-btn .material-symbols-outlined { font-size: 22px; }
.appbar .user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 9999px; background: var(--surface-container); }
.appbar .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-container); color: var(--on-primary-container); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.appbar .user-meta { font-size: 12px; line-height: 1.2; }
.appbar .user-meta .name { font-weight: 600; color: var(--on-surface); }
.appbar .user-meta .role { color: var(--on-surface-variant); text-transform: capitalize; }

/* Empty state card (richer) */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state .ill {
  display: inline-flex; align-items: center; justify-content: center;
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--surface-container); margin-bottom: 16px;
  position: relative;
}
.empty-state .ill::before { content: ''; position: absolute; inset: -8px; border-radius: 50%; border: 2px dashed var(--outline-variant); opacity: 0.4; }
.empty-state .ill .material-symbols-outlined { font-size: 40px; color: var(--on-surface-variant); }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--on-surface); margin-bottom: 4px; }
.empty-state p { font-size: 13px; color: var(--on-surface-variant); max-width: 320px; margin: 0 auto 20px; }

/* Compact tooltip */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 8px);
  left: 50%; transform: translateX(-50%);
  background: var(--inverse-surface); color: var(--inverse-on-surface);
  padding: 4px 8px; border-radius: 4px;
  font-size: 11px; white-space: nowrap;
  z-index: 100; pointer-events: none;
}

/* === Mobile refinements === */
@media (max-width: 640px) {
  .hero { padding: 20px; }
  .hero h1 { font-size: 22px; }
  .stat-card-v2 .value { font-size: 26px; }
  .appbar .user-meta { display: none; }
  .appbar .brand-text .host { display: none; }
}