/* =====================================================================
   BETAH-POS — DESIGN SYSTEM
   Sidebar 196px, sticky 3-bagian | Topbar sticky | Scroll independen
   Shadow berlapis (kesan 3D) | Font-scale persis sesuai spesifikasi
   ===================================================================== */

:root {
  --sidebar-w: 196px;
  --topbar-h: 56px;

  --c-bg: #f2f4f8;
  --c-surface: #ffffff;
  --c-sidebar: #15203b;
  --c-sidebar-hover: #1f2c4d;
  --c-sidebar-active: #2b3d6b;
  --c-primary: #4361ee;
  --c-primary-dark: #3247b8;
  --c-text: #1f2733;
  --c-text-muted: #6b7686;
  --c-border: #e4e8f0;
  --c-success: #16a34a;
  --c-warning: #d97706;
  --c-danger: #dc2626;
  --c-info: #0891b2;

  --radius: 10px;
  --radius-sm: 6px;

  --shadow-card: 0 1px 2px rgba(16,24,40,.06), 0 4px 8px rgba(16,24,40,.06), 0 12px 24px -8px rgba(16,24,40,.10);
  --shadow-card-hover: 0 2px 4px rgba(16,24,40,.08), 0 8px 16px rgba(16,24,40,.10), 0 20px 36px -10px rgba(16,24,40,.16);
  --shadow-panel: 0 1px 2px rgba(16,24,40,.05), 0 6px 14px rgba(16,24,40,.06);
  --shadow-topbar: 0 1px 2px rgba(16,24,40,.04), 0 4px 10px rgba(16,24,40,.05);
  --shadow-btn: 0 1px 2px rgba(16,24,40,.10), 0 3px 6px rgba(16,24,40,.08);
  --shadow-btn-pressed: 0 1px 1px rgba(16,24,40,.10) inset;
}

* { box-sizing: border-box; }

html, body { height: 100%; overflow: hidden; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 14px;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; }

.app-shell { display: flex; height: 100vh; width: 100%; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--c-sidebar);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 0 rgba(0,0,0,.04), 4px 0 16px rgba(0,0,0,.08);
  z-index: 20;
}

.sidebar-brand {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .brand-logo {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  background: #fff;
}
.sidebar-brand .brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-brand .brand-text { min-width: 0; }
.sidebar-brand .brand-name { font-size: 12.5px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-brand .brand-version { font-size: 9.5px; color: #8b96b3; margin-top: 1px; }

.sidebar-nav { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 8px 8px; }
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }

.nav-section { margin-bottom: 2px; }
.nav-section-label {
  font-size: 9px; font-weight: 700; letter-spacing: .08em; color: #6b7796;
  text-transform: uppercase; padding: 0 8px; margin-top: 6px; margin-bottom: 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; margin-bottom: 1px;
  border-radius: var(--radius-sm);
  font-size: 11.5px; font-weight: 500; color: #b7c0d8;
  cursor: pointer; transition: background .15s ease, color .15s ease;
  white-space: nowrap;
}
.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; stroke: currentColor; }
.nav-item:hover { background: var(--c-sidebar-hover); color: #fff; }
.nav-item.active {
  background: var(--c-sidebar-active); color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), 0 2px 6px rgba(0,0,0,.18);
}
.nav-item .nav-badge { margin-left: auto; font-size: 9px; padding: 1px 6px; border-radius: 999px; background: rgba(255,255,255,.12); color: #fff; }

.sidebar-foot { flex: 0 0 auto; border-top: 1px solid rgba(255,255,255,.08); padding: 5px 8px; background: var(--c-sidebar); }
.sidebar-user { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: var(--radius-sm); }
.sidebar-user .avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--c-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.sidebar-user .info { min-width: 0; }
.sidebar-user .u-name { font-size: 11.5px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .u-role { font-size: 10px; color: #8b96b3; }

.sidebar-foot .foot-links { margin-top: 2px; }
.sidebar-foot .foot-link { display: flex; align-items: center; gap: 7px; font-size: 11.5px; padding: 5px 6px; border-radius: var(--radius-sm); color: #b7c0d8; }
.sidebar-foot .foot-link svg { width: 14px; height: 14px; stroke: currentColor; }
.sidebar-foot .foot-link:hover { background: var(--c-sidebar-hover); color: #fff; }
.sidebar-foot .foot-link.logout:hover { background: rgba(220,38,38,.18); color: #fca5a5; }

/* MAIN */
.main { flex: 1 1 auto; height: 100vh; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  flex: 0 0 auto; height: var(--topbar-h);
  background: var(--c-surface); border-bottom: 1px solid var(--c-border);
  box-shadow: var(--shadow-topbar);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; z-index: 10;
}
.topbar .search-box { display: flex; align-items: center; gap: 8px; background: var(--c-bg); border: 1px solid var(--c-border); border-radius: 999px; padding: 6px 14px; font-size: 12.5px; color: var(--c-text-muted); width: 280px; }
.topbar .search-box svg { width: 14px; height: 14px; stroke: currentColor; }
.topbar .search-box input { border: none; background: transparent; outline: none; font-size: 12.5px; width: 100%; }
.topbar .topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar .icon-btn { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--c-bg); border: 1px solid var(--c-border); cursor: pointer; position: relative; box-shadow: var(--shadow-btn); }
.topbar .icon-btn svg { width: 16px; height: 16px; stroke: var(--c-text-muted); }
.topbar .icon-btn .dot { position: absolute; top: 5px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--c-danger); border: 1.5px solid #fff; }
.topbar .product-tag { font-size: 12px; font-weight: 600; color: var(--c-text-muted); display:inline-flex; align-items:center; gap:4px; }
.topbar .product-tag svg { width: 13px; height: 13px; stroke: currentColor; flex-shrink: 0; }

.content { flex: 1 1 auto; overflow-y: auto; padding: 22px; }
.content::-webkit-scrollbar { width: 8px; }
.content::-webkit-scrollbar-thumb { background: #c9d0dd; border-radius: 4px; }

/* COMPONENTS */
.page-title { font-size: 19px; font-weight: 700; margin: 0 0 2px; }
.page-subtitle { font-size: 12.5px; color: var(--c-text-muted); margin: 0 0 18px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card-v2 { background: var(--c-surface); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-card); border: 1px solid var(--c-border); transition: transform .15s ease, box-shadow .15s ease; position: relative; overflow: hidden; }
.stat-card-v2:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-hover); }
.stat-card-v2 .stat-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; box-shadow: var(--shadow-btn); }
.stat-card-v2 .stat-icon svg { width: 17px; height: 17px; stroke: #fff; }
.stat-card-v2.c-blue .stat-icon   { background: linear-gradient(135deg,#4361ee,#6f82f5); }
.stat-card-v2.c-green .stat-icon  { background: linear-gradient(135deg,#16a34a,#4ade80); }
.stat-card-v2.c-orange .stat-icon { background: linear-gradient(135deg,#d97706,#fbbf24); }
.stat-card-v2.c-purple .stat-icon { background: linear-gradient(135deg,#7c3aed,#a78bfa); }
.stat-card-v2 .stat-value { font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat-card-v2 .stat-label { font-size: 12px; color: var(--c-text-muted); margin-top: 2px; }
.stat-card-v2 .stat-delta { font-size: 11px; font-weight: 600; margin-top: 8px; display: inline-flex; align-items: center; gap: 3px; }
.stat-card-v2 .stat-delta.up { color: var(--c-success); }
.stat-card-v2 .stat-delta.down { color: var(--c-danger); }

.panel { background: var(--c-surface); border-radius: var(--radius); border: 1px solid var(--c-border); box-shadow: var(--shadow-panel); padding: 18px; margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head h3 { font-size: 14.5px; font-weight: 700; margin: 0; }

.tab-pill-group { display: inline-flex; background: var(--c-bg); border-radius: 999px; padding: 3px; gap: 2px; border: 1px solid var(--c-border); }
.tab-pill { font-size: 12px; font-weight: 600; padding: 6px 14px; border-radius: 999px; color: var(--c-text-muted); cursor: pointer; transition: all .15s ease; }
.tab-pill.active { background: var(--c-surface); color: var(--c-primary); box-shadow: var(--shadow-btn); }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 9.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .02em; }
.badge-soft-bg.blue   { background: #e8ecfd; color: #4361ee; }
.badge-soft-bg.green  { background: #e3f9ea; color: #16a34a; }
.badge-soft-bg.orange { background: #fef3e2; color: #d97706; }
.badge-soft-bg.red    { background: #fde8e8; color: #dc2626; }
.badge-soft-bg.gray   { background: #eef0f4; color: #6b7686; }
.badge-soft-bg.purple { background: #f1eafe; color: #7c3aed; }

.btn { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; box-shadow: var(--shadow-btn); transition: transform .08s ease, box-shadow .08s ease; }
.btn svg { width: 14px; height: 14px; stroke: currentColor; }
.btn:active { transform: translateY(1px); box-shadow: var(--shadow-btn-pressed); }
.btn-primary { background: linear-gradient(180deg, var(--c-primary), var(--c-primary-dark)); color: #fff; }
.btn-outline { background: var(--c-surface); border-color: var(--c-border); color: var(--c-text); }
.btn-danger { background: linear-gradient(180deg, #ef4444, #dc2626); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 11.5px; }

.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data-table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--c-text-muted); font-weight: 700; padding: 10px 12px; border-bottom: 2px solid var(--c-border); }
table.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--c-border); vertical-align: middle; }
table.data-table tr:hover td { background: #fafbfd; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; color: var(--c-text); }
.form-control { width: 100%; padding: 9px 12px; font-size: 13px; border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: var(--c-surface); color: var(--c-text); box-shadow: inset 0 1px 2px rgba(16,24,40,.04); }
.form-control:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(67,97,238,.14); }
.form-hint { font-size: 11px; color: var(--c-text-muted); margin-top: 4px; }

.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 12.5px; margin-bottom: 14px; }
.alert-success { background: #e3f9ea; color: #157347; }
.alert-error { background: #fde8e8; color: #b02a2a; }

.login-shell { height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #15203b, #2b3d6b); overflow: auto; }
.login-card { width: 360px; background: #fff; border-radius: 14px; padding: 32px 28px; box-shadow: 0 4px 8px rgba(0,0,0,.1), 0 16px 40px rgba(0,0,0,.25); }
.login-card .brand-logo { width: 56px; height: 56px; border-radius: 12px; margin-bottom: 14px; display:flex;align-items:center;justify-content:center; overflow:hidden; background:#fff; box-shadow: var(--shadow-btn); }
.login-card .brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.login-card h1 { font-size: 17px; margin: 0 0 4px; }
.login-card p.sub { font-size: 12.5px; color: var(--c-text-muted); margin: 0 0 22px; }
.login-card .btn { width: 100%; justify-content: center; padding: 10px; font-size: 13px; margin-top: 6px; }
.login-foot { text-align: center; font-size: 10.5px; color: #cbd5e1; margin-top: 16px; }

@media (max-width: 860px) {
  .sidebar { position: fixed; left: -196px; top: 0; transition: left .2s ease; }
  .sidebar.open { left: 0; }
  .main { width: 100%; }
  .topbar .search-box { display: none; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .content { padding: 14px; }
}
.mobile-menu-btn { display: none; }
@media (max-width: 860px) { .mobile-menu-btn { display: flex; } }
