/* =====================================================================
   DEPOT ADMIN — Design tokens
   Palette terinspirasi air jernih & kedalaman laut, bukan biru generik.
   ===================================================================== */
:root {
  --deep: #0A3A4A;        /* navy-teal gelap: sidebar, teks utama */
  --deep-2: #0E4E63;
  --aqua: #1AA6B7;        /* aksen utama: aksi, ikon aktif */
  --aqua-light: #5FD1DE;
  --foam: #EAF6F8;        /* background lembut */
  --paper: #FFFFFF;
  --ink: #12313B;
  --ink-soft: #587883;
  --line: #D9E9EC;
  --amber: #E8A23D;       /* aksen uang / peringatan */
  --amber-soft: #FBF1DF;
  --coral: #E2604F;       /* aksen bahaya / hapus */
  --coral-soft: #FBE9E6;
  --mint: #2E9E6B;        /* aksen sukses / lunas */
  --mint-soft: #E5F5EE;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(10,58,74,.06), 0 1px 2px rgba(10,58,74,.08);
  --font-display: 'Sora', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--foam);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, .brand { font-family: var(--font-display); }
button { font-family: inherit; }
a { color: inherit; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--deep) 0%, var(--deep-2) 100%);
  color: #DDF0F3;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 40;
  transition: transform .25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .drop {
  width: 34px; height: 34px; border-radius: 9px;
  background: radial-gradient(circle at 30% 25%, var(--aqua-light), var(--aqua) 70%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(26,166,183,.5);
  font-size: 18px;
}
.sidebar-brand .name { font-weight: 700; font-size: 15.5px; line-height: 1.2; }
.sidebar-brand .sub { font-size: 11px; color: #8FC3CC; }

.nav-scroll { flex: 1; overflow-y: auto; padding: 10px 10px 20px; }
.nav-scroll::-webkit-scrollbar { width: 6px; }
.nav-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

.nav-group { margin-bottom: 4px; }
.nav-group-title {
  display: flex; align-items: center; gap: 8px;
  width: 100%; border: 0; background: transparent; cursor: pointer;
  color: #B9E1E7; font-size: 12.5px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  padding: 10px 10px; border-radius: 8px;
}
.nav-group-title:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-group-title .chev { margin-left: auto; transition: transform .18s ease; font-size: 11px; opacity: .7; }
.nav-group.open .chev { transform: rotate(90deg); }
.nav-group-items { display: none; padding: 2px 0 6px 6px; }
.nav-group.open .nav-group-items { display: block; }

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 8px 20px; margin: 1px 0;
  border-radius: 8px; font-size: 13.5px; color: #C9E5E9;
  cursor: pointer; border-left: 2px solid transparent;
}
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active {
  background: rgba(26,166,183,.22); color: #fff;
  border-left: 2px solid var(--aqua-light);
  font-weight: 600;
}
.nav-link .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .55; }

.sidebar-footer {
  padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12px; color: #86B4BC;
}

/* ---------- Main area ---------- */
.main {
  margin-left: 260px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: 62px; flex-shrink: 0;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  position: sticky; top: 0; z-index: 30;
}
.topbar .menu-toggle {
  display: none; border: 0; background: var(--foam); width: 36px; height: 36px;
  border-radius: 8px; cursor: pointer; font-size: 16px; color: var(--deep);
}
.topbar .page-title { font-size: 17px; font-weight: 700; color: var(--deep); }
.topbar .page-sub { font-size: 12px; color: var(--ink-soft); }
.topbar-spacer { flex: 1; }
.topbar .user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 6px; border-radius: 999px;
  background: var(--foam); cursor: pointer;
}
.topbar .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--aqua), var(--deep-2));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

.content { padding: 22px; flex: 1; }

/* ---------- Cards / stat tiles ---------- */
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-header h3 { margin: 0; font-size: 15px; color: var(--deep); }

.stat-tile { display: flex; flex-direction: column; gap: 6px; }
.stat-tile .icon {
  width: 38px; height: 38px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  margin-bottom: 4px;
}
.stat-tile .label { font-size: 12.5px; color: var(--ink-soft); font-weight: 500; }
.stat-tile .value { font-size: 22px; font-weight: 700; color: var(--deep); font-family: var(--font-display); }
.icon.bg-aqua { background: rgba(26,166,183,.13); color: var(--aqua); }
.icon.bg-amber { background: var(--amber-soft); color: var(--amber); }
.icon.bg-mint { background: var(--mint-soft); color: var(--mint); }
.icon.bg-coral { background: var(--coral-soft); color: var(--coral); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid transparent; border-radius: 8px;
  padding: 9px 14px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: filter .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--aqua); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-outline { background: var(--paper); border-color: var(--line); color: var(--deep); }
.btn-outline:hover { background: var(--foam); }
.btn-danger { background: var(--coral-soft); color: var(--coral); }
.btn-danger:hover { filter: brightness(.97); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; }

/* ---------- Forms ---------- */
label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); display: block; margin-bottom: 5px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13.5px; font-family: inherit; background: var(--paper); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--aqua-light); outline-offset: 1px; border-color: var(--aqua); }
.field { margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em;
  color: var(--ink-soft); padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 11px 12px; border-bottom: 1px solid var(--line); color: var(--ink); }
tbody tr:hover { background: var(--foam); }
tbody tr:last-child td { border-bottom: none; }

.badge {
  display: inline-flex; align-items: center; padding: 3px 9px;
  border-radius: 999px; font-size: 11.5px; font-weight: 600;
}
.badge-mint { background: var(--mint-soft); color: var(--mint); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-coral { background: var(--coral-soft); color: var(--coral); }
.badge-aqua { background: rgba(26,166,183,.13); color: var(--aqua); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10,58,74,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal {
  background: var(--paper); border-radius: 12px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(10,58,74,.3);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-header h3 { margin: 0; font-size: 16px; color: var(--deep); }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { border: 0; background: transparent; font-size: 18px; cursor: pointer; color: var(--ink-soft); }

/* ---------- Empty / placeholder ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-soft); }
.empty-state .drop-lg { font-size: 40px; margin-bottom: 10px; }
.empty-state h3 { color: var(--deep); margin: 0 0 6px; }
.empty-state p { max-width: 380px; margin: 0 auto; font-size: 13.5px; }

/* ---------- Toast ---------- */
#toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--deep); color: #fff; padding: 11px 16px; border-radius: 9px;
  font-size: 13px; box-shadow: 0 8px 24px rgba(10,58,74,.3);
  animation: toast-in .2s ease;
}
.toast.error { background: var(--coral); }
.toast.success { background: var(--mint); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 20% -10%, #12586E 0%, var(--deep) 55%, #06222C 100%);
  padding: 20px;
}
.login-card {
  background: var(--paper); border-radius: 16px; width: 100%; max-width: 380px;
  padding: 32px 28px; box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
.login-card .drop { width: 46px; height: 46px; border-radius: 12px;
  background: radial-gradient(circle at 30% 25%, var(--aqua-light), var(--aqua) 70%);
  display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 14px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; color: var(--deep); }
.login-card p.sub { font-size: 13px; color: var(--ink-soft); margin: 0 0 22px; }
.login-error { background: var(--coral-soft); color: var(--coral); font-size: 12.5px; padding: 9px 12px; border-radius: 8px; margin-bottom: 14px; display: none; }

/* ---------- Kasir / POS layout ---------- */
.pos-layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .pos-layout { grid-template-columns: 1fr; } }
.pos-cart-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pos-cart-row:last-child { border-bottom: none; }
.pos-cart-row .name { flex: 1; font-size: 13.5px; font-weight: 600; }
.pos-cart-row .qty-ctrl { display: flex; align-items: center; gap: 6px; }
.pos-cart-row .qty-ctrl button { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--line); background: var(--foam); cursor: pointer; }
.pos-total-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13.5px; }
.pos-total-row.grand { font-size: 17px; font-weight: 700; color: var(--deep); border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 12px; }

/* ---------- Utility ---------- */
.flex { display: flex; align-items: center; }
.gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-14 { gap: 14px; }
.mt-10 { margin-top: 10px; } .mt-16 { margin-top: 16px; } .mb-14 { margin-bottom: 14px; }
.text-soft { color: var(--ink-soft); }
.text-right { text-align: right; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.search-input { max-width: 280px; }

/* ---------- Responsive sidebar ---------- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar .menu-toggle { display: flex; align-items: center; justify-content: center; }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 39; display: none; }
  .sidebar-overlay.show { display: block; }
}
