
/* ============================
   TOKO PART & BUILD — Style
   ============================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --primary:       #1B3A6B;
  --primary-dark:  #122952;
  --primary-hover: #24508C;
  --accent:        #3B82F6;
  --bg:            #EEF2F7;
  --card:          #FFFFFF;
  --text:          #1E293B;
  --text-muted:    #64748B;
  --border:        #E2E8F0;
  --success:       #10B981;
  --danger:        #EF4444;
  --warning:       #F59E0B;
  --sidebar-w:     260px;
  --topbar-h:      64px;
  --radius:        10px;
  --shadow:        0 2px 12px rgba(0,0,0,.07);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

/* ── Layout ───────────────────────────────── */
.wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--primary);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: transform .25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 22px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.brand-icon {
  width: 40px; height: 40px;
  background: rgba(255,255,255,.15);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.brand-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .5px;
  display: block;
}
.brand-sub {
  font-size: 10px;
  color: rgba(255,255,255,.6);
  letter-spacing: 1px;
  display: block;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section {
  font-size: 10px;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 10px 6px;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.75);
  font-size: 13.5px;
  font-weight: 500;
  transition: all .18s ease;
  margin-bottom: 2px;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 2; }
.nav-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-link.active {
  background: rgba(255,255,255,.18);
  color: #fff;
  border-left: 3px solid #fff;
  padding-left: 9px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255,255,255,.08);
  border-radius: 8px;
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}
.user-name { font-size: 13px; font-weight: 600; color: #fff; }
.user-role-tag {
  font-size: 10px;
  color: rgba(255,255,255,.6);
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ── Main area ────────────────────────────── */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ───────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.page-title { font-size: 17px; font-weight: 700; color: var(--primary); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.greeting { font-size: 13px; color: var(--text-muted); }

/* ── Content ──────────────────────────────── */
.content {
  padding: 24px 28px;
  flex: 1;
}

/* ── Cards ────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 700; color: var(--text); }

/* ── Stat cards ───────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px,1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.stat-icon {
  width: 46px; height: 46px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue   { background: #EFF6FF; color: var(--primary); }
.stat-icon.green  { background: #ECFDF5; color: var(--success); }
.stat-icon.yellow { background: #FFFBEB; color: var(--warning); }
.stat-icon.red    { background: #FEF2F2; color: var(--danger); }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 3px; font-weight: 500; }

/* ── Buttons ──────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .18s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: #DC2626; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #D97706; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-xs { padding: 4px 8px; font-size: 12px; border-radius: 5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-icon {
  width: 34px; height: 34px;
  padding: 0;
  justify-content: center;
  border-radius: 7px;
}

/* ── Forms ────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .18s;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ── Tables ───────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: #F8FAFC;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #F8FAFC; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ── Badges ───────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge-success { background: #ECFDF5; color: #059669; }
.badge-danger  { background: #FEF2F2; color: #DC2626; }
.badge-warning { background: #FFFBEB; color: #D97706; }
.badge-blue    { background: #EFF6FF; color: #2563EB; }
.badge-gray    { background: #F1F5F9; color: #64748B; }

/* ── Modals ───────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
  animation: slideUp .22s ease;
}
.modal-lg { max-width: 800px; }
@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--text); }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 6px;
  background: var(--bg);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: background .15s;
}
.modal-close:hover { background: var(--border); }
.modal-body { padding: 22px; }
.modal-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Search input ─────────────────────────── */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrap svg {
  position: absolute;
  left: 11px;
  color: var(--text-muted);
  width: 16px; height: 16px;
}
.search-input {
  padding-left: 36px !important;
}

/* ── Alert / Toast ────────────────────────── */
.toast-wrap {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 9px;
  background: var(--card);
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  font-size: 13.5px;
  font-weight: 500;
  min-width: 260px;
  max-width: 360px;
  animation: toastIn .25s ease;
  border-left: 4px solid;
}
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--danger);  color: var(--danger);  }
.toast.info    { border-color: var(--accent);  color: var(--accent);  }
@keyframes toastIn { from { transform: translateX(40px); opacity: 0; } to { opacity: 1; transform: none; } }

/* ── Kasir layout ─────────────────────────── */
.kasir-wrap {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  height: calc(100vh - var(--topbar-h) - 48px);
}
.kasir-left, .kasir-right {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.kasir-search { margin-bottom: 14px; }
.item-results {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
.result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}
.result-item:last-child { border-bottom: none; }
.result-item:hover { background: #F0F7FF; }
.result-item .item-name { font-weight: 600; font-size: 13.5px; }
.result-item .item-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.result-item .item-price { font-weight: 700; color: var(--primary); text-align: right; }
.result-item .item-stock-badge {
  font-size: 11px; font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  background: #ECFDF5;
  color: var(--success);
  margin-top: 2px;
  display: inline-block;
}
.result-item .item-stock-badge.low { background: #FEF2F2; color: var(--danger); }

/* Cart */
.cart-panel {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  box-shadow: var(--shadow);
}
.cart-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cart-items { flex: 1; overflow-y: auto; padding: 8px 0; }
.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.cart-item:last-child { border-bottom: none; }
.cart-item-name { font-size: 13px; font-weight: 600; flex: 1; }
.cart-item-price { font-size: 12px; color: var(--text-muted); }
.cart-qty {
  display: flex;
  align-items: center;
  gap: 6px;
}
.qty-btn {
  width: 26px; height: 26px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: var(--primary);
  transition: background .15s;
}
.qty-btn:hover { background: var(--border); }
.qty-val { min-width: 28px; text-align: center; font-weight: 700; font-size: 13px; }
.cart-item-total { font-weight: 700; font-size: 13px; color: var(--primary); min-width: 80px; text-align: right; }
.remove-btn { color: var(--danger); background: none; border: none; cursor: pointer; padding: 0; display: flex; align-items: center; }
.remove-btn:hover { opacity: .7; }
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  gap: 10px;
  padding: 40px;
}
.cart-empty svg { width: 48px; height: 48px; opacity: .3; }
.cart-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.cart-summary { margin-bottom: 14px; }
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
  font-size: 13.5px;
}
.summary-row.total {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 10px;
}

/* Discount input in cart */
.discount-row { display: flex; align-items: center; gap: 8px; }
.discount-row input { width: 110px; padding: 6px 10px; border-radius: 6px; border: 1.5px solid var(--border); font-size: 13px; text-align: right; }

/* ── Login page ───────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, #2B5BA8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 30px;
  gap: 12px;
}
.login-logo-icon {
  width: 64px; height: 64px;
  background: var(--primary);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
}
.login-logo-icon svg { width: 34px; height: 34px; color: #fff; }
.login-brand { font-size: 22px; font-weight: 800; color: var(--primary); letter-spacing: .5px; }
.login-sub { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.login-form .form-group label { font-size: 13.5px; font-weight: 600; }
.btn-login {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  letter-spacing: .3px;
  margin-top: 6px;
}
.error-msg {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #DC2626;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Page headers ─────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.page-header h2 { font-size: 18px; font-weight: 700; }
.page-header p  { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── Tabs ─────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 22px; }
.tab-btn {
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .18s;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn:hover { color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Barcode ──────────────────────────────── */
.barcode-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.barcode-wrap svg { max-width: 180px; }
.barcode-wrap small { font-size: 11px; color: var(--text-muted); }

/* ── Utility ──────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
.flex    { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-2   { gap: 8px; }
.gap-3   { gap: 12px; }
.ml-auto { margin-left: auto; }
.mt-1    { margin-top: 8px; }
.mt-2    { margin-top: 16px; }
.mb-1    { margin-bottom: 8px; }
.mb-2    { margin-bottom: 16px; }
.fw-bold { font-weight: 700; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger);  }
.fs-sm { font-size: 12.5px; }
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 50px 20px; color: var(--text-muted); gap: 10px;
  text-align: center;
}
.empty-state svg { width: 48px; height: 48px; opacity: .3; }

/* ── Print styles ─────────────────────────── */
@media print {
  .sidebar, .topbar, .no-print, .modal-overlay { display: none !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0 !important; }
  body { background: #fff; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }


/* ── Mobile improvements ──────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 240px; }
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.18); }
  .main { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .grid-2 { grid-template-columns: 1fr !important; }
  .grid-3 { grid-template-columns: 1fr 1fr !important; }
  .kasir-wrap { grid-template-columns: 1fr; height: auto; gap: 14px; }
  .kasir-wrap .panel-right { max-height: 420px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .modal { max-width: 100%; margin: 0 12px; }
  .modal-lg { max-width: 100%; }
  table { font-size: 12.5px; }
  thead th, tbody td { padding: 9px 10px; }
  .sidebar-overlay { display: block; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 18px; }
  .content { padding: 12px; }
  .topbar { height: 56px; }
  .main { margin-left: 0; }
}

/* ── Sidebar overlay for mobile ─────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}
@media (max-width: 768px) {
  .sidebar-overlay.open { display: block; }
}

/* ── Brand icon resize ───────────────── */
.brand-icon {
  width: 44px; height: 44px;
  background: rgba(255,255,255,.12);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  padding: 5px;
}
.brand-icon svg { width: 100%; height: 100%; }

