:root {
  color-scheme: light dark;
  --bg: #f7f7f8;
  --shell: #ffffff;
  --panel: #ffffff;
  --panel-2: #fbfbfc;
  --text: #121316;
  --muted: #666b76;
  --line: #e5e7eb;
  --line-strong: #d7dae0;
  --accent: #ff4f0a;
  --accent-2: #ff6b1a;
  --accent-soft: #fff0e8;
  --green: #25b15a;
  --blue: #2c7be5;
  --purple: #7c3aed;
  --amber: #d98b05;
  --danger: #ff3232;
  --shadow: 0 14px 40px rgba(16, 24, 40, .06);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #080b0d;
    --shell: #0d1013;
    --panel: #111519;
    --panel-2: #0d1115;
    --text: #f5f6f7;
    --muted: #a7adb7;
    --line: #252a30;
    --line-strong: #333941;
    --accent-soft: #4a210d;
    --shadow: 0 20px 60px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
html, body, #app { min-height: 100%; margin: 0; background: var(--bg); color: var(--text); }
body { font-size: 14px; letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; line-height: 1.1; font-weight: 780; }
h1:focus { outline: none; }
h2 { font-size: 18px; line-height: 1.25; }
h3 { font-size: 15px; line-height: 1.25; }
p, small, span, td, th, input, button, a { line-height: 1.35; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 335px minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 20px;
  border-right: 1px solid var(--line);
  background: color-mix(in oklab, var(--shell) 92%, transparent);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 18px;
}

.brand strong { font-size: 23px; font-weight: 800; white-space: nowrap; }
.brand span:last-child { color: var(--accent); font-weight: 800; }
.brand-mark {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent);
  border: 1px solid var(--line-strong);
  font-weight: 900;
}

.nav-group { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.nav-group:first-of-type { border-top: 0; }
.nav-group p, .label {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
  margin: 0 0 8px;
}

.nav-item {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: 7px;
  padding: 0 14px;
  color: var(--text);
  font-weight: 600;
}

.nav-item.active, .nav-item:hover {
  color: var(--accent);
  background: linear-gradient(90deg, var(--accent-soft), transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.icon { width: 22px; text-align: center; color: inherit; }

.sidebar-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.status-card { margin-top: auto; display: grid; gap: 14px; }
.service-row { display: flex; gap: 8px; }
.service-row span {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  color: var(--muted);
  font-size: 12px;
}
.service-row b, .ok-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  margin-left: 5px;
}
.status-card small { color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; }
.help-card { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px; }
.help-card small { display: block; color: var(--muted); margin-top: 4px; }

.main { min-width: 0; }
.topbar {
  height: 70px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklab, var(--shell) 92%, transparent);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 34px;
}
.profile { display: flex; align-items: center; gap: 12px; }
.profile small { display: block; color: var(--muted); }
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #f6b28f, #1f2937);
  color: #fff;
  font-weight: 800;
  border: 2px solid color-mix(in oklab, var(--panel), #fff 20%);
}
.avatar.small { width: 32px; height: 32px; font-size: 11px; flex: 0 0 auto; }

.content { padding: 34px; max-width: 1680px; }
.page-head { display: flex; justify-content: space-between; align-items: start; gap: 24px; margin-bottom: 22px; }
.page-head p, .breadcrumb { color: var(--muted); margin-top: 6px; }
.page-head.compact { margin-bottom: 16px; }
.breadcrumb { margin-bottom: 12px; }
.actions, .publish-bar { display: flex; gap: 14px; }
.button {
  min-height: 42px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 750;
  background: var(--panel);
  color: var(--text);
}
.button.primary {
  color: #fff;
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: 0 10px 20px rgba(255, 79, 10, .18);
}
.button.secondary { background: var(--panel); }
.button.slim { min-height: 36px; margin-left: auto; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}
.metric {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 42px 1fr;
  column-gap: 14px;
  align-items: center;
  box-shadow: var(--shadow);
}
.metric-icon {
  width: 38px;
  height: 38px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 900;
}
.metric strong { font-size: 28px; }
.metric small, .metric em { grid-column: 2; color: var(--muted); font-style: normal; }
.metric em { color: var(--green); font-weight: 700; font-size: 12px; }
.metric em.warn { color: var(--accent); }

.filters {
  display: grid;
  grid-template-columns: 1.6fr .8fr .7fr .7fr .55fr;
  gap: 14px;
  margin-bottom: 14px;
}
.filters label, .filters button, .search, .copy-field {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.filters label:not(.search) { flex-direction: column; align-items: start; gap: 0; font-size: 11px; }
.filters strong { color: var(--text); font-size: 13px; }
.filters label span:last-child { margin-left: auto; }
input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}
.search.hot { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 79, 10, .06); }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}
.panel h3 { margin-bottom: 7px; }
.panel p { color: var(--muted); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }

.data-table { width: 100%; border-collapse: collapse; table-layout: auto; }
.data-table th, .data-table td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}
.data-table th { color: var(--muted); font-size: 12px; font-weight: 800; background: var(--panel-2); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table span { color: var(--muted); }
.title-link { font-weight: 800; }
.path { white-space: normal; overflow-wrap: anywhere; }
.copy, .dots {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 4px 6px;
  font-weight: 900;
}
.copy.danger { color: var(--danger); }

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 6px;
  padding: 3px 9px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.chip.success { color: #14803d; background: color-mix(in oklab, var(--green) 16%, transparent); border-color: color-mix(in oklab, var(--green) 25%, transparent); }
.chip.review { color: var(--amber); background: rgba(217, 139, 5, .12); border-color: rgba(217, 139, 5, .22); }
.chip.draft, .chip.subtle { color: var(--muted); background: color-mix(in oklab, var(--line) 45%, transparent); border-color: var(--line); }
.chip.admin { color: var(--accent); background: var(--accent-soft); border-color: rgba(255, 79, 10, .16); }
.chip.team { color: var(--blue); background: rgba(44, 123, 229, .12); }
.chip.external { color: #0f9f68; background: rgba(15, 159, 104, .12); }
.chip.purple { color: var(--purple); background: rgba(124, 58, 237, .12); }

.avatars { display: flex; align-items: center; }
.avatars span, .avatars em {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-right: -7px;
  border: 2px solid var(--panel);
  background: linear-gradient(145deg, #f6b28f, #273343);
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}
.avatars em { background: color-mix(in oklab, var(--line) 70%, var(--panel)); color: var(--text); margin-left: 8px; margin-right: 0; }

.flow-panel { margin-top: 20px; }
.flow-panel h2 { margin-bottom: 2px; }
.flow { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 36px; align-items: center; margin-top: 20px; }
.flow-step {
  min-height: 106px;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 12px;
  position: relative;
}
.flow-step span { color: var(--accent); font-size: 24px; }
.flow-step small { color: var(--muted); }
.flow-step b {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
}
.flow-step:not(:last-child)::after { content: "→"; position: absolute; right: -26px; color: var(--muted); font-size: 22px; }

.stepper { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 20px; margin: 24px 0; }
.step { position: relative; display: grid; gap: 4px; }
.step::after { content: ""; position: absolute; top: 15px; left: 43px; right: -14px; height: 1px; background: var(--line-strong); }
.step:last-child::after { display: none; }
.step b {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in oklab, var(--line) 80%, var(--panel));
  z-index: 1;
}
.step.active b, .step:first-child b { color: #fff; background: var(--accent); }
.step small { color: var(--green); font-weight: 700; }
.step.active small { color: var(--accent); }

.import-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.import-grid .wide { grid-column: span 2; }
.content-card { grid-column: span 2; }
.input-action { display: grid; grid-template-columns: 1fr 150px; gap: 14px; margin: 12px 0; }
.input-action input, .form-grid input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  background: var(--panel-2);
}
.ok-line { color: var(--green); font-weight: 700; }
.check-row, .person-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.check-row:last-child, .person-row:last-child { border-bottom: 0; }
.check-row span { color: var(--green); }
.check-row b { margin-left: auto; color: var(--green); background: rgba(37, 177, 90, .12); border-radius: 6px; padding: 3px 7px; font-size: 11px; }
.activity { margin-top: 18px; }
.field-label { display: block; color: var(--muted); font-size: 12px; font-weight: 800; margin: 14px 0 6px; }
.url-final { color: var(--accent); overflow-wrap: anywhere; }
.fathom-card { display: grid; grid-template-columns: 46px 1fr; gap: 12px; }
.fathom-logo { color: #1f8fff; font-size: 28px; }
dl { display: grid; grid-template-columns: 130px 1fr; gap: 12px; margin: 16px 0 0; }
dt { color: var(--muted); font-weight: 700; }
dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.mini-card-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.mini-card-grid > div { min-height: 128px; border: 1px solid var(--line); border-radius: 7px; padding: 14px; display: grid; gap: 8px; }
.mini-card-grid small { color: var(--muted); }
.mini-lines, .mini-table, .mini-diagram, .mini-images { display: block; height: 50px; border-radius: 5px; background: linear-gradient(135deg, var(--line), transparent); }
.person-row button, .ghost-full {
  margin-left: auto;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  border-radius: 6px;
  min-height: 30px;
  padding: 0 10px;
}
.person-row small { display: block; color: var(--muted); }
.task-line { display: flex; gap: 9px; align-items: center; padding: 8px 0; color: var(--muted); }
.task-line span { margin-left: auto; }
.ghost-full { width: 100%; margin-top: 12px; color: var(--text); }
.pdf-box { border: 1px solid var(--line); border-radius: 7px; padding: 16px; display: grid; gap: 6px; margin: 12px 0; }
.pdf-box span { color: var(--danger); font-weight: 900; }
.publish-bar { margin-top: 18px; }
.publish-bar .button { flex: 1; }

.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; }
.detail-top { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .9fr); gap: 16px; }
.video-frame { border-radius: var(--radius); overflow: hidden; background: #101010; min-height: 320px; }
.video-art {
  height: 100%;
  min-height: 320px;
  display: flex;
  align-items: end;
  padding: 18px;
  color: #fff;
  background:
    linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, .7)),
    linear-gradient(135deg, #4c5859, #1f1712 55%, #0d1117);
  position: relative;
}
.play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, .92);
  color: #111;
}
.facts dl { grid-template-columns: 150px 1fr; }
.quick-panel { display: grid; grid-template-columns: 1.1fr repeat(3, 1fr); gap: 20px; margin: 16px 0; align-items: center; }
.quick-panel a { border-left: 1px solid var(--line); padding-left: 20px; color: var(--muted); }
.quick-panel b { display: block; color: var(--accent); margin-top: 4px; }
.tabs { display: flex; align-items: center; border-bottom: 1px solid var(--line); gap: 8px; }
.tabs button:not(.button) { border: 0; background: transparent; padding: 13px 16px; color: var(--muted); font-weight: 800; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.page-render { border-top-left-radius: 0; border-top-right-radius: 0; }
.page-render > p { margin: 5px 0 18px; }
.content-grid { display: grid; grid-template-columns: 1fr 1fr .8fr; gap: 14px; margin-bottom: 20px; }
.content-box { border: 1px solid var(--line); border-radius: 7px; padding: 16px; }
.content-box ol { padding-left: 18px; margin: 10px 0 0; }
.funnel span { display: block; margin: 8px auto; width: 80%; text-align: center; color: #fff; background: linear-gradient(180deg, #ffbd8e, #b65316); clip-path: polygon(8% 0, 92% 0, 82% 100%, 18% 100%); padding: 8px; }
.compact-table th, .compact-table td { padding: 9px 10px; }
.negative { color: var(--danger); font-weight: 800; }
.right-rail { display: grid; gap: 16px; align-content: start; }
.matrix { width: 100%; border-collapse: collapse; }
.matrix th, .matrix td { padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 12px; text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.perm.yes, .matrix td:not(:first-child) { color: var(--green); font-weight: 900; }
.perm.no { color: var(--muted); }
.task-card { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.task-card small { display: block; color: var(--muted); margin-top: 5px; }

.selected-call { display: grid; grid-template-columns: 48px 1fr auto; gap: 14px; align-items: center; margin-bottom: 16px; }
.users-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; margin-bottom: 16px; }
.users-grid.lower { grid-template-columns: 1.35fr .9fr; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.span-2 { grid-column: span 2; }
.segmented { display: flex; gap: 6px; }
.segmented button {
  min-height: 30px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
}
.segmented .active { color: #fff; background: var(--accent); border-color: var(--accent); }
.person-inline { display: flex; align-items: center; gap: 10px; }
.person-inline > div { min-width: 170px; }
.person-inline small { display: block; overflow-wrap: anywhere; color: var(--muted); }
.notice {
  border: 1px solid rgba(255, 79, 10, .35);
  background: color-mix(in oklab, var(--accent-soft) 45%, transparent);
  border-radius: var(--radius);
  padding: 16px 18px;
  color: var(--muted);
}

#blazor-error-ui {
  color-scheme: light only;
  background: #fff8d9;
  bottom: 0;
  box-shadow: 0 -1px 2px rgba(0,0,0,.2);
  display: none;
  left: 0;
  padding: .7rem 1.25rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.loading-progress {
  position: fixed;
  width: 72px;
  height: 72px;
  inset: 42vh 0 auto 0;
  margin: 0 auto;
}
.loading-progress circle {
  fill: none;
  stroke-width: .55rem;
  stroke: var(--line);
  transform-origin: 50% 50%;
  transform: rotate(-90deg);
}
.loading-progress circle:last-child {
  stroke: var(--accent);
  stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * .8), 500%;
}
.loading-progress-text {
  position: fixed;
  inset: calc(42vh + 84px) 0 auto 0;
  text-align: center;
  color: var(--muted);
}
.loading-progress-text::after { content: var(--blazor-load-percentage-text, "Loading"); }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 88px minmax(0, 1fr); }
  .brand strong, .brand span:last-child, .nav-item:not(.active), .nav-group p, .sidebar-card { display: none; }
  .brand { justify-content: center; }
  .nav-item { justify-content: center; padding: 0; }
  .metrics-grid, .filters, .import-grid, .detail-layout, .detail-top, .users-grid, .users-grid.lower, .content-grid { grid-template-columns: 1fr; }
  .import-grid .wide, .content-card { grid-column: auto; }
  .stepper { grid-template-columns: repeat(4, 1fr); }
  .right-rail { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 12px; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px; }
  .page-head, .actions, .publish-bar, .quick-panel { display: grid; grid-template-columns: 1fr; }
  .data-table { min-width: 900px; }
  .panel { overflow-x: auto; }
  h1 { font-size: 24px; }
}
