:root {
  color-scheme: light dark;
  --font: "Avenir Next", "Segoe UI Variable", "Microsoft YaHei", system-ui, sans-serif;
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-subtle: #f7f9fa;
  --surface-hover: #eef3f6;
  --text: #16232c;
  --text-secondary: #566772;
  --text-muted: #7b8a93;
  --border: #dbe3e8;
  --border-strong: #bdcbd3;
  --brand: #12679b;
  --brand-hover: #0d5786;
  --brand-pressed: #0a4266;
  --brand-soft: #e8f3f8;
  --success: #19734a;
  --warning: #946200;
  --danger: #b83c46;
  --focus: #12679b;
  --shadow-menu: 0 16px 40px rgba(31, 64, 82, 0.14);
  --shadow-surface: 0 12px 32px rgba(31, 64, 82, 0.07);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --topbar-height: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161616;
    --surface: #242424;
    --surface-subtle: #292929;
    --surface-hover: #333333;
    --text: #f5f5f5;
    --text-secondary: #d1d1d1;
    --text-muted: #adadad;
    --border: #484848;
    --border-strong: #666666;
    --brand: #479ef5;
    --brand-hover: #62abf5;
    --brand-pressed: #77b7f7;
    --brand-soft: #0c3b5e;
    --success: #54b054;
    --warning: #f9d949;
    --danger: #dc626d;
    --focus: #479ef5;
  }
}

:root[data-theme="dark"] {
  --bg: #161616;
  --surface: #242424;
  --surface-subtle: #292929;
  --surface-hover: #333333;
  --text: #f5f5f5;
  --text-secondary: #d1d1d1;
  --text-muted: #adadad;
  --border: #484848;
  --border-strong: #666666;
  --brand: #479ef5;
  --brand-hover: #62abf5;
  --brand-pressed: #77b7f7;
  --brand-soft: #0c3b5e;
  --success: #54b054;
  --warning: #f9d949;
  --danger: #dc626d;
  --focus: #479ef5;
}

:root[data-theme="light"] {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  font-family: var(--font);
}

body {
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
}

html {
  scroll-behavior: smooth;
}

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

button,
a,
input,
select,
textarea {
  outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

a {
  color: var(--brand);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(29px, 3vw, 40px);
  font-weight: 680;
  letter-spacing: -0.035em;
  line-height: 1.14;
}

h2 {
  margin-bottom: 6px;
  font-size: 21px;
  font-weight: 650;
  line-height: 1.3;
}

h3 {
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 630;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: none;
}

.app-shell {
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 3vw, 44px);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(18px) saturate(1.15);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 18px;
  font-weight: 650;
  text-decoration: none;
}

.brand.compact {
  font-size: 15px;
}

.brand.compact strong {
  color: var(--text-secondary);
  font-weight: 500;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  background: var(--brand);
  color: #ffffff;
  font-weight: 730;
}

.topbar-actions,
.workspace-actions,
.action-row,
.title-row,
.preflight-head,
.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions {
  position: relative;
}

.save-state {
  min-width: 96px;
  color: var(--text-secondary);
  font-size: 12px;
  text-align: right;
}

.save-state[data-state="saved"] {
  color: var(--success);
}

.save-state[data-state="error"] {
  color: var(--danger);
}

.button,
.icon-button,
.avatar-button,
.menu-action,
.product-tab,
.section-nav-button {
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease,
    box-shadow 180ms ease, transform 120ms ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 14px;
  font-weight: 590;
}

.button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

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

.button.primary:active {
  background: var(--brand-pressed);
}

.button.subtle {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.button.subtle:hover {
  background: var(--surface-hover);
}

.button.small {
  min-height: 28px;
  padding: 3px 9px;
  font-size: 12px;
}

.button.wide {
  width: 100%;
  min-height: 42px;
}

.button:disabled {
  border-color: var(--border);
  background: var(--surface-hover);
  color: var(--text-muted);
  cursor: not-allowed;
}

.icon-button {
  width: 34px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 18px;
}

.icon-button:hover,
.avatar-button:hover,
.menu-action:hover {
  background: var(--surface-hover);
}

.avatar-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px 3px 4px;
  background: transparent;
}

.avatar {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.account-menu {
  position: absolute;
  top: 44px;
  right: 0;
  width: 240px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-menu);
}

.account-menu p {
  overflow: hidden;
  margin: 4px 8px 8px;
  color: var(--text-secondary);
  text-overflow: ellipsis;
}

.menu-action {
  width: 100%;
  padding: 6px 8px;
  background: transparent;
  text-align: left;
}

#main-content {
  min-height: calc(100dvh - var(--topbar-height));
}

.loading-state,
.page-state,
.home-view,
.workspace-view {
  width: min(1360px, calc(100% - 64px));
  margin: 0 auto;
}

.loading-state {
  padding-top: 58px;
}

.skeleton {
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--border) 65%, transparent);
  animation: pulse 1.2s ease-in-out infinite alternate;
}

.title-skeleton {
  width: 260px;
  height: 34px;
}

.line-skeleton {
  width: 420px;
  max-width: 75%;
  height: 16px;
  margin-top: 14px;
}

.panel-skeleton {
  height: 300px;
  margin-top: 42px;
}

.page-state {
  display: grid;
  min-height: 65vh;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.state-symbol {
  display: grid;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  place-items: center;
  border-radius: 50%;
  font-size: 22px;
  font-weight: 700;
}

.error-symbol {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

.home-view {
  padding: 48px 0 72px;
}

.home-heading {
  margin-bottom: 26px;
}

.home-heading p,
.editor-heading p,
.upload-card p,
.workspace-header p {
  color: var(--text-secondary);
}

.section-kicker,
.eyebrow {
  margin-bottom: 5px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 720;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.upload-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(420px, 1.28fr);
  gap: 28px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.drop-zone {
  display: grid;
  min-height: 170px;
  place-content: center;
  justify-items: center;
  padding: 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  text-align: center;
}

.drop-zone:hover,
.drop-zone[data-dragging="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.picker-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.folder-fallback {
  max-width: 460px;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 11px;
}

.upload-symbol {
  display: grid;
  width: 34px;
  height: 34px;
  margin-bottom: 8px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: #ffffff;
  font-size: 19px;
}

.drop-title {
  font-size: 16px;
  font-weight: 620;
}

.drop-help {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 12px;
}

.upload-preflight {
  grid-column: 1 / -1;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.preflight-head,
.section-heading {
  justify-content: space-between;
}

.file-list {
  margin: 14px 0;
  padding: 0;
  list-style: none;
}

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}

.file-list strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list span {
  flex: none;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.action-row {
  justify-content: flex-end;
}

.drafts-section {
  margin-top: 38px;
}

.draft-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.draft-card {
  display: block;
  min-height: 128px;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.draft-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.draft-card h3 {
  margin-top: 14px;
  font-size: 16px;
}

.draft-card-meta {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 12px;
}

.empty-drafts {
  margin-top: 12px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-secondary);
}

.empty-drafts p {
  margin: 0;
}

.workspace-view {
  padding: 28px 0 64px;
}

.workspace-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.back-link {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--text-secondary);
  text-decoration: none;
}

.title-row {
  align-items: center;
}

.title-row h1 {
  margin-bottom: 0;
}

.status-pill {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11px;
  font-weight: 650;
}

.workspace-meta {
  margin: 7px 0 0;
  font-size: 12px;
}

.upload-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--border));
  border-radius: var(--radius-md);
  background: var(--brand-soft);
}

.upload-banner strong,
.upload-banner span {
  display: block;
}

.upload-banner span {
  color: var(--text-secondary);
  font-size: 12px;
}

.upload-banner progress {
  width: min(260px, 35%);
  accent-color: var(--brand);
}

.product-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 4px 0 0;
  border-bottom: 1px solid var(--border);
}

.product-tab {
  flex: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: transparent;
  color: var(--text-secondary);
}

.product-tab:hover {
  background: var(--surface-hover);
}

.product-tab[aria-pressed="true"] {
  border-bottom: 2px solid var(--brand);
  color: var(--text);
  font-weight: 630;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  min-height: 540px;
  border: 1px solid var(--border);
  border-top: 0;
  background: var(--surface);
}

.section-nav {
  padding: 12px 8px;
  border-right: 1px solid var(--border);
  background: var(--surface-subtle);
}

.section-nav-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
}

.section-nav-button:hover {
  background: var(--surface-hover);
}

.section-nav-button[aria-current="page"] {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 620;
}

.section-nav-button span:last-child {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.editor-panel {
  min-width: 0;
  padding: 24px 28px 42px;
}

.editor-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.editor-heading p:last-child {
  margin-bottom: 0;
}

.field-count-summary {
  min-height: 18px;
  color: var(--text-secondary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.field-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 0 0;
}

.field-search-label {
  align-self: center;
  color: var(--text-secondary);
  font-size: 12px;
}

#field-search {
  flex: 1 1 260px;
  min-width: 180px;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.field-filters button {
  min-height: 32px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.field-filters button:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--text);
}

.field-filters button[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 620;
}

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

.field-control {
  min-width: 0;
}

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

.field-control label,
.field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
  font-weight: 590;
}

.field-origin {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 400;
}

.field-control input,
.field-control select,
.field-control textarea {
  width: 100%;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.field-control textarea {
  min-height: 88px;
  resize: vertical;
}

.field-control input:hover,
.field-control select:hover,
.field-control textarea:hover {
  border-color: var(--text-secondary);
}

.field-control input::placeholder,
.field-control textarea::placeholder {
  color: var(--text-secondary);
  opacity: 1;
}

.field-control input:focus,
.field-control select:focus,
.field-control textarea:focus {
  border-color: var(--brand);
  box-shadow: inset 0 -1px 0 var(--brand);
}

.structured-field-editor {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.structured-field-editor.single-column,
.structured-field-editor.list-editor {
  grid-template-columns: 1fr;
}

.structured-part {
  min-width: 0;
}

.structured-part.wide {
  grid-column: 1 / -1;
}

.field-control .structured-part > label,
.field-control .structured-field-editor.list-editor > label {
  display: block;
  margin: 0 0 4px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 520;
}

.field-control .structured-part textarea {
  min-height: 64px;
}

.structured-reference {
  display: grid;
  min-height: 54px;
  align-content: center;
  gap: 2px;
  padding: 8px 10px;
  overflow-wrap: anywhere;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
}

.structured-reference strong {
  font-size: 13px;
  font-weight: 590;
}

.structured-reference span {
  color: var(--text-muted);
  font-size: 11px;
}

.boolean-control {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 14px;
}

.boolean-control label {
  justify-content: flex-start;
  margin: 0;
  font-weight: 400;
}

.section-empty {
  padding: 28px 0;
  color: var(--text-secondary);
}

.conflict-panel {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.45);
}

.conflict-card {
  width: min(520px, 100%);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-menu);
}

.conflict-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0;
}

.conflict-values div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
}

.conflict-values span,
.conflict-values strong {
  display: block;
  overflow-wrap: anywhere;
}

.conflict-values span {
  color: var(--text-secondary);
  font-size: 11px;
}

.toast {
  position: fixed;
  z-index: 90;
  right: 20px;
  bottom: 20px;
  max-width: 380px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-menu);
}

.muted {
  color: var(--text-secondary);
}

.login-body {
  background: var(--surface);
}

.login-layout {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.18fr) minmax(400px, 0.82fr);
}

.login-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(48px, 8vw, 110px);
  background: var(--bg);
}

.login-copy .brand {
  position: absolute;
  top: 30px;
}

.login-copy h1 {
  max-width: 680px;
  font-size: clamp(38px, 5vw, 66px);
  line-height: 1.07;
}

.login-copy .lead {
  max-width: 620px;
  margin: 14px 0 26px;
  color: var(--text-secondary);
  font-size: 17px;
}

.login-points {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.login-points li::before {
  margin-right: 9px;
  color: var(--success);
  content: "✓";
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 36px;
  border-left: 1px solid var(--border);
}

.login-panel-inner {
  width: min(360px, 100%);
}

.login-panel-inner > p:not(.section-kicker) {
  color: var(--text-secondary);
}

.google-glyph {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  color: #1a73e8;
  font-weight: 750;
}

.login-error {
  margin: 14px 0 0;
  color: var(--danger) !important;
}

.privacy-note {
  margin-top: 20px;
  font-size: 12px;
}

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

.button.danger:hover {
  background: color-mix(in srgb, var(--danger) 88%, var(--text));
}

.button.danger-text {
  border-color: transparent;
  background: transparent;
  color: var(--danger);
}

.button.danger-text:hover {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.button:active,
.icon-button:active,
.avatar-button:active,
.product-tab:active,
.section-nav-button:active {
  transform: translateY(1px);
}

.home-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.search-form {
  width: min(520px, 100%);
}

.search-form > label,
.inline-create-form label,
.qa-create-form label,
.qa-row-form label,
.component-row-form label {
  display: grid;
  gap: 5px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 590;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.search-row input,
.inline-create-form input,
.qa-create-form input,
.qa-create-form select,
.qa-create-form textarea,
.qa-row-form input,
.qa-row-form select,
.qa-row-form textarea,
.component-row-form input,
.component-row-form select {
  width: 100%;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.segmented-control {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
}

.segmented-control button {
  min-height: 30px;
  padding: 4px 12px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.segmented-control button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px color-mix(in srgb, var(--text) 12%, transparent);
}

.draft-card {
  position: relative;
  display: grid;
}

.draft-card h3 a {
  color: var(--text);
  text-decoration: none;
}

.draft-card h3 a::after {
  position: absolute;
  inset: 0;
  content: "";
}

.draft-card-status,
.draft-card-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.draft-card-status {
  flex-wrap: wrap;
  margin-top: 10px;
}

.draft-card-actions {
  justify-content: flex-end;
  margin-top: 8px;
}

.summary-tag {
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 11px;
}

.summary-tag[data-kind="needs-info"],
.summary-tag[data-kind="stale"] {
  color: var(--warning);
}

.draft-list-loading {
  margin-top: 12px;
}

.draft-list-loading .panel-skeleton {
  height: 130px;
  margin-top: 10px;
}

.load-more {
  display: flex;
  margin: 18px auto 0;
}

.upload-recovery-actions {
  display: flex;
  flex: none;
  gap: 6px;
}

.upload-recovery-actions input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.workspace-actions > input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.compact-select {
  display: grid;
  gap: 3px;
  color: var(--text-secondary);
  font-size: 10px;
}

.compact-select select {
  min-height: 32px;
  padding: 4px 26px 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.workspace-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.next-step-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.next-step-panel h2 {
  font-size: 17px;
}

.next-step-panel p:last-child {
  max-width: 65ch;
  margin-bottom: 0;
  color: var(--text-secondary);
}

.next-step-panel > .button {
  flex: none;
}

.workspace-summary div {
  min-width: 0;
  padding: 9px 12px;
  border-right: 1px solid var(--border);
}

.workspace-summary div:last-child {
  border-right: 0;
}

.workspace-summary span,
.workspace-summary strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-summary span {
  color: var(--text-muted);
  font-size: 11px;
}

.workspace-summary strong {
  margin-top: 2px;
  font-size: 13px;
}

.section-nav-button {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 2px 7px;
}

.section-nav-button strong {
  grid-row: 1 / span 2;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.section-field-counts {
  grid-column: 2;
  color: var(--text-muted);
  font-size: 10px !important;
  font-weight: 450;
}

.group-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 14px 0 0;
}

.group-tabs button {
  display: grid;
  flex: none;
  gap: 1px;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
}

.group-tabs button[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

.group-field-counts {
  color: var(--text-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  font-weight: 450;
}

.field-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  align-items: start;
}

.field-input-row.structured-input-row {
  grid-template-columns: repeat(2, minmax(112px, 1fr));
}

.structured-input-row > .structured-field-editor,
.structured-input-row > .structured-reference {
  grid-column: 1 / -1;
}

.silkscreen-color-editor > .structured-part[hidden] {
  display: none;
}

.preview-source-controls {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px;
  align-items: start;
}

.preview-source-controls > .button {
  white-space: nowrap;
}

.preview-manual-controls {
  min-width: 0;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.preview-manual-controls summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
}

.preview-manual-controls[open] {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.preview-manual-controls[open] summary {
  flex-basis: 100%;
}

.preview-manual-controls input[type="text"] {
  flex: 1 1 240px;
  min-width: 0;
}

.product-preview-display {
  grid-column: 1 / -1;
  display: grid;
  justify-items: start;
  gap: 7px;
  width: 100%;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.product-preview-image {
  display: block;
  max-width: 100%;
  max-height: 340px;
  object-fit: contain;
  background: var(--surface);
}

.product-preview-image[hidden],
.product-preview-display > .button[hidden] {
  display: none;
}

.product-preview-status {
  color: var(--text-secondary);
  font-size: 12px;
}

.product-preview-previous {
  display: grid;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
}

.product-preview-previous img {
  width: min(100%, 260px);
  max-height: 160px;
  object-fit: contain;
  border: 1px solid var(--border);
}

.field-input-row > .button {
  grid-column: 1 / -1;
  justify-self: start;
  white-space: nowrap;
}

.field-input-row .compact-select {
  width: auto;
  min-width: 112px;
}

.field-helper {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 11px;
}

.field-control[data-review-status="SYSTEM_CANDIDATE"] .field-helper {
  color: var(--brand);
}

.field-control[data-review-status="NEEDS_INFO"] .field-helper,
.field-control[data-review-status="STALE"] .field-helper {
  color: var(--warning);
}

.field-control[data-field-error="true"] .field-helper {
  color: var(--danger);
}

.repeated-panel {
  padding-top: 20px;
}

.repeated-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.repeated-heading p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.toggle-label {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 12px;
}

.repeated-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.repeated-row[data-archived="true"] {
  opacity: 0.72;
}

.row-ordinal {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 11px;
}

.qa-row-form {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(130px, 1fr) minmax(110px, .7fr) minmax(200px, 1.6fr);
  gap: 10px;
  align-items: end;
}

.component-row-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(100px, 1fr)) minmax(180px, 1.5fr);
  gap: 10px;
  align-items: end;
}

.row-evidence,
.component-review-state {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
}

.qa-evidence {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
}

.qa-evidence p,
.qa-evidence-list {
  margin: 0;
}

.qa-evidence-list {
  display: grid;
  gap: 5px;
  padding-left: 18px;
}

.qa-evidence-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.qa-evidence-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.qa-evidence-controls select {
  min-width: 220px;
  max-width: min(100%, 460px);
}

.qa-evidence-controls small {
  flex-basis: 100%;
}

.component-review-state[data-state="SYSTEM_CANDIDATE"],
.component-review-state[data-state="STALE"] {
  color: var(--warning);
}

.row-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.inline-create-form,
.qa-create-form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.inline-create-form {
  grid-template-columns: repeat(3, minmax(100px, 1fr)) minmax(180px, 1.5fr) auto;
  align-items: end;
}

.qa-create-form {
  grid-template-columns: minmax(240px, 2fr) minmax(140px, 1fr) minmax(110px, .8fr);
}

.qa-create-form .wide,
.qa-create-footer {
  grid-column: 1 / -1;
}

.qa-create-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.qa-create-footer p,
.repeated-empty {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.form-error {
  margin-top: 10px;
  color: var(--danger);
  font-size: 12px;
}

.report-panel {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.report-heading,
.report-history-heading,
.report-revision-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.report-heading {
  align-items: flex-start;
}

.report-heading h2,
.report-history-heading h3 {
  margin-bottom: 3px;
}

.report-heading p:not(.section-kicker) {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.report-readiness {
  display: grid;
  grid-template-columns: minmax(220px, .85fr) minmax(280px, 1.15fr);
  gap: 18px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.report-readiness ul {
  display: grid;
  gap: 7px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.report-readiness li {
  display: grid;
  gap: 1px;
  padding-left: 10px;
  border-left: 2px solid var(--warning);
  color: var(--text-secondary);
  font-size: 12px;
}

.report-readiness li[data-kind="blocker"] {
  border-left-color: var(--danger);
}

.report-readiness li strong,
.report-readiness li span {
  display: block;
}

.report-readiness li strong {
  color: var(--text);
}

.report-explanations {
  display: grid;
  gap: 10px;
}

.report-explanations label {
  display: grid;
  gap: 5px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 590;
}

.report-explanations textarea {
  width: 100%;
  min-height: 66px;
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  resize: vertical;
}

.report-check {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.report-check-heading,
.report-check-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.report-check-heading p,
.report-check-actions p {
  margin-bottom: 0;
  color: var(--text-secondary);
  font-size: 12px;
}

#report-check-content {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.report-check-picture-notice {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.report-check-sheet {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
}

.report-check-sheet h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 620;
}

.report-check-values {
  display: grid;
  gap: 0;
  margin: 0;
}

.report-check-values > div {
  display: grid;
  grid-template-columns: minmax(150px, .34fr) minmax(0, 1fr);
  gap: 12px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
}

.report-check-values > div:first-child {
  border-top: 0;
}

.report-check-values dt {
  color: var(--text-secondary);
}

.report-check-values dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.report-check-image {
  display: block;
  width: min(100%, 420px);
  max-height: 320px;
  margin-top: 10px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.report-check-actions {
  align-items: center;
  margin-top: 16px;
}

.report-diff {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
}

.report-diff-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.report-diff-heading h3 {
  margin: 0;
  font-size: 15px;
}

.report-diff-heading p,
.report-diff > p {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
}

#report-diff-content {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.report-diff-change {
  padding: 9px 0;
  border-top: 1px solid var(--border);
}

.report-diff-change strong,
.report-diff-change span {
  display: block;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.report-diff-change span {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 12px;
}

.report-history {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.report-revision-row {
  padding: 9px 0;
  border-top: 1px solid var(--border);
}

.report-revision-row:first-child {
  border-top: 0;
}

.report-revision-row > div,
.report-revision-row strong,
.report-revision-row span {
  display: block;
  min-width: 0;
}

.report-revision-actions {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.report-revision-row span {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 11px;
}

.confirmation-dialog {
  width: min(560px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-menu);
}

.confirmation-dialog::backdrop {
  background: color-mix(in srgb, #111111 55%, transparent);
}

.dialog-card {
  padding: 24px;
}

.impact-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 16px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
}

.impact-grid dt {
  color: var(--text-secondary);
}

.impact-grid dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.dialog-warning {
  margin: 14px 0;
  color: var(--text-secondary);
}

.dialog-warning strong {
  color: var(--danger);
}

.file-update-dialog {
  width: min(680px, calc(100% - 32px));
}

#file-conflict-list {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.file-conflict-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(180px, 0.8fr);
  gap: 8px 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
}

.file-conflict-row p,
.file-conflict-row label {
  margin: 0;
}

.file-conflict-row p {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-secondary);
  font-size: 12px;
}

.file-conflict-row label,
#file-confirmation-reason-label {
  display: grid;
  gap: 5px;
  color: var(--text-secondary);
  font-size: 11px;
}

.file-conflict-row .new-path {
  grid-column: 1 / -1;
}

.confirmation-effects {
  display: grid;
  gap: 6px;
  margin: 14px 0;
  padding: 12px 12px 12px 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 12px;
}

/* Focused workflow redesign: keep the existing capabilities, but make the
   current task and the single primary action visually dominant. */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.home-view {
  padding: 64px 0 88px;
}

.home-heading {
  max-width: 760px;
  margin-bottom: 34px;
}

.home-heading h1 {
  margin-bottom: 12px;
  font-size: clamp(38px, 5vw, 60px);
  text-wrap: balance;
}

.home-heading > div > p:last-child {
  max-width: 62ch;
  margin-bottom: 0;
  color: var(--text-secondary);
  font-size: 16px;
  text-wrap: pretty;
}

.section-kicker,
.eyebrow {
  text-transform: none;
  letter-spacing: 0.045em;
}

.upload-card {
  position: relative;
  overflow: hidden;
  grid-template-columns: minmax(250px, 0.72fr) minmax(440px, 1.28fr);
  gap: 40px;
  padding: 34px;
  border-color: color-mix(in srgb, var(--brand) 18%, var(--border));
  background:
    radial-gradient(circle at 92% 8%, color-mix(in srgb, var(--brand-soft) 72%, transparent), transparent 38%),
    var(--surface);
  box-shadow: var(--shadow-surface);
}

.upload-card h2 {
  margin-top: 5px;
  font-size: 26px;
}

.upload-card > div:first-child > p:last-child {
  max-width: 38ch;
  line-height: 1.7;
}

.drop-zone {
  min-height: 196px;
  border-width: 1.5px;
  background: color-mix(in srgb, var(--surface) 78%, var(--brand-soft));
  transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.drop-zone:hover,
.drop-zone[data-dragging="true"] {
  transform: translateY(-2px);
}

.drop-title {
  font-size: 17px;
}

.drafts-section {
  margin-top: 52px;
}

.draft-grid {
  grid-template-columns: 1fr;
  gap: 8px;
}

.draft-card {
  grid-template-columns: minmax(150px, 0.72fr) minmax(260px, 1.5fr) minmax(180px, 1fr) auto;
  min-height: 0;
  align-items: center;
  gap: 18px;
  padding: 16px 18px;
  border-color: transparent;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border);
  transition: background-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.draft-card:hover {
  border-color: transparent;
  background: var(--surface);
  box-shadow: var(--shadow-surface);
  transform: translateY(-1px);
}

.draft-card h3 {
  margin: 0;
  font-size: 16px;
}

.draft-card h3 a::after {
  content: none;
}

.draft-card > p {
  margin: 0;
  color: var(--text-secondary);
}

.draft-card-meta {
  display: grid;
  gap: 2px;
}

.draft-card-status {
  display: none;
}

.draft-card-actions {
  margin-top: 0;
}

.draft-card-actions .button {
  text-decoration: none;
  white-space: nowrap;
}

.workspace-view {
  display: flex;
  flex-direction: column;
  padding: 34px 0 84px;
}

.workspace-header { order: 1; }
.upload-banner { order: 2; }
.workflow-progress { order: 3; }
.next-step-panel { order: 4; }
.product-tabs { order: 5; }
.workspace-grid { order: 6; }
.report-panel { order: 7; }

.workspace-header {
  align-items: center;
  margin-bottom: 22px;
}

.workspace-header h1 {
  font-size: clamp(28px, 3vw, 38px);
}

.workspace-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.workspace-overflow {
  position: relative;
}

.workspace-overflow > summary {
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  list-style: none;
  transition: background-color 180ms ease, color 180ms ease;
}

.workspace-overflow > summary::-webkit-details-marker {
  display: none;
}

.workspace-overflow > summary::after {
  margin-left: 6px;
  content: "···";
  letter-spacing: 0.08em;
}

.workspace-overflow > summary:hover,
.workspace-overflow[open] > summary {
  background: var(--surface-hover);
  color: var(--text);
}

.workspace-overflow-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  width: 280px;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-menu);
}

.workspace-overflow-menu .button {
  justify-content: flex-start;
}

.workflow-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 82%, var(--bg));
}

.workflow-step {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 1px 10px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: calc(var(--radius-lg) - 4px);
}

.workflow-step::after {
  position: absolute;
  top: 16px;
  right: -2px;
  width: 1px;
  height: calc(100% - 32px);
  background: var(--border);
  content: "";
}

.workflow-step:last-of-type::after {
  content: none;
}

.workflow-index {
  display: grid;
  grid-row: 1 / span 2;
  width: 28px;
  height: 28px;
  align-self: center;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.workflow-step > span:not(.workflow-index) {
  color: var(--text-secondary);
  font-size: 12px;
}

.workflow-step > strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-step[data-state="complete"] .workflow-index {
  border-color: var(--success);
  background: color-mix(in srgb, var(--success) 12%, var(--surface));
  color: var(--success);
}

.workflow-step[data-state="current"],
.workflow-step[data-state="ready"] {
  background: var(--surface);
  box-shadow: 0 2px 12px rgba(31, 64, 82, 0.06);
}

.workflow-step[data-state="current"] .workflow-index,
.workflow-step[data-state="ready"] .workflow-index {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.workflow-step[data-state="attention"] .workflow-index {
  border-color: var(--warning);
  background: color-mix(in srgb, var(--warning) 12%, var(--surface));
  color: var(--warning);
}

.next-step-panel {
  padding: 22px 24px;
  border: 0;
  border-left: 4px solid var(--brand);
  background: linear-gradient(100deg, var(--brand-soft), var(--surface) 72%);
  box-shadow: var(--shadow-surface);
}

.next-step-panel h2 {
  margin-bottom: 4px;
  font-size: 20px;
}

.next-step-panel > .button {
  min-height: 40px;
  padding-inline: 18px;
}

.workspace-grid {
  grid-template-columns: 224px minmax(0, 1fr);
  gap: 18px;
  min-height: 560px;
  border: 0;
  background: transparent;
}

.section-nav {
  align-self: start;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 6px 20px rgba(31, 64, 82, 0.04);
}

.section-nav-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  min-height: 52px;
  margin: 2px 0;
  padding: 8px 11px;
  border-radius: var(--radius-md);
}

.section-nav-button[aria-current="page"] {
  box-shadow: inset 3px 0 0 var(--brand);
}

.section-nav-button > span:first-child {
  font-size: 13px;
}

.section-field-counts {
  grid-column: 1;
  font-size: 10px !important;
}

.editor-panel {
  padding: 30px 34px 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 6px 24px rgba(31, 64, 82, 0.04);
}

.editor-heading {
  padding-bottom: 20px;
}

.field-filters {
  align-items: center;
  gap: 7px;
  padding: 18px 0 0;
}

.field-search-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

#field-search {
  min-height: 36px;
  padding-inline: 11px;
}

.field-filters button {
  min-height: 36px;
  padding-inline: 13px;
}

.group-tabs {
  padding-top: 16px;
}

.field-form {
  gap: 16px;
  padding-top: 18px;
}

.field-control {
  padding: 15px 16px 13px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.field-control:focus-within {
  border-color: color-mix(in srgb, var(--brand) 48%, var(--border));
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(31, 64, 82, 0.07);
}

.field-control input,
.field-control select,
.field-control textarea {
  min-height: 38px;
  background: var(--surface);
}

.field-origin {
  text-align: right;
}

.field-helper {
  margin-top: 7px;
  margin-bottom: 0;
  color: var(--text-muted);
  font-size: 11px;
}

.report-panel {
  margin-top: 32px;
  padding: 28px 30px;
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 24px rgba(31, 64, 82, 0.04);
}

.report-heading h2 {
  font-size: 24px;
}

.report-check {
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.toast {
  border-color: color-mix(in srgb, var(--brand) 18%, var(--border));
  box-shadow: var(--shadow-menu);
}

[hidden] {
  display: none !important;
}

@keyframes pulse {
  from { opacity: 0.45; }
  to { opacity: 0.9; }
}

@media (max-width: 900px) {
  .preview-source-controls {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .preview-source-controls > .button {
    white-space: normal;
  }

  .upload-card {
    grid-template-columns: 1fr;
  }

  .upload-preflight {
    grid-column: auto;
  }

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

  .draft-card {
    grid-template-columns: minmax(120px, 0.65fr) minmax(220px, 1.35fr) auto;
  }

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

  .workflow-step:nth-of-type(2)::after {
    content: none;
  }

  .workflow-step:nth-of-type(-n + 2) {
    border-bottom: 1px solid var(--border);
  }

  .workspace-grid {
    grid-template-columns: 205px minmax(0, 1fr);
  }

  .field-form {
    grid-template-columns: 1fr;
  }

  .field-control.full-width {
    grid-column: auto;
  }

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

  .workspace-summary div:nth-child(3) {
    border-right: 0;
  }

  .workspace-summary div:nth-child(-n + 3) {
    border-bottom: 1px solid var(--border);
  }

  .qa-row-form,
  .component-row-form,
  .inline-create-form,
  .qa-create-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .login-copy {
    min-height: 54vh;
    padding: 88px 34px 42px;
  }

  .login-copy h1 {
    font-size: clamp(34px, 8vw, 52px);
  }

  .login-panel {
    min-height: 46vh;
    border-top: 1px solid var(--border);
    border-left: 0;
  }
}

@media (max-width: 660px) {
  .preview-source-controls {
    grid-template-columns: 1fr;
  }

  .preview-source-controls > .button {
    justify-self: start;
  }
  .topbar {
    padding: 0 14px;
  }

  .brand.compact strong,
  .save-state,
  .account-label {
    display: none;
  }

  .loading-state,
  .page-state,
  .home-view,
  .workspace-view {
    width: min(100% - 28px, 1240px);
  }

  .home-view {
    padding-top: 28px;
  }

  .home-toolbar,
  .report-heading,
  .report-check-heading,
  .report-check-actions,
  .report-diff-heading,
  .report-revision-row {
    align-items: stretch;
    flex-direction: column;
  }

  .segmented-control {
    align-self: flex-start;
  }

  .upload-card {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .upload-preflight {
    grid-column: auto;
  }

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

  .workspace-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace-actions {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
  }

  .workspace-actions .compact-select {
    width: 100%;
  }

  .workspace-overflow {
    margin-left: auto;
  }

  .workspace-overflow-menu {
    right: 0;
    width: min(280px, calc(100vw - 40px));
  }

  .file-conflict-row {
    grid-template-columns: 1fr;
  }

  .file-conflict-row .new-path {
    grid-column: auto;
  }

  .workspace-actions .button {
    flex: 1 1 calc(50% - 5px);
  }

  .draft-card {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
  }

  .draft-card-meta,
  .draft-card > p {
    grid-column: 1 / -1;
  }

  .draft-card h3 {
    grid-column: 1;
    grid-row: 2;
  }

  .draft-card-actions {
    grid-column: 2;
    grid-row: 2;
  }

  .upload-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .upload-banner progress {
    width: 100%;
  }

  .upload-recovery-actions {
    flex-wrap: wrap;
  }

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

  .workflow-progress {
    grid-template-columns: 1fr;
  }

  .workflow-step {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .workflow-step::after {
    top: auto;
    right: 14px;
    bottom: 0;
    left: 54px;
    width: auto;
    height: 1px;
    content: "";
  }

  .workflow-step:nth-of-type(2)::after {
    content: "";
  }

  .workflow-step:last-of-type::after {
    content: none;
  }

  .workflow-step:nth-of-type(-n + 2) {
    border-bottom: 0;
  }

  .workspace-summary div,
  .workspace-summary div:nth-child(3) {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  .workspace-summary div:nth-child(even) {
    border-right: 0;
  }

  .workspace-summary div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .workspace-grid {
    display: block;
    border: 0;
    background: transparent;
  }

  .section-nav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 8px 0;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
  }

  .section-nav-button {
    width: auto;
    flex: none;
    gap: 8px;
  }

  .editor-panel {
    margin-top: 10px;
    padding: 20px 18px 32px;
    border: 1px solid var(--border);
    background: var(--surface);
  }

  .editor-heading {
    flex-direction: column;
  }

  .field-filters {
    flex-wrap: wrap;
    padding-bottom: 2px;
  }

  .field-search-label {
    flex-basis: 100%;
  }

  #field-search {
    flex-basis: 100%;
  }

  .field-control {
    padding: 13px;
  }

  .report-panel {
    padding: 22px 18px;
  }

  .field-input-row,
  .field-input-row.structured-input-row,
  .qa-row-form,
  .component-row-form,
  .inline-create-form,
  .qa-create-form,
  .report-readiness {
    grid-template-columns: 1fr;
  }

  .structured-field-editor {
    grid-template-columns: 1fr;
  }

  .structured-part.wide {
    grid-column: auto;
  }

  .field-input-row .compact-select {
    width: 100%;
  }

  .repeated-row {
    grid-template-columns: 1fr;
  }

  .row-ordinal {
    width: auto;
    justify-self: start;
    padding: 0 9px;
  }

  .qa-create-form .wide,
  .qa-create-footer,
  .row-actions,
  .row-evidence,
  .component-review-state {
    grid-column: auto;
  }

  .qa-create-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .conflict-values {
    grid-template-columns: 1fr;
  }
}

@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;
  }
}
