:root {
  color-scheme: light;
  --bg: #f4f2ec;
  --panel: #fbfaf7;
  --panel-strong: #ffffff;
  --ink: #1f2322;
  --muted: #6f756f;
  --line: #ded9cf;
  --line-strong: #c9c1b4;
  --shelf: #242624;
  --shelf-edge: #121413;
  --accent: #d29322;
  --green: #4c9a6a;
  --blue: #4775b7;
  --violet: #7d63a7;
  --red: #b76057;
  --shadow: 0 18px 45px rgba(35, 30, 21, 0.13);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171a18;
  --panel: #20231f;
  --panel-strong: #242823;
  --ink: #ece8dc;
  --muted: #a29e92;
  --line: #34382f;
  --line-strong: #4b5045;
  --shelf: #0f1110;
  --shelf-edge: #080908;
  --accent: #dca43b;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.36);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #171a18;
    --panel: #20231f;
    --panel-strong: #242823;
    --ink: #ece8dc;
    --muted: #a29e92;
    --line: #34382f;
    --line-strong: #4b5045;
    --shelf: #0f1110;
    --shelf-edge: #080908;
    --accent: #dca43b;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.36);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow: hidden;
  min-width: 320px;
  background:
    linear-gradient(90deg, rgba(40, 45, 43, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(40, 45, 43, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: 36px 36px;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(560px, 1fr) 360px;
  height: 100vh;
  overflow: hidden;
  transition: grid-template-columns 180ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 76px minmax(560px, 1fr) 360px;
}

.sidebar,
.inspector {
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(18px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  height: 100vh;
  min-height: 0;
  padding: 20px 18px;
  overflow: hidden;
  transition: padding 180ms ease;
}

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

.brand strong {
  display: block;
  font-size: 20px;
  line-height: 1.1;
}

.app-shell.sidebar-collapsed .sidebar {
  padding: 20px 14px;
}

.app-shell.sidebar-collapsed .brand {
  justify-content: center;
  padding-bottom: 18px;
}

.app-shell.sidebar-collapsed .brand > div,
.app-shell.sidebar-collapsed .nav-heading span,
.app-shell.sidebar-collapsed .nav-heading .icon-button,
.app-shell.sidebar-collapsed .category-toggle strong,
.app-shell.sidebar-collapsed .category-toggle small,
.app-shell.sidebar-collapsed .nav-item span:last-child,
.app-shell.sidebar-collapsed .lab-mode,
.app-shell.sidebar-collapsed .sidebar-footer {
  display: none;
}

.app-shell.sidebar-collapsed .category-toggle {
  justify-content: center;
}

.app-shell.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 9px;
}

.app-shell.sidebar-collapsed .nav-heading {
  justify-content: center;
}

.app-shell.sidebar-collapsed .chevron {
  display: none;
}

.brand small,
.muted,
.shelf-titlebar p,
.shelf-tip,
.lab-mode p,
.status-pill small {
  color: var(--muted);
}

.brand-mark {
  display: block;
  flex: 0 0 44px;
  position: relative;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--panel-strong) 62%, transparent);
  cursor: pointer;
}

.brand-mark span {
  position: absolute;
  left: 11px;
  width: 22px;
  height: 3px;
  border-radius: 999px;
  background: var(--shelf);
}

.brand-mark span:nth-child(1) {
  top: 12px;
}

.brand-mark span:nth-child(2) {
  top: 20px;
  transform: translateX(5px);
}

.brand-mark span:nth-child(3) {
  top: 28px;
  transform: translateX(-3px);
}

.nav-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.icon-button,
.sidebar-footer button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--muted);
  cursor: pointer;
}

.project-nav {
  padding-right: 2px;
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  margin-bottom: 14px;
}

.category {
  margin-bottom: 12px;
}

.category-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 8px 4px;
  text-align: left;
}

.category-toggle strong {
  flex: 1;
  font-size: 14px;
}

.category-toggle small {
  color: var(--muted);
}

.chevron {
  color: var(--muted);
  font-size: 13px;
}

.nav-items {
  display: grid;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 34px;
  gap: 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 7px 9px 7px 17px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: color-mix(in srgb, var(--accent) 14%, var(--panel));
}

.nav-item span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 999px;
  background: var(--green);
}

.dot.Published {
  background: var(--green);
}

.dot.Active {
  background: var(--blue);
}

.dot.Baseline {
  background: var(--violet);
}

.dot.Blocked {
  background: var(--red);
}

.lab-mode {
  position: relative;
  margin-top: auto;
  min-height: 140px;
  padding: 18px 96px 18px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 9%, var(--panel));
  overflow: hidden;
}

.lab-mode strong {
  display: block;
  margin-bottom: 10px;
}

.lab-mode p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.mini-record {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #e1b04b 0 8px, #101211 9px 12px, transparent 13px),
    repeating-radial-gradient(circle, #1b1c1b 0 3px, #0d0e0d 4px 5px);
  box-shadow: 0 16px 26px rgba(0, 0, 0, 0.22);
}

.sidebar-footer {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.workspace {
  min-width: 0;
  height: 100vh;
  min-height: 0;
  overflow: auto;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(320px, 620px) auto;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 84px;
  padding: 20px 32px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 3;
  background:
    linear-gradient(90deg, rgba(40, 45, 43, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(40, 45, 43, 0.035) 1px, transparent 1px),
    color-mix(in srgb, var(--bg) 88%, transparent);
  background-size: 36px 36px;
  backdrop-filter: blur(16px);
}

.search {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 72%, transparent);
  padding: 0 14px;
}

kbd {
  min-width: 22px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: var(--panel-strong);
  font-size: 12px;
  line-height: 20px;
  text-align: center;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 72%, transparent);
  padding: 12px 14px;
}

.status-pill > span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #2fa35c;
}

.status-pill strong {
  display: block;
  font-size: 13px;
}

.shelf-panel {
  padding: 28px 32px 18px;
}

.shelf-titlebar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

h1 {
  margin: 0 0 6px;
  font-size: 32px;
  line-height: 1.08;
}

.shelf-titlebar p {
  margin: 0;
}

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

.filter {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 13px;
}

.filter:hover {
  border-color: var(--line);
}

.filter.active {
  background: var(--ink);
  color: #fff;
}

[data-theme="dark"] .filter.active {
  color: #121412;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .filter.active {
    color: #121412;
  }
}

.shelf-stage {
  position: relative;
  overflow: hidden;
  min-height: 690px;
  border-radius: 8px;
}

.shelf-rows {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 42px;
}

.shelf-row {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 22px 18px;
  align-items: end;
  min-height: 224px;
  padding: 0 10px 24px;
}

.shelf-row::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 20px;
  border-radius: 3px;
  background:
    linear-gradient(180deg, #3b3b38, var(--shelf-edge)),
    var(--shelf);
  box-shadow:
    0 16px 24px rgba(30, 23, 16, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.record {
  position: relative;
  display: grid;
  align-content: space-between;
  min-height: 210px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 5px;
  background: var(--cover-bg, #222);
  color: var(--cover-ink, #fff);
  box-shadow: 8px 8px 0 rgba(22, 22, 20, 0.16), 0 16px 24px rgba(42, 34, 22, 0.18);
  cursor: pointer;
  padding: 20px 18px 16px;
  text-align: left;
  transform: translateY(0);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.record::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 5px;
  background: var(--cover-pattern);
  opacity: 0.82;
  pointer-events: none;
}

.record::after {
  content: "";
  position: absolute;
  right: -10px;
  bottom: 7px;
  width: 10px;
  height: calc(100% - 20px);
  border-radius: 0 3px 3px 0;
  background: rgba(26, 25, 22, 0.22);
}

.record > * {
  position: relative;
  z-index: 1;
}

.record:hover,
.record.active {
  transform: translateY(-8px);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(210, 147, 34, 0.7), 10px 16px 28px rgba(42, 34, 22, 0.28);
}

.record h2 {
  margin: 0;
  max-width: 11ch;
  font-size: 18px;
  line-height: 1.08;
  text-transform: uppercase;
}

.record small {
  display: block;
  margin-top: 7px;
  color: currentColor;
  opacity: 0.72;
}

.record-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  opacity: 0.86;
}

.shelf-tip {
  margin: 18px 0 0;
  text-align: center;
  font-size: 13px;
}

.inspector {
  border-left: 1px solid var(--line);
  height: 100vh;
  overflow: auto;
  padding: 20px 18px;
}

.inspector-card {
  position: relative;
  display: grid;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 76%, transparent);
  box-shadow: var(--shadow);
  padding: 22px;
}

.project-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

#detailStatusDot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
}

.inspector h2 {
  margin: -8px 0 0;
  font-size: 24px;
  line-height: 1.1;
}

.inspector section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.inspector h3 {
  margin: 0 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
}

.inspector p {
  margin: 0;
  line-height: 1.55;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-list span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 82%, var(--bg));
  color: var(--muted);
  font-size: 12px;
  padding: 6px 9px;
}

.entry-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.entry-links a {
  display: grid;
  place-items: center;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 700;
}

.entry-links a:hover {
  border-color: var(--accent);
}

.preview-card {
  min-height: 184px;
  border-radius: 8px;
  background: #121817;
  color: #e6ece5;
  overflow: hidden;
  padding: 14px;
}

.preview-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
  color: #a8b5ad;
  font-size: 11px;
}

.preview-graph {
  height: 90px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  background:
    linear-gradient(135deg, transparent 0 20%, rgba(210, 147, 34, 0.28) 21% 23%, transparent 24% 100%),
    linear-gradient(25deg, transparent 0 35%, rgba(76, 154, 106, 0.36) 36% 38%, transparent 39% 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 28px);
}

.preview-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.preview-metrics span {
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
  padding: 8px;
  color: #b8c4bd;
  font-size: 11px;
}

.preview-metrics strong {
  display: block;
  margin-top: 3px;
  color: #fff;
  font-size: 18px;
}

.next-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

@media (max-width: 1180px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 250px minmax(0, 1fr);
    height: auto;
    overflow: visible;
  }

  .inspector {
    grid-column: 2;
    border-top: 1px solid var(--line);
    border-left: 0;
    height: auto;
    overflow: visible;
  }

  .inspector-card {
    position: static;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

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

  .project-nav {
    max-height: 300px;
  }

  .topbar,
  .shelf-titlebar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .topbar,
  .shelf-panel {
    padding: 20px;
  }

  .status-pill {
    min-width: 0;
  }

  .shelf-stage {
    min-height: auto;
  }

  .shelf-row {
    grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
    min-height: 210px;
  }
}
