/* ============================================================
   Laptop Store POS — Design System (design.md)
   Tokens, base, components. Handcrafted, minimal external deps.
   ============================================================ */

:root {
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --sidebar: #04004d;
  --sidebar-hover: rgba(255,255,255,0.08);
  --sidebar-active: rgba(255,255,255,0.14);
  --sidebar-text: #DCE6F2;
  --sidebar-muted: #8FA4BC;

  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-light: #EFF6FF;

  --success: #16A34A; --success-light: #F0FDF4;
  --warning: #D97706; --warning-light: #FFFBEB;
  --danger:  #DC2626; --danger-light:  #FEF2F2;
  --info:    #0284C7; --info-light:    #F0F9FF;

  --text-primary:   #111827;
  --text-secondary: #4B5563;
  --text-muted:      #6B7280;
  --border:          #E5E7EB;
  --border-light:    #F1F5F9;

  --radius-sm: 6px; --radius-md: 8px; --radius-lg: 10px; --radius-xl: 12px;

  --shadow-card:  0 1px 3px rgba(15,23,42,.06);
  --shadow-modal: 0 10px 30px rgba(15,23,42,.12);

  --sidebar-w: 240px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 64px;
  --content-pad: 24px;

  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
h1,h2,h3,h4 { margin: 0; line-height: 1.25; }
.h1 { font-size: 24px; font-weight: 700; }
.h2 { font-size: 20px; font-weight: 700; }
h2.card-title { font-size: 16px; font-weight: 600; }
h3.form-section { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin: 24px 0 12px; text-transform: uppercase; letter-spacing:.04em; }
.muted { color: var(--text-muted); }
.text-color-success { color: var(--success); font-weight: 600; }
.text-color-warning { color: var(--warning); font-weight: 600; }
.text-color-danger { color: var(--danger); font-weight: 600; }
.cell-strong { font-weight: 600; }
.cell-sub { font-size: 12px; }
.product-cell { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.product-thumb {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: var(--radius-md);
  overflow: hidden; background: #F1F5F9; display: grid; place-items: center;
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-thumb span { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.req { color: var(--danger); }
.kbd {
  font-family: var(--font); font-size: 11px; padding: 2px 6px;
  border: 1px solid var(--border); border-radius: 6px; color: var(--text-muted); background: #fff;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-md); border: 1px solid #CBD5E1;
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  background: #FFFFFF; color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all .15s ease-in-out;
}
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { display: flex; width: 100%; }

.btn-primary { background: var(--primary); border-color: var(--primary); color: #ffffff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #ffffff; }

.btn-secondary { background: #FFFFFF; border: 1px solid #CBD5E1; color: #1E293B; }
.btn-secondary:hover { background: #F1F5F9; border-color: #94A3B8; color: #0F172A; }

.btn-ghost { background: #F8FAFC; border: 1px solid #E2E8F0; color: #334155; }
.btn-ghost:hover { background: #E2E8F0; border-color: #CBD5E1; color: #0F172A; }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #ffffff; }
.btn-danger:hover { background: #B91C1C; border-color: #B91C1C; color: #ffffff; }

.btn-success { background: var(--success); border-color: var(--success); color: #ffffff; }
.btn-success:hover { background: #15803D; border-color: #15803D; color: #ffffff; }

.btn-outline-primary { background: #ffffff; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary-light); color: var(--primary-hover); }

.is-disabled, .btn:disabled { opacity: .5; pointer-events: none; }

/* ---------- Inputs ---------- */
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-secondary); }
.form-control {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: #fff;
  color: var(--text-primary); font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
textarea.form-control { height: auto; padding: 10px 12px; resize: vertical; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); outline: none; }
.form-control::placeholder { color: #9CA3AF; }
.form-group { margin-bottom: 16px; }
.form-help { font-size: 12px; margin: 4px 0 0; }
.form-fieldset { border: none; padding: 0; margin: 0; }
.form-legend { font-weight: 600; margin: 16px 0 10px; padding: 0; color: var(--text-secondary); }
.form-footer {
  display: flex; justify-content: flex-end; gap: 12px;
  margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border-light);
}

select.form-control { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #888 50%), linear-gradient(135deg, #888 50%, transparent 50%); background-position: calc(100% - 16px) 18px, calc(100% - 11px) 18px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 20px;
}
.card-header { margin-bottom: 16px; }
.card-title { font-weight: 600; }

/* ---------- Layout: app shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  flex: 0 0 var(--sidebar-w); width: var(--sidebar-w);
  background: linear-gradient(180deg, #04004d, #02002e); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar-brand-mark { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; flex-shrink: 0; }
.sidebar-brand-text { min-width: 0; }
.sidebar-brand-title { font-weight: 800; color: #fff; font-size: 13px; letter-spacing: .02em; line-height: 1.1; }
.sidebar-brand-sub { font-size: 9px; color: var(--sidebar-muted); margin-top: 2px; line-height: 1.1; }
.sidebar-dashboard { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin: 10px 12px 0; border-radius: 8px; color: #fff; font-weight: 600; font-size: 13px; text-decoration: none; background: var(--primary); }
.sidebar-dashboard:hover { background: #1d4ed8; color: #fff; }
.sidebar-dashboard.is-active { background: #1d4ed8; }
.nav { padding: 8px 0; flex: 1; }
.nav-section { padding: 14px 18px 4px; font-size: 10px; font-weight: 700; color: var(--sidebar-muted); text-transform: uppercase; letter-spacing: .08em; }
.nav-link, .nav-group { display: flex; align-items: center; gap: 10px; padding: 9px 18px; color: var(--sidebar-text); font-weight: 500; font-size: 13px; margin: 1px 8px; border-radius: 6px; transition: background-color .12s; text-decoration: none; cursor: pointer; user-select: none; }
.nav-link:hover, .nav-group:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.is-active, .nav-group.is-active { background: var(--primary); color: #fff; }
.nav-icon, .nav-icon-sub { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex-shrink: 0; color: inherit; }
.nav-icon svg, .nav-icon-sub svg { width: 16px; height: 16px; }
.nav-icon-sub { width: 4px; height: 4px; background: var(--sidebar-muted); border-radius: 50%; }
.nav-link:hover .nav-icon-sub, .nav-group:hover .nav-icon-sub { background: #fff; }
.nav-text { flex: 1; line-height: 1.2; }
.nav-chevron { display: inline-flex; width: 14px; height: 14px; transition: transform .15s; color: var(--sidebar-muted); }
.nav-chevron svg { width: 14px; height: 14px; }
.nav-group.is-open .nav-chevron { transform: rotate(-90deg); color: #fff; }
.nav-sub { display: none; background: rgba(0,0,0,.15); }
.nav-sub.is-open { display: block; }
.nav-link.nav-link-sub { padding: 7px 18px 7px 28px; margin: 1px 8px; font-size: 12px; color: var(--sidebar-muted); font-weight: 500; }
.nav-link.nav-link-sub:hover { color: #fff; }
.nav-link.nav-link-sub.is-active { color: #fff; background: rgba(255,255,255,.12); }
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.06); }
/* Switch branch button — distinct color */
.sidebar-switch { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 8px 12px 12px; padding: 10px 12px; border-radius: 8px; background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; font-weight: 600; font-size: 12px; text-decoration: none; transition: opacity .12s, transform .12s; }
.sidebar-switch:hover { opacity: .9; transform: translateX(2px); }

.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 var(--content-pad);
  position: sticky; top: 0; z-index: 20;
}
.topbar-toggle { display: none; background: #FFFFFF; border: 1px solid #CBD5E1; color: var(--text-secondary); cursor: pointer; padding: 6px; border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.topbar-toggle:hover { background: #F1F5F9; color: var(--text-primary); border-color: #94A3B8; }
.topbar-branch { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.topbar-branch-label { color: var(--text-muted); font-weight: 500; font-size: 12px; }
.topbar-spacer { flex: 1 1 auto; }
.topbar-search { display: flex; align-items: center; gap: 8px; }
.topbar-search-input { height: 36px; width: 220px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: #F8FAFC; }
.content { padding: var(--content-pad); flex: 1 1 auto; max-width: 1400px; width: 100%; }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; display: inline-flex; }
.dropdown-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  background: #F1F5F9; border: 1px solid transparent; border-radius: var(--radius-md);
  padding: 6px 10px; font: inherit; font-weight: 600; color: var(--text-primary); cursor: pointer;
}
.dropdown-trigger:hover { background: #E2E8F0; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal); padding: 6px; z-index: 40; display: none;
}
.dropdown-menu-right { left: auto; right: 0; }
.dropdown.is-open .dropdown-menu { display: block; }
.dropdown-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 6px; color: var(--text-primary); cursor: pointer; }
.dropdown-item:hover { background: #F8FAFC; }
.dropdown-item.is-active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.dropdown-item-meta { font-size: 12px; color: var(--text-muted); }
.dropdown-item--danger { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border-light); margin: 6px 0; }
.branch-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); display: inline-block; }
.branch-dot.is-pusat { background: var(--primary); }

.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.topbar-user { gap: 8px; }
.topbar-user-name { font-weight: 600; }

/* ---------- Page header ---------- */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-title { font-size: 24px; font-weight: 700; }
.page-subtitle { color: var(--text-secondary); margin: 4px 0 0; }
.page-actions { display: flex; gap: 10px; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow-card); }
.kpi-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.kpi-value { font-size: 22px; font-weight: 700; margin: 6px 0 4px; letter-spacing: -.01em; }
.kpi-foot { font-size: 12px; }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table thead th { background: #F8FAFC; color: var(--text-muted); font-size: 12px; font-weight: 600; text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.table tbody tr { transition: background-color .12s; }
.table tbody tr:hover { background: #F8FAFC; }
.t-left { text-align: left; } .t-center { text-align: center; } .t-right { text-align: right; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; line-height: 1.4; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-info    { background: var(--info-light);    color: var(--info); }
.badge-muted   { background: #F1F5F9; color: var(--text-secondary); }
.badge-success::before, .badge-muted::before, .badge-info::before, .badge-warning::before, .badge-danger::before { display: inline-block; }

/* ---------- Alerts / Toast ---------- */
.alert { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: var(--radius-md); margin-bottom: 16px; font-weight: 500; }
.alert-close { background: none; border: none; font-size: 20px; line-height: 1; color: inherit; cursor: pointer; opacity: .6; }
.alert-close:hover { opacity: 1; }
.alert-success { background: var(--success-light); color: var(--success); }
.alert-danger  { background: var(--danger-light);  color: var(--danger); }
.alert-warning { background: var(--warning-light); color: var(--warning); }
.toast-stack { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { padding: 12px 14px; border-radius: var(--radius-md); box-shadow: var(--shadow-modal); background: #fff; border: 1px solid var(--border); animation: toast-in .15s ease; max-width: 340px; }
.toast.is-success { border-color: var(--success); }
.toast.is-danger  { border-color: var(--danger);  }
.toast.is-warning { border-color: var(--warning); }
.toast-close { float: right; cursor: pointer; opacity: .6; border: none; background: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Toolbar / Search ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search { flex: 1 1 280px; max-width: 420px; }
.search .form-control { width: 100%; }

/* ---------- Grid helper ---------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; padding-top: 16px; gap: 12px; flex-wrap: wrap; }
.pagination-actions { display: flex; gap: 8px; }

/* ---------- Empty / Loading ---------- */
.empty-state, .empty-state-sm { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state h3 { font-size: 16px; color: var(--text-primary); margin-bottom: 6px; }
.empty-state p { margin: 0 0 16px; }

/* ---------- Auth (login / install) ---------- */
.auth-body { background: #0F2747; }
.auth-shell { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.auth-card { background: #fff; border-radius: var(--radius-xl); box-shadow: var(--shadow-modal); width: 100%; max-width: 460px; padding: 32px; }
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-logo { width: 52px; height: 52px; border-radius: 12px; background: var(--primary); color: #fff; display: grid; place-items: center; margin: 0 auto 12px; font-weight: 700; letter-spacing: .02em; }
.auth-title { font-size: 22px; font-weight: 700; }
.auth-subtitle { color: var(--text-muted); margin: 4px 0 0; font-size: 13px; }
.auth-form { display: block; }
.auth-foot { text-align: center; margin: 16px 0 0; font-size: 12px; }

.install-status { padding: 12px 14px; border-radius: var(--radius-md); margin-bottom: 18px; font-weight: 500; }
.install-status.is-ok { background: var(--success-light); color: var(--success); }
.install-status.is-error { background: var(--danger-light); color: var(--danger); }

/* ---------- Launcher ---------- */
.launcher-body { background: var(--bg); }
.launcher-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 32px; border-bottom: 1px solid rgba(255,255,255,0.1); background: linear-gradient(180deg, #04004d, #02002e); color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.15); }
.launcher-brand { display: flex; align-items: center; gap: 14px; }
.launcher-brand-name { font-weight: 700; color: #ffffff; font-size: 15px; }
.launcher-brand-user { font-size: 12px; color: #94A3B8; }
.launcher-main { max-width: 1100px; margin: 0 auto; padding: 40px 32px; }
.launcher-intro { margin-bottom: 24px; }
.launcher-intro .muted { margin: 6px 0 0; }
.launcher-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.launcher-card { display: flex; flex-direction: column; gap: 6px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-card); color: var(--text-primary); transition: border-color .15s, transform .15s, box-shadow .15s; }
.launcher-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(15,23,42,.08); color: var(--text-primary); }
.launcher-card--pusat { background: linear-gradient(180deg, #EFF6FF, #fff); }
.launcher-card--manage { background: #F8FAFC; }
.launcher-card--add { background: #fff; border: 2px dashed var(--primary); display: flex; align-items: center; justify-content: center; text-align: center; }
.launcher-card--add:hover { border-style: solid; background: var(--primary-light); }
.launcher-card-type { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.launcher-card-name { font-size: 18px; font-weight: 700; }
.launcher-card-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.branch-code { font-family: ui-monospace, monospace; background: #F1F5F9; padding: 2px 8px; border-radius: 6px; }
.launcher-sales { margin-top: 8px; padding: 10px 0 2px; border-top: 1px solid var(--border-light); color: var(--text-muted); font-size: 11px; }
.launcher-sales-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: baseline; }
.launcher-sales-row span { white-space: nowrap; }
.launcher-sales-row span:first-child { overflow: hidden; text-overflow: ellipsis; }
.launcher-sales strong { display: block; margin-top: 2px; color: var(--text-primary); font-size: 13px; }
.launcher-sales-sub { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 11px; }
.launcher-trend { font-weight: 700; font-size: 11px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.launcher-trend--up { background: #DCFCE7; color: #15803D; }
.launcher-trend--down { background: #FEE2E2; color: #B91C1C; }
.launcher-trend--flat { background: #F1F5F9; color: var(--text-muted); }
.launcher-sales-month { margin-top: 8px; }
.launcher-sales-month strong { color: var(--text-primary); }
.launcher-card-cta { margin-top: 10px; font-weight: 600; color: var(--primary); font-size: 13px; }

/* Launcher sections */
.launcher-section { margin-bottom: 32px; }
.launcher-section:last-child { margin-bottom: 0; }
.launcher-section-title { font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 14px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.launcher-grid--narrow { grid-template-columns: repeat(3, 1fr); }

/* Launcher pagination */
.launcher-pagination { display: flex; align-items: center; justify-content: center; margin-top: 20px; gap: 8px; }

/* ---------- Role assignment ---------- */
.role-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 12px 0 0; }
.role-block { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; }
.role-block-head { padding: 0 0 10px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.role-branches { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; cursor: pointer; }
.checkbox-pill:has(input:checked) { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* ---------- Matrix ---------- */
.permission-card { padding: 24px; }
.matrix-help { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border-light); }
.matrix-intro { margin: 0; color: var(--text-secondary); }
.matrix-hint { margin: 4px 0 0; color: var(--text-muted); font-size: 12px; }
.matrix-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.matrix-module { overflow: hidden; margin-bottom: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.matrix-module:last-child { margin-bottom: 0; }
.matrix-module-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; background: #F8FAFC; border-bottom: 1px solid var(--border); }
.matrix-module-name { margin: 0; font-size: 13px; font-weight: 700; color: var(--text-primary); text-transform: uppercase; letter-spacing: .06em; }
.matrix-module-count, .matrix-module-label { display: block; color: var(--text-muted); font-size: 11px; }
.matrix-module-count { margin-top: 2px; }
.matrix-module-label { font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.matrix-scroll { overflow-x: auto; }
.matrix { width: 100%; min-width: 600px; border-collapse: collapse; }
.matrix th, .matrix td { padding: 12px 16px; border-bottom: 1px solid var(--border-light); }
.matrix tbody tr:last-child td { border-bottom: 0; }
.matrix tbody tr:hover { background: #FAFCFF; }
.matrix th { background: var(--surface); font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.matrix-permission-col { width: auto; }
.matrix-action-col { width: 88px; }
.matrix .cell-strong { font-size: 13px; }
.matrix .cell-sub { max-width: 560px; margin-top: 2px; line-height: 1.4; }
.cb { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 6px; cursor: pointer; transition: background-color .12s; }
.cb:hover { background: var(--primary-light); }
.cb input[type=checkbox] { width: 17px; height: 17px; margin: 0; accent-color: var(--primary); cursor: pointer; }

/* ---------- Mini lists / chart ---------- */
.mini-list { list-style: none; padding: 0; margin: 0; }
.mini-list li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border-light); }
.mini-list li:last-child { border: none; }
.chart-placeholder { height: 240px; background: linear-gradient(180deg, #F8FAFC, #fff); border-radius: var(--radius-md); padding: 16px; }
.chart-bars { display: flex; align-items: flex-end; gap: 10px; height: 100%; }
.chart-bars span { flex: 1 1 0; background: linear-gradient(180deg, var(--primary), #93C5FD); border-radius: 6px 6px 0 0; min-height: 4px; opacity: .7; }

/* ---------- Errors ---------- */
.error-code { font-size: 64px; font-weight: 800; color: var(--primary); letter-spacing: -.02em; }
.error-state, .auth-card { text-align: center; }

/* ---------- Tabs ---------- */
.tabs-nav { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab-btn { padding: 10px 16px; background: none; border: none; border-bottom: 2px solid transparent; font: inherit; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: color .12s, border-color .12s; }
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: grid; place-items: center; z-index: 80; padding: 16px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: #fff; border-radius: var(--radius-xl); box-shadow: var(--shadow-modal);
  width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto;
}
.modal.modal-lg { max-width: 900px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border-light); }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: #F8FAFC; border: 1px solid #CBD5E1; font-size: 20px; line-height: 1; cursor: pointer; color: var(--text-secondary); padding: 2px 10px; border-radius: 6px; }
.modal-close:hover { background: #EF4444; border-color: #DC2626; color: #FFFFFF; }
.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 20px; border-top: 1px solid var(--border-light); }

/* ---------- Sidebar sub-link ---------- */
.nav-link-sub { padding-left: 32px; font-size: 13px; color: var(--sidebar-muted); }
.nav-link-sub:hover { color: #fff; }
.nav-link-sub.is-active { background: rgba(29,78,216,.18); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .launcher-grid { grid-template-columns: repeat(2, 1fr); }
  .launcher-grid--narrow { grid-template-columns: repeat(2, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; z-index: 50; }
  body.sidebar-open .sidebar { transform: none; box-shadow: var(--shadow-modal); }
  .topbar-toggle { display: inline-flex; }
    .grid-2 { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .role-grid { grid-template-columns: 1fr; }
}
  @media (max-width: 640px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .launcher-grid { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .page-header { flex-direction: column; }
  .topbar-search { display: none; }
  .permission-card { padding: 16px; }
  .matrix-help { flex-direction: column; gap: 14px; margin-bottom: 16px; padding-bottom: 16px; }
  .matrix-actions { justify-content: flex-start; }
  .matrix-module-head { padding: 12px; }
  .matrix-module-label { display: none; }
  .matrix th, .matrix td { padding: 10px 12px; }
}

/* ---------- Goods Receipt: product picker & barcode scan ---------- */
.gr-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 12px; }
.gr-section-head .form-section { margin: 0; }
.gr-toolbar { display: flex; gap: 8px; }
.gr-pick { display: flex; gap: 6px; align-items: center; }
.gr-pick .form-control { min-width: 240px; }
.gr-pick .gr-scan { flex: 0 0 auto; display: inline-flex; align-items: center; }
.gr-suggest { position: absolute; z-index: 90; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-modal); max-height: 300px; overflow-y: auto; padding: 4px; }
.gr-suggest[hidden] { display: none; }
.gr-suggest-item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: var(--radius-md); cursor: pointer; font: inherit; }
.gr-suggest-item:hover, .gr-suggest-item.is-active { background: var(--primary-light); }
.gsi-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.gsi-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.gr-hint { font-size: 12px; margin-top: 4px; color: var(--warning); }
.gr-scan-stage { position: relative; background: #0F172A; border-radius: var(--radius-lg); overflow: hidden; aspect-ratio: 4 / 3; min-height: 260px; display: grid; place-items: center; }
.gr-scan-stage video { width: 100%; height: 100%; object-fit: cover; }
.gr-scan-frame { position: absolute; inset: 18% 10%; border: 2px solid rgba(255,255,255,.85); border-radius: 10px; box-shadow: 0 0 0 9999px rgba(15,23,42,.25); pointer-events: none; }
.gr-scan-status { margin-top: 12px; font-size: 13px; color: var(--text-secondary); min-height: 20px; }
.gr-scan-status.is-ok { color: var(--success); font-weight: 600; }
.gr-scan-status.is-err { color: var(--danger); font-weight: 600; }
.gr-scan-manual { margin-top: 10px; }
.gr-scan-last { margin-top: 8px; font-size: 12px; color: var(--text-secondary); }

/* ---------- Testimonials admin (Pengaturan > Testimoni) ---------- */
.tst-thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; border: 1px solid var(--border); background: var(--border-light); }
.tst-thumb-fallback { display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--text-secondary); }
.tst-quote { max-width: 460px; font-size: 12px; line-height: 1.5; color: var(--text-secondary); }
.tst-stars { color: #F59E0B; font-size: 12px; letter-spacing: 1px; white-space: nowrap; }
.tst-photo-preview { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.tst-photo-preview img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; border: 1px solid var(--border); background: var(--border-light); }
.form-check { font-size: 13px; }

/* ---------- Storefront homepage admin (Pengaturan > Halaman Beranda) ---------- */
.toolbar-between { justify-content: space-between; }
.form-section-split { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 4px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin: 6px 0 0; }
.sf-thumb { width: 96px; height: 54px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); background: var(--border-light); display: block; }
.sf-thumb-fallback { display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--text-secondary); }
.sf-photo-preview { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.sf-photo-preview img { width: 168px; height: 94px; border-radius: 10px; object-fit: cover; border: 1px solid var(--border); background: var(--border-light); }
