:root {
  --bg: #f3f5f8;
  --bg-muted: #e8edf3;
  --surface: #ffffff;
  --surface-alt: #f7f9fc;
  --surface-strong: #eef3f8;
  --line: #d7dee8;
  --line-strong: #bcc7d5;
  --text: #17212e;
  --muted: #5f6f82;
  --accent: #0f6cbd;
  --accent-strong: #084f8a;
  --accent-soft: #dcecff;
  --gold: #c78b2f;
  --danger: #bf3b4b;
  --danger-soft: #fdecef;
  --success: #1f7a4d;
  --success-soft: #e7f6ee;
  --shadow: 0 18px 40px rgba(17, 33, 56, 0.08);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-ui: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Avenir Next Condensed", "Arial Narrow", "Franklin Gothic Medium", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(15, 108, 189, 0.08), transparent 32%),
    linear-gradient(180deg, #f7f9fc 0%, #eef2f7 100%);
  color: var(--text);
  font-family: var(--font-ui);
}

body {
  line-height: 1.45;
}

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

audio {
  width: 100%;
}

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

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

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  letter-spacing: 0.01em;
}

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

.landing-shell,
.app-shell,
.admin-body {
  width: min(1600px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 16px 0 32px;
}

.landing-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.landing-panel,
.hero-banner,
.toolbar-card,
.form-card,
.table-card,
.catalog-card,
.status-bar,
.summary-card,
.list-panel,
.detail-panel,
.grid-panel,
.info-card,
.record-card,
.admin-sidebar,
.view-frame {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.landing-panel,
.hero-banner,
.toolbar-card,
.form-card,
.table-card,
.list-panel,
.detail-panel,
.grid-panel,
.admin-sidebar,
.view-frame {
  padding: 24px;
}

.landing-panel {
  width: min(720px, 100%);
  display: grid;
  gap: 16px;
}

.eyebrow,
.sidebar-kicker,
.topbar-kicker,
.summary-label,
.stat-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.lede,
.section-copy,
.muted-copy,
.sidebar-copy,
.topbar-subtitle,
.panel-header p,
.catalog-meta {
  color: var(--muted);
}

.landing-actions,
.hero-actions,
.topbar-actions,
.form-actions,
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.primary-button,
.secondary-button,
.ghost-button,
.ghost-link,
.small-button,
.danger-button,
.sidebar-tab {
  appearance: none;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 11px 16px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.ghost-link:hover,
.small-button:hover,
.danger-button:hover,
.sidebar-tab:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: linear-gradient(180deg, #1674c7, #0c5fa8);
  border-color: #0c5fa8;
  color: #fff;
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.ghost-button:focus-visible,
.ghost-link:focus-visible,
.small-button:focus-visible,
.danger-button:focus-visible,
.sidebar-tab:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(15, 108, 189, 0.18);
  outline-offset: 1px;
}

.secondary-button,
.ghost-button,
.ghost-link,
.small-button {
  background: var(--surface-alt);
}

.danger-button {
  border-color: #e8b2bb;
  background: var(--danger-soft);
  color: var(--danger);
}

.admin-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-sidebar {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 18px;
  padding: 20px;
}

.sidebar-brand {
  display: grid;
  gap: 8px;
}

.sidebar-brand h1 {
  font-size: 1.8rem;
  line-height: 0.95;
}

.sidebar-nav,
.sidebar-links {
  display: grid;
  gap: 8px;
}

.sidebar-tab,
.sidebar-link {
  width: 100%;
  text-align: left;
  background: var(--surface-alt);
}

.sidebar-tab.active {
  background: var(--accent-soft);
  border-color: #9cc8f0;
  color: var(--accent-strong);
  font-weight: 700;
}

.sidebar-link {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}

.admin-main {
  display: grid;
  gap: 16px;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  padding: 6px 4px 0;
}

.topbar-copy {
  display: grid;
  gap: 6px;
}

.topbar-copy h2 {
  font-size: clamp(1.9rem, 2.8vw, 2.8rem);
  line-height: 0.96;
}

.topbar-subtitle {
  max-width: 72ch;
}

.topbar-actions {
  justify-content: flex-end;
}

.topbar-search,
.search-input,
.field input,
.field textarea,
.field select,
label > input,
label > textarea,
label > select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 12px 14px;
}

.topbar-search {
  min-width: 280px;
  max-width: 360px;
}

.summary-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.summary-card {
  padding: 16px 18px;
  display: grid;
  gap: 8px;
}

.summary-value,
.stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
}

.status-bar {
  padding: 14px 16px;
  color: var(--muted);
}

.status-bar.success {
  background: var(--success-soft);
  border-color: #b6e0c7;
  color: var(--success);
}

.status-bar.error {
  background: var(--danger-soft);
  border-color: #efc2c9;
  color: var(--danger);
}

.view-frame {
  padding: 14px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.editor-layout,
.split-layout {
  display: grid;
  gap: 14px;
}

.editor-layout {
  grid-template-columns: 320px minmax(0, 1fr);
}

.split-layout {
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
}

.list-panel,
.detail-panel,
.grid-panel {
  min-height: 640px;
}

.list-panel,
.detail-panel,
.grid-panel {
  display: grid;
  gap: 14px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.panel-header.compact {
  align-items: center;
}

.panel-header h3 {
  font-size: 1.25rem;
}

.list-scroll {
  display: grid;
  gap: 8px;
  align-content: start;
  max-height: 100%;
  overflow: auto;
  padding-right: 2px;
}

.record-card {
  padding: 14px;
  display: grid;
  gap: 4px;
  text-align: left;
  cursor: pointer;
}

.record-card strong {
  font-size: 1rem;
}

.record-card span,
.record-card small {
  color: var(--muted);
}

.record-card.active {
  border-color: #9cc8f0;
  background: var(--accent-soft);
}

.detail-form,
.stack-form {
  display: grid;
  gap: 16px;
}

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

.field,
label {
  display: grid;
  gap: 7px;
  align-content: start;
}

.field span,
label > span {
  font-size: 0.9rem;
  font-weight: 700;
  color: #334154;
}

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

.field textarea,
label > textarea {
  resize: vertical;
  min-height: 120px;
}

.toggle-field {
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding-top: 28px;
}

.toggle-field input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: 1px solid #b8d7f5;
  font-size: 0.82rem;
  font-weight: 700;
}

.pill.muted {
  background: var(--surface-strong);
  color: var(--muted);
  border-color: var(--line);
}

.card-grid,
.catalog-grid,
.summary-stack {
  display: grid;
  gap: 12px;
}

.card-grid,
.catalog-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.summary-stack {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.info-card,
.catalog-card {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.compact-card {
  min-height: 0;
}

.media-frame {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  padding: 10px;
}

.media-frame img,
.media-frame video {
  width: 100%;
  border-radius: 10px;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  padding: 20px;
}

.hero-banner {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
}

.hero-banner h1 {
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 0.95;
  margin-bottom: 10px;
}

.page-stack {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.toolbar-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.stat-card {
  padding: 18px;
}

.catalog-section {
  display: grid;
}

.table-card {
  display: grid;
  gap: 16px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
}

.catalog-title {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.catalog-meta {
  font-size: 0.88rem;
}

.info-card p,
.catalog-card p,
.section-copy,
.lede,
.sidebar-copy,
.topbar-subtitle {
  line-height: 1.55;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em;
}

@media (max-width: 1180px) {
  .admin-layout,
  .editor-layout,
  .split-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
  }

  .admin-topbar,
  .hero-banner,
  .toolbar-card {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-search {
    max-width: none;
    min-width: 0;
  }
}

@media (max-width: 760px) {
  .landing-shell,
  .app-shell,
  .admin-body {
    width: min(100vw - 16px, 100%);
    padding: 8px 0 18px;
  }

  .landing-panel,
  .hero-banner,
  .toolbar-card,
  .form-card,
  .table-card,
  .list-panel,
  .detail-panel,
  .grid-panel,
  .admin-sidebar,
  .view-frame {
    padding: 16px;
    border-radius: 16px;
  }

  .field-grid,
  .form-grid,
  .summary-bar,
  .stats-grid,
  .card-grid,
  .catalog-grid,
  .summary-stack {
    grid-template-columns: 1fr;
  }
}

.intake-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 20px;
}

.intake-list-panel,
.intake-detail-panel {
  min-height: 0;
}

.intake-detail-panel {
  display: grid;
  gap: 18px;
}

.compact-stack {
  margin-bottom: 16px;
}

.bucket-stack {
  display: grid;
  gap: 18px;
}

.bucket-panel {
  display: grid;
  gap: 12px;
  padding-top: 6px;
}

.intake-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.intake-asset-card {
  display: grid;
  gap: 12px;
}

.dirty-card {
  border-color: var(--gold);
  box-shadow: 0 16px 36px rgba(199, 139, 47, 0.12);
}

.compact-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.pill-row-tight {
  gap: 6px;
}

.muted-row {
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 1180px) {
  .intake-layout {
    grid-template-columns: 1fr;
  }
}

.admin-layout.sidebar-collapsed {
  grid-template-columns: 92px minmax(0, 1fr);
}

.admin-layout.sidebar-collapsed .sidebar-brand,
.admin-layout.sidebar-collapsed .sidebar-links {
  display: none;
}

.admin-layout.sidebar-collapsed .sidebar-tab {
  text-align: center;
  padding-left: 10px;
  padding-right: 10px;
}

.intake-layout-compact {
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
}

.intake-bucket-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.intake-strip-shell {
  gap: 14px;
}

.intake-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 220px);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
}

.intake-strip-card {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  padding: 10px;
  display: grid;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
}

.intake-strip-card.active {
  border-color: #8ab7e7;
  background: linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%);
  box-shadow: 0 18px 32px rgba(15, 108, 189, 0.14);
}

.intake-strip-media {
  padding: 8px;
}

.intake-strip-media img,
.intake-strip-media video {
  height: 150px;
  object-fit: cover;
}

.intake-strip-meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.intake-strip-meta strong {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.intake-inspector-shell {
  min-height: 0;
}

.intake-inspector .media-frame img,
.intake-inspector .media-frame video {
  max-height: 420px;
  object-fit: contain;
}

.intake-quickbar {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
  padding-top: 4px;
}

@media (max-width: 1180px) {
  .admin-layout.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .admin-layout.sidebar-collapsed .sidebar-brand,
  .admin-layout.sidebar-collapsed .sidebar-links {
    display: grid;
  }

  .intake-layout-compact {
    grid-template-columns: 1fr;
  }

  .intake-strip {
    grid-auto-columns: minmax(220px, 260px);
  }
}
