:root {
  color-scheme: dark;
  --bg: #070709;
  --panel: #111115;
  --panel-2: #17171d;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f7f4ec;
  --muted: #aaa59a;
  --gold: #d7b56d;
  --gold-strong: #f0cb7d;
  --green: #5fd0a5;
  --amber: #f0b95b;
  --red: #e86f6f;
  --blue: #77a7ff;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 70% 0%, rgba(215, 181, 109, 0.12), transparent 36rem),
    linear-gradient(135deg, #070709 0%, #111115 48%, #080808 100%);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 18rem 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.25rem;
  border-right: 1px solid var(--line);
  background: rgba(8, 8, 9, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.8rem;
  height: 2.8rem;
  border: 1px solid rgba(215, 181, 109, 0.65);
  border-radius: 8px;
  color: var(--gold-strong);
  font-weight: 800;
  background: #0d0c0a;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.sidebar-card p,
.metric small,
.metric span,
.panel-header span,
.eyebrow {
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 0.45rem;
  padding: 1.4rem 0;
}

.nav-item,
.ghost,
.primary {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.72rem 0.9rem;
  color: var(--text);
  background: transparent;
}

.nav-item {
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  border-color: rgba(215, 181, 109, 0.52);
  background: rgba(215, 181, 109, 0.1);
  color: var(--gold-strong);
}

.sidebar-card {
  margin-top: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.mini-label,
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
}

.main {
  padding: 1.4rem;
  overflow: hidden;
}

.topbar,
.section-heading,
.panel-header,
.form-actions,
.top-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar {
  padding-bottom: 1.2rem;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 3vw, 3rem);
}

h2 {
  margin-bottom: 0;
  font-size: 1.55rem;
}

h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.primary {
  border-color: rgba(215, 181, 109, 0.75);
  background: linear-gradient(180deg, #e0bd72, #9f792d);
  color: #12100b;
  font-weight: 800;
}

.ghost:hover,
.upload-tile:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.04);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 17, 21, 0.86);
  box-shadow: var(--shadow);
}

.metric {
  padding: 1rem;
}

.metric strong {
  display: block;
  margin: 0.2rem 0;
  font-size: 1.65rem;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.dashboard-grid,
.workspace-grid,
.concept-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(18rem, 0.8fr);
  gap: 1rem;
  margin-top: 1rem;
}

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

.panel {
  padding: 1rem;
  overflow: hidden;
}

.panel-wide {
  min-width: 0;
}

.status-pill,
.signal {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  border-radius: 999px;
  padding: 0.32rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 800;
}

.status-pill.good,
.signal.good {
  background: rgba(95, 208, 165, 0.14);
  color: var(--green);
}

.status-pill.warn,
.signal.warn {
  background: rgba(240, 185, 91, 0.14);
  color: var(--amber);
}

.status-pill.bad,
.signal.bad {
  background: rgba(232, 111, 111, 0.14);
  color: var(--red);
}

.event-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.summary-tile,
.signal-list > div,
.average-list > div {
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.summary-tile span,
.average-list span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.summary-tile strong,
.average-list strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.05rem;
}

.signal-list,
.average-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.category-bars {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 9rem 1fr 5rem;
  gap: 0.8rem;
  align-items: center;
}

.bar-track {
  height: 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--blue));
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 17, 21, 0.86);
}

label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.85rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  color: var(--text);
  background: #0c0c10;
}

textarea {
  resize: vertical;
}

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

.table-wrap {
  width: 100%;
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  background: rgba(17, 17, 21, 0.86);
}

.table-wrap.compact {
  margin-top: 1rem;
}

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

th,
td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

td input,
td select {
  min-width: 5.5rem;
  padding: 0.55rem;
}

.drink-picker {
  display: grid;
  gap: 0.55rem;
  max-height: 35rem;
  overflow: auto;
  margin-top: 1rem;
}

.picker-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.picker-item small,
.muted {
  color: var(--muted);
}

.cell-sub {
  display: block;
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.link-button {
  border: 0;
  padding: 0;
  color: var(--gold-strong);
  background: transparent;
  font-weight: 800;
  text-align: left;
}

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

.upload-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.upload-tile input {
  display: none;
}

.screenshot-preview {
  display: grid;
  place-items: center;
  min-height: 18rem;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: var(--muted);
  overflow: hidden;
  background: #09090b;
}

.screenshot-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

pre {
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #09090b;
  color: #efe7d5;
}

li {
  margin-bottom: 0.5rem;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

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

  .metric-grid,
  .dashboard-grid,
  .workspace-grid,
  .concept-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .event-summary {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .main,
  .sidebar {
    padding: 1rem;
  }

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

  .top-actions,
  .form-actions {
    width: 100%;
    flex-direction: column;
  }

  .top-actions button,
  .form-actions button {
    width: 100%;
  }
}

@media print {
  :root {
    color-scheme: light;
  }

  body {
    background: #fff;
    color: #111;
  }

  .sidebar,
  .top-actions,
  .nav,
  .view:not(.active),
  .upload-tile,
  button {
    display: none !important;
  }

  .app-shell,
  .main,
  .dashboard-grid,
  .workspace-grid,
  .concept-grid,
  .metric-grid {
    display: block;
  }

  .main {
    padding: 0;
  }

  .panel,
  .metric,
  .table-wrap,
  .form-grid {
    page-break-inside: avoid;
    margin-bottom: 1rem;
    box-shadow: none;
    border-color: #d4c29a;
    background: #fff;
    color: #111;
  }

  input,
  select,
  textarea {
    color: #111;
    background: #fff;
    border-color: #ccc;
  }
}
