:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --border: #e3e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #5b6b82;
  --text-faint: #93a3b8;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-deep: #1e40af;
  --accent: #06b6d4;
  --primary-soft: #eff6ff;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.07), 0 4px 12px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 6px 18px -4px rgba(15, 23, 42, 0.12), 0 12px 28px -8px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, 0.2);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  min-width: 340px;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; color: inherit; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -0.015em; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }

::selection { background: var(--primary); color: #fff; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid var(--primary);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease, transform .15s ease, border-color .15s;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}
.btn:hover { background: linear-gradient(180deg, var(--primary-dark), var(--primary-deep)); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn.secondary:hover { background: var(--surface-2); border-color: var(--text-muted); box-shadow: var(--shadow-sm); transform: none; }
.btn.ghost { background: transparent; color: var(--primary); border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--primary-soft); }
.btn.sm { height: 34px; padding: 0 13px; font-size: 13px; border-radius: 9px; font-weight: 650; }
.btn.success { background: linear-gradient(180deg, #10b981, var(--success)); border-color: var(--success); }
.btn.success:hover { filter: brightness(.96); }

/* ---------- Inputs ---------- */
.field { display: grid; gap: 6px; }
.field > label { font-size: 12px; font-weight: 650; color: var(--text-muted); }
.input, input, textarea, select {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 90px; padding: 10px 13px; resize: vertical; line-height: 1.5; }
.input:focus, input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand .logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px;
  box-shadow: 0 4px 10px -2px rgba(37, 99, 235, 0.45);
}
.brand .name { font-weight: 800; font-size: 15px; letter-spacing: -0.01em; }
.brand .tag { font-size: 12px; color: var(--text-muted); margin-top: -2px; }

.viewswitch { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 4px; gap: 4px; }
.viewswitch button {
  border: none; background: transparent; height: 32px; padding: 0 15px; border-radius: 9px;
  color: var(--text-muted); font-weight: 650; cursor: pointer; transition: color .15s, background .15s; font-size: 13px;
}
.viewswitch button:hover { color: var(--text); }
.viewswitch button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ---------- Layout ---------- */
.view { display: none; }
.view.active { display: block; }

/* Storefront */
.store-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1100px 480px at 82% -10%, rgba(6, 182, 212, 0.28), transparent 60%),
    radial-gradient(900px 420px at 12% -10%, rgba(37, 99, 235, 0.38), transparent 55%),
    linear-gradient(165deg, #0a1120 0%, #13224a 55%, #1b355f 100%);
  color: #fff; padding: 84px 20px 96px; text-align: center;
}
.store-hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 70%);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 70%);
}
.store-hero > * { position: relative; }
.store-hero h1 { color: #fff; font-size: 42px; font-weight: 800; letter-spacing: -0.02em; }
.store-hero p { color: #cbd5e1; margin: 16px auto 0; font-size: 17px; max-width: 640px; }
.store-search {
  max-width: 760px; margin: 34px auto 0; display: grid;
  grid-template-columns: 1fr auto; gap: 10px; background: #fff; padding: 10px;
  border-radius: 18px; box-shadow: var(--shadow-lg);
}
.store-search input { border: none; height: 50px; font-size: 17px; background: transparent; }
.store-search input:focus { box-shadow: none; }
.store-search .btn { height: 50px; padding: 0 26px; border-radius: 12px; font-size: 15px; }
.hero-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 22px; }
.chip {
  font-size: 12.5px; font-weight: 600; color: #dbe4f0;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 6px 12px; border-radius: 999px;
}

.container { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 40px 0 72px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-title h2 { font-size: 21px; }
.section-title .sub { color: var(--text-muted); font-size: 13.5px; }

/* Product grid */
.grid { display: grid; gap: 18px; }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs); padding: 20px;
}
.grid > .card { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.grid > .card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #cdd8e6; }
.card h3 { font-size: 16px; }

.product { display: flex; flex-direction: column; gap: 14px; }
.product .thumb {
  height: 150px; border-radius: 12px;
  background: linear-gradient(135deg, #eaf0ff, #f4f8fd);
  display: grid; place-items: center; border: 1px solid var(--border);
}
.product .thumb svg { color: var(--primary); opacity: 0.9; }
.product .ptitle { font-weight: 700; font-size: 16px; line-height: 1.35; }
.product .pmeta { color: var(--text-muted); font-size: 13px; }
.product .pbreak { border-top: 1px dashed var(--border-strong); padding-top: 12px; margin-top: 4px; font-size: 13.5px; color: var(--text-muted); display: grid; gap: 4px; }
.product .pbreak b { color: var(--text); font-weight: 700; }
.product .ptotal { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border); padding-top: 14px; margin-top: 2px; }
.product .ptotal .price { font-size: 23px; font-weight: 800; letter-spacing: -0.01em; }

/* Dashboard shell */
.dash { display: grid; grid-template-columns: 236px 1fr; min-height: calc(100vh - 64px); }
.sidebar {
  background: linear-gradient(180deg, #0b1220 0%, #0f172a 100%);
  color: #cbd5e1; padding: 18px 12px 16px; display: flex; flex-direction: column; gap: 3px;
}
.sidebar .sbrand {
  color: #fff; font-weight: 800; padding: 8px 10px 14px; font-size: 15.5px;
  display: flex; align-items: center; gap: 9px;
}
.sidebar .sbrand::before {
  content: ""; width: 10px; height: 10px; border-radius: 3px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.5);
}
.side-label { font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: #475569; padding: 10px 12px 4px; }
.sidebar a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: #94a3b8; font-weight: 600; cursor: pointer; text-decoration: none; font-size: 13px;
  transition: background .15s, color .15s; position: relative;
}
.sidebar a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.sidebar a.active { background: linear-gradient(90deg, rgba(37, 99, 235, 0.22), rgba(37, 99, 235, 0.05)); color: #fff; }
.sidebar a.active::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 2px; background: var(--primary); }
.sidebar .spacer { flex: 1; }
.side-status {
  display: flex; align-items: center; gap: 7px; margin: 8px 8px 4px; padding: 8px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08); color: #94a3b8;
}
.side-status.ok { color: #34d399; background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.28); }
.side-status.bad { color: #f87171; background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.28); }
.side-status .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.sidebar .foot { font-size: 11px; color: #475569; padding: 10px; border-top: 1px solid rgba(255, 255, 255, 0.06); margin-top: 8px; }

.dash-main { padding: 26px 30px 64px; }
.dash-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 14px; flex-wrap: wrap; }
.dash-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-right: auto; }
.dash-title h2 { font-size: 21px; }

/* Metrics */
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 17px 18px 16px; box-shadow: var(--shadow-xs); }
.metric .label { color: var(--text-muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.metric .value { font-size: 29px; font-weight: 800; margin-top: 7px; letter-spacing: -0.02em; }
.metric .value small { font-size: 14px; color: var(--text-muted); font-weight: 650; }

/* Tables */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th { text-align: left; padding: 13px 16px; background: var(--surface-3); color: #5b6b82; font-weight: 700; border-bottom: 1px solid var(--border); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; }
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge.gray { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.badge.green { background: var(--success-soft); color: #047857; border: 1px solid #a7f3d0; }
.badge.amber { background: var(--warning-soft); color: #b45309; border: 1px solid #fde68a; }
.badge.red { background: var(--danger-soft); color: #b91c1c; border: 1px solid #fecaca; }
.badge.blue { background: var(--primary-soft); color: var(--primary-dark); border: 1px solid #bfdbfe; }

/* Progress bar */
.bar { height: 9px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border); overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 999px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: grid; gap: 16px; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.center-note { text-align: center; color: var(--text-muted); padding: 40px 0; }
.empty { text-align: center; padding: 30px; color: var(--text-muted); }

/* Responsive helpers */
.side-toggle { display: none; margin-right: auto; }
.side-backdrop { display: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row input { min-width: 0; }
.track-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 15, 30, 0.55); display: none; align-items: center; justify-content: center; z-index: 50; padding: 20px; backdrop-filter: blur(2px);
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border-radius: 18px; width: min(520px, 100%);
  max-height: calc(100vh - 40px); display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.modal header { flex-shrink: 0; padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal header h3 { font-size: 17px; }
.modal .body { padding: 22px; overflow-y: auto; }
.modal .foot { flex-shrink: 0; padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-2); }
.modal .foot > .btn { min-width: 0; }
.modal .x { border: none; background: transparent; font-size: 24px; line-height: 1; color: var(--text-faint); cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.modal .x:hover { color: var(--text); background: var(--surface-3); }

/* Toast */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 12px 20px; border-radius: 12px; box-shadow: var(--shadow-md);
  z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  font-size: 13.5px; font-weight: 600;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.error { background: var(--danger); }

.code-block {
  background: #0f172a; color: #e2e8f0; border-radius: var(--radius-sm); padding: 14px;
  font-size: 12px; line-height: 1.5; overflow: auto; max-height: 360px; white-space: pre-wrap; word-break: break-word;
}

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.site-footer .inner {
  width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 26px 0 34px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.foot-brand { display: flex; align-items: center; gap: 10px; }
.foot-brand .logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 11px;
}
.foot-brand .name { font-weight: 800; font-size: 14px; }
.foot-brand .tag { font-size: 12px; color: var(--text-muted); }

/* ---------- Responsive ---------- */

/* Wide screens: give content room to breathe */
@media (min-width: 1500px) {
  .container { width: min(1340px, calc(100% - 56px)); }
  .dash-main { padding: 30px 40px 64px; }
  .grid.cols-3 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Large desktops: 3-col product grid + 4 metrics */
@media (min-width: 1080px) {
  .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Medium screens: 2-col product grid instead of a single skinny column */
@media (max-width: 1180px) {
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Tablets & phones: sidebar becomes an off-canvas drawer */
@media (max-width: 960px) {
  .dash { display: block; min-height: 0; }
  .dash-main { overflow: visible; padding: 22px 18px 48px; }
  .side-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 45;
    width: 258px; max-width: 82vw; padding: 16px 12px 24px;
    transform: translateX(-100%); transition: transform .22s ease;
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .side-backdrop {
    display: block; position: fixed; inset: 0; z-index: 44;
    background: rgba(10, 15, 30, 0.5); opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .side-backdrop.open { opacity: 1; pointer-events: auto; }
}

/* Small screens: tighten the header and hero */
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; height: auto; padding: 10px 16px; }
  .brand { flex: 1 1 auto; min-width: 0; }
  .brand .tag { display: none; }
  .store-hero { padding: 56px 14px 64px; }
  .store-hero h1 { font-size: 30px; }
  .store-hero p { font-size: 15.5px; }
}

/* Phones: stacked grids, card-style tables, wrapping rows */
@media (max-width: 720px) {
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .row-between { flex-wrap: wrap; }
  .dash-head { align-items: flex-start; }
  .table-wrap { overflow: visible; }
  table, thead, tbody, tr, th, td { display: block; box-sizing: border-box; }
  thead { display: none; }
  tbody tr {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 4px 14px; margin-bottom: 12px;
  }
  tbody tr:hover { background: var(--surface); }
  tbody td {
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
    padding: 10px 0; border-bottom: 1px dashed var(--border);
  }
  tbody td:last-child { border-bottom: none; }
  tbody td::before {
    content: attr(data-label);
    color: var(--text-muted); font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .03em;
  }
  tbody td.empty { display: block; text-align: center; padding: 14px; border: none; }
  tbody td.empty::before { content: none; }
}

/* Very small screens */
@media (max-width: 520px) {
  .metrics { grid-template-columns: 1fr; }
  .store-search { grid-template-columns: 1fr; padding: 8px; margin-top: 26px; border-radius: 14px; }
  .store-search .btn { width: 100%; }
  .store-hero h1 { font-size: 26px; }
  .section-title { flex-wrap: wrap; gap: 6px; }
  .viewswitch button { padding: 0 12px; }
  .container { width: min(1180px, calc(100% - 24px)); padding: 28px 0 48px; }
  .product .ptotal { flex-wrap: wrap; gap: 8px; }
  .btn-row .btn { flex: 1 1 auto; }
  .brand .logo { width: 32px; height: 32px; }
  .brand .name { font-size: 13.5px; }
  .chip { font-size: 11.5px; }
  .track-grid { grid-template-columns: 1fr; }
}