:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background: #050505;
  color: #f4f0e6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: #050505;
}

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

button, .ghost-button {
  border: 1px solid #c9a84c;
  background: #c9a84c;
  color: #080808;
  border-radius: 8px;
  min-height: 38px;
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button.ghost-button, .ghost-button {
  background: #151515;
  color: #c9a84c;
  border-color: #3a3320;
}

button.danger {
  background: #2b1010;
  color: #ff8a8a;
  border-color: #6d2424;
}

input, textarea, select {
  width: 100%;
  border: 1px solid #2a2a2a;
  background: #111;
  color: #f4f0e6;
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 11px;
}

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

label {
  display: grid;
  gap: 7px;
  color: #8b846f;
  font-size: 12px;
  font-weight: 800;
}

.hidden { display: none !important; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(520px, 100%);
  background: #0d0d0d;
  border: 1px solid #29230f;
  border-radius: 14px;
  padding: 28px;
  display: grid;
  gap: 16px;
}

.eyebrow {
  color: #c9a84c;
  margin: 0 0 5px;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 900;
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  min-height: 88px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid #1d1d1d;
  padding: 18px 24px;
  background: #080808;
}

.topbar h1 { color: #f4f0e6; font-size: 24px; }
.topbar p:not(.eyebrow), .status-text { color: #8d8777; font-size: 12px; }

.top-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.workspace {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 0;
}

.sidebar {
  border-right: 1px solid #1d1d1d;
  background: #080808;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px;
  border: 1px solid #242424;
  border-radius: 10px;
  background: #0d0d0d;
  margin-bottom: 8px;
}

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

.sidebar button, .mode-switch button {
  justify-content: flex-start;
  background: #111;
  color: #b6ad94;
  border-color: #242424;
}

.mode-switch button {
  justify-content: center;
  min-height: 42px;
}

.sidebar button.active, .mode-switch button.active {
  background: #c9a84c;
  color: #080808;
  border-color: #c9a84c;
}

.main-panel {
  min-width: 0;
  padding: 16px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.panel-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 380px) auto 1fr;
  gap: 10px;
  align-items: center;
}

.content-root {
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.hero-band {
  min-height: 154px;
  border-radius: 14px;
  border: 1px solid #29230f;
  background: #101010;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.hero-band h2 {
  font-size: 28px;
  color: #f8efd4;
  margin-bottom: 6px;
}

.hero-band p:not(.eyebrow) {
  color: #9a927d;
  max-width: 760px;
  line-height: 1.45;
}

.internal-band {
  background: linear-gradient(135deg, #101010, #151515 58%, #171309);
}

.external-band {
  background: linear-gradient(135deg, #0b0b0b, #16120a 54%, #211a0c);
}

.hero-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric-card {
  min-height: 94px;
  border: 1px solid #242424;
  background: #0d0d0d;
  border-radius: 12px;
  padding: 14px;
  display: grid;
  align-content: center;
  gap: 8px;
}

.metric-card span {
  color: #777;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 900;
}

.metric-card strong {
  color: #f8efd4;
  font-size: 24px;
}

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

.split {
  display: grid;
  grid-template-columns: minmax(300px, 42%) 1fr;
  gap: 14px;
  align-items: start;
}

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

.record-card {
  min-height: 94px;
  border: 1px solid #242424;
  background: #101010;
  border-radius: 10px;
  padding: 11px;
  display: grid;
  gap: 7px;
  cursor: pointer;
}

.internal-card-grid .record-card {
  min-height: 108px;
  align-content: start;
}

.subtabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 8px;
  border: 1px solid #242424;
  border-radius: 12px;
  background: #0a0a0a;
}

.menu-subtabs {
  position: sticky;
  top: 0;
  z-index: 1;
  margin-bottom: 12px;
}

.subtabs button {
  background: #111;
  color: #c9a84c;
  border-color: #3a3320;
}

.subtabs button.active {
  background: #c9a84c;
  color: #080808;
  border-color: #c9a84c;
}

.record-card.active {
  border-color: #c9a84c;
  background: #211b0e;
}

.record-card strong {
  color: #f2e8c7;
  font-size: 14px;
}

.record-card small {
  color: #777;
  font-size: 11px;
}

.mini-stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.mini-stat-row span {
  min-height: 24px;
  max-width: 100%;
  border: 1px solid #2a2a2a;
  border-radius: 7px;
  padding: 4px 7px;
  color: #c8b878;
  background: #151515;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor {
  border: 1px solid #29230f;
  background: #0d0d0d;
  border-radius: 12px;
  padding: 14px;
  display: grid;
  gap: 13px;
}

.internal-editor-shell {
  display: grid;
  grid-template-columns: minmax(360px, 46%) minmax(360px, 1fr);
  gap: 14px;
  align-items: start;
}

.editor-section-title {
  min-height: 54px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  margin-bottom: 10px;
}

.editor-section-title h3 {
  color: #f4e6b7;
  font-size: 20px;
}

.internal-detail-editor {
  position: sticky;
  top: 74px;
}

.internal-detail-editor .editor-header h2 {
  margin: 2px 0;
  color: #f8efd4;
  font-size: 22px;
}

.internal-detail-editor .editor-header small {
  color: #777;
}

.compact-metrics {
  margin-bottom: 12px;
}

.compact-metrics .metric-card {
  min-height: 74px;
  padding: 11px 12px;
}

.compact-metrics .metric-card strong {
  font-size: 20px;
}

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

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

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

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  border: 1px solid #2a2a2a;
  background: #151515;
  color: #aaa;
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 34px;
  cursor: pointer;
}

.chip.selected {
  background: #c9a84c;
  color: #080808;
  border-color: #c9a84c;
  font-weight: 900;
}

.variant-row, .ref-row, .prep-row {
  display: grid;
  grid-template-columns: 1fr 1fr 100px auto;
  gap: 8px;
  align-items: center;
}

.ref-row {
  grid-template-columns: 1fr 120px auto;
}

.prep-row {
  grid-template-columns: 1fr 1fr 100px auto;
}

.section-card {
  border: 1px solid #242424;
  background: #0a0a0a;
  border-radius: 10px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.muted {
  color: #817a68;
  line-height: 1.45;
}

.sync-stack {
  display: grid;
  gap: 8px;
  color: #aaa;
}

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

.bill-row {
  min-height: 62px;
  border: 1px solid #242424;
  border-radius: 10px;
  background: #0d0d0d;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.bill-row small {
  display: block;
  color: #777;
  margin-top: 4px;
}

.bill-row.voided {
  border-color: #5a2020;
  background: #170d0d;
  opacity: 0.74;
}

.web-category-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.web-category-card {
  border: 1px solid #29230f;
  background: #0d0d0d;
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

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

.mini-items span {
  max-width: 100%;
  border: 1px solid #2a2a2a;
  border-radius: 7px;
  padding: 5px 7px;
  color: #d5c99d;
  background: #151515;
  font-size: 11px;
}

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

.external-item-card {
  min-height: 260px;
  border: 1px solid #242424;
  background: #0d0d0d;
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  grid-template-rows: 170px 1fr;
}

.external-item-card.assigned {
  border-color: #c9a84c;
}

.photo-cell img,
.photo-cell .empty-image {
  width: 100%;
  height: 170px;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: #151515;
  color: #685f48;
  font-weight: 900;
}

.item-mask {
  padding: 12px;
  display: grid;
  gap: 9px;
}

.item-mask strong {
  color: #f4e6b7;
}

.item-mask small {
  color: #777;
  display: block;
  margin-top: 4px;
}

.step-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.step-card textarea {
  min-height: 96px;
}

.preview-board {
  display: grid;
  gap: 14px;
}

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

.preview-items article {
  min-height: 180px;
  border: 1px solid #242424;
  background: #111;
  border-radius: 10px;
  overflow: hidden;
}

.preview-items img,
.preview-items .empty-image {
  width: 100%;
  height: 112px;
  object-fit: cover;
  background: #171717;
  display: grid;
  place-items: center;
  color: #6b624b;
}

.preview-items strong,
.preview-items small {
  display: block;
  padding: 8px 10px 0;
}

.preview-items small {
  color: #c9a84c;
  padding-top: 4px;
}

.website-layout {
  display: grid;
  gap: 14px;
}

.website-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.website-tabs button {
  background: #111;
  color: #c9a84c;
  border-color: #3a3320;
}

.website-tabs button.active {
  background: #c9a84c;
  color: #080808;
}

.image-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  background: #151515;
  border: 1px solid #29230f;
}

.mask-card {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  align-items: start;
}

.mask-card img, .mask-card .empty-image {
  width: 110px;
  height: 88px;
  object-fit: cover;
  border-radius: 8px;
  background: #151515;
  display: grid;
  place-items: center;
  color: #6c6245;
  font-size: 11px;
  border: 1px solid #29230f;
}

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .sidebar { grid-template-columns: repeat(2, 1fr); border-right: 0; border-bottom: 1px solid #1d1d1d; }
  .nav-list { grid-template-columns: repeat(2, 1fr); }
  .split, .internal-editor-shell { grid-template-columns: 1fr; }
  .two-up { grid-template-columns: 1fr; }
  .internal-detail-editor { position: static; }
  .panel-toolbar { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .hero-band { align-items: flex-start; flex-direction: column; }
}
