:root {
  color-scheme: light;
  --ink: #151513;
  --ink-soft: #393733;
  --muted: #68635d;
  --line: rgba(21, 21, 19, 0.14);
  --line-strong: rgba(21, 21, 19, 0.28);
  --paper: #f4f0e8;
  --paper-deep: #e9e2d7;
  --white: #fffdf8;
  --copper: #a55f3c;
  --copper-bright: #ce835a;
  --sage: #69766a;
  --danger: #a1483b;
  --source: #365e75;
  --source-soft: #e5edf1;
  --shadow: 0 24px 70px rgba(28, 23, 17, 0.13);
  --header-height: 82px;
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 30px;
  --sans: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", "Noto Serif SC", "Songti SC", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 8%, rgba(165, 95, 60, 0.09), transparent 30%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.52), transparent 48%),
    var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.022'/%3E%3C/svg%3E");
  content: "";
  pointer-events: none;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--copper-bright);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.site-header {
  position: relative;
  z-index: 30;
  display: flex;
  height: var(--header-height);
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(24px, 4.4vw, 76px);
  border-bottom: 1px solid var(--line);
  background: rgba(244, 240, 232, 0.82);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.brand img {
  width: 34px;
  height: 34px;
}

.brand span {
  display: grid;
  gap: 2px;
}

.brand strong {
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.23em;
}

.brand small {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.header-actions,
.hero-actions,
.toolbar-left,
.toolbar-right,
.dock-actions,
.inspector-actions,
.modal-actions,
.model-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.connection-state small {
  padding-left: 8px;
  border-left: 1px solid var(--line);
  color: var(--copper);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.14em;
}

.connection-state:hover span,
.connection-state:hover small {
  color: var(--ink);
}

.connection-state i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #9c978e;
  box-shadow: 0 0 0 4px rgba(156, 151, 142, 0.12);
}

.connection-state[data-tone="ready"] i {
  background: var(--sage);
  box-shadow: 0 0 0 4px rgba(105, 118, 106, 0.13);
}

.connection-state[data-tone="warn"] i {
  background: var(--copper);
  box-shadow: 0 0 0 4px rgba(165, 95, 60, 0.12);
}

.icon-button,
.quiet-button,
.primary-button,
.text-button {
  border: 0;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease, opacity 180ms ease;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.62);
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--white);
  transform: translateY(-1px);
}

.icon-button svg,
.quiet-button svg,
.primary-button svg,
.lux-select svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.primary-button,
.quiet-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
}

.primary-button {
  border: 1px solid var(--ink);
  color: var(--paper);
  background: var(--ink);
}

.primary-button:hover:not(:disabled) {
  background: #292824;
  transform: translateY(-1px);
}

.primary-button.large {
  min-height: 56px;
  padding: 0 24px;
}

.primary-button.copper {
  border-color: var(--copper);
  background: var(--copper);
}

.primary-button.copper:hover:not(:disabled) {
  background: #8e4e30;
}

.quiet-button {
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.52);
}

.quiet-button:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--white);
}

.text-button {
  padding: 9px 6px;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  color: var(--ink-soft);
  background: transparent;
  font-size: 12px;
  letter-spacing: 0.05em;
}

.text-button:hover {
  border-color: var(--copper);
  color: var(--copper);
}

.landing {
  position: relative;
  display: grid;
  min-height: calc(100vh - var(--header-height));
  grid-template-columns: minmax(0, 1.15fr) minmax(330px, 0.65fr);
  align-items: center;
  gap: clamp(48px, 8vw, 150px);
  overflow: hidden;
  padding: clamp(64px, 8vw, 128px) clamp(24px, 8vw, 144px);
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 850px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.eyebrow span {
  color: var(--copper);
}

.landing h1,
.collection-masthead h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 450;
  letter-spacing: -0.045em;
}

.landing h1 {
  max-width: 850px;
  font-size: clamp(44px, 4.3vw, 76px);
  line-height: 0.99;
}

.landing h1 > span,
.landing h1 > em {
  white-space: nowrap;
}

.landing h1 em {
  color: var(--copper);
  font-weight: 400;
}

.hero-lead {
  max-width: 590px;
  margin: 32px 0 34px;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: clamp(16px, 1.45vw, 21px);
  line-height: 1.75;
}

.hero-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.hero-signal {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(30vw, 430px);
  min-width: 330px;
  aspect-ratio: 0.82;
  place-items: center;
  border: 1px solid rgba(21, 21, 19, 0.16);
  background:
    linear-gradient(rgba(21, 21, 19, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 21, 19, 0.08) 1px, transparent 1px),
    rgba(255, 253, 248, 0.42);
  background-size: 33.333% 33.333%;
  box-shadow: var(--shadow);
}

.hero-signal::before,
.hero-signal::after {
  position: absolute;
  content: "";
}

.hero-signal::before {
  width: 58%;
  aspect-ratio: 1;
  border: 1px solid rgba(165, 95, 60, 0.48);
  border-radius: 50%;
}

.hero-signal::after {
  width: 1px;
  height: 72%;
  background: linear-gradient(transparent, var(--copper), transparent);
  animation: scan 4.5s ease-in-out infinite;
}

@keyframes scan {
  0%, 100% { transform: translateX(-108px); opacity: 0; }
  14%, 86% { opacity: 1; }
  50% { transform: translateX(108px); }
}

.signal-dot {
  width: 12px;
  height: 12px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--copper);
  box-shadow: 0 0 0 12px rgba(165, 95, 60, 0.12);
}

.signal-index {
  position: absolute;
  top: 30px;
  left: 30px;
  display: grid;
  gap: 6px;
}

.signal-index span,
.hero-signal p {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.2em;
}

.signal-index strong {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 450;
}

.hero-signal p {
  position: absolute;
  right: 26px;
  bottom: 22px;
  left: 26px;
  margin: 0;
  text-align: center;
}

.corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--copper);
  border-style: solid;
}

.corner.tl { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.corner.tr { top: -1px; right: -1px; border-width: 2px 2px 0 0; }
.corner.bl { bottom: -1px; left: -1px; border-width: 0 0 2px 2px; }
.corner.br { right: -1px; bottom: -1px; border-width: 0 2px 2px 0; }

.hero-orbit {
  position: absolute;
  border: 1px solid rgba(21, 21, 19, 0.07);
  border-radius: 50%;
  pointer-events: none;
}

.hero-orbit-one {
  right: -18vw;
  width: 65vw;
  height: 65vw;
}

.hero-orbit-two {
  right: -8vw;
  width: 42vw;
  height: 42vw;
}

.collection {
  display: flex;
  height: calc(100vh - var(--header-height));
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  padding: 18px clamp(18px, 4.2vw, 72px) 92px;
}

.collection-masthead {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  flex: none;
  align-items: center;
  gap: 24px;
  min-height: 68px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.collection-statline {
  display: flex;
  margin: 0;
  gap: clamp(12px, 1.6vw, 26px);
}

.collection-statline div {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 6px;
}

.collection-statline dt {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.09em;
}

.collection-statline dd {
  order: -1;
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1;
}

.source-ribbon {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 34px;
  align-items: center;
  gap: 9px;
  overflow: auto hidden;
  padding: 0;
  scrollbar-width: thin;
}

.source-chip {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.45);
  color: var(--ink-soft);
  font-size: 10px;
}

.source-chip i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sage);
}

.source-chip[data-writable="false"] i {
  background: #a68e6d;
}

.collection-toolbar {
  position: relative;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
}

.collection-toolbar .quiet-button,
.collection-toolbar .lux-select > button {
  min-height: 36px;
}

.collection-toolbar .quiet-button {
  padding-inline: 13px;
}

.collection-toolbar .lux-select.compact {
  min-width: 132px;
}

.run-progress {
  display: grid;
  grid-template-columns: auto minmax(140px, 1fr) auto;
  flex: none;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  margin: 10px 0 0;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.56);
}

.run-progress-copy,
.run-progress-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.run-progress-copy span,
.run-progress-meta {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.run-progress-copy strong {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
}

.run-progress-track {
  position: relative;
  height: 2px;
  margin: 0;
  overflow: hidden;
  background: rgba(21, 21, 19, 0.12);
}

.run-progress-track span {
  position: relative;
  display: block;
  width: 0;
  height: 100%;
  background: var(--copper);
  transition: width 250ms ease;
}

.run-progress[data-phase="active"] .run-progress-track span::after {
  position: absolute;
  inset: 0;
  width: 44%;
  background: linear-gradient(90deg, transparent, rgba(255, 253, 248, 0.9), transparent);
  animation: progress-glint 1.35s ease-in-out infinite;
  content: "";
}

.run-progress[data-phase="errors"] {
  border-color: rgba(161, 72, 59, 0.34);
  background: rgba(161, 72, 59, 0.045);
}

.run-progress[data-phase="errors"] .run-progress-track span {
  background: var(--danger);
}

@keyframes progress-glint {
  from { transform: translateX(-120%); }
  to { transform: translateX(330%); }
}

.gallery-list-head {
  display: grid;
  grid-template-columns: 36px 70px minmax(150px, 1.35fr) 142px 154px minmax(180px, 0.9fr);
  gap: 14px;
  align-items: center;
  min-height: 30px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.gallery-list-head span:first-child {
  text-align: center;
}

.gallery-list-head span:nth-child(2) { grid-column: 2 / 4; }

.gallery-viewport {
  position: relative;
  min-height: 0;
  flex: 1;
  height: auto;
  overflow: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overscroll-behavior: contain;
  scrollbar-color: rgba(21, 21, 19, 0.25) transparent;
}

.gallery-virtual {
  position: relative;
  width: 100%;
  min-height: 100%;
}

.gallery-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 18px;
}

.gallery-card {
  position: absolute;
  display: grid;
  grid-template-columns: 36px 70px minmax(150px, 1.35fr) 142px 154px minmax(180px, 0.9fr);
  gap: 14px;
  align-items: center;
  overflow: hidden;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 15px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.66);
  box-shadow: 0 6px 22px rgba(28, 23, 17, 0.04);
  cursor: pointer;
  text-align: left;
  content-visibility: auto;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.gallery-card:hover,
.gallery-card[aria-current="true"] {
  border-color: rgba(165, 95, 60, 0.5);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: 0 11px 30px rgba(28, 23, 17, 0.09);
  transform: translateX(2px);
}

.gallery-card[data-source-marked="true"] {
  border-color: rgba(165, 95, 60, 0.24);
  box-shadow: inset 4px 0 0 var(--copper), 0 7px 24px rgba(28, 23, 17, 0.055);
}

.gallery-card[data-status="person"] {
  border-color: rgba(148, 70, 47, 0.16);
  background: linear-gradient(90deg, rgba(148, 70, 47, 0.055), rgba(255, 253, 248, 0.84) 42%);
}

.gallery-card[data-status="person"]:hover,
.gallery-card[data-status="person"][aria-current="true"] {
  border-color: rgba(148, 70, 47, 0.62);
  background: linear-gradient(90deg, rgba(148, 70, 47, 0.15), rgba(255, 253, 248, 0.96) 44%);
}

.gallery-thumb {
  position: relative;
  width: 70px;
  height: 70px;
  overflow: hidden;
  border-radius: 10px;
  background: #eeeae3;
}

.gallery-card[data-status="person"] .gallery-thumb {
  box-shadow: none;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gallery-order {
  align-self: center;
  min-width: 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}

.gallery-thumb::after {
  position: absolute;
  right: 0;
  left: 0;
  top: -24%;
  height: 24%;
  opacity: 0;
  background: linear-gradient(180deg, transparent, rgba(255, 253, 248, 0.74), rgba(206, 131, 90, 0.72), transparent);
  box-shadow: 0 0 18px rgba(206, 131, 90, 0.3);
  content: "";
  pointer-events: none;
}

body[data-review-phase="active"] .gallery-card[data-status="running"] .gallery-thumb::after {
  opacity: 1;
  animation: image-scan 1.35s ease-in-out infinite;
}

@keyframes image-scan {
  from { transform: translateY(0); }
  to { transform: translateY(455%); }
}

.gallery-copy {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.gallery-copy strong,
.gallery-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-copy strong {
  font-size: 12px;
  font-weight: 680;
}

.gallery-copy span {
  color: var(--muted);
  font-size: 9px;
}

.gallery-cell {
  min-width: 0;
}

.gallery-cell-label {
  display: none;
}

.gallery-source-marker,
.gallery-status {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  min-height: 29px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid rgba(21, 21, 19, 0.1);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(244, 240, 232, 0.72);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

.gallery-source-marker::before,
.gallery-status::before {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #938d84;
  content: "";
}

.gallery-source-marker[data-tone="marked"] {
  border-color: rgba(165, 95, 60, 0.36);
  color: #713d27;
  background: rgba(165, 95, 60, 0.12);
  box-shadow: 0 5px 16px rgba(165, 95, 60, 0.08);
}

.gallery-source-marker[data-tone="marked"]::before { background: var(--copper); }
.gallery-source-marker[data-tone="reading"]::before { background: #b48a48; animation: pulse 1s ease-in-out infinite; }
.gallery-source-marker[data-tone="unsupported"] { color: var(--muted); }

.gallery-status[data-tone="person"] {
  border-color: #8b402d;
  color: #fffdf8;
  background: #94462f;
  box-shadow: 0 6px 16px rgba(104, 45, 30, 0.2);
  font-weight: 760;
}

.gallery-status[data-tone="person"]::before {
  width: 7px;
  height: 7px;
  background: #fffdf8;
  box-shadow: 0 0 0 3px rgba(255, 253, 248, 0.16);
}
.gallery-status[data-tone="clear"]::before { background: var(--sage); }
.gallery-status[data-tone="review"]::before { background: #b48a48; }
.gallery-status[data-tone="failed"]::before { background: var(--danger); }
.gallery-status[data-tone="running"]::before { background: var(--copper-bright); animation: pulse 1s ease-in-out infinite; }

@keyframes pulse { 50% { opacity: 0.28; transform: scale(0.7); } }

.gallery-message {
  display: flex;
  align-items: center;
  color: var(--muted);
}

.gallery-message strong {
  overflow: hidden;
  font-size: 10px;
  font-weight: 570;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-message[data-tone="failed"] { color: var(--danger); }
.gallery-message[data-tone="failed"] strong {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid rgba(161, 72, 59, 0.24);
  border-radius: 999px;
  background: rgba(161, 72, 59, 0.075);
  font-weight: 700;
}

.gallery-message[data-tone="retrying"],
.gallery-message[data-tone="warning"] { color: #8b612c; }
.gallery-message[data-tone="retrying"] strong,
.gallery-message[data-tone="warning"] strong {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid rgba(139, 97, 44, 0.22);
  border-radius: 999px;
  background: rgba(180, 138, 72, 0.075);
  font-weight: 650;
}
.gallery-message[data-tone="person"] { color: #713823; }
.gallery-message[data-tone="person"] strong { font-weight: 740; }
.gallery-message[data-tone="clear"] { color: #566258; }
.gallery-message[data-tone="running"] { color: var(--copper); }

.command-dock {
  position: fixed;
  z-index: 24;
  right: clamp(18px, 4vw, 70px);
  bottom: 22px;
  left: clamp(18px, 4vw, 70px);
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 12px 8px 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  color: var(--paper);
  background: rgba(21, 21, 19, 0.93);
  box-shadow: 0 22px 65px rgba(21, 21, 19, 0.28);
  backdrop-filter: blur(18px);
}

.dock-copy {
  display: grid;
  gap: 4px;
}

.dock-copy span {
  color: rgba(244, 240, 232, 0.58);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dock-copy strong {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 450;
}

.command-dock .quiet-button {
  border-color: rgba(255, 255, 255, 0.13);
  color: var(--paper);
  background: rgba(255, 255, 255, 0.05);
}

.command-dock .primary-button {
  min-height: 48px;
  min-width: 172px;
  padding-inline: 24px;
  box-shadow: 0 9px 24px rgba(107, 55, 32, 0.32);
}

.lux-select {
  position: relative;
}

.lux-select > button {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.76);
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}

.lux-select.compact {
  min-width: 148px;
}

.lux-select.wide {
  width: 100%;
}

.lux-select > button:hover,
.lux-select[data-open="true"] > button {
  border-color: var(--line-strong);
  background: var(--white);
}

.lux-select[data-open="true"] > button svg {
  transform: rotate(180deg);
}

.select-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 7px);
  right: 0;
  min-width: 100%;
  max-height: min(320px, 50vh);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.98);
  box-shadow: 0 18px 48px rgba(28, 23, 17, 0.17);
  backdrop-filter: blur(18px);
}

.select-menu button {
  display: block;
  width: 100%;
  padding: 10px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  text-align: left;
  white-space: nowrap;
}

.select-menu button:hover,
.select-menu button[aria-selected="true"] {
  color: var(--copper);
  background: rgba(165, 95, 60, 0.09);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.modal-head span {
  color: var(--copper-bright);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.modal-head h2 {
  margin: 7px 0 0;
  font-family: var(--serif);
  font-size: 29px;
  font-weight: 450;
}

.image-review-dialog {
  position: fixed;
  z-index: 160;
  inset: 0;
  display: grid;
  grid-template-rows: minmax(220px, 1fr) auto;
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  gap: clamp(12px, 2vw, 20px);
  padding: clamp(20px, 2.6vw, 40px);
  overflow: hidden;
  border: 0;
  color: var(--paper);
  background: rgba(13, 13, 12, 0.96);
  backdrop-filter: blur(12px);
}

.image-review-dialog:not([open]) {
  display: none;
}

.image-review-dialog::backdrop {
  background: rgba(13, 13, 12, 0.72);
}

.image-review-close {
  position: absolute;
  z-index: 2;
  top: clamp(16px, 2vw, 28px);
  right: clamp(16px, 2vw, 28px);
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--paper);
  background: rgba(255, 255, 255, 0.06);
}

.image-review-stage {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  place-items: center;
  margin: 0;
}

.image-review-stage img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
}

.image-review-dock {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(1180px, 100%);
  grid-template-columns: minmax(0, 1fr) minmax(250px, 320px);
  justify-self: center;
  gap: 18px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 22px;
  background: rgba(28, 28, 25, 0.92);
  box-shadow: 0 22px 64px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(18px);
}

.image-review-summary {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(160px, 0.8fr) minmax(220px, 1.2fr) minmax(132px, 0.55fr);
  align-content: center;
  align-items: center;
  gap: 10px 18px;
}

.inspector-path {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.inspector-path span,
.inspector-status span,
.image-review-marker span,
.field-label {
  color: rgba(244, 240, 232, 0.45);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.inspector-path strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspector-path small {
  overflow: hidden;
  color: rgba(244, 240, 232, 0.52);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspector-status {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.inspector-status strong {
  overflow: hidden;
  color: var(--copper-bright);
  font-size: 11px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspector-status[data-tone="person"] span {
  color: #dc936b;
  font-weight: 740;
}

.inspector-status[data-tone="person"] strong {
  color: #f0a47b;
  font-weight: 740;
}

.image-review-marker {
  display: grid;
  gap: 5px;
}

.image-review-marker strong {
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 450;
}

.evidence-copy {
  display: -webkit-box;
  grid-column: 1 / -1;
  overflow: hidden;
  margin: 0;
  color: rgba(244, 240, 232, 0.67);
  font-family: var(--serif);
  font-size: 11px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.field-label {
  display: block;
  margin: 0 0 8px;
}

.image-review-controls {
  align-self: center;
  min-width: 0;
}

.image-review-dialog .lux-select > button {
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--paper);
  background: rgba(255, 255, 255, 0.05);
}

.image-review-dialog .select-menu {
  top: auto;
  bottom: calc(100% + 7px);
  color: var(--ink);
}

.inspector-actions {
  margin-top: 16px;
}

.image-review-dialog .quiet-button {
  flex: 1;
  border-color: rgba(255, 255, 255, 0.13);
  color: var(--paper);
  background: rgba(255, 255, 255, 0.04);
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  overflow: auto;
  padding: 15px;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
}

.modal:not([open]) {
  display: none;
}

.modal::backdrop {
  background: rgba(21, 21, 19, 0.48);
  backdrop-filter: blur(7px);
}

.modal-panel {
  width: min(650px, 100%);
  margin: auto;
  padding: 30px;
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: 0 32px 100px rgba(21, 21, 19, 0.28);
}

.compact-panel {
  max-width: 540px;
}

.modal-head {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 24px 0 12px;
}

.settings-field {
  display: grid;
  gap: 8px;
}

.settings-field > span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
}

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

.settings-field input {
  width: 100%;
  min-height: 45px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fbf8f2;
  outline: none;
}

.settings-field input:focus {
  border-color: var(--copper);
  box-shadow: 0 0 0 3px rgba(165, 95, 60, 0.1);
}

.model-row .model-select {
  min-width: 0;
}

.model-row .quiet-button {
  flex: none;
}

.settings-note,
.confirm-copy {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.confirm-copy {
  margin: 24px 0 14px;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 15px;
}

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

.write-breakdown div {
  display: grid;
  min-height: 72px;
  place-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
}

.write-breakdown strong {
  display: block;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 450;
}

.write-breakdown span {
  color: var(--muted);
  font-size: 9px;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 26px;
}

.import-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 24px;
  color: var(--paper);
  background: rgba(21, 21, 19, 0.92);
  text-align: center;
  backdrop-filter: blur(18px);
}

.import-mark {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: 25px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.import-mark i,
.import-mark span {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 42px;
  height: 1px;
  background: var(--copper-bright);
  content: "";
}

.import-mark i { transform: translate(-50%, -50%); }
.import-mark span { transform: translate(-50%, -50%) rotate(90deg); }
.import-mark::after {
  position: absolute;
  inset: -1px;
  border-top: 2px solid var(--copper-bright);
  content: "";
  animation: spin 1.5s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.import-overlay strong {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 450;
}

.import-overlay p {
  max-width: 450px;
  color: rgba(244, 240, 232, 0.58);
  font-size: 11px;
}

.toast {
  position: static;
  display: flex;
  flex: none;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0 0 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-soft);
  background: var(--white);
  font-size: 12px;
  line-height: 1.5;
}

.toast[data-tone="error"] {
  color: #822f27;
  border-color: rgba(161, 72, 59, .3);
  background: #faeee9;
}

.toast > span { min-width: 0; overflow-wrap: anywhere; }
.toast .text-button { flex: none; min-height: 32px; color: inherit; }
.image-review-dock > .toast { margin: 0; }
.modal-panel > .toast { margin-top: 16px; }
.gallery-status[data-tone="person"] { box-shadow: none; }
.gallery-message[data-tone="person"] strong { font-weight: 500; }

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

  .hero-signal {
    display: none;
  }

  .collection-masthead {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px 20px;
  }

  .collection-statline {
    width: auto;
  }

  .collection-toolbar {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 900px) {
  .run-progress {
    grid-template-columns: auto minmax(100px, 1fr);
    gap: 8px 12px;
  }

  .run-progress-meta {
    grid-column: 1 / -1;
    justify-content: space-between;
  }

  .gallery-list-head {
    display: none;
  }

  .gallery-card {
    grid-template-areas:
      "order thumb copy"
      "order thumb source"
      "order thumb review"
      "order thumb message";
    grid-template-columns: 32px 64px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto auto auto;
    gap: 5px 12px;
    padding: 9px 12px;
  }

  .gallery-thumb {
    grid-area: thumb;
    width: 76px;
    height: 100%;
  }

  .gallery-copy { grid-area: copy; }
  .gallery-order { grid-area: order; }
  .gallery-source { grid-area: source; justify-self: start; }
  .gallery-review { grid-area: review; }
  .gallery-message { grid-area: message; }

  .gallery-source-marker,
  .gallery-status {
    min-height: 25px;
    padding-inline: 8px;
    font-size: 8px;
  }

  .gallery-message strong {
    font-size: 9px;
  }
}

@media (max-width: 680px) {
  :root { --header-height: 68px; }

  .site-header {
    padding: 0 17px;
  }

  .brand small,
  .connection-state span,
  .connection-state small {
    display: none;
  }

  .landing {
    align-items: start;
    padding: 70px 20px;
  }

  .landing h1 {
    font-size: clamp(28px, 7.7vw, 38px);
  }

  .hero-actions,
  .collection-toolbar,
  .toolbar-left,
  .toolbar-right {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .hero-actions .primary-button,
  .hero-actions .text-button,
  .toolbar-left > *,
  .toolbar-right > * {
    width: 100%;
  }

  .collection {
    height: auto;
    min-height: calc(100vh - var(--header-height));
    overflow: visible;
    padding: 14px 15px 118px;
  }

  .collection-masthead {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
    min-height: 0;
    padding: 0 0 12px;
  }

  .collection-statline {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }

  .collection-statline div {
    min-width: 0;
  }

  .collection-statline dd {
    font-size: 23px;
  }

  .collection-toolbar {
    grid-column: auto;
    align-items: stretch;
  }

  .toolbar-left,
  .toolbar-right {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .toolbar-right {
    grid-template-columns: 1fr;
  }

  .gallery-viewport {
    min-height: 420px;
    flex: none;
    height: 60vh;
  }

  .command-dock {
    right: 12px;
    bottom: 12px;
    left: 12px;
    min-height: 62px;
    align-items: center;
    gap: 14px;
    padding: 10px 12px 10px 14px;
  }

  .dock-copy {
    min-width: 0;
  }

  .dock-copy strong {
    font-size: 14px;
    line-height: 1.25;
  }

  .dock-actions {
    display: grid;
    flex: 0 0 138px;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .dock-actions .quiet-button,
  .command-dock .primary-button {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding-inline: 12px;
  }

  .dock-actions .primary-button {
    grid-column: auto;
  }

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

  .settings-field.full {
    grid-column: auto;
  }

  .modal-panel {
    padding: 22px;
  }

  .image-review-dialog {
    grid-template-rows: minmax(180px, 1fr) auto;
    gap: 10px;
    padding: 12px;
  }

  .image-review-dock {
    max-height: 46dvh;
    grid-template-columns: 1fr;
    gap: 12px;
    overflow: auto;
    padding: 13px;
    border-radius: 18px;
  }

  .image-review-summary {
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
  }

  .inspector-path,
  .evidence-copy {
    grid-column: 1 / -1;
  }

  .write-breakdown {
    grid-template-columns: 1fr;
  }
}

/* PRESENCE VI: warm editorial canvas, restrained chrome, semantic status colors. */
.primary-button, .quiet-button, .text-button, .lux-select > button, .select-menu button {
  font-size: 13px;
  line-height: 1.35;
}
.quiet-button, .lux-select > button, .collection-toolbar .quiet-button,
.collection-toolbar .lux-select > button { min-height: 40px; border-radius: var(--radius-sm); }
.text-button { min-height: 40px; }
.settings-note, .toast, .run-progress-meta, .run-progress-copy span { font-size: 12px; letter-spacing: 0; }
.settings-field > span, .collection-statline dt, .gallery-list-head { font-size: 11px; }
.source-chip { font-size: 12px; }
.collection-statline { gap: 16px; }
.collection-masthead { gap: 18px; grid-template-columns: minmax(160px, 1fr) auto auto; }
.collection-find { position: relative; z-index: 11; display: flex; flex: none; align-items: center; gap: 12px; padding: 12px 0; }
.search-field { flex: 0 1 300px; min-width: 120px; }
.search-field input { width: 100%; min-height: 40px; padding: 0 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); background: rgba(255,253,248,.6); font-size: 13px; }
.search-field input::placeholder { color: var(--muted); }
.collection-find .lux-select { min-width: 180px; max-width: 300px; }
.collection-find .lux-select > button > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collection-find .select-menu { max-width: min(480px, calc(100vw - 40px)); }
.collection-find .select-menu button { white-space: normal; overflow-wrap: anywhere; }
.filter-count { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
#removeFiltered { color: var(--danger); }
.collection-notice { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 12px; margin-bottom: 8px; border-left: 2px solid var(--source); color: var(--ink-soft); background: rgba(54,94,117,.06); font-size: 12px; line-height: 1.5; }
.collection-notice button { min-height: 28px; flex: none; }
.gallery-copy strong { font-size: 14px; }
.gallery-copy > span { font-size: 12px; }
.gallery-source-marker, .gallery-status { min-height: 30px; font-size: 12px; letter-spacing: 0; }
.gallery-source-marker { font-size: 11px; }
.source-write-note { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 400; }
.gallery-message strong { font-size: 12px; line-height: 1.45; white-space: normal; overflow-wrap: anywhere; }
.gallery-card { box-shadow: none; border-radius: 12px; }
.gallery-card:hover, .gallery-card[aria-current="true"] { transform: none; box-shadow: none; }
.gallery-card[data-source-marked="true"] { border-color: rgba(54,94,117,.2); box-shadow: inset 3px 0 0 var(--source); }
.gallery-source-marker[data-tone="marked"] { color: var(--source); background: var(--source-soft); border-color: rgba(54,94,117,.3); }
.gallery-card[data-source-marked="true"] .gallery-source-marker::before { background: var(--source); }
.dock-copy > span { font-size: 11px; }
.dock-copy strong { font-size: 16px; }
.image-review-dialog { grid-template-rows: 42px minmax(120px, 1fr) auto; gap: 14px; }
.image-review-navigation { display: flex; justify-content: center; align-items: center; gap: 14px; padding-right: 52px; }
.image-review-navigation .quiet-button { flex: none; }
#imagePosition { min-width: 60px; font-size: 13px; text-align: center; font-variant-numeric: tabular-nums; }
.image-review-stage { display: flex; align-items: center; justify-content: center; }
.image-review-stage img { position: static; width: auto; height: auto; max-width: 100%; max-height: 100%; flex: none; user-select: none; }
.image-review-dialog[data-zoom="actual"] .image-review-stage { display: block; overflow: auto; cursor: grab; touch-action: none; }
.image-review-dialog[data-zoom="actual"] .image-review-stage:active { cursor: grabbing; }
.image-review-dialog[data-zoom="actual"] .image-review-stage img { max-width: none; max-height: none; margin: auto; }
.image-review-dock { max-height: 34dvh; overflow: auto; border-radius: 16px; }
.image-review-summary { grid-template-columns: minmax(160px,1fr) minmax(180px,1fr); }
.image-review-marker { grid-column: 1; }
.evidence-copy { display: block; overflow: visible; -webkit-line-clamp: unset; font-family: var(--sans); font-size: 13px; line-height: 1.55; color: #d4d0c8; overflow-wrap: anywhere; white-space: pre-line; }
.inspector-path strong { font-size: 14px; white-space: normal; overflow-wrap: anywhere; }
.inspector-path small { font-size: 12px; line-height: 1.5; white-space: normal; overflow-wrap: anywhere; color: #b6b3ad; user-select: text; }
.inspector-status strong { font-size: 13px; white-space: normal; overflow-wrap: anywhere; }
.inspector-path span, .inspector-status span, .image-review-marker span, .field-label { font-size: 11px; color: #b6b3ad; }
.image-review-marker strong { font-size: 13px; color: #a7c4d5; font-family: var(--sans); }
.inspector-actions { flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.inspector-actions .quiet-button { flex: 1 1 auto; }
.image-review-dialog .select-menu { position: fixed; top: auto; bottom: 24px; right: 32px; min-width: 220px; max-width: calc(100vw - 48px); }
@media (max-width: 1100px) {
  .collection-masthead { grid-template-columns: minmax(0,1fr) auto; gap: 10px 16px; }
  .collection-toolbar { grid-column: 1 / -1; justify-content: space-between; }
}
@media (max-width: 900px) {
  .gallery-card { grid-template-columns: 32px 64px minmax(0,1fr); gap: 4px 10px; }
  .gallery-thumb { width: 64px; height: 64px; align-self: center; }
  .gallery-source-marker { font-size: 10px; padding-inline: 6px; }
  .gallery-status { font-size: 12px; }
  .gallery-message strong { font-size: 12px; }
  .gallery-copy > span { font-size: 11px; }
  .image-review-summary { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .collection-masthead { grid-template-columns: 1fr; gap: 8px; }
  .collection-toolbar { flex-direction: row; gap: 8px; }
  .toolbar-left { display: flex; flex-direction: row; width: auto; }
  .toolbar-left > *, .toolbar-right > * { width: auto; }
  .toolbar-right { display: block; width: auto; min-width: 0; }
  .collection-toolbar .quiet-button { padding-inline: 9px; }
  .toolbar-left .quiet-button { white-space: nowrap; }
  .toolbar-left .quiet-button svg { display: none; }
  .collection-toolbar .lux-select.compact { min-width: 120px; }
  .collection-toolbar .lux-select > button { max-width: 146px; }
  .collection-toolbar .lux-select > button > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .collection-find { flex-wrap: wrap; gap: 8px; }
  .search-field { flex: 1 1 150px; }
  .collection-find .lux-select { flex: 1 1 150px; min-width: 120px; max-width: 100%; }
  .filter-count { margin-left: 0; }
  .collection-notice { align-items: flex-start; flex-wrap: wrap; gap: 4px; }
  .collection { padding-bottom: 180px; }
  .command-dock { gap: 10px; }
  .dock-actions { flex-basis: 150px; }
  .dock-copy strong { font-size: 13px; }
  .image-review-dialog { grid-template-rows: 42px minmax(100px,1fr) auto; }
  .image-review-navigation { gap: 5px; padding-right: 40px; justify-content: start; }
  .image-review-navigation .quiet-button { padding-inline: 8px; font-size: 12px; min-height: 38px; }
  #imagePosition { min-width: 48px; font-size: 12px; }
  .image-review-dock { max-height: 43dvh; }
  .image-review-close { top: 16px; right: 12px; width: 36px; height: 36px; }
  .image-review-dialog .select-menu { right: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
