:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #edf0f3;
  --ink: #172027;
  --muted: #5c6872;
  --line: #d7dde3;
  --primary: #101820;
  --primary-2: #243746;
  --gold: #d6a12c;
  --green: #2e7d6b;
  --coral: #d85532;
  --blue: #4b6bfb;
  --violet: #7a5af8;
  --shadow: 0 14px 40px rgba(16, 24, 32, .09);
  --radius: 8px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1115;
  --panel: #151b21;
  --panel-2: #1d252d;
  --ink: #eef3f7;
  --muted: #9aa7b2;
  --line: #2d3740;
  --primary: #f6f7f9;
  --primary-2: #dfe6ec;
  --shadow: 0 14px 40px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% -10%, rgba(214, 161, 44, .14), transparent 28rem),
    linear-gradient(180deg, rgba(75, 107, 251, .05), transparent 22rem),
    var(--bg);
  font-family: "Fira Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
  overscroll-behavior-y: none;
}

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

button {
  cursor: pointer;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(75, 107, 251, .45);
  outline-offset: 2px;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.boot-screen {
  min-height: 100svh;
  display: grid;
  place-content: center;
  gap: 14px;
  color: var(--muted);
  text-align: center;
}

.layout {
  min-height: 100svh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100svh;
  padding: calc(18px + var(--safe-top)) 14px calc(18px + var(--safe-bottom));
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

:root[data-theme="dark"] .sidebar {
  background: rgba(16, 24, 32, .76);
}

.brand {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(214, 161, 44, .22);
  flex: 0 0 auto;
}

.brand-name {
  font-weight: 700;
  line-height: 1.05;
}

.brand-sub {
  font-family: "Fira Code", monospace;
  font-size: 11px;
  color: var(--muted);
}

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

.nav-button {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  padding: 0 12px;
  text-align: left;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}

.nav-button svg { width: 19px; height: 19px; }

.nav-button:hover, .nav-button.active {
  background: var(--panel-2);
  color: var(--ink);
}

.nav-button.active {
  box-shadow: inset 3px 0 0 var(--gold);
}

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

.user-chip {
  min-height: 52px;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--green), var(--blue));
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  flex: 0 0 auto;
}

.main {
  min-width: 0;
  padding: calc(18px + var(--safe-top)) 24px calc(90px + var(--safe-bottom));
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin: 0 auto 18px;
  max-width: 1480px;
}

.searchbox {
  position: relative;
  max-width: 680px;
}

.searchbox svg {
  position: absolute;
  left: 13px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.searchbox input, .field input, .field select, .field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  padding: 10px 12px;
}

.searchbox input { padding-left: 42px; }

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page {
  max-width: 1480px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
}

.eyebrow {
  font-family: "Fira Code", monospace;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--green);
  letter-spacing: .08em;
}

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

h1 {
  margin-bottom: 4px;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.03;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 22px;
  line-height: 1.18;
}

h3 {
  margin-bottom: 6px;
  font-size: 16px;
}

p {
  margin-bottom: 0;
  color: var(--muted);
}

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

.grid.stats {
  grid-template-columns: repeat(5, minmax(130px, 1fr));
}

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

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

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

.panel, .card, .modal-card, .drawer {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
}

.card {
  overflow: hidden;
}

.card-body {
  padding: 14px;
}

.stat {
  min-height: 104px;
  padding: 14px;
  border-left: 4px solid var(--gold);
}

.stat:nth-child(2) { border-left-color: var(--green); }
.stat:nth-child(3) { border-left-color: var(--blue); }
.stat:nth-child(4) { border-left-color: var(--coral); }
.stat:nth-child(5) { border-left-color: var(--violet); }

.stat-value {
  font-family: "Fira Code", monospace;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.stat-label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.hero-band {
  min-height: 280px;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  background: var(--primary);
  color: white;
  display: grid;
  align-items: end;
}

.hero-band img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .52;
}

.hero-band::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(16, 24, 32, .82));
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 24px;
  max-width: 720px;
}

.toolbar, .segmented, .card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.segmented button {
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  border-radius: 6px;
}

.segmented button.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(16, 24, 32, .08);
}

.btn {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.btn svg { width: 18px; height: 18px; }
.btn:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--line), var(--ink) 25%); }
.btn.primary { background: var(--primary); color: var(--bg); border-color: var(--primary); }
.btn.gold { background: var(--gold); color: #111; border-color: var(--gold); }
.btn.green { background: var(--green); color: white; border-color: var(--green); }
.btn.coral { background: var(--coral); color: white; border-color: var(--coral); }
.btn.icon { width: 44px; padding: 0; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.small { min-height: 34px; padding: 0 10px; font-size: 13px; }

.badge, .status {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  color: var(--muted);
  background: var(--panel);
}

.status.live {
  color: var(--green);
  border-color: rgba(46, 125, 107, .34);
  background: rgba(46, 125, 107, .08);
}

.status.warn {
  color: var(--coral);
  border-color: rgba(216, 85, 50, .34);
  background: rgba(216, 85, 50, .08);
}

.media {
  aspect-ratio: 16/9;
  background: var(--panel-2);
  overflow: hidden;
}

.media.square { aspect-ratio: 1; }

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

.listing-card .media {
  aspect-ratio: 4/3;
}

.price {
  font-family: "Fira Code", monospace;
  font-weight: 700;
  color: var(--green);
}

.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.list {
  display: grid;
  gap: 8px;
}

.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

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

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

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

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

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

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

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

th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  background: var(--panel-2);
}

.map {
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel-2);
}

.floor-map {
  min-height: 420px;
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel-2);
}

.floor-map img {
  width: 100%;
  height: 100%;
  min-height: 420px;
  object-fit: cover;
}

.booth-pin {
  position: absolute;
  min-width: 56px;
  min-height: 44px;
  border: 2px solid var(--primary);
  background: rgba(255, 255, 255, .92);
  color: #111;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-family: "Fira Code", monospace;
  font-weight: 700;
  transform: translate(-50%, -50%);
  box-shadow: var(--shadow);
}

.booth-pin.live {
  border-color: var(--green);
}

.feed-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.feed-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  color: var(--primary);
}

.feed-icon svg { width: 20px; height: 20px; }

.chart {
  min-height: 220px;
  display: grid;
  place-items: center;
}

.chart svg {
  width: 100%;
  max-height: 220px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 24, 32, .46);
}

.modal-card {
  width: min(760px, 100%);
  max-height: calc(100svh - 36px);
  overflow: auto;
  padding: 16px;
}

.drawer {
  position: fixed;
  z-index: 45;
  right: 16px;
  top: calc(16px + var(--safe-top));
  bottom: calc(16px + var(--safe-bottom));
  width: min(520px, calc(100vw - 32px));
  overflow: auto;
  padding: 16px;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 44;
  background: rgba(16, 24, 32, .35);
}

.toast-region {
  position: fixed;
  z-index: 80;
  right: 16px;
  bottom: calc(16px + var(--safe-bottom));
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
}

.toast {
  padding: 12px;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--bg);
  box-shadow: var(--shadow);
}

.empty {
  min-height: 180px;
  display: grid;
  place-content: center;
  gap: 10px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel), transparent 26%);
}

.hidden {
  display: none !important;
}

.mobile-bar {
  display: none;
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .main {
    padding-inline: 14px;
  }
  .grid.stats, .grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mobile-bar {
    position: fixed;
    z-index: 40;
    left: 10px;
    right: 10px;
    bottom: calc(10px + var(--safe-bottom));
    min-height: 58px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .9);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
  }
  :root[data-theme="dark"] .mobile-bar {
    background: rgba(16, 24, 32, .9);
  }
  .mobile-bar button {
    min-height: 48px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    display: grid;
    place-items: center;
  }
  .mobile-bar button.active {
    color: var(--ink);
    background: var(--panel-2);
  }
}

@media (max-width: 720px) {
  body {
    font-size: 15px;
  }
  .main {
    padding-bottom: calc(130px + var(--safe-bottom));
  }
  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .top-actions {
    justify-content: space-between;
  }
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .grid.stats, .grid.two, .grid.three, .grid.four, .form-grid {
    grid-template-columns: 1fr;
  }
  .hero-band {
    min-height: 240px;
  }
  .hero-content {
    padding: 18px;
  }
  .listing-card > a {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    min-height: 156px;
  }
  .listing-card .media {
    aspect-ratio: auto;
    min-height: 156px;
    height: 100%;
  }
  .list-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
