:root {
  color-scheme: light;
  --bg: #edf2f7;
  --surface: #ffffff;
  --surface-soft: #f6f8fb;
  --surface-tint: #f1f8f5;
  --surface-dark: #0d1520;
  --surface-dark-soft: #182331;
  --text: #101828;
  --muted: #667085;
  --line: #d9e2ea;
  --line-dark: #2a3543;
  --brand: #12313f;
  --brand-strong: #071219;
  --accent: #12b886;
  --accent-2: #2f80ed;
  --accent-3: #f97316;
  --accent-4: #eab308;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --warn-bg: #fffaeb;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 12px 30px rgba(16, 24, 40, 0.06);
  --shadow-strong: 0 18px 54px rgba(16, 24, 40, 0.22);
  --radius: 8px;
  --radius-sm: 6px;
  --control-h: 36px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #f8fbfd 0, #edf2f7 280px),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 14px;
}

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

button {
  border: 0;
}

.shell {
  min-height: 100vh;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(6, 8, 12, 0.9), rgba(17, 24, 39, 0.7)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='800' viewBox='0 0 1200 800'%3E%3Crect width='1200' height='800' fill='%23e5e7eb'/%3E%3Cpath d='M0 610h1200v190H0z' fill='%23111827'/%3E%3Cpath d='M105 190h990v410H105z' fill='%23f9fafb'/%3E%3Cpath d='M145 230h910v82H145z' fill='%230b0d10'/%3E%3Cpath d='M188 354h190v164H188zM420 354h190v164H420zM652 354h360v164H652z' fill='%23ffffff' stroke='%23d1d5db' stroke-width='6'/%3E%3Cpath d='M220 400h126M452 400h126M690 400h286M220 451h126M452 451h126M690 451h286' stroke='%23111827' stroke-width='16' stroke-linecap='round'/%3E%3C/svg%3E");
  background-position: center;
  background-size: cover;
}

.login-panel {
  width: min(440px, 100%);
  padding: 30px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  box-shadow: var(--shadow-strong);
}

.brand-mark {
  display: inline-grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 8px;
  background: var(--brand-strong);
  color: white;
  font-size: 26px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 5px;
  font-size: 24px;
  line-height: 1.12;
}

h2 {
  margin-bottom: 10px;
  font-size: 18px;
}

h3 {
  margin-bottom: 8px;
  font-size: 14px;
}

.muted {
  color: var(--muted);
}

.field {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--control-h);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfdff;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(18, 184, 134, 0.16);
}

textarea {
  min-height: 74px;
  resize: vertical;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-h);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand), #0f766e);
  color: white;
  cursor: pointer;
  font-weight: 800;
  gap: 8px;
  transition:
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.lucide-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button:hover {
  background: linear-gradient(135deg, var(--brand-strong), #0d9488);
  transform: translateY(-1px);
}

.button.secondary {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
}

.button.secondary:hover {
  border-color: rgba(18, 184, 134, 0.35);
  background: #f0fdf9;
}

.button.danger {
  border: 1px solid #fecaca;
  background: var(--danger-bg);
  color: var(--danger);
}

.button.danger:hover {
  background: #fee4e2;
}

.button.ghost {
  background: transparent;
  color: var(--text);
}

.button.icon {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
}

.button.icon .lucide-icon {
  width: 17px;
  height: 17px;
}

.hint {
  margin: 16px 0 0;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 232px 1fr;
  transition: grid-template-columns 180ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 64px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 14px 12px;
  border-right: 1px solid var(--line-dark);
  background:
    linear-gradient(180deg, #0d1520 0, #101f2d 54%, #0b111a 100%);
  color: #ffffff;
}

.side-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 18px;
  font-weight: 900;
}

.side-name {
  min-width: 0;
}

.side-logo {
  display: inline-grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff, #dff8ef);
  color: #0b2f2a;
  font-weight: 900;
}

.side-toggle {
  display: inline-grid;
  width: 30px;
  height: 30px;
  margin-left: auto;
  place-items: center;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  cursor: pointer;
  font-size: 20px;
  font-weight: 900;
}

.side-toggle .lucide-icon {
  width: 18px;
  height: 18px;
}

.side-toggle:hover {
  background: #ecfdf3;
  color: #063b31;
}

.sidebar-collapsed .sidebar {
  align-items: center;
  padding: 14px 8px;
}

.sidebar-collapsed .side-title {
  width: 100%;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 0;
}

.sidebar-collapsed .side-name,
.sidebar-collapsed .side-footer {
  display: none;
}

.sidebar-collapsed .side-toggle {
  width: 42px;
  height: 36px;
  margin-left: 0;
}

.sidebar .muted {
  color: #9ca3af;
}

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

.nav button {
  gap: 10px;
  justify-content: flex-start;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid transparent;
  background: transparent;
  color: #d8dee9;
  font-weight: 800;
}

.nav .lucide-icon {
  width: 19px;
  height: 19px;
}

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

.sidebar-collapsed .nav {
  width: 100%;
  margin-top: 16px;
}

.sidebar-collapsed .nav button {
  width: 48px;
  min-width: 48px;
  padding: 9px;
  justify-content: center;
}

.sidebar-collapsed .nav-label {
  display: none;
}

.nav button.active {
  border-color: rgba(18, 184, 134, 0.75);
  background: linear-gradient(135deg, #ecfdf3, #dff7ff);
  color: #0b2f2a;
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: none;
}

.nav button.active:hover {
  background: linear-gradient(135deg, #ecfdf3, #dff7ff);
  color: #0b2f2a;
}

.side-footer {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.role-chip {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 99px;
  border: 1px solid rgba(18, 184, 134, 0.35);
  background: rgba(18, 184, 134, 0.12);
  color: #c8f7e5;
  font-size: 12px;
  font-weight: 900;
}

.content {
  min-width: 0;
  padding: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 56px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(217, 226, 234, 0.92);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(240, 253, 249, 0.9)),
    #ffffff;
  box-shadow: var(--shadow);
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.grid.two {
  grid-template-columns: minmax(320px, 0.8fr) minmax(360px, 1.2fr);
}

.grid.three {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.dashboard-lanes {
  grid-template-columns: minmax(260px, 0.9fr) minmax(260px, 1fr) minmax(260px, 0.9fr);
  margin-top: 10px;
}

.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-metrics .metric {
  min-height: 62px;
  padding: 9px 10px;
}

.dashboard-metrics .metric-label,
.dashboard-metrics .metric-note {
  font-size: 11px;
}

.dashboard-metrics .metric-value {
  margin-top: 4px;
  font-size: 19px;
  line-height: 1.05;
}

.dashboard-section-panel,
.dashboard-analytics-panel {
  margin-top: 10px;
}

.dashboard-analytics-panel {
  padding: 10px;
}

.order-layout {
  display: grid;
  grid-template-columns: minmax(650px, 1fr) minmax(280px, 330px);
  align-items: start;
  gap: 10px;
}

.orders-pending-panel {
  margin-bottom: 10px;
}

.order-products-panel,
.cart-panel {
  min-width: 0;
}

.cart-panel {
  position: sticky;
  top: 16px;
}

.panel {
  padding: 12px;
  border: 1px solid rgba(217, 226, 234, 0.95);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 252, 255, 0.98)),
    var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 88px;
  position: relative;
  overflow: hidden;
  background: #ffffff;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--metric-color, var(--accent));
}

.metric:nth-child(1) {
  --metric-color: var(--accent-2);
}

.metric:nth-child(2) {
  --metric-color: var(--accent);
}

.metric:nth-child(3) {
  --metric-color: var(--accent-3);
}

.metric:nth-child(4) {
  --metric-color: var(--accent-4);
}

.metric:nth-child(5) {
  --metric-color: var(--brand);
}

.metric:nth-child(6) {
  --metric-color: var(--accent-2);
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric-value {
  margin-top: 7px;
  overflow: hidden;
  font-size: 24px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-note {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-chart {
  display: grid;
  gap: 8px;
}

.chart-insights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.chart-insight {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.chart-insight.best {
  border-color: #0f766e;
  background: linear-gradient(135deg, #12313f, #0f766e);
  color: #ffffff;
}

.chart-insight.best .micro-label,
.chart-insight.best em {
  color: #d1d5db;
}

.chart-insight.worst {
  background:
    repeating-linear-gradient(135deg, #fff7ed 0, #fff7ed 8px, #ffedd5 8px, #ffedd5 16px);
  border-color: #fed7aa;
}

.chart-insight strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-insight em {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  overflow: hidden;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-grid,
.chartjs-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.7fr);
  gap: 10px;
}

.chartjs-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  align-items: start;
}

.chart-card {
  min-width: 0;
  align-self: start;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  overflow: hidden;
}

.chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 86px;
  min-height: 0;
  max-height: 86px;
  overflow: hidden;
}

.chart-canvas-wrap.large {
  height: 128px;
  max-height: 128px;
}

.chart-canvas-wrap.compact {
  height: 92px;
  max-height: 92px;
  margin-top: 4px;
}

.chart-canvas-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
}

.chart-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.chart-subhead strong {
  font-size: 14px;
}

.chart-subhead span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.timeline-bars {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(44px, 1fr);
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.timeline-bars.day {
  grid-auto-columns: minmax(38px, 1fr);
}

.timeline-bars.month {
  grid-auto-columns: minmax(34px, 1fr);
}

.timeline-slot {
  position: relative;
  display: grid;
  grid-template-rows: 18px 86px 16px 14px;
  min-width: 0;
  gap: 4px;
  text-align: center;
}

.timeline-value {
  align-self: end;
  overflow: hidden;
  color: var(--text);
  font-size: 10px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-track {
  display: flex;
  min-height: 86px;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafb;
}

.timeline-track span {
  display: block;
  width: 100%;
  min-height: 5px;
  border-radius: 8px 8px 0 0;
  background: #111827;
}

.timeline-slot.best .timeline-track {
  border-color: #111827;
  background: #111827;
}

.timeline-slot.best .timeline-track span {
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.timeline-slot.worst .timeline-track span {
  background: #9ca3af;
}

.timeline-slot strong {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-slot small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.density-panel {
  display: grid;
  gap: 8px;
}

.density-best {
  padding: 6px 8px;
  border: 1px solid #0f766e;
  border-radius: 8px;
  background: linear-gradient(135deg, #12313f, #0f766e);
  color: #ffffff;
}

.density-best .micro-label,
.density-best em {
  color: #d1d5db;
}

.density-best strong,
.density-best em {
  display: block;
}

.density-best strong {
  margin-top: 2px;
  font-size: 14px;
}

.density-best em {
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

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

.density-hour {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.density-hour.best {
  border-color: #111827;
  box-shadow: inset 0 0 0 1px #111827;
}

.density-hour span,
.density-hour strong {
  font-size: 11px;
  font-weight: 900;
}

.density-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.density-bar b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #111827;
}

.compact-bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(84px, 1fr));
  gap: 8px;
}

.compact-day {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  min-height: 96px;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.compact-day.best {
  border-color: #111827;
  box-shadow: inset 0 0 0 1px #111827;
}

.compact-day.worst {
  background: #f9fafb;
}

.compact-track {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  border-radius: 99px;
  background: #e5e7eb;
}

.compact-track span {
  display: block;
  width: 100%;
  min-height: 5px;
  border-radius: inherit;
  background: #111827;
}

.compact-day.worst .compact-track span {
  background: #9ca3af;
}

.compact-meta {
  display: grid;
  align-content: end;
  min-width: 0;
}

.compact-meta strong {
  font-size: 13px;
}

.compact-meta span {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 900;
}

.compact-meta small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.chart-badge {
  position: absolute;
  right: 8px;
  top: 8px;
  padding: 3px 6px;
  border-radius: 999px;
  background: #111827;
  color: #ffffff;
  font-size: 10px;
}

.chart-badge.muted-badge {
  background: #e5e7eb;
  color: #111827;
}

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

.product-results,
.product-sections {
  display: grid;
  gap: 10px;
}

.category-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 2px 0 10px;
  padding-bottom: 4px;
}

.category-tabs button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--category-color, #111827);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
}

.category-tabs button.active {
  border-color: var(--category-color, #111827);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--category-color, #111827) 92%, #ffffff), var(--category-color, #111827));
  color: #ffffff;
}

.category-tabs strong {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: #f3f4f6;
  color: #111827;
  font-size: 12px;
}

.category-tabs button.active strong {
  background: #ffffff;
}

.product-category-section {
  display: grid;
  gap: 7px;
}

.product-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 9px;
  border-left: 5px solid var(--category-color, #111827);
  border-radius: 8px;
  background: color-mix(in srgb, var(--category-color, #111827) 8%, #ffffff);
}

.product-category-head h3 {
  margin: 0;
  font-size: 15px;
}

.product-category-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.product-tile {
  display: grid;
  min-height: 84px;
  align-content: space-between;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--category-color, #111827);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, color-mix(in srgb, var(--category-color, #111827) 5%, #ffffff));
  cursor: pointer;
  text-align: left;
  box-shadow: 0 10px 24px rgba(11, 13, 16, 0.04);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.product-tile:hover {
  border-color: var(--category-color, var(--brand));
  background: color-mix(in srgb, var(--category-color, #111827) 8%, #ffffff);
  box-shadow: 0 12px 26px rgba(16, 24, 40, 0.11);
  transform: translateY(-1px);
}

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

.tile-name {
  display: block;
  line-height: 1.18;
  font-size: 13px;
  font-weight: 900;
}

.tile-meta {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.tile-price {
  margin-top: 8px;
  color: var(--category-color, #111827);
  font-size: 17px;
  font-weight: 900;
}

.category-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.category-color-card {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--category-color, #111827);
  border-radius: 8px;
  background: #ffffff;
}

.category-color-card strong,
.category-color-card small {
  display: block;
}

.category-color-card small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.category-color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--category-color, #111827);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.category-color-card input[type="color"] {
  width: 42px;
  min-width: 42px;
  height: 36px;
  min-height: 36px;
  padding: 2px;
  cursor: pointer;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.products-panel {
  padding: 8px;
}

.product-view-toggle {
  grid-template-columns: repeat(2, minmax(72px, 1fr));
}

.products-list {
  display: grid;
  gap: 6px;
}

.product-list-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(92px, 0.25fr) minmax(92px, 0.25fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--category-color, #111827);
  border-radius: var(--radius);
  background: #ffffff;
}

.product-list-main {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.category-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--category-color, #111827);
}

.product-list-main strong,
.product-list-main span,
.product-list-price span,
.product-list-price strong {
  display: block;
}

.product-list-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-list-main span,
.product-list-price span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.product-list-price strong {
  margin-top: 2px;
  font-size: 15px;
  font-weight: 900;
}

.catalog-card,
.expense-card,
.reminder-card {
  display: grid;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-top: 5px solid var(--category-color, var(--line));
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  box-shadow: var(--shadow);
}

.catalog-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.catalog-card h3,
.expense-card h3,
.reminder-card h3 {
  margin: 3px 0 0;
  font-size: 15px;
}

.micro-label {
  display: inline-flex;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.price-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.price-pair div {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.price-pair span,
.catalog-meta span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.price-pair strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
}

.catalog-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.card-actions.compact {
  justify-content: flex-end;
}

.cart-list,
.simple-list {
  display: grid;
  gap: 7px;
}

.stock-layout {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.stock-quick-panel {
  margin-top: 8px;
  padding: 10px;
}

.stock-critical-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 8px;
  padding: 7px 8px;
  min-width: 0;
}

.stock-quick-panel .toolbar {
  margin-bottom: 8px;
}

.stock-critical-head {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  padding-right: 8px;
  border-right: 1px solid var(--line);
}

.stock-critical-head h2 {
  margin: 0;
  font-size: 13px;
  white-space: nowrap;
}

.stock-critical-list {
  display: flex;
  min-width: 0;
  flex: 1;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 1px;
}

.stock-critical-list .list-row {
  flex: 0 0 auto;
  grid-template-columns: minmax(92px, 128px) auto;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 7px;
}

.stock-critical-list .list-row strong {
  overflow: hidden;
  font-size: 12px;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-critical-list .list-row .muted {
  display: none;
}

.stock-critical-list .status {
  width: fit-content;
  min-height: 18px;
  padding: 2px 6px;
  font-size: 10px;
}

.stock-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 6px;
}

.stock-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.stock-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.stock-card-head strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-card .muted {
  font-size: 11px;
  line-height: 1.15;
}

.stock-card .status {
  min-height: 18px;
  padding: 2px 6px;
  font-size: 10px;
}

.stock-meter {
  height: 5px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(90deg, #fee4e2, #fffaeb, #ecfdf3);
}

.stock-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--stock-color, #12b886) 68%, #ffffff), var(--stock-color, #12b886));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--stock-color, #12b886) 24%, transparent);
  transition:
    width 180ms ease,
    background 180ms ease;
}

.stock-actions {
  display: grid;
  grid-template-columns: 28px 34px 28px;
  align-items: center;
  text-align: center;
}

.stock-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.stock-manage-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.stock-actions .button,
.stock-manage-actions .button {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
}

.stock-actions span {
  font-size: 14px;
  font-weight: 900;
}

.finance-layout,
.reminder-board {
  display: grid;
  grid-template-columns: minmax(460px, 1.15fr) minmax(300px, 0.85fr);
  gap: 10px;
}

.expense-list,
.summary-list,
.reminder-list {
  display: grid;
  gap: 8px;
}

.expense-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.expense-amount {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.expense-amount strong {
  font-size: 18px;
}

.summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.summary-row > span {
  font-weight: 900;
}

.reminder-board {
  grid-template-columns: minmax(420px, 1fr) minmax(320px, 0.75fr);
}

.reminder-card.done {
  opacity: 0.72;
}

.cart-row,
.list-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.cart-row strong {
  display: block;
  line-height: 1.18;
}

.cart-line-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.cart-line-meta span {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
}

.cart-line-meta small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.cart-line-meta .price-purpose {
  border-color: color-mix(in srgb, var(--brand) 28%, var(--line));
  background: color-mix(in srgb, var(--brand) 9%, #ffffff);
  color: var(--brand-strong);
}

.cart-panel .cart-list {
  max-height: 248px;
  overflow-y: auto;
  padding-right: 2px;
}

.cart-panel .button[data-action="complete-order"] {
  width: 100%;
}

.qty-controls {
  display: inline-grid;
  grid-template-columns: 30px 32px 30px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.qty-controls button {
  display: grid;
  place-items: center;
  height: 30px;
  background: var(--surface-soft);
  cursor: pointer;
  font-weight: 900;
}

.qty-controls .lucide-icon {
  width: 14px;
  height: 14px;
}

.qty-controls span {
  text-align: center;
  font-weight: 900;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  margin: 10px 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 18px;
  font-weight: 900;
}

.order-detail-box {
  margin: 10px 0;
  padding: 10px;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f4fbf8;
}

.cart-panel .order-detail-box {
  padding: 10px;
}

.cart-panel .order-detail-box .form-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.cart-panel .order-detail-box input,
.cart-panel .order-detail-box select,
.cart-panel .order-detail-box textarea {
  min-width: 0;
  font-size: 15px;
}

.cart-panel .order-detail-box textarea {
  min-height: 76px;
}

.order-mode-box {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}

.order-mode-box > label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.order-detail-box h3 {
  margin-bottom: 9px;
}

.pending-orders {
  display: grid;
  gap: 8px;
}

.pending-order-card {
  display: grid;
  grid-template-columns: minmax(190px, 0.85fr) minmax(170px, 0.7fr) minmax(240px, 1.15fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.pending-time {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 5px;
  padding: 3px 7px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.pending-order-card p {
  margin: 4px 0 0;
}

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

.pending-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.pending-actions .button {
  min-height: 32px;
  padding: 7px 9px;
  font-size: 12px;
}

.order-items-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.order-items-preview span {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
}

.order-items-editor {
  display: grid;
  gap: 7px;
}

.order-item-edit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 8px;
  align-items: center;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.order-item-edit span {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.order-item-edit input {
  height: 34px;
  padding: 6px 8px;
  text-align: center;
}

.empty {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1240px;
}

th,
td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #f0fdf9;
}

.status {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.status.ok {
  background: var(--ok-bg);
  color: var(--ok);
  border: 1px solid #abefc6;
}

.status.warn {
  background: var(--warn-bg);
  color: #93370d;
  border: 1px solid #fedf89;
}

.status.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecdca;
}

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

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

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

.form-grid .full {
  grid-column: 1 / -1;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(11, 13, 16, 0.58);
}

.dialog {
  width: min(640px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 14px;
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow-strong);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #f7f8fa;
}

.segmented.two {
  grid-template-columns: repeat(2, minmax(90px, 1fr));
}

.segmented button {
  min-height: 34px;
  background: transparent;
  cursor: pointer;
  font-weight: 800;
  color: var(--muted);
}

.segmented button.active {
  background: linear-gradient(135deg, var(--brand), #0f766e);
  color: white;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 40px));
  padding: 13px 15px;
  border-radius: 8px;
  background: #0b0d10;
  color: white;
  box-shadow: var(--shadow-strong);
  font-weight: 800;
}

.mobile-menu {
  display: none;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line-dark);
  }

  .sidebar-collapsed .sidebar {
    height: auto;
    align-items: flex-start;
    padding: 12px 14px;
  }

  .sidebar-collapsed .side-title {
    flex-direction: row;
    margin-bottom: 0;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .side-footer {
    margin-top: 16px;
  }

  .grid.two,
  .grid.three,
  .grid.four,
  .dashboard-metrics,
  .order-layout,
  .analytics-grid,
  .chartjs-grid,
  .dashboard-lanes,
  .finance-layout,
  .reminder-board,
  .stock-layout {
    grid-template-columns: 1fr;
  }

  .dashboard-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .dashboard-metrics .metric {
    min-height: 58px;
  }

  .product-list-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .cart-panel {
    position: static;
  }
}

@media (max-width: 620px) {
  .content {
    padding: 14px;
  }

  .login-panel {
    padding: 20px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .stock-critical-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .stock-critical-head {
    width: 100%;
    justify-content: space-between;
    padding-right: 0;
    padding-bottom: 5px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .product-tile {
    min-height: 104px;
  }

  .product-list-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .product-list-row .card-actions {
    justify-content: flex-start;
  }

  .category-tabs {
    margin-right: -14px;
    padding-right: 14px;
  }

  .catalog-grid {
    grid-template-columns: 1fr;
  }

  .chart-insights {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stock-list {
    grid-template-columns: 1fr;
  }

  .stock-side {
    justify-content: flex-start;
  }

  .chartjs-grid {
    gap: 8px;
  }

  .chart-canvas-wrap.large {
    height: 108px;
    max-height: 108px;
  }

  .chart-canvas-wrap.compact {
    height: 76px;
    max-height: 76px;
  }

  .compact-bars {
    grid-template-columns: repeat(7, minmax(82px, 1fr));
    gap: 6px;
    overflow-x: auto;
  }

  .timeline-bars {
    grid-auto-columns: minmax(42px, 1fr);
  }

  .density-grid {
    grid-template-columns: 1fr;
  }

  .expense-card,
  .stock-card,
  .pending-order-card {
    grid-template-columns: 1fr;
  }

  .expense-amount,
  .stock-actions,
  .stock-side,
  .stock-manage-actions,
  .pending-actions {
    justify-content: flex-start;
    justify-items: stretch;
  }

  .segmented {
    width: 100%;
  }
}
