:root {
  color-scheme: dark;
  --bg: #08090a;
  --panel: #111317;
  --panel-2: #171a20;
  --line: #2a2e35;
  --line-soft: #202329;
  --text: #f2efe7;
  --muted: #a7a49c;
  --dim: #737069;
  --gold: #d9ad55;
  --gold-2: #f0d18a;
  --danger: #ff8b8b;
  --ok: #74d39a;
  --warn: #f0c66f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: inherit; }
.skip-link {
  position: fixed;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  background: var(--gold);
  color: #111;
  padding: .75rem 1rem;
}
.skip-link:focus { top: 1rem; }
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
}
.sidebar {
  border-right: 1px solid var(--line);
  background: #0c0d10;
  padding: 1.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: .8rem;
  min-height: 54px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(217, 173, 85, .55);
  background: #15120b;
  color: var(--gold-2);
  font-weight: 800;
}
.brand small, .eyebrow, .meta, .muted { color: var(--muted); }
.brand strong { display: block; }
.nav-list, .mobile-menu {
  display: grid;
  gap: .35rem;
  margin-top: 2rem;
}
.nav-item, .ghost-button, .primary-button, .secondary-button, .icon-button {
  border: 1px solid var(--line);
  min-height: 42px;
  padding: .6rem .85rem;
  background: transparent;
  color: var(--text);
}
.nav-item {
  text-align: left;
  color: var(--muted);
}
.nav-item.active, .nav-item:hover, .ghost-button:hover, .secondary-button:hover, .icon-button:hover {
  border-color: rgba(217, 173, 85, .65);
  color: var(--text);
  background: rgba(217, 173, 85, .08);
}
.primary-button {
  background: var(--gold);
  color: #111;
  border-color: var(--gold);
  font-weight: 750;
}
.secondary-button { background: var(--panel-2); }
.main { min-width: 0; }
.topbar {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.35rem;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 9, 10, .92);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h1, .auth-card h1, .section-title h2 { margin: 0; }
.eyebrow {
  margin: 0 0 .25rem;
  text-transform: uppercase;
  font-size: .74rem;
  letter-spacing: .08em;
}
.topbar-actions {
  display: flex;
  align-items: end;
  gap: .7rem;
}
.icon-button { display: none; }
.content-band {
  padding: 1.25rem;
  max-width: 1240px;
}
.auth-layout {
  min-height: calc(100vh - 86px);
  display: grid;
  place-items: center;
  padding: 1.25rem;
}
.auth-card {
  width: min(100%, 460px);
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 1.35rem;
}
.field {
  display: grid;
  gap: .45rem;
  margin: .85rem 0;
}
.field span, .status-label { color: var(--muted); font-size: .86rem; }
.field input, .field select {
  width: 100%;
  min-height: 44px;
  background: #0b0d10;
  color: var(--text);
  border: 1px solid var(--line);
  padding: .65rem .75rem;
}
.field.compact { margin: 0; min-width: 210px; }
.field.compact select { min-height: 38px; }
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  align-items: center;
  margin-top: 1rem;
}
.alert {
  border: 1px solid var(--line);
  background: var(--panel-2);
  padding: .8rem;
  margin: .8rem 0;
}
.alert.error { border-color: rgba(255, 139, 139, .55); color: #ffd7d7; }
.alert.ok { border-color: rgba(116, 211, 154, .55); color: #d8ffe5; }
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
}
.summary-card, .product-card, .table-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 1rem;
}
.summary-card { grid-column: span 4; min-height: 150px; }
.wide { grid-column: span 8; }
.full { grid-column: 1 / -1; }
.section-title {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin: .4rem 0 1rem;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}
.product-card {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.product-card h3 { margin: 0 0 .35rem; }
.badge-row { display: flex; flex-wrap: wrap; gap: .4rem; margin: .7rem 0; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  padding: .18rem .5rem;
  color: var(--muted);
  font-size: .82rem;
}
.badge.gold { color: var(--gold-2); border-color: rgba(217, 173, 85, .5); }
.badge.ok { color: var(--ok); border-color: rgba(116, 211, 154, .45); }
.badge.warn { color: var(--warn); border-color: rgba(240, 198, 111, .45); }
.badge.dim { color: var(--dim); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 620px; }
th, td {
  padding: .8rem;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}
th { color: var(--muted); font-weight: 650; }
.row-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 1rem;
}
.loading {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.mobile-menu {
  margin: 0;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: #0c0d10;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
:focus-visible {
  outline: 2px solid var(--gold-2);
  outline-offset: 2px;
}

@media (max-width: 1050px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-card, .wide { grid-column: span 6; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .icon-button { display: inline-flex; align-items: center; }
  .topbar {
    position: static;
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .topbar-actions { width: 100%; align-items: stretch; }
  .field.compact { min-width: 0; flex: 1; }
  .content-band, .auth-layout { padding: .9rem; }
  .grid, .split { display: block; }
  .summary-card, .table-panel, .auth-card { margin-bottom: .9rem; }
  .product-grid { grid-template-columns: 1fr; }
  table { min-width: 540px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
