/* Simantep WMS — Design Tokens */
:root {
  /* Brand palette derived from logo */
  --brand-50: #fff5f3;
  --brand-100: #ffe4df;
  --brand-200: #ffc7bb;
  --brand-300: #ff9d8a;
  --brand-400: #ff6b50;
  --brand-500: #ed3a1a;   /* primary Simantep red */
  --brand-600: #d12a0d;   /* hover / dark accent */
  --brand-700: #a8210b;
  --brand-800: #7d1808;

  /* Neutrals — warm-tinted */
  --bg: #fbf9f7;
  --surface: #ffffff;
  --surface-2: #faf6f3;
  --border: #ece6e1;
  --border-strong: #d9d2cb;
  --ink-900: #1a1614;
  --ink-700: #3d3530;
  --ink-500: #6b605a;
  --ink-400: #948880;
  --ink-300: #b8aea7;

  /* Status */
  --green: #1c8e5a;
  --green-bg: #e8f5ed;
  --amber: #c47a06;
  --amber-bg: #fdf3dd;
  --blue:  #1f6fd9;
  --blue-bg: #e7f0fd;
  --rose:  #c4314b;
  --rose-bg: #fde9ed;

  /* radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --shadow-sm: 0 1px 2px rgba(20,10,5,0.04);
  --shadow-md: 0 2px 6px rgba(20,10,5,0.06), 0 1px 2px rgba(20,10,5,0.04);
  --shadow-lg: 0 12px 28px rgba(20,10,5,0.10), 0 2px 6px rgba(20,10,5,0.05);

  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* Icons have intrinsic width/height attrs; this just keeps them from being squashed in flex containers */
svg { flex-shrink: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink-900);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ============ APP SHELL ============ */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
}
.sb-brand img { width: 36px; height: 36px; object-fit: contain; }
.sb-brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.sb-brand-text strong { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; color: var(--brand-600); }
.sb-brand-text span { font-size: 11px; color: var(--ink-500); letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; }

.sb-section { font-size: 10.5px; font-weight: 700; color: var(--ink-400); text-transform: uppercase; letter-spacing: 0.1em; padding: 14px 10px 6px; }

.sb-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  color: var(--ink-700);
  font-weight: 500;
  font-size: 13.5px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: background 0.12s;
}
.sb-item:hover { background: var(--surface-2); color: var(--ink-900); }
.sb-item.active {
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 600;
}
.sb-item.active::before {
  content: '';
  position: absolute; left: -14px; top: 8px; bottom: 8px;
  width: 3px; background: var(--brand-500);
  border-radius: 0 3px 3px 0;
}
.sb-item .sb-badge {
  margin-left: auto;
  font-size: 11px; font-weight: 700;
  background: var(--brand-500); color: white;
  padding: 1px 7px; border-radius: 999px;
  min-width: 18px; text-align: center;
}
.sb-item.active .sb-badge { background: var(--brand-600); }
.sb-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.8; }
.sb-item.active svg { opacity: 1; }

.sb-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.sb-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  cursor: pointer;
}
.sb-user:hover { background: var(--surface-2); }
.sb-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  color: white; font-weight: 700; font-size: 13px;
  display: grid; place-items: center;
}
.sb-user-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sb-user-meta strong { font-size: 13px; font-weight: 600; }
.sb-user-meta span { font-size: 11.5px; color: var(--ink-500); }
.sb-logout {
  margin-left: auto;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: var(--ink-400);
  text-decoration: none;
  flex-shrink: 0;
  transition: all 0.12s;
}
.sb-logout:hover { background: var(--rose-bg); color: var(--rose); }

/* TOPBAR */
.topbar {
  height: 60px;
  display: flex; align-items: center;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  gap: 16px;
  position: sticky; top: 0;
  z-index: 10;
}
.tb-search {
  flex: 1;
  max-width: 480px;
  display: flex; align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--ink-500);
}
.tb-search > svg { width: 15px; height: 15px; }
.scan-target > svg { width: 40px; height: 40px; }
.tb-search input { background: none; border: 0; outline: 0; flex: 1; font-size: 13.5px; color: var(--ink-900); }
.tb-search kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--ink-500);
}
.tb-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.tb-icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  color: var(--ink-700);
  position: relative;
}
.tb-icon-btn:hover { background: var(--surface-2); }
.tb-icon-btn .dot {
  position: absolute; top: 8px; right: 8px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand-500);
  border: 2px solid var(--surface);
}
.tb-divider { width: 1px; height: 24px; background: var(--border); }
.tb-store-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
  color: var(--ink-700);
}
.tb-store-pill .dot-online { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }

/* MAIN */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.page {
  padding: 28px 32px 60px;
  max-width: 1400px;
  width: 100%;
}
.page-head {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 4px; }
.page-sub { color: var(--ink-500); font-size: 13.5px; margin: 0; }
.page-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ============ COMPONENTS ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  border-radius: var(--r-md);
  font-size: 13px; font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: all 0.12s;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary {
  background: var(--brand-500); color: white;
  box-shadow: 0 1px 0 rgba(168, 33, 11, 0.2), inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-primary:hover { background: var(--brand-600); }
.btn-secondary {
  background: var(--surface);
  color: var(--ink-900);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { color: var(--ink-700); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-danger { background: white; color: var(--rose); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--rose-bg); border-color: var(--rose); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 700; margin: 0; }
.card-sub { font-size: 12.5px; color: var(--ink-500); margin: 2px 0 0; }
.card-body { padding: 20px; }

/* metric tile */
.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 18px 16px;
  display: flex; flex-direction: column; gap: 4px;
  position: relative;
  overflow: hidden;
}
.metric-label { font-size: 12.5px; color: var(--ink-500); font-weight: 600; }
.metric-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; margin-top: 2px; }
.metric-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; margin-top: 6px; }
.metric-delta.up { color: var(--green); }
.metric-delta.down { color: var(--rose); }
.metric-icon {
  position: absolute; top: 14px; right: 14px;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--brand-50);
  color: var(--brand-600);
  display: grid; place-items: center;
}
/* per-context icon sizing handled by intrinsic width/height attrs in components/icons.jsx */

/* badge / chip */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-700);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.chip-green { background: var(--green-bg); color: var(--green); border-color: transparent; }
.chip-amber { background: var(--amber-bg); color: var(--amber); border-color: transparent; }
.chip-blue  { background: var(--blue-bg);  color: var(--blue);  border-color: transparent; }
.chip-rose  { background: var(--rose-bg);  color: var(--rose);  border-color: transparent; }
.chip-brand { background: var(--brand-50); color: var(--brand-700); border-color: transparent; }
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* table */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-500);
  font-weight: 700;
  padding: 11px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .check { width: 22px; }
.table input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--brand-500); }

/* marketplace icon dot */
.mp {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600;
}
.mp-icon {
  width: 20px; height: 20px;
  border-radius: 5px;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 800; color: white;
  letter-spacing: -0.04em;
}
.mp-shopee  { background: #ee4d2d; }
.mp-tokped  { background: #03ac0e; }
.mp-tiktok  { background: linear-gradient(135deg, #000 50%, #25f4ee 50%); position: relative; }
.mp-tiktok::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(circle at 70% 70%, #fe2c55 25%, transparent 26%); }
.mp-lazada  { background: #0f146d; }
.mp-bukalap { background: #e31e52; }
.mp-blibli  { background: #0095da; }

/* SKU mono */
.mono { font-family: var(--font-mono); font-size: 12px; color: var(--ink-500); }

/* segmented */
.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}
.segmented button {
  padding: 6px 12px;
  font-size: 12.5px; font-weight: 600;
  color: var(--ink-500);
  border-radius: 7px;
}
.segmented button.active {
  background: var(--surface);
  color: var(--ink-900);
  box-shadow: var(--shadow-sm);
}

/* tabs (page-level) */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}
.tab {
  padding: 10px 14px;
  font-size: 13px; font-weight: 600;
  color: var(--ink-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--ink-900); }
.tab.active { color: var(--brand-600); border-bottom-color: var(--brand-500); }
.tab .count { margin-left: 6px; font-size: 11px; color: var(--ink-400); background: var(--surface-2); padding: 1px 6px; border-radius: 999px; }
.tab.active .count { color: var(--brand-700); background: var(--brand-50); }

/* progress */
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--brand-500); border-radius: 999px; }

/* spark / chart */
.spark { display: block; width: 100%; height: 60px; }

/* inputs */
.input {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: 13.5px;
  color: var(--ink-900);
}
.input:focus-within { border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--brand-100); }
.input input, .input select { background: none; border: 0; outline: 0; flex: 1; font-size: 13.5px; }
.input svg { width: 15px; height: 15px; color: var(--ink-400); }

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

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* ============= Role switcher ============= */
.sb-footer { position: relative; }
.sb-user-btn {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  font-family: inherit;
  text-align: left;
}
.sb-user-btn:hover { background: var(--surface-2); border-color: var(--border); }

.sb-avatar[data-role="owner"]   { background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); color: white; }
.sb-avatar[data-role="gudang"]  { background: linear-gradient(135deg, #1f6fd9, #1352a8); color: white; }
.sb-avatar[data-role="finance"] { background: linear-gradient(135deg, #1c8e5a, #11623d); color: white; }

.role-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(15,12,10,.18);
  padding: 8px;
  z-index: 50;
  display: flex; flex-direction: column; gap: 2px;
}
.role-menu-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-500); font-weight: 700;
  padding: 6px 8px 4px;
}
.role-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px;
  border-radius: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  color: inherit;
}
.role-opt:hover { background: var(--surface-2); }
.role-opt.on { background: var(--brand-50); }
.role-opt.on strong { color: var(--brand-700); }
.role-opt svg { color: var(--brand-600); }

/* ============= Finance tables ============= */
.table-finance { font-size: 13.5px; }
.table-finance thead th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-500); padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.table-finance tbody td { padding: 9px 16px; border-bottom: 1px solid var(--surface-2); }
.table-finance tbody tr:last-child td { border-bottom: none; }

/* select inside btn-secondary (used in page actions) */
.btn-secondary select,
select.btn {
  border: none; background: transparent; font-family: inherit;
  font-size: inherit; font-weight: inherit; color: inherit;
  outline: none; padding-right: 18px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23999' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0 center;
}


/* page transition */
.page { animation: fadein 0.18s ease-out; }
@keyframes fadein {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-300); }

/* ============ PACKING ASSISTANT ============ */
.packing-modal {
  position: fixed; inset: 0;
  background: rgba(20, 14, 10, 0.55);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 200;
  animation: fadein 0.16s ease-out;
}
.packing-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  width: min(880px, 92vw);
  max-height: 90vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.packing-head {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.packing-head .step-num {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--brand-500); color: white;
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px;
}
.packing-body { padding: 28px 32px; overflow-y: auto; flex: 1; }
.packing-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.packing-progress {
  height: 4px; background: var(--border);
}
.packing-progress > div { height: 100%; background: var(--brand-500); transition: width 0.3s; }

/* Scan target */
.scan-target {
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: 32px;
  text-align: center;
  background: var(--surface-2);
}
.scan-target.active {
  border-color: var(--brand-400);
  background: var(--brand-50);
}
.scan-input {
  font-family: var(--font-mono);
  font-size: 18px;
  text-align: center;
  width: 100%;
  border: 1px solid var(--border-strong);
  background: white;
  padding: 12px;
  border-radius: var(--r-md);
  margin-top: 14px;
  letter-spacing: 0.04em;
}
.scan-input:focus { outline: 0; border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); }

/* item row in packing */
.pk-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}
.pk-item.done { background: var(--green-bg); border-color: transparent; }
.pk-item .pk-thumb {
  width: 48px; height: 48px;
  border-radius: 8px;
  background: var(--surface-2);
  flex-shrink: 0;
  background-image:
    repeating-linear-gradient(45deg, var(--border) 0 6px, transparent 6px 12px);
}
.pk-item.done .pk-thumb { opacity: 0.6; }

/* ============ ENDPOINT (API DOCS) ============ */
.api-layout {
  display: grid;
  grid-template-columns: 240px 1fr 320px;
  gap: 24px;
  align-items: start;
}
.api-sidenav {
  position: sticky; top: 80px;
  font-size: 13px;
}
.api-sidenav-section { font-size: 11px; font-weight: 700; color: var(--ink-400); text-transform: uppercase; letter-spacing: 0.08em; margin: 16px 0 6px; }
.api-sidenav a {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 6px; color: var(--ink-700);
  margin: 1px 0;
}
.api-sidenav a:hover { background: var(--surface-2); }
.api-sidenav a.active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.api-method {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 700;
  padding: 2px 5px; border-radius: 4px;
  width: 38px; text-align: center;
}
.api-method.get { background: var(--blue-bg); color: var(--blue); }
.api-method.post { background: var(--green-bg); color: var(--green); }
.api-method.put { background: var(--amber-bg); color: var(--amber); }
.api-method.del { background: var(--rose-bg); color: var(--rose); }

.code-block {
  background: #1e1814;
  color: #f4ece4;
  border-radius: var(--r-lg);
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  overflow-x: auto;
  position: relative;
}
.code-block .tok-key   { color: #ffb084; }
.code-block .tok-str   { color: #b3e597; }
.code-block .tok-num   { color: #ffd29c; }
.code-block .tok-com   { color: #7a6e64; font-style: italic; }
.code-block .tok-kw    { color: #ff9275; }
.code-block-tabs {
  display: flex; gap: 2px;
  background: #15110e;
  padding: 6px 6px 0;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  border-bottom: 1px solid #2a2320;
}
.code-block-tabs button {
  padding: 7px 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #9a8f86;
  border-radius: 6px 6px 0 0;
}
.code-block-tabs button.active { background: #1e1814; color: #fff; }
.code-with-tabs .code-block { border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* endpoint block */
.endpoint-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-900);
}

/* Auth-style page */
.split-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

/* ============ GENERIC MODAL ============ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 14, 10, 0.55);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 200;
  animation: fadein 0.16s ease-out;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  width: min(640px, 100%);
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
  animation: fadein 0.16s ease-out;
}
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-foot {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* textarea variant of .input */
textarea.input {
  display: block; width: 100%;
  font-family: inherit;
  resize: vertical;
  line-height: 1.5;
}

/* picker buttons (warehouse selector etc) */
.pick {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  color: var(--ink-700);
  cursor: pointer;
  transition: all 0.12s;
}
.pick:hover { border-color: var(--brand-300); color: var(--ink-900); }
.pick.on {
  background: var(--brand-50);
  border-color: var(--brand-500);
  color: var(--brand-700);
}
.pick svg { width: 14px; height: 14px; }

/* link-styled button */
.link-btn {
  background: none; border: 0; padding: 0;
  color: var(--brand-600); font-weight: 600; font-size: inherit;
  cursor: pointer; text-decoration: underline;
}
.link-btn:hover { color: var(--brand-700); }

/* ============ SETTINGS PAGE ============ */
.settings-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  align-items: flex-start;
}
.settings-nav {
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 80px;
}
.settings-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: none; border: 0;
  border-radius: 8px;
  color: var(--ink-700);
  font-size: 13.5px; font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.12s;
}
.settings-nav-item svg { width: 16px; height: 16px; color: var(--ink-400); }
.settings-nav-item:hover { background: var(--surface-2); color: var(--ink-900); }
.settings-nav-item.active {
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 600;
}
.settings-nav-item.active svg { color: var(--brand-600); }

.settings-content {
  display: flex; flex-direction: column; gap: 18px;
  min-width: 0;
}
.settings-card { padding: 0; overflow: hidden; }
.settings-card-head {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.settings-card-head h3 {
  margin: 0; font-size: 15px; font-weight: 700;
}
.settings-card-head p {
  margin: 4px 0 0; font-size: 13px; color: var(--ink-500);
  line-height: 1.5;
}
.settings-card-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.settings-card-foot {
  padding: 12px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; gap: 10px; justify-content: flex-end;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row.full { grid-column: 1 / -1; }
.form-label { font-size: 12.5px; font-weight: 600; color: var(--ink-700); }
.form-hint { font-size: 11.5px; color: var(--ink-500); display: block; margin-top: 2px; }
.form-row textarea.input { width: 100%; }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  background: none; border: 0; border-bottom: 1px solid var(--border);
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.toggle-row:last-child { border-bottom: 0; }
.toggle-label { font-size: 13.5px; font-weight: 600; color: var(--ink-900); }
.toggle-desc { font-size: 12.5px; color: var(--ink-500); margin-top: 2px; line-height: 1.45; }
.toggle-switch {
  flex-shrink: 0;
  width: 36px; height: 20px;
  background: var(--ink-300);
  border-radius: 999px;
  position: relative;
  transition: background 0.15s;
}
.toggle-switch.on { background: var(--brand-500); }
.toggle-knob {
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: white; border-radius: 50%;
  transition: transform 0.18s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch.on .toggle-knob { transform: translateX(16px); }

@media (max-width: 900px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .settings-nav-item { flex-shrink: 0; }
  .form-grid { grid-template-columns: 1fr; }
}
