/* ============================================================================
   SILICONE STORE ADMIN — COMPACT MINIMAL-BRUTALIST CSS GRID SYSTEM
   Clean Minimalism + Crisp Brutalist Strokes + Smooth Transitions
   ============================================================================ */

:root {
  --font-display: "Outfit", system-ui, -apple-system, sans-serif;
  --font-body: "Public Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  /* 60-30-10 Minimal Paper + Ink Palette */
  --bg-canvas: #f5f5f2;
  --bg-surface: #ffffff;
  --bg-subtle: #ecece6;
  --bg-inset: #f9f9f6;
  --border-strong: #18181b;
  --border-muted: #deded6;
  --text-primary: #121214;
  --text-secondary: #52525b;
  --text-muted: #71717a;
  --accent: #141416;
  --accent-contrast: #ffffff;
  --accent-blue: #2563eb;
  --accent-blue-soft: #eff6ff;

  /* Semantic Status Colors */
  --status-green: #15803d;
  --status-green-bg: #f0fdf4;
  --status-amber: #b45309;
  --status-amber-bg: #fffbeb;
  --status-orange: #c2410c;
  --status-orange-bg: #fff7ed;
  --status-red: #b91c1c;
  --status-red-bg: #fef2f2;

  /* Smooth Minimal-Brutalist Geometry */
  --radius: 6px;
  --radius-sm: 4px;
  --stroke: 1.25px;
  --shadow-soft: 0 1px 2px rgba(20, 20, 22, 0.04);
  --shadow-hard: 2px 2px 0px #18181b;
  --shadow-hard-sm: 1.5px 1.5px 0px #18181b;
  --transition: 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  --bg-canvas: #0f0f11;
  --bg-surface: #18181b;
  --bg-subtle: #222227;
  --bg-inset: #131316;
  --border-strong: #d4d4d8;
  --border-muted: #2e2e35;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #fafafa;
  --accent-contrast: #111113;
  --accent-blue: #60a5fa;
  --accent-blue-soft: #172554;

  --status-green: #4ade80;
  --status-green-bg: #052e16;
  --status-amber: #fbbf24;
  --status-amber-bg: #271b05;
  --status-orange: #fb923c;
  --status-orange-bg: #2b1407;
  --status-red: #f87171;
  --status-red-bg: #2f1010;

  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-hard: 2px 2px 0px #000000;
  --shadow-hard-sm: 1.5px 1.5px 0px #000000;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.45;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mono,
.tabular {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

img {
  display: block;
  max-width: 100%;
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 1px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ============================================================================
   APP SHELL CSS GRID (COMPACT)
   ============================================================================ */

.app-shell {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  grid-template-rows: 52px minmax(0, 1fr);
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  grid-column: 1;
  grid-row: 1 / -1;
  display: grid;
  grid-template-rows: 52px 1fr auto;
  background: var(--bg-surface);
  border-right: var(--stroke) solid var(--border-strong);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: var(--stroke) solid var(--border-strong);
}

.brand-wordmark {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--text-primary);
  white-space: nowrap;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 10px 8px;
  gap: 3px;
  overflow-y: auto;
}

.nav-item {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  background: transparent;
  border: var(--stroke) solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
}

.nav-item:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.nav-item.is-active {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-hard-sm);
}

.nav-index {
  font-family: var(--font-mono);
  font-size: 10.5px;
  opacity: 0.7;
}

.nav-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

.sidebar-footer {
  border-top: var(--stroke) solid var(--border-strong);
  padding: 10px 12px;
  display: grid;
  gap: 8px;
  background: var(--bg-inset);
}

.auth-summary {
  display: grid;
  gap: 2px;
}

.auth-user-line {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-link {
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-blue);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.theme-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Top Header */
.topbar {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: auto minmax(180px, 380px) auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  background: var(--bg-surface);
  border-bottom: var(--stroke) solid var(--border-strong);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-center {
  width: 100%;
}

.search-input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  background: var(--bg-inset);
  border: var(--stroke) solid var(--border-muted);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  transition: border-color var(--transition), background var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--border-strong);
  background: var(--bg-surface);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Main Content */
.main-content {
  grid-column: 2;
  grid-row: 2;
  padding: 16px;
  min-width: 0;
}

.view-root {
  display: grid;
  gap: 14px;
  max-width: 1320px;
  margin: 0 auto;
}

/* Mobile Quick Bar (hidden on desktop) */
.mobile-only,
.mobile-only-block {
  display: none;
}

.mobile-quick-bar {
  margin-bottom: 10px;
  display: none;
  gap: 8px;
}

.mobile-nav-strip {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.mobile-nav-strip::-webkit-scrollbar {
  display: none;
}

.mobile-tab {
  min-height: 34px;
  padding: 4px 11px;
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.mobile-tab.is-active {
  background: var(--accent);
  color: var(--accent-contrast);
}

/* ============================================================================
   FULL-SCREEN SUBPAGES (PRODUCT EDITOR, PATHAO DISPATCH, CAMERA)
   ============================================================================ */

.subpage-shell {
  display: grid;
  gap: 10px;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
}

.subpage-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.input-action-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.url-action-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
}

.fullscreen-camera {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: #0b0b0c;
  color: #ffffff;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.fullscreen-camera-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-surface);
  color: var(--text-primary);
  border-bottom: var(--stroke) solid var(--border-strong);
}

.fullscreen-camera-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000000;
}

.fullscreen-camera-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.fullscreen-camera-foot {
  display: flex;
  justify-content: center;
  padding: 12px;
  background: var(--bg-surface);
  border-top: var(--stroke) solid var(--border-strong);
}

/* ============================================================================
   BUTTONS, INPUTS & CONTROLS (COMPACT & SMOOTH)
   ============================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 12px;
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition);
}

.btn:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow-hard-sm);
}

.btn:active:not(:disabled) {
  transform: translate(0, 0);
  box-shadow: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-blue {
  background: var(--accent-blue);
  border-color: var(--border-strong);
  color: #ffffff;
}

.btn-danger {
  background: var(--status-red-bg);
  border-color: var(--status-red);
  color: var(--status-red);
}

.btn-outline {
  background: var(--bg-surface);
  border-color: var(--border-strong);
}

.btn-sm {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 11.5px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--bg-surface);
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition);
}

.icon-btn:hover {
  background: var(--bg-subtle);
}

.btn[hidden],
.icon-btn[hidden] {
  display: none !important;
}

/* ============================================================================
   MINIMAL-BRUTALIST SURFACES, GRIDS & CARDS
   ============================================================================ */

.panel {
  background: var(--bg-surface);
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-soft);
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-muted);
}

.panel-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.panel-meta {
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* KPI 4-Column Compact Strip */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.kpi-card {
  background: var(--bg-surface);
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: grid;
  gap: 4px;
  box-shadow: var(--shadow-soft);
  transition: transform var(--transition), box-shadow var(--transition);
}

.kpi-card:hover {
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow-hard-sm);
}

.kpi-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Analytics Split Grids */
.analytics-split {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.analytics-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

/* Status Breakdown List */
.status-bars {
  display: grid;
  gap: 10px;
}

.status-bar-row {
  display: grid;
  gap: 4px;
}

.status-bar-btn {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.status-bar-btn:hover {
  background: var(--bg-inset);
  border-color: var(--border-muted);
}

.status-bar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
}

.status-track {
  height: 9px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  overflow: hidden;
}

.status-fill {
  height: 100%;
  transition: width 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Compact Responsive Insight Panel & Single-Row Tabs */
.insight-panel {
  display: grid;
  gap: 10px;
}

.insight-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  overflow: hidden;
  width: fit-content;
  max-width: 100%;
}

.insight-tab {
  min-height: 32px;
  padding: 5px 12px;
  border: none;
  border-right: 1px solid var(--border-muted);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.insight-tab:last-child {
  border-right: none;
}

.insight-tab:hover:not(.is-active) {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.insight-tab.is-active {
  background: var(--accent);
  color: var(--accent-contrast);
}

.insight-footer-btn {
  width: 100%;
  min-height: 32px;
  padding: 5px 10px;
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition);
}

.insight-footer-btn:hover {
  background: var(--bg-subtle);
}

.insight-list {
  display: grid;
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.insight-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  background: var(--bg-surface);
  border: none;
  border-bottom: 1px solid var(--border-muted);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition);
}

.insight-row:last-child {
  border-bottom: none;
}

.insight-row:hover {
  background: var(--bg-inset);
}

.insight-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.insight-rank {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  width: 20px;
  flex-shrink: 0;
}

.insight-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.insight-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.insight-sub {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.insight-metrics {
  display: grid;
  justify-items: end;
  gap: 1px;
  flex-shrink: 0;
}

.insight-primary {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.insight-secondary {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Data Tables (Compact) */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table th,
.data-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-muted);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: var(--stroke) solid var(--border-strong);
  white-space: nowrap;
}

.data-table td.num,
.data-table th.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:hover {
  background: var(--bg-inset);
}

/* ============================================================================
   TOOLBARS & SEGMENTED FILTERS
   ============================================================================ */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.products-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.products-toolbar-filters {
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(170px, 210px);
  gap: 8px;
  align-items: center;
}

.products-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Custom Minimal-Brutalist Dropdown */
.cselect {
  position: relative;
  width: 100%;
}

.cselect-trigger {
  width: 100%;
  min-height: 34px;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-surface);
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.cselect-trigger:hover,
.cselect.is-open .cselect-trigger {
  background: var(--bg-inset);
  box-shadow: var(--shadow-hard-sm);
}

.cselect-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cselect-chevron {
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: transform var(--transition);
}

.cselect.is-open .cselect-chevron {
  transform: rotate(180deg);
  color: var(--text-primary);
}

.cselect-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: min(320px, 90vw);
  max-height: 250px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hard);
  padding: 4px;
  z-index: 60;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
}

.cselect.is-open .cselect-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.cselect-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.cselect-option:hover {
  background: var(--bg-subtle);
}

.cselect-option.is-selected {
  background: var(--accent);
  color: var(--accent-contrast);
}

.cselect-opt-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.cselect-opt-meta {
  font-size: 11px;
  opacity: 0.72;
  flex-shrink: 0;
}

.cselect-check {
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  overflow: hidden;
  max-width: 100%;
}

.seg-btn {
  min-height: 32px;
  padding: 4px 11px;
  border: none;
  border-right: 1px solid var(--border-muted);
  background: transparent;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}

.seg-btn:hover:not(.is-active) {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.seg-btn:last-child {
  border-right: none;
}

.seg-btn.is-active {
  background: var(--accent);
  color: var(--accent-contrast);
}

/* ============================================================================
   PRODUCTS GRID & TABLE (COMPACT)
   ============================================================================ */

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 12px;
}

.product-card {
  background: var(--bg-surface);
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  grid-template-rows: 132px 1fr auto;
  box-shadow: var(--shadow-soft);
  transition: transform var(--transition), box-shadow var(--transition);
}

.product-card:hover {
  transform: translate(-1.5px, -1.5px);
  box-shadow: var(--shadow-hard);
}

.product-thumb {
  position: relative;
  background: var(--bg-inset);
  border-bottom: var(--stroke) solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.thumb-fallback {
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.product-body {
  padding: 10px 12px;
  display: grid;
  gap: 7px;
  align-content: start;
  cursor: pointer;
}

.product-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.meta-line {
  font-size: 10.5px;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.card-prices-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  overflow: hidden;
}

.card-metric {
  padding: 4px 7px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  border-bottom: 1px solid var(--border-muted);
}

.card-metric:nth-child(odd) {
  border-right: 1px solid var(--border-muted);
}

.card-metric:nth-last-child(-n + 2) {
  border-bottom: none;
}

.card-metric-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.card-metric-val {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.card-metric-val.is-accent {
  color: var(--accent-blue);
}

.card-metric-val.is-muted {
  color: var(--text-muted);
  font-weight: 500;
}

.card-metric-val.is-low {
  color: var(--status-red);
}

.card-stock-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  overflow: hidden;
}

.card-stock-cell {
  padding: 4px 6px;
  display: grid;
  justify-items: center;
  gap: 1px;
  border-right: 1px solid var(--border-muted);
}

.card-stock-cell:last-child {
  border-right: none;
}

.product-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: var(--stroke) solid var(--border-strong);
}

.product-actions button {
  min-height: 36px;
  border: none;
  background: var(--bg-surface);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.product-actions button:first-child {
  border-right: var(--stroke) solid var(--border-strong);
}

.product-actions button:hover {
  background: var(--bg-subtle);
}

.product-actions button.danger:hover,
.product-actions button.is-confirming {
  background: var(--status-red-bg);
  color: var(--status-red);
}

/* ============================================================================
   CATEGORIES WORKSPACE (COMPACT)
   ============================================================================ */

.categories-layout {
  display: grid;
  grid-template-columns: minmax(270px, 360px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.categories-list {
  display: grid;
  gap: 10px;
}

.category-card {
  background: var(--bg-surface);
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: grid;
  gap: 8px;
  box-shadow: var(--shadow-soft);
}

.category-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.category-thumb {
  width: 44px;
  height: 44px;
  background: var(--bg-inset);
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.category-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.subcat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border-muted);
}

.subcat-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  font-size: 11px;
  font-weight: 600;
}

.subcat-remove {
  background: none;
  border: none;
  padding: 1px 3px;
  cursor: pointer;
  color: var(--status-red);
  font-weight: 700;
}

/* ============================================================================
   ORDERS WORKSPACE (COMPACT)
   ============================================================================ */

.alert-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--status-amber-bg);
  border: var(--stroke) solid var(--status-amber);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 12.5px;
}

.alert-banner.is-error {
  background: var(--status-red-bg);
  border-color: var(--status-red);
}

.orders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
}

.order-card {
  background: var(--bg-surface);
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: grid;
  gap: 9px;
  box-shadow: var(--shadow-soft);
}

.order-card.is-unseen {
  box-shadow: 2px 2px 0px var(--status-amber);
}

.order-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-muted);
}

.order-id {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.status-tag.pending {
  color: var(--status-amber);
  background: var(--status-amber-bg);
}

.status-tag.delivered {
  color: var(--status-green);
  background: var(--status-green-bg);
}

.status-tag.return {
  color: var(--status-orange);
  background: var(--status-orange-bg);
}

.status-tag.cancelled {
  color: var(--status-red);
  background: var(--status-red-bg);
}

.order-items-box {
  background: var(--bg-inset);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  display: grid;
  gap: 4px;
}

.order-item-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.order-totals {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
}

.order-status-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  padding-top: 8px;
  border-top: 1px solid var(--border-muted);
}

.status-action-btn {
  min-height: 30px;
  padding: 3px 5px;
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.status-action-btn:hover {
  border-color: var(--border-strong);
}

.status-action-btn.is-current.pending {
  background: var(--status-amber);
  border-color: var(--border-strong);
  color: #111111;
}

.status-action-btn.is-current.delivered {
  background: var(--status-green);
  border-color: var(--border-strong);
  color: #ffffff;
}

.status-action-btn.is-current.return {
  background: var(--status-orange);
  border-color: var(--border-strong);
  color: #ffffff;
}

.status-action-btn.is-current.cancelled {
  background: var(--status-red);
  border-color: var(--border-strong);
  color: #ffffff;
}

/* ============================================================================
   FORMS & EDITOR CONTROLS (COMPACT DESKTOP / TOUCH-SAFE MOBILE)
   ============================================================================ */

.form-grid {
  display: grid;
  gap: 10px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.field {
  display: grid;
  gap: 4px;
}

.field-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  background: var(--bg-inset);
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: border-color var(--transition), background var(--transition);
}

.input:focus,
.select:focus,
.textarea:focus {
  background: var(--bg-surface);
}

.textarea {
  min-height: 128px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
}

.stepper {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-inset);
}

.stepper button {
  min-height: 36px;
  border: none;
  background: var(--bg-subtle);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.stepper input {
  border: none;
  border-left: var(--stroke) solid var(--border-strong);
  border-right: var(--stroke) solid var(--border-strong);
  background: transparent;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
}

/* Image Preview & 3x3 Grid Overlay */
.preview-stage {
  position: relative;
  height: 170px;
  background: repeating-conic-gradient(var(--bg-subtle) 0% 25%, var(--bg-inset) 0% 50%) 50% / 14px 14px;
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-stage.is-compact {
  height: 124px;
}

.preview-stage img {
  max-width: 100%;
  max-height: 100%;
  transition: transform 80ms linear;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(37, 99, 235, 0.32) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(37, 99, 235, 0.32) 1px, transparent 1px);
  background-size: 33.333% 33.333%;
}

.inline-status {
  padding: 8px 10px;
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-inset);
}

.inline-status.is-info {
  border-color: var(--accent-blue);
  background: var(--accent-blue-soft);
}

.inline-status.is-success {
  border-color: var(--status-green);
  background: var(--status-green-bg);
  color: var(--status-green);
}

.inline-status.is-error {
  border-color: var(--status-red);
  background: var(--status-red-bg);
  color: var(--status-red);
}

.gallery-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gallery-thumb {
  position: relative;
  width: 68px;
  height: 68px;
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  overflow: hidden;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumb button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: var(--bg-surface);
  color: var(--status-red);
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.spec-list {
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
}

.spec-row {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-muted);
  font-size: 12.5px;
}

.spec-row:last-child {
  border-bottom: none;
}

.markdown-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.markdown-preview {
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  padding: 10px 12px;
  min-height: 128px;
  font-size: 13px;
}

.markdown-preview h2,
.markdown-preview h3 {
  font-family: var(--font-display);
  margin: 10px 0 4px;
}

.markdown-preview table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
}

.markdown-preview th,
.markdown-preview td {
  border: 1px solid var(--border-strong);
  padding: 5px 7px;
  font-size: 12px;
}

/* ============================================================================
   TOASTS, CHARTS & SKELETONS
   ============================================================================ */

.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  display: grid;
  gap: 6px;
  max-width: 320px;
}

.toast {
  background: var(--accent);
  color: var(--accent-contrast);
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hard-sm);
  padding: 9px 12px;
  font-size: 12.5px;
  font-weight: 600;
}

.toast.is-error {
  background: var(--status-red);
  color: #ffffff;
}

.chart-box {
  position: relative;
  width: 100%;
  min-height: 154px;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--accent);
  color: var(--accent-contrast);
  border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
  z-index: 10;
}

.empty-state {
  padding: 28px 16px;
  border: var(--stroke) dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-surface);
  text-align: center;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.skeleton-panel,
.loading-panel {
  display: grid;
  gap: 12px;
}

.skeleton-bar {
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: var(--stroke) solid var(--border-muted);
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.skeleton-box {
  height: 88px;
  border-radius: var(--radius);
  background: var(--bg-subtle);
  border: var(--stroke) solid var(--border-muted);
}

/* ============================================================================
   RESPONSIVE BREAKPOINTS (COMPACT TABLET & MOBILE)
   ============================================================================ */

@media (max-width: 1080px) {
  .kpi-grid,
  .skeleton-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .analytics-split,
  .analytics-two-col,
  .categories-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 48px minmax(0, 1fr);
  }

  .mobile-only {
    display: inline-flex;
  }

  .mobile-only-block {
    display: grid;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 248px;
    transform: translateX(-100%);
    transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 35;
  }

  .sidebar-backdrop[hidden] {
    display: none;
  }

  .topbar {
    grid-column: 1;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 0 10px;
    height: 48px;
  }

  .topbar-center {
    display: none;
  }

  .main-content {
    grid-column: 1;
    padding: 10px;
  }

  .view-root {
    gap: 10px;
  }

  .panel {
    padding: 12px;
  }

  .panel-header {
    padding-bottom: 8px;
    margin-bottom: 10px;
  }

  .btn {
    min-height: 40px;
  }

  .btn-sm {
    min-height: 34px;
  }

  .input,
  .select,
  .textarea,
  .search-input {
    min-height: 40px;
    font-size: 16px;
  }

  .cselect-trigger {
    min-height: 40px;
    font-size: 13.5px;
  }

  .cselect-option {
    min-height: 38px;
    font-size: 13.5px;
  }

  .products-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .products-toolbar-filters {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .products-toolbar-filters > :last-child .cselect-menu {
    left: auto;
    right: 0;
  }

  .products-toolbar-right {
    justify-content: space-between;
  }

  .insight-tabs {
    width: 100%;
  }

  .insight-tab {
    padding: 5px 4px;
    font-size: 11px;
  }

  .orders-grid,
  .products-grid {
    grid-template-columns: 1fr;
  }

  .form-row-2,
  .form-row-3 {
    grid-template-columns: 1fr;
  }

  .url-action-row {
    grid-template-columns: 1fr 1fr;
  }

  .url-action-row > input {
    grid-column: 1 / -1;
  }

  .segmented-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
  }

  .segmented-4 .seg-btn {
    padding: 6px 4px;
    text-align: center;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .kpi-card {
    padding: 10px;
  }

  .kpi-value {
    font-size: 18px;
  }

  .category-head {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .category-head > div:last-child {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .subpage-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .toast-stack {
    left: 10px;
    right: 10px;
    bottom: 10px;
    max-width: none;
  }
}

@media (max-width: 380px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .order-status-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .input-action-row {
    grid-template-columns: 1fr;
  }
  .subpage-actions {
    grid-template-columns: 1fr;
  }
}
