:root {
  --shell: #05070c;
  --shell-2: #0b0d14;
  --canvas: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --ink: #14161d;
  --muted: #616879;
  --line: rgba(20, 22, 29, 0.08);
  --line-strong: rgba(20, 22, 29, 0.14);
  --accent: #5e6ad2;
  --accent-2: #8894ff;
  --accent-3: #dfe3ff;
  --success: #0d8a63;
  --danger: #b53d2e;
  --shadow-lg: 0 16px 40px rgba(6, 10, 20, 0.16);
  --shadow-md: 0 8px 20px rgba(6, 10, 20, 0.06);
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(94, 106, 210, 0.18), transparent 18%),
    linear-gradient(180deg, #05070c 0%, #0b0d14 14%, var(--canvas) 14%, var(--canvas) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.28), transparent 70%);
}

.page-shell {
  position: relative;
  width: min(1380px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 14px 0 28px;
}

.hero {
  display: block;
  margin-bottom: 10px;
}

.hero-copy,
.panel,
.subpanel,
.metric-tile,
.hint-card {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hero-copy {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 18px;
  border-radius: 16px;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    linear-gradient(180deg, rgba(13, 14, 20, 0.98), rgba(9, 10, 14, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-lg);
  color: #eef6ff;
}

.root-hero {
  justify-content: space-between;
  gap: 16px;
}

.root-hero h1 {
  text-align: left;
}

.top-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.top-links a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: rgba(238, 246, 255, 0.78);
  text-decoration: none;
  font-weight: 700;
}

.top-links a.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.task-console {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid rgba(20, 22, 29, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 20px rgba(6, 10, 20, 0.04);
}

.task-user-box,
.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.task-user-box span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid rgba(20, 22, 29, 0.08);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.task-user-box {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(180px, 0.75fr) minmax(140px, 0.55fr) auto auto auto;
}

.task-user-box.is-authenticated {
  grid-template-columns: minmax(220px, 1fr) auto;
}

.task-user-box.is-authenticated #auth-email,
.task-user-box.is-authenticated #auth-password,
.task-user-box.is-authenticated #auth-login,
.task-user-box.is-authenticated #auth-register {
  display: none;
}

.task-actions {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) auto minmax(220px, 0.7fr) auto;
}

.task-console input,
.task-console select {
  width: auto;
  min-width: 150px;
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.88rem;
}

.task-actions {
  justify-content: start;
}

.task-status {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.auth-gate {
  width: min(520px, calc(100vw - 28px));
  margin: 8vh auto 0;
}

.auth-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(20, 22, 29, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-lg);
}

.auth-card h1 {
  text-align: left;
  font-family: inherit;
  font-size: 1.5rem;
  letter-spacing: 0;
}

.auth-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.auth-gate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid rgba(94, 106, 210, 0.18);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,248,255,0.94));
}

.admin-panel[hidden] {
  display: none;
}

.admin-panel-head,
.admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-panel-head h2 {
  font-family: inherit;
  font-size: 1rem;
  letter-spacing: 0;
}

.admin-panel-head span,
.admin-user-row em {
  color: #4d58b8;
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 700;
}

.admin-user-list {
  display: grid;
  gap: 6px;
}

.admin-user-row {
  padding: 8px 10px;
  border: 1px solid rgba(20, 22, 29, 0.08);
  border-radius: 8px;
  background: #fff;
}

.admin-user-row span {
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.workflow-strip span,
.hero-lead,
.section-note,
.upload-note,
.metric-copy,
.status-box,
.empty-state,
label,
input,
textarea,
select,
button,
table,
small,
.sidecar-list,
.rule-callout p {
  font-size: 0.95rem;
  line-height: 1.65;
}

.hero-lead {
  margin: 6px 0 0;
  color: rgba(238, 246, 255, 0.78);
}

.workflow-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.workflow-strip span {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(238, 246, 255, 0.82);
  font-size: 0.76rem;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.68rem;
  color: var(--accent);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.04;
}

h1,
h2 {
  font-family: "Source Serif 4", serif;
}

h1 {
  font-size: clamp(2rem, 3.5vw, 3rem);
  letter-spacing: -0.045em;
  text-align: center;
}

h2 {
  font-size: clamp(1.15rem, 1.8vw, 1.6rem);
  letter-spacing: -0.04em;
}

h3 {
  font-size: 0.92rem;
}

h4 {
  font-size: 0.88rem;
}

.hero-actions,
.inline-actions,
.promotion-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.promotion-workbench {
  display: grid;
  gap: 12px;
}

.promotion-workbench .promotion-controls {
  display: grid;
  grid-template-columns: minmax(132px, 150px) minmax(132px, 150px) minmax(150px, 170px) auto;
  align-items: end;
  justify-content: end;
  justify-self: end;
  width: min(100%, 720px);
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.promotion-workbench .promotion-controls label {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.promotion-workbench .promotion-controls select {
  min-height: 42px;
  border-radius: 12px;
  font-size: 0.9rem;
}

.promotion-workbench .promotion-controls .button {
  min-height: 42px;
  border-radius: 12px;
}

@media (max-width: 980px) {
  .promotion-workbench .promotion-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-self: stretch;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .promotion-workbench .promotion-controls {
    grid-template-columns: 1fr;
  }

  .field-search {
    grid-template-columns: 112px minmax(0, 1fr) 38px;
  }
}

.reason-text {
  display: inline-flex;
  max-width: 360px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.aba-empty-hint {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border: 1px solid rgba(190, 130, 20, 0.22);
  border-radius: 10px;
  background: rgba(255, 247, 226, 0.8);
  color: #7a4b08;
  font-size: 0.86rem;
  line-height: 1.45;
}

.table-sort {
  display: inline-flex;
  width: 100%;
  padding: 0;
  padding-right: 8px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.column-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  z-index: 3;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.column-resizer::after {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 3px;
  width: 1px;
  background: rgba(20, 32, 51, 0.12);
}

.column-resizer:hover::after {
  width: 2px;
  background: rgba(94, 106, 210, 0.75);
}

.promotion-filter-bar {
  display: flex;
  justify-content: flex-start;
}

.field-search {
  display: grid;
  grid-template-columns: 132px minmax(260px, 420px) 42px;
  align-items: stretch;
  width: min(100%, 594px);
  min-height: 42px;
  border: 1px solid rgba(20, 32, 51, 0.16);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.field-search-select,
.field-search-input,
.field-search-clear {
  border: 0;
  border-radius: 0;
  background: #fff;
}

.field-search-select {
  padding: 0 12px;
  border-right: 1px solid rgba(20, 32, 51, 0.12);
  color: var(--text);
  font-weight: 800;
}

.column-filter {
  width: 100%;
  min-height: 42px;
  padding: 7px 10px;
  border-radius: 0;
  border: 0;
  background: #fff;
  color: var(--text);
  font-size: 0.9rem;
  text-transform: none;
  letter-spacing: 0;
}

.field-search-clear {
  display: grid;
  place-items: center;
  border-left: 1px solid rgba(20, 32, 51, 0.12);
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.column-filter:focus {
  outline: none;
}

.field-search:focus-within {
  border-color: rgba(94, 106, 210, 0.75);
  box-shadow: 0 0 0 3px rgba(94, 106, 210, 0.12);
}

.hero-actions {
  margin-top: 0;
  justify-content: flex-end;
  align-self: start;
}

.layout {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
}

.span-12 {
  grid-column: span 12;
}

.span-6 {
  grid-column: span 6;
}

.span-7 {
  grid-column: span 7;
}

.span-5 {
  grid-column: span 5;
}

.panel {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-md);
}

.panel-primary {
  background:
    radial-gradient(circle at top right, rgba(143, 188, 255, 0.22), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 249, 254, 0.96));
}

.panel-header,
.subpanel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.section-note,
.upload-note,
.metric-copy,
.status-box,
.empty-state,
.muted,
.sidecar-list,
.rule-callout p {
  color: var(--muted);
}

.rule-builder,
.upload-workbench,
.listing-grid,
.insight-grid,
.summary-grid {
  display: grid;
  gap: 10px;
}

.rule-builder {
  grid-template-columns: 1fr;
}

.compact-note-strip {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
}

.mini-note,
.upload-sidecar {
  padding: 6px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(246, 249, 254, 0.82);
  color: var(--muted);
  font-size: 0.74rem;
}

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

.rule-field {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.rule-field span {
  color: var(--ink);
  font-weight: 700;
}

label {
  display: grid;
  gap: 6px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(20, 32, 51, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  padding: 9px 11px;
  font: inherit;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

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

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(15, 158, 178, 0.38);
  box-shadow: 0 0 0 4px rgba(15, 158, 178, 0.12);
  background: #fff;
}

.button {
  border: 0;
  border-radius: 10px;
  padding: 9px 13px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  color: #f6fbff;
  background: linear-gradient(135deg, #5e6ad2, #7382ff);
  box-shadow: 0 10px 24px rgba(94, 106, 210, 0.22);
}

.button.ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line-strong);
}

.upload-workbench {
  grid-template-columns: 1fr;
  align-items: start;
}

.upload-card,
.upload-stack {
  display: grid;
  gap: 10px;
}

.upload-card {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 249, 254, 0.92));
}

.upload-chips,
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(94, 106, 210, 0.08);
  border: 1px solid rgba(94, 106, 210, 0.12);
  color: #4d58b8;
  font-size: 0.74rem;
}

.pill.warn {
  background: rgba(255, 124, 69, 0.1);
  border-color: rgba(255, 124, 69, 0.14);
  color: #9b4f2a;
}

.status-box {
  min-height: 24px;
  white-space: pre-line;
}

.status-box.success {
  color: var(--success);
}

.status-box.error {
  color: var(--danger);
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 10px;
}

.insight-panel {
  padding: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 250, 253, 0.92));
}

.insight-panel > .panel-header {
  align-items: center;
  margin: 0;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(246, 249, 254, 0.78));
}

.insight-panel > .method-panel,
.insight-panel > .summary-grid,
.insight-panel > .insight-grid,
.insight-panel > .fold-panel:not(.method-panel) {
  margin-right: 14px;
  margin-left: 14px;
}

.insight-panel > .method-panel {
  margin-top: 14px;
}

.insight-panel > .fold-panel:not(.method-panel) {
  margin-bottom: 14px;
}

.insight-panel .inline-actions {
  justify-content: flex-end;
}

.insight-panel .summary-grid {
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 12px;
}

.insight-panel .metric-tile {
  display: grid;
  align-content: center;
  min-height: 86px;
  padding: 12px 14px;
  border-color: rgba(94, 106, 210, 0.12);
  background:
    linear-gradient(90deg, rgba(94, 106, 210, 0.12), transparent 4px),
    linear-gradient(180deg, #ffffff, #f6f8fc);
}

.insight-panel .metric-tile strong {
  font-size: 1.55rem;
  color: #313b9f;
}

.insight-panel .metric-tile div {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.metric-tile {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 249, 254, 0.92));
}

.metric-tile strong {
  display: block;
  margin-bottom: 2px;
  font-size: 1.15rem;
  letter-spacing: -0.04em;
}

.insight-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 10px;
}

.insight-panel .insight-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(260px, 0.82fr);
  align-items: stretch;
  gap: 10px;
  margin-bottom: 12px;
}

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

.subpanel {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
}

.insight-card {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 188px;
  padding: 0;
  overflow: hidden;
  background: #fff;
}

.insight-card h3 {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8faff;
  color: #252a3a;
}

.insight-card > div {
  display: grid;
  gap: 10px;
  padding: 12px;
  align-content: start;
}

.shared-card > div {
  max-height: 260px;
  overflow: auto;
}

.fold-panel {
  padding: 10px 12px;
}

.method-panel {
  margin-bottom: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 249, 254, 0.86));
}

.fold-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  color: var(--ink);
  font-weight: 700;
}

.fold-summary::after {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(94, 106, 210, 0.1);
  color: #4d58b8;
  line-height: 1;
}

details[open] > .fold-summary::after {
  content: "-";
}

.fold-summary::-webkit-details-marker {
  display: none;
}

.bucket-list,
.placement-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.logic-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.logic-list p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.bucket-block {
  min-width: 0;
}

.bucket-block + .bucket-block {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.bucket-list li,
.placement-list li {
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid rgba(20, 32, 51, 0.08);
  background: rgba(246, 249, 254, 0.96);
  font-size: 0.88rem;
  line-height: 1.35;
}

.insight-panel .pill-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.insight-panel .pill-row .pill {
  justify-content: space-between;
  width: 100%;
  border-radius: 8px;
  white-space: normal;
  line-height: 1.35;
}

.table-wrap {
  overflow: auto;
  max-height: 350px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.insight-panel .table-wrap {
  max-height: 420px;
  border-radius: 10px;
}

.insight-panel table {
  min-width: 1280px;
}

#promotion-table {
  table-layout: fixed;
  min-width: 0;
}

.listing-output-panel .subpanel {
  max-height: 280px;
  overflow: auto;
}

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

th,
td {
  text-align: left;
  padding: 10px 11px;
  border-bottom: 1px solid rgba(20, 32, 51, 0.08);
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(243, 247, 253, 0.98);
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#promotion-table th {
  position: sticky;
}

tbody tr:hover {
  background: rgba(240, 248, 255, 0.7);
}

.checkbox-cell {
  width: 44px;
}

.keyword {
  font-weight: 700;
}

.keyword-search-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  color: var(--ink);
  text-decoration: none;
}

.keyword-search-link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.keyword-search-icon {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
}

.library-action-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 8px;
}

.library-action-cell > span {
  font-weight: 700;
}

.library-action-cell small {
  grid-column: 1;
  color: var(--muted);
}

.quick-promote {
  grid-row: 1 / span 2;
  grid-column: 2;
  min-width: 48px;
  height: 32px;
  border: 1px solid rgba(94, 106, 210, 0.2);
  border-radius: 8px;
  background: rgba(94, 106, 210, 0.08);
  color: #4d58b8;
  font-weight: 700;
  cursor: pointer;
}

.quick-promote:hover {
  background: rgba(94, 106, 210, 0.14);
}

.empty-state {
  padding: 10px 0 2px;
}

.table-select,
.table-input {
  width: 100%;
  min-width: 120px;
  padding: 9px 10px;
}

#library-table {
  min-width: 1280px;
}

#library-table td:first-child {
  color: var(--muted);
  font-weight: 700;
}

.library-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 210px;
}

.library-check {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.library-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.library-check span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid rgba(20, 32, 51, 0.12);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.library-check input:checked + span {
  border-color: rgba(94, 106, 210, 0.35);
  background: rgba(94, 106, 210, 0.1);
  color: #4d58b8;
}

.coverage-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.77rem;
  font-weight: 700;
}

.coverage-badge.ad {
  background: rgba(255, 124, 69, 0.12);
  color: #9b4f2a;
}

.coverage-badge.listing {
  background: rgba(15, 158, 178, 0.12);
  color: #136676;
}

.coverage-badge.both {
  background: rgba(143, 188, 255, 0.18);
  color: #275d9d;
}

/* ═══════════════════════════════════════════════════
   COSMO — Standalone page (v3 redesign)
   ═══════════════════════════════════════════════════ */

/* ── Page layout ── */
.cosmo-page-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

/* ── Step number badge ── */
.cosmo-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}

.cosmo-step-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.cosmo-step-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}

.cosmo-step-desc {
  margin: 5px 0 0;
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ── Step 01: Config strip ── */
.cosmo-config-strip {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  padding: 14px 18px;
}

.cosmo-config-fields {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  flex: 1;
}

.cosmo-kb-badge {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(94, 106, 210, 0.08);
  border: 1px solid rgba(94, 106, 210, 0.14);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

/* ── Form labels + inputs ── */
.cosmo-field-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.cosmo-field-label small {
  font-size: 0.76rem;
  font-weight: 400;
  color: var(--muted);
}

.cosmo-field-label input,
.cosmo-field-label textarea,
.cosmo-field-label select {
  color: var(--ink);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 400;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  padding: 9px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
  resize: vertical;
  width: 100%;
}

.cosmo-field-label input:focus,
.cosmo-field-label textarea:focus,
.cosmo-field-label select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 106, 210, 0.1);
  background: #fff;
}

/* ── Mode tabs ── */
.cosmo-mode-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--line);
}

.cosmo-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-bottom: 3px solid transparent;
  background: none;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: -2px;
  border-radius: 0;
  transition: color 0.15s, border-color 0.15s;
}

.cosmo-tab:hover { color: var(--ink); }
.cosmo-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.cosmo-tab-icon { font-size: 1rem; }

.cosmo-mode-panel { margin-bottom: 18px; }

/* ── ASIN row ── */
.cosmo-asin-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.cosmo-asin-input { flex: 0 0 180px; }
.cosmo-asin-input input {
  letter-spacing: 0.08em;
  font-weight: 700 !important;
  text-transform: uppercase;
}

.cosmo-scrape-btns {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

.cosmo-asin-hint {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.55;
}

.cosmo-ext-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.cosmo-ext-link:hover { text-decoration: underline; }

/* ── Inputs ── */
.cosmo-inputs {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 4px 0 20px;
}

.cosmo-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ── Run row ── */
.cosmo-run-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cosmo-run-btn { min-width: 180px; padding: 10px 20px; }
.cosmo-run-note { font-size: 0.82rem; color: var(--muted); }

/* ── Status messages ── */
.cosmo-status { min-height: 28px; padding: 4px 0; }
.cosmo-status-info  { color: var(--accent); font-size: 0.88rem; }
.cosmo-status-warn  { color: #c07400; font-size: 0.88rem; }
.cosmo-status-error { color: var(--danger); font-size: 0.88rem; font-weight: 600; }
.cosmo-status-loading {
  color: var(--muted);
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.cosmo-status-loading::before {
  content: "";
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--accent-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: cosmo-spin 0.7s linear infinite;
}
@keyframes cosmo-spin { to { transform: rotate(360deg); } }

/* ═══ Step 03: Diagnosis results ═══ */

/* Score hero */
.cosmo-score-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(94, 106, 210, 0.12);
  background: linear-gradient(135deg, rgba(94, 106, 210, 0.06) 0%, transparent 55%);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.cosmo-score-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 90px;
}

.cosmo-score-value {
  font-family: "Source Serif 4", serif;
  font-size: 3.4rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
}

.cosmo-score-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-top: 6px;
  white-space: nowrap;
}

.cosmo-score-good { color: var(--success); }
.cosmo-score-mid  { color: #c07400; }
.cosmo-score-bad  { color: var(--danger); }

.cosmo-score-divider {
  width: 1px;
  height: 56px;
  background: var(--line-strong);
  flex-shrink: 0;
}

/* Stat boxes */
.cosmo-stat-row {
  display: flex;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
}

.cosmo-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  min-width: 60px;
  flex: 1;
  gap: 4px;
}

.cosmo-stat strong {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
}

.cosmo-stat span {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.cosmo-stat-covered { background: rgba(13, 138, 99, 0.08); }
.cosmo-stat-covered strong { color: var(--success); }
.cosmo-stat-covered span   { color: #0a6e50; }

.cosmo-stat-vague { background: rgba(192, 116, 0, 0.08); }
.cosmo-stat-vague strong { color: #c07400; }
.cosmo-stat-vague span   { color: #8f5600; }

.cosmo-stat-missing { background: rgba(20, 22, 29, 0.05); }
.cosmo-stat-missing strong { color: var(--muted); }
.cosmo-stat-missing span   { color: var(--muted); }

.cosmo-stat-blocked { background: rgba(181, 61, 46, 0.08); }
.cosmo-stat-blocked strong { color: var(--danger); }
.cosmo-stat-blocked span   { color: #7d2a1f; }

.cosmo-score-meta {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  font-size: 0.74rem;
  color: var(--muted);
}

/* Blocked warning */
.cosmo-blocked-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(181, 61, 46, 0.05);
  border: 1px solid rgba(181, 61, 46, 0.18);
  border-radius: var(--radius-md);
  font-size: 0.87rem;
  color: var(--danger);
  margin-bottom: 12px;
}

.cosmo-blocked-icon { flex-shrink: 0; }

/* Suggestions */
.cosmo-top-suggestions {
  padding: 14px 18px;
  background: rgba(94, 106, 210, 0.04);
  border: 1px solid rgba(94, 106, 210, 0.12);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.cosmo-top-suggestions h4 {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.cosmo-top-suggestions ol {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cosmo-top-suggestions li { font-size: 0.87rem; color: var(--ink); line-height: 1.5; }

/* ── Relation card grid ── */
.cosmo-relation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.cosmo-rel-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  overflow: hidden;
  background: var(--surface);
  transition: transform 0.14s, box-shadow 0.14s;
}

.cosmo-rel-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Colored top bar per status */
.cosmo-rel-card-bar { height: 3px; width: 100%; }
.cosmo-rel-card.cosmo-covered .cosmo-rel-card-bar { background: var(--success); }
.cosmo-rel-card.cosmo-vague   .cosmo-rel-card-bar { background: #c07400; }
.cosmo-rel-card.cosmo-missing .cosmo-rel-card-bar { background: var(--line-strong); }
.cosmo-rel-card.cosmo-blocked .cosmo-rel-card-bar { background: var(--danger); }

.cosmo-rel-card-body { padding: 12px 14px; }

.cosmo-rel-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.cosmo-rel-name {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}

.cosmo-rel-code {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  font-family: "SF Mono", "Fira Code", monospace;
  margin-top: 2px;
  letter-spacing: 0.02em;
}

.cosmo-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.cosmo-pill.cosmo-covered { background: rgba(13, 138, 99, 0.1); color: var(--success); }
.cosmo-pill.cosmo-vague   { background: rgba(192, 116, 0, 0.1); color: #c07400; }
.cosmo-pill.cosmo-missing { background: rgba(20, 22, 29, 0.07); color: var(--muted); }
.cosmo-pill.cosmo-blocked { background: rgba(181, 61, 46, 0.1); color: var(--danger); }

.cosmo-rel-note {
  margin: 0 0 8px;
  font-size: 0.84rem;
  color: var(--ink);
  line-height: 1.55;
}

.cosmo-rel-evidence {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
  border-left: 2px solid var(--line-strong);
  padding-left: 8px;
  margin-bottom: 6px;
  line-height: 1.45;
}

.cosmo-rel-suggestion {
  font-size: 0.78rem;
  color: var(--accent);
  padding: 5px 8px;
  background: rgba(94, 106, 210, 0.07);
  border-radius: 6px;
  line-height: 1.45;
}

/* ── Generate bar ── */
.cosmo-generate-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0 2px;
  border-top: 1px solid var(--line);
  margin-top: 16px;
}

.cosmo-gen-btn { padding: 10px 22px; font-size: 0.95rem; }

/* ═══ Step 04: Generated listing ═══ */
.cosmo-generated-listing {
  border: 1.5px solid rgba(94, 106, 210, 0.18);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}

.gen-summary-bar {
  padding: 14px 20px;
  background: linear-gradient(135deg, rgba(94, 106, 210, 0.07), rgba(94, 106, 210, 0.02));
  border-bottom: 1px solid rgba(94, 106, 210, 0.12);
}

.gen-changes-text {
  font-size: 0.84rem;
  color: var(--ink);
  line-height: 1.5;
  margin: 0 0 8px;
}

.gen-covered-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.gen-covered-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cosmo-rel-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(94, 106, 210, 0.1);
  border: 1px solid rgba(94, 106, 210, 0.14);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.72rem;
}

.gen-block {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.gen-block:last-of-type { border-bottom: none; }

.gen-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.gen-block-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

.copy-btn {
  padding: 4px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.copy-btn:hover {
  background: rgba(94, 106, 210, 0.07);
  color: var(--accent);
  border-color: rgba(94, 106, 210, 0.2);
}

.gen-title-box {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.5;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  border: 1px solid var(--line);
}

.gen-bullets {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gen-bullet-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  transition: border-color 0.14s;
}
.gen-bullet-row:hover { border-color: rgba(94, 106, 210, 0.22); }

.gen-bullet-index {
  flex-shrink: 0;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  background: rgba(94, 106, 210, 0.1);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
}

.gen-bullet-text {
  flex: 1;
  font-size: 0.9rem;
  color: var(--ink);
  line-height: 1.55;
}

.gen-bullet-row .copy-btn { flex-shrink: 0; align-self: center; }

.gen-description-box {
  font-size: 0.9rem;
  color: var(--ink);
  line-height: 1.7;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border: 1px solid var(--line);
  white-space: pre-wrap;
}

.gen-export-row {
  display: flex;
  justify-content: flex-end;
  padding: 12px 20px;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
}

/* ── COSMO entry card (index.html link) ── */
.cosmo-entry-panel {
  background: linear-gradient(135deg,
    rgba(94, 106, 210, 0.06) 0%,
    rgba(255, 255, 255, 0.88) 60%);
}
.cosmo-entry-desc {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}
.cosmo-entry-steps {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.cosmo-entry-step {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(94, 106, 210, 0.08);
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 600;
}
.cosmo-entry-arrow { color: var(--muted); }

/* ── COSMO responsive ── */
@media (max-width: 960px) {
  .cosmo-relation-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .cosmo-two-col {
    grid-template-columns: 1fr;
  }
  .cosmo-relation-grid {
    grid-template-columns: 1fr;
  }
  .cosmo-score-hero {
    gap: 14px;
    padding: 16px;
  }
  .cosmo-score-divider { display: none; }
  .cosmo-stat-row { gap: 6px; }
  .cosmo-stat { padding: 8px 10px; }
  .cosmo-stat strong { font-size: 1.3rem; }
  .cosmo-config-strip { gap: 14px; }
}

@media (max-width: 1240px) {
  .listing-grid,
  .insight-grid {
    grid-template-columns: 1fr;
  }

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

  .insight-panel .shared-card {
    grid-column: span 2;
  }

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

@media (max-width: 880px) {
  .page-shell {
    width: min(100vw - 24px, 1500px);
    padding-top: 12px;
  }

  .panel,
  .hero-copy {
    padding: 14px;
    border-radius: 14px;
  }

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

  .panel-header,
  .subpanel-head {
    flex-direction: column;
  }

  h1 {
    font-size: 2.2rem;
  }

  .hero-copy {
    grid-template-columns: 1fr;
  }

  .span-6,
  .span-7,
  .span-5 {
    grid-column: span 12;
  }

  .rule-fields,
  .upload-workbench,
  .listing-grid,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .insight-panel > .panel-header {
    align-items: flex-start;
  }

  .insight-panel .insight-grid,
  .insight-panel .insight-grid {
    grid-template-columns: 1fr;
  }

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

  .insight-panel .shared-card {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .insight-panel > .panel-header {
    padding: 14px;
  }

  .insight-panel > .method-panel,
  .insight-panel > .summary-grid,
  .insight-panel > .insight-grid,
  .insight-panel > .fold-panel:not(.method-panel) {
    margin-right: 10px;
    margin-left: 10px;
  }

  .insight-panel .inline-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 8px;
  }

  .insight-panel .inline-actions .button {
    min-width: 0;
    padding-right: 9px;
    padding-left: 9px;
    font-size: 0.86rem;
  }

  .insight-panel .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .insight-panel .metric-tile {
    min-height: 72px;
    padding: 10px;
  }

  .insight-panel .metric-tile strong {
    font-size: 1.28rem;
  }

  .insight-panel .metric-tile div {
    font-size: 0.72rem;
  }

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

  .insight-card h3 {
    padding: 10px 11px;
    font-size: 0.86rem;
  }

  .insight-card > div {
    padding: 10px;
  }

  .bucket-list,
  .placement-list {
    gap: 6px;
  }

  .bucket-list li,
  .placement-list li {
    padding: 6px 8px;
    font-size: 0.82rem;
  }

  th,
  td {
    padding: 10px 12px;
  }
}


/* ════════════════════════════════════════════════════════════════
   APP SHELL  v6  —  Claude-inspired design
   Warm dark sidebar · Warm off-white canvas · Copper accent
   ════════════════════════════════════════════════════════════════ */

/* ── Design tokens ── */
:root {
  --cw: 240px;          /* sidebar width */
  --th: 56px;           /* topbar height */

  /* Claude colour palette */
  --c-sidebar:   #1a1a1a;           /* near-black warm sidebar */
  --c-accent:    #c96442;           /* Claude copper-orange */
  --c-accent-h:  #b0522f;           /* hover */
  --c-accent-bg: rgba(201,100,66,.12); /* tint background */
  --c-accent-txt:rgba(201,100,66,1);

  --c-bg:        #faf9f7;           /* warm canvas */
  --c-surface:   #ffffff;           /* card/panel */
  --c-surface-2: #f5f3f0;           /* recessed */

  --c-border:    rgba(0,0,0,.07);   /* ultra-subtle line */
  --c-border-s:  rgba(0,0,0,.12);   /* slightly stronger */

  --c-text:      #1a1a1a;           /* main text */
  --c-muted:     #706b66;           /* secondary */
  --c-faint:     #a39e99;           /* placeholder / meta */

  --c-ok:        #059669;
  --c-warn:      #b45309;
  --c-err:       #dc2626;

  --c-r:   8px;          /* radius */
  --c-rl: 12px;          /* radius large */
}

/* ── Body ── */
body.app-body {
  background: var(--c-bg);
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--c-text);
}
body.app-body::before { display: none; }

/* ── Shell ── */
.app-shell {
  display: flex;
  min-height: 100vh;
}
/* display:flex overrides the browser's default hidden=display:none — fix it explicitly */
.app-shell[hidden] { display: none !important; }

/* ══════════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════════ */
.app-sidebar {
  width: var(--cw);
  flex-shrink: 0;
  background: var(--c-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(145deg, #c96442 0%, #e8885e 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 800; color: #fff;
  flex-shrink: 0; letter-spacing: -.04em;
  box-shadow: 0 2px 8px rgba(201,100,66,.4);
}
.brand-name {
  font-size: .85rem; font-weight: 700;
  color: #fff; line-height: 1.2;
}
.brand-sub {
  font-size: .64rem; color: rgba(255,255,255,.28);
  margin-top: 1px;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  display: flex; flex-direction: column; gap: 1px;
}
.nav-group-label {
  font-size: .59rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: rgba(255,255,255,.22);
  padding: 10px 10px 5px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 7px;
  color: rgba(255,255,255,.48);
  font-size: .875rem; font-weight: 500;
  text-decoration: none;
  transition: background .12s, color .12s;
  min-height: 44px;   /* touch-target standard */
  line-height: 1.3;
}
.nav-item:hover {
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.88);
}
.nav-item.active {
  background: var(--c-accent-bg);
  color: #e8885e;       /* warm orange on dark */
  font-weight: 600;
}
.nav-icon {
  width: 17px; height: 17px; flex-shrink: 0;
  opacity: .65;
}
.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { opacity: 1; }

/* Footer / user */
.sidebar-footer {
  padding: 10px 8px;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 7px;
  min-height: 44px;
  transition: background .12s;
}
.sidebar-user:hover { background: rgba(255,255,255,.05); }
.sidebar-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(201,100,66,.25);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-avatar svg {
  width: 13px; height: 13px;
  fill: rgba(255,255,255,.7);
}
.sidebar-user-name {
  flex: 1; min-width: 0;
  font-size: .76rem; color: rgba(255,255,255,.55);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: block;
}
.sidebar-logout-btn {
  border: none; background: none; padding: 4px;
  border-radius: 5px; cursor: pointer; flex-shrink: 0;
  color: rgba(255,255,255,.25);
  transition: color .12s, background .12s;
  display: flex; align-items: center;
}
.sidebar-logout-btn svg { width: 14px; height: 14px; }
.sidebar-logout-btn:hover {
  color: rgba(255,255,255,.7);
  background: rgba(255,255,255,.08);
}
.sidebar-status {
  font-size: .7rem; color: rgba(255,255,255,.28);
  padding: 2px 10px 0; min-height: 0;
}

/* ══════════════════════════════════════════════════
   MAIN
   ══════════════════════════════════════════════════ */
.app-main {
  margin-left: var(--cw);
  flex: 1; display: flex; flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.app-topbar {
  height: var(--th);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 100;
  flex-shrink: 0; gap: 16px;
}
.topbar-left {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.topbar-title {
  margin: 0; font-size: .975rem; font-weight: 700;
  color: var(--c-text); letter-spacing: -.02em; line-height: 1;
  font-family: inherit;
}
.topbar-tag {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 999px;
  background: var(--c-accent-bg);
  color: var(--c-accent);
  font-size: .68rem; font-weight: 600;
}
.topbar-actions {
  display: flex; align-items: center; gap: 8px;
  flex: 1; justify-content: flex-end; flex-wrap: wrap;
}
.topbar-status {
  font-size: .78rem; color: var(--c-muted);
  padding: 4px 24px; min-height: 0;
}

/* Content */
.app-content {
  flex: 1; padding: 24px;
  width: auto; max-width: none; margin: 0;
}
.app-admin-panel { margin: 0 24px; }

/* ══════════════════════════════════════════════════
   PANEL OVERRIDES — clean warm white inside app-body
   ══════════════════════════════════════════════════ */
body.app-body .panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--c-rl);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
body.app-body .panel-primary { background: var(--c-surface); background-image: none; }
body.app-body .subpanel       { background: var(--c-surface-2); border: 1px solid var(--c-border); backdrop-filter: none; }
body.app-body .insight-card   { background: var(--c-surface); }
body.app-body .insight-card h3 { background: var(--c-surface-2); }
body.app-body .table-wrap    { border-color: var(--c-border); }
body.app-body th             { background: var(--c-surface-2); color: var(--c-muted); }
body.app-body tbody tr:hover { background: rgba(0,0,0,.02); }
body.app-body .bucket-list li,
body.app-body .placement-list li { background: var(--c-surface-2); border-color: var(--c-border); }
body.app-body .section-kicker { color: var(--c-accent); }
body.app-body .section-note   { color: var(--c-muted); }
body.app-body .rule-field      { background: var(--c-surface-2); border-color: var(--c-border); }
body.app-body .upload-card     { background: var(--c-surface); border-color: var(--c-border); }
body.app-body .metric-tile     { background: var(--c-surface); border-color: var(--c-border); }
body.app-body .insight-panel   { background: var(--c-surface); background-image: none; }
body.app-body .insight-panel > .panel-header { background: var(--c-surface-2); border-bottom-color: var(--c-border); }
body.app-body .insight-panel .metric-tile strong { color: var(--c-accent); }
body.app-body .fold-panel, body.app-body .method-panel { background: var(--c-surface-2); background-image: none; }
/* Buttons */
body.app-body .button.primary {
  background: var(--c-accent); color: #fff; border-color: transparent;
  box-shadow: 0 1px 3px rgba(201,100,66,.3);
}
body.app-body .button.primary:hover { background: var(--c-accent-h); }
body.app-body .button.ghost  { background: var(--c-surface); border-color: var(--c-border-s); color: var(--c-text); }
body.app-body .button.ghost:hover { background: var(--c-surface-2); }

/* Inputs */
body.app-body input, body.app-body textarea, body.app-body select {
  background: var(--c-surface); border-color: var(--c-border-s); color: var(--c-text);
}
body.app-body input:focus, body.app-body textarea:focus, body.app-body select:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(201,100,66,.1);
  background: var(--c-surface);
}

/* Pills / badges */
body.app-body .pill { background: rgba(0,0,0,.05); border-color: transparent; color: var(--c-muted); }

/* ══════════════════════════════════════════════════
   TOPBAR TASK CONTROLS (index / root-table)
   ══════════════════════════════════════════════════ */
.topbar-select {
  height: 36px; padding: 0 10px;
  border: 1px solid var(--c-border-s); border-radius: var(--c-r);
  background: var(--c-surface); font: inherit;
  font-size: .85rem; color: var(--c-text);
  min-width: 150px; max-width: 220px;
}
.topbar-select:focus {
  outline: none; border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(201,100,66,.1);
}
.topbar-input {
  height: 36px; padding: 0 10px;
  border: 1px solid var(--c-border-s); border-radius: var(--c-r);
  background: var(--c-surface); font: inherit;
  font-size: .85rem; color: var(--c-text); width: 150px;
}
.topbar-input:focus {
  outline: none; border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(201,100,66,.1);
}
.topbar-btn {
  height: 36px; padding: 0 14px; border: 1px solid transparent;
  border-radius: var(--c-r); font: inherit;
  font-size: .85rem; font-weight: 600; cursor: pointer;
  transition: background .12s, box-shadow .12s; white-space: nowrap;
}
.topbar-btn-primary {
  background: var(--c-accent); color: #fff;
  box-shadow: 0 1px 3px rgba(201,100,66,.25);
}
.topbar-btn-primary:hover { background: var(--c-accent-h); }
.topbar-btn-ghost {
  background: var(--c-surface); color: var(--c-text);
  border-color: var(--c-border-s);
}
.topbar-btn-ghost:hover { background: var(--c-surface-2); }

/* ══════════════════════════════════════════════════
   STEP CARDS  (cosmo.html)
   ══════════════════════════════════════════════════ */
.step-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--c-rl);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.step-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface-2);
  min-height: 52px;
}
.step-head-left { display: flex; align-items: center; gap: 10px; }
.step-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--c-accent); color: #fff;
  font-size: .65rem; font-weight: 700; flex-shrink: 0;
}
.step-done { background: var(--c-ok); }
.step-title { font-size: .9rem; font-weight: 600; color: var(--c-text); }
.step-desc  { font-size: .77rem; color: var(--c-faint); font-weight: 400; }
.step-card-body  { padding: 20px; }
.step-config-body{ padding: 14px 20px; }

/* KB pill */
.kb-pill {
  display: inline-flex; align-items: center;
  padding: 4px 11px; border-radius: 999px;
  background: var(--c-accent-bg);
  border: 1px solid rgba(201,100,66,.18);
  color: var(--c-accent); font-size: .76rem; font-weight: 600;
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════
   FORMS  (cosmo.html)
   ══════════════════════════════════════════════════ */
.form-row   { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-field { display: flex; flex-direction: column; gap: 5px; min-width: 160px; }
.form-label {
  font-size: .71rem; font-weight: 600; color: var(--c-muted);
  text-transform: uppercase; letter-spacing: .05em;
}
.label-muted { font-size: .68rem; font-weight: 400; color: var(--c-faint); text-transform: none; letter-spacing: 0; }
.form-control {
  border: 1px solid var(--c-border-s); border-radius: var(--c-r);
  background: var(--c-surface); color: var(--c-text);
  padding: 8px 11px; font: inherit; font-size: .9rem;
  transition: border-color .15s, box-shadow .15s; width: 100%;
}
.form-control:focus {
  outline: none; border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(201,100,66,.1);
}
textarea.form-control { resize: vertical; }
.asin-input { letter-spacing: .08em; font-weight: 700; text-transform: uppercase; }

/* ══════════════════════════════════════════════════
   BUTTONS  (cosmo.html)
   ══════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--c-r);
  font: inherit; font-size: .875rem; font-weight: 600;
  cursor: pointer; border: 1px solid transparent;
  transition: background .12s, box-shadow .12s, transform .1s;
  white-space: nowrap; min-height: 36px;
}
.btn:hover  { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-primary {
  background: var(--c-accent); color: #fff; border-color: var(--c-accent);
  box-shadow: 0 1px 4px rgba(201,100,66,.3);
}
.btn-primary:hover { background: var(--c-accent-h); border-color: var(--c-accent-h); }
.btn-ghost {
  background: var(--c-surface); color: var(--c-text);
  border-color: var(--c-border-s);
}
.btn-ghost:hover { background: var(--c-surface-2); }
.btn-lg  { padding: 10px 22px; font-size: .925rem; border-radius: 9px; min-height: 44px; }
.btn-sm  { padding: 5px 12px; font-size: .78rem; min-height: 30px; }

/* ══════════════════════════════════════════════════
   SEGMENTED CONTROL
   ══════════════════════════════════════════════════ */
.seg-control {
  display: inline-flex; padding: 3px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: 10px; margin-bottom: 20px;
}
.seg-btn {
  padding: 7px 16px; border: none; border-radius: 8px;
  background: transparent; font: inherit;
  font-size: .85rem; font-weight: 500; color: var(--c-muted);
  cursor: pointer; transition: background .12s, color .12s, box-shadow .12s;
  min-height: 34px;
}
.seg-btn:hover { color: var(--c-text); }
.seg-btn.active {
  background: var(--c-surface); color: var(--c-text); font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* ══════════════════════════════════════════════════
   MODE / ASIN / LISTING
   ══════════════════════════════════════════════════ */
.mode-panel     { margin-bottom: 20px; }
.asin-row       { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.asin-field     { flex: 0 0 180px; }
.asin-btns      { display: flex; gap: 8px; align-items: flex-end; }
.listing-fields { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.field-hint     { font-size: .77rem; color: var(--c-faint); line-height: 1.55; margin: 0; }
.action-row     { display: flex; align-items: center; gap: 14px; }
.action-row-top { padding-top: 20px; margin-top: 16px; border-top: 1px solid var(--c-border); }
.action-hint    { font-size: .77rem; color: var(--c-faint); }

/* ══════════════════════════════════════════════════
   STATUS MESSAGES
   ══════════════════════════════════════════════════ */
.inline-status { min-height: 28px; padding: 4px 0; }
.cosmo-status-info    { color: var(--c-accent); font-size: .86rem; }
.cosmo-status-warn    { color: var(--c-warn); font-size: .86rem; }
.cosmo-status-error   { color: var(--c-err); font-size: .86rem; font-weight: 600; }
.cosmo-status-loading {
  color: var(--c-muted); font-size: .86rem;
  display: inline-flex; align-items: center; gap: 8px;
}
.cosmo-status-loading::before {
  content: ""; display: inline-block; width: 13px; height: 13px;
  border: 2px solid var(--c-border-s); border-top-color: var(--c-accent);
  border-radius: 50%; animation: app-spin .7s linear infinite;
}
@keyframes app-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════
   COSMO REPORT — score hero
   ══════════════════════════════════════════════════ */
body.app-body .cosmo-score-hero {
  background: linear-gradient(135deg, rgba(201,100,66,.05) 0%, transparent 60%);
  border-color: rgba(201,100,66,.1); border-radius: 10px; padding: 18px 22px;
}
body.app-body .cosmo-score-value { font-family: inherit; }
body.app-body .cosmo-stat        { border-radius: var(--c-r); }
body.app-body .cosmo-score-good  { color: var(--c-ok); }
body.app-body .cosmo-score-mid   { color: var(--c-warn); }
body.app-body .cosmo-score-bad   { color: var(--c-err); }
body.app-body .cosmo-stat-covered strong { color: var(--c-ok); }
body.app-body .cosmo-stat-vague   strong { color: var(--c-warn); }
body.app-body .cosmo-stat-blocked strong { color: var(--c-err); }
body.app-body .cosmo-stat-covered { background: rgba(5,150,105,.08); }
body.app-body .cosmo-stat-vague   { background: rgba(180,83,9,.08); }
body.app-body .cosmo-stat-missing { background: rgba(0,0,0,.04); }
body.app-body .cosmo-stat-blocked { background: rgba(220,38,38,.08); }

body.app-body .cosmo-rel-card { border-color: var(--c-border); box-shadow: none; }
body.app-body .cosmo-rel-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.08); transform: translateY(-1px); }
body.app-body .cosmo-rel-suggestion { background: var(--c-accent-bg); color: var(--c-accent); }
body.app-body .cosmo-top-suggestions { background: var(--c-accent-bg); border-color: rgba(201,100,66,.14); }
body.app-body .cosmo-top-suggestions h4 { color: var(--c-accent); }
body.app-body .cosmo-pill.cosmo-covered { background: rgba(5,150,105,.1); color: var(--c-ok); }
body.app-body .cosmo-pill.cosmo-vague   { background: rgba(180,83,9,.1); color: var(--c-warn); }
body.app-body .cosmo-pill.cosmo-missing { background: rgba(0,0,0,.06); color: var(--c-muted); }
body.app-body .cosmo-pill.cosmo-blocked { background: rgba(220,38,38,.1); color: var(--c-err); }
body.app-body .cosmo-generate-bar { border-top-color: var(--c-border); }
body.app-body .cosmo-blocked-warning { background: rgba(220,38,38,.05); border-color: rgba(220,38,38,.15); }

/* COSMO generated listing */
body.app-body .cosmo-generated-listing {
  border: 1px solid var(--c-border); border-radius: 10px; margin-top: 0;
}
body.app-body .gen-summary-bar {
  background: linear-gradient(135deg, rgba(201,100,66,.05), transparent);
  border-bottom-color: rgba(201,100,66,.08);
}
body.app-body .gen-title-box,
body.app-body .gen-bullet-row,
body.app-body .gen-description-box  { border-color: var(--c-border); background: var(--c-surface-2); }
body.app-body .gen-bullet-index     { background: var(--c-accent-bg); color: var(--c-accent); border-radius: 5px; }
body.app-body .gen-bullet-row:hover { border-color: rgba(201,100,66,.2); }
body.app-body .copy-btn:hover       { background: var(--c-accent-bg); color: var(--c-accent); border-color: rgba(201,100,66,.2); }
body.app-body .cosmo-rel-badge      { background: var(--c-accent-bg); border-color: rgba(201,100,66,.15); color: var(--c-accent); }
.cosmo-ext-link { color: var(--c-accent); text-decoration: none; font-weight: 600; }
.cosmo-ext-link:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════
   AUTH GATE override for warm background
   ══════════════════════════════════════════════════ */
body.app-body .auth-gate {
  width: min(420px, calc(100vw - 32px));
  margin: 10vh auto 0;
}
body.app-body .auth-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border-s);
  box-shadow: 0 8px 30px rgba(0,0,0,.1);
  border-radius: var(--c-rl);
}
body.app-body .auth-card h1 {
  font-family: inherit; font-size: 1.3rem; color: var(--c-text);
}
body.app-body .auth-card .section-kicker { color: var(--c-accent); }
body.app-body .auth-gate-actions .button.primary { background: var(--c-accent); }

/* ══════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  :root { --cw: 200px; }
}
@media (max-width: 768px) {
  .app-sidebar  { transform: translateX(-100%); }
  .app-main     { margin-left: 0; }
  .app-content  { padding: 16px; }
  .form-row-2   { grid-template-columns: 1fr; }
  body.app-body .cosmo-relation-grid { grid-template-columns: 1fr; }
  body.app-body .cosmo-score-divider { display: none; }
}

/* ════════════════════════════════════════════════════════════════
   SIDEBAR USER POPUP  —  avatar click menu
   ════════════════════════════════════════════════════════════════ */

/* Make footer the anchor for absolute positioning */
.sidebar-footer { position: relative; }

/* Popup card */
.sidebar-popup {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 6px; right: 6px;
  background: #262626;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  overflow: hidden;
  box-shadow:
    0 -8px 32px rgba(0,0,0,.5),
    0  4px 12px rgba(0,0,0,.3);
  z-index: 400;
}

/* User info header */
.popup-user-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.popup-avatar-lg {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(201,100,66,.28);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.popup-avatar-lg svg { width: 18px; height: 18px; fill: rgba(255,255,255,.75); }
.popup-user-info { min-width: 0; }
.popup-display-name {
  display: block;
  font-size: .84rem; font-weight: 600;
  color: rgba(255,255,255,.88);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.popup-display-email {
  display: block;
  font-size: .72rem; color: rgba(255,255,255,.38);
  margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Admin panel inside popup */
.sidebar-admin-panel {
  margin: 0 !important;
  padding: 10px 14px !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-image: none !important;
  border-bottom: 1px solid rgba(255,255,255,.07) !important;
}
.sidebar-admin-panel[hidden] { display: none !important; }

/* Override admin panel inner elements for dark context */
.sidebar-admin-panel .admin-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px;
}
.sidebar-admin-panel .admin-panel-head h2 {
  font-family: inherit; font-size: .8rem;
  color: rgba(255,255,255,.75); letter-spacing: 0;
}
.sidebar-admin-panel .admin-panel-head span {
  font-size: .72rem; color: rgba(201,100,66,.9);
}
.sidebar-admin-panel .section-kicker {
  font-size: .58rem; color: rgba(201,100,66,.7);
  margin-bottom: 3px;
}
.sidebar-admin-panel .admin-user-list { display: grid; gap: 5px; }
.sidebar-admin-panel .admin-user-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; padding: 6px 8px; border-radius: 6px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.06);
}
.sidebar-admin-panel .admin-user-row strong {
  font-size: .78rem; color: rgba(255,255,255,.75);
  font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.sidebar-admin-panel .admin-user-row span {
  font-size: .7rem; color: rgba(255,255,255,.35);
  overflow: hidden; text-overflow: ellipsis; flex: 1;
}
.sidebar-admin-panel .admin-user-row em {
  font-size: .66rem; font-style: normal; font-weight: 600;
  color: rgba(201,100,66,.8);
  background: rgba(201,100,66,.12);
  padding: 2px 6px; border-radius: 4px; white-space: nowrap;
}

/* Logout button */
.popup-logout-btn {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 11px 14px;
  border: none; background: none;
  color: rgba(255,255,255,.45);
  font: inherit; font-size: .85rem;
  cursor: pointer; text-align: left;
  transition: background .12s, color .12s;
}
.popup-logout-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.popup-logout-btn:hover {
  background: rgba(220,38,38,.1);
  color: rgba(255,120,120,.9);
}

/* Chevron in trigger (rotates when open) */
.sidebar-chevron {
  width: 14px; height: 14px; flex-shrink: 0;
  color: rgba(255,255,255,.25);
  transition: transform .2s;
}
.sidebar-user[aria-expanded="true"] .sidebar-chevron {
  transform: rotate(180deg);
  color: rgba(201,100,66,.7);
}

/* Trigger hover while popup is open */
.sidebar-user[aria-expanded="true"] {
  background: rgba(201,100,66,.08);
}

/* ── Detection result row (step 01, after scraping) ── */
.detection-row {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}
.detection-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(201,100,66,.06);
  border: 1px solid rgba(201,100,66,.15);
  border-radius: 9px;
  flex-wrap: wrap;
}
.detection-icon svg {
  width: 18px; height: 18px;
  color: var(--c-accent, #c96442);
  display: block;
}
.detection-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.detection-label {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-muted, #706b66);
}
.detection-value {
  font-size: .9rem;
  font-weight: 600;
  color: var(--c-text, #1a1a1a);
}
