:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #2c1d14;
  color: #2d2118;
  --surface: #fff6e7;
  --surface-elevated: #fdf0dc;
  --surface-muted: #f3e3ca;
  --border: #d9c19c;
  --brand-brown: #553f2b;
  --brand-brown-dark: #3b291c;
  --brand-brown-deep: #291a12;
  --brand-copper: #b97037;
  --brand-copper-dark: #85451f;
  --brand-copper-soft: #ecd2af;
  --green: #1f6f4a;
  --green-dark: #18593c;
  --brown: #553f2b;
  --muted: #746557;
  --control-height: 44px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1100px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -8%, rgba(185, 112, 55, 0.34), transparent 36rem),
    radial-gradient(circle at 92% 18%, rgba(118, 79, 48, 0.28), transparent 34rem),
    linear-gradient(135deg, #281a12 0%, #4a3323 52%, #2f2016 100%);
  background-attachment: fixed;
}

.app-shell {
  width: min(100%, 2240px);
  margin: 0 auto;
  padding: 24px clamp(24px, 2vw, 44px) 64px;
}

.hero,
.card {
  background: rgba(255, 246, 231, 0.98);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 18px 46px rgba(20, 12, 7, 0.24);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 32px;
  margin-bottom: 24px;
}

.compact-hero {
  align-items: center;
  min-height: auto;
  padding: 18px 24px;
}

.brand-header {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 148px;
  margin-bottom: 18px;
  padding: 16px 28px 18px;
  overflow: hidden;
  border: 1px solid rgba(225, 194, 153, 0.78);
  border-radius: 20px 20px 8px 8px;
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 255, 255, 0.72), transparent 24rem),
    linear-gradient(135deg, rgba(255, 247, 232, 0.99), rgba(235, 214, 180, 0.99));
  box-shadow: 0 18px 42px rgba(19, 11, 6, 0.24);
}

.brand-header::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 5px;
  background: linear-gradient(90deg, var(--brand-brown-dark), var(--brand-copper), var(--brand-brown-dark));
}

.brand-lockup {
  display: flex;
  align-items: center;
}

.brand-logo {
  width: clamp(176px, 17vw, 224px);
  height: auto;
  min-height: 0;
  border-radius: 0;
  background: transparent;
  object-fit: contain;
}

.eyebrow {
  color: #a45f1f;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0 0 12px;
}

h1,
h2,
h3,
h4 {
  color: var(--brand-brown-dark);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.card {
  margin-bottom: 24px;
  padding: 28px;
}

#loginPanel {
  width: min(100%, 580px);
  margin-inline: auto;
}

.app-card {
  border-top: 4px solid var(--brand-copper);
}

.app-authenticated .app-shell {
  width: 100%;
  max-width: none;
  padding: 18px clamp(18px, 1.5vw, 32px) 40px;
}

.app-authenticated .brand-header,
.app-authenticated .login-footer-status {
  display: none;
}

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

.app-sidebar {
  position: sticky;
  top: 18px;
  display: flex;
  min-width: 0;
  height: calc(100vh - 36px);
  min-height: 620px;
  flex-direction: column;
  padding: 18px 14px;
  overflow-y: auto;
  border: 1px solid rgba(225, 194, 153, 0.35);
  border-radius: 20px;
  background: linear-gradient(160deg, #60452e 0%, #3a281c 62%, #291b13 100%);
  box-shadow: 0 18px 46px rgba(20, 12, 7, 0.26);
}

.sidebar-brand {
  display: flex;
  justify-content: center;
  padding: 14px 12px;
  border-radius: 15px;
  background: linear-gradient(135deg, #fff6e7, #e9d0aa);
}

.sidebar-brand img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  border-radius: 0;
  background: transparent;
  object-fit: contain;
}

.app-content {
  min-width: 0;
  min-height: calc(100vh - 36px);
  margin-bottom: 0;
  padding: clamp(20px, 2vw, 36px);
}

.sidebar-bottom {
  display: grid;
  gap: 18px;
  margin-top: auto;
}

.sidebar-account {
  display: grid;
  gap: 8px;
  padding: 14px 8px 0;
  border-top: 1px solid rgba(255, 235, 205, 0.18);
  color: #faedda;
}

.sidebar-account span,
.sidebar-api-status .footer-label {
  color: #d5bfa5;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-account strong {
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}

.sidebar-account button {
  width: 100%;
  margin-top: 4px;
}

.sidebar-api-status {
  padding: 16px 8px 3px;
  border-top: 1px solid rgba(255, 235, 205, 0.18);
}

.sidebar-api-status .footer-label {
  display: block;
  margin-bottom: 9px;
}

.sidebar-api-status .status {
  width: 100%;
  text-align: center;
}

.hidden {
  display: none !important;
}

video,
img {
  width: 100%;
  min-height: 280px;
  background: #1f2933;
  border-radius: 16px;
  object-fit: contain;
}

.actions,
.toolbar,
.tabs,
.form-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.actions {
  margin-top: 16px;
}

.user-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  margin-bottom: 18px;
  padding: 2px 4px;
}

.user-summary {
  min-width: 0;
}

.user-summary .hint {
  margin-bottom: 0;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  width: 100%;
  gap: 3px;
  margin-bottom: 28px;
  padding: 5px;
  border-radius: 14px;
  border: 1px solid rgba(255, 235, 205, 0.12);
  background: linear-gradient(135deg, var(--brand-brown-dark), var(--brand-brown));
  box-shadow: 0 10px 24px rgba(49, 31, 19, 0.18);
}

.tabs .tab {
  width: 100%;
  min-width: 0;
  background: transparent;
  color: #faedda;
}

.app-sidebar .tabs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  width: 100%;
  margin: 22px 0 16px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.app-sidebar .tabs .tab {
  justify-content: flex-start;
  min-height: 46px;
  padding: 11px 15px;
  text-align: left;
}

.dashboard-hero,
.station-heading,
.dashboard-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.dashboard-hero {
  align-items: center;
  padding: 4px 4px 22px;
}

.dashboard-hero h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1;
}

.dashboard-hero .hint,
.station-heading .hint {
  margin-bottom: 0;
}

.dashboard-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.dashboard-metric {
  position: relative;
  display: grid;
  gap: 4px;
  min-height: 142px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-elevated);
}

.dashboard-metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: #b7a58d;
}

.dashboard-metric.queued::before { background: #ca812f; }
.dashboard-metric.running::before { background: #4578a8; }
.dashboard-metric.review::before { background: #b85c4a; }
.dashboard-metric.done::before { background: var(--green); }

.dashboard-metric span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.dashboard-metric strong {
  align-self: center;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
}

.dashboard-metric small {
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
}

.dashboard-panel {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-muted);
}

.dashboard-panel h2 {
  margin-bottom: 0;
}

.workflow-mode {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fffaf0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  white-space: nowrap;
}

.workflow-mode.active {
  border-color: #a8c9b7;
  background: #e9f5ee;
  color: var(--green-dark);
}

.workflow-steps {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.workflow-step,
.dashboard-recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: auto;
  padding: 13px 14px;
  border: 1px solid transparent;
  background: var(--surface);
  color: inherit;
  text-align: left;
}

.workflow-step {
  justify-content: flex-start;
  gap: 14px;
}

.workflow-step:hover,
.dashboard-recent-item:hover {
  border-color: var(--brand-copper);
  background: #f9ead2;
  color: inherit;
}

.workflow-step > span:last-child,
.dashboard-recent-item > span:first-child {
  display: grid;
  gap: 2px;
}

.workflow-step small,
.dashboard-recent-item small {
  color: var(--muted);
  font-weight: 500;
}

.workflow-number {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-copper-soft);
  color: var(--brown);
  font-weight: 850;
}

.dashboard-recent-list {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.dashboard-recent-list.empty {
  min-height: 120px;
  place-items: center;
}

.text-button {
  min-height: auto;
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--brand-copper-dark);
  font-weight: 750;
}

.text-button:hover {
  background: transparent;
  color: var(--brand-brown);
  text-decoration: underline;
}

.station-heading {
  align-items: center;
  margin-bottom: 22px;
}

.capture-queue-status {
  display: grid;
  justify-items: end;
  gap: 3px;
  min-width: 250px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-muted);
  text-align: right;
}

.capture-queue-status span {
  color: var(--muted);
  font-size: 0.82rem;
}

.capture-queue-status .text-button {
  font-size: 0.78rem;
}

.evaluation-batch-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 0.9fr);
  align-items: center;
  gap: 24px;
  margin-top: 22px;
  padding: 20px;
  border: 1px solid #dccbad;
  border-radius: 16px;
  background: linear-gradient(135deg, #f9ead2, var(--surface-muted));
}

.evaluation-batch-panel h3,
.evaluation-batch-panel .hint {
  margin-bottom: 0;
}

.evaluation-batch-panel .actions {
  margin-top: 0;
}

.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.switch-row input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--brand-copper-dark);
}

.switch-row span {
  display: grid;
  gap: 3px;
}

.switch-row small {
  color: var(--muted);
  font-weight: 500;
}

.number-input-suffix {
  display: grid;
  grid-template-columns: minmax(80px, 130px) auto;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.number-input-suffix > span {
  color: var(--muted);
  font-weight: 650;
}

.automation-settings-card label.disabled {
  opacity: 0.55;
}

.section-kicker {
  margin: 0 0 4px;
  color: var(--brand-copper-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.action-grid {
  display: grid;
  width: 100%;
}

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

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

.action-grid button {
  width: 100%;
}

.camera-shell {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
}

.editor-shell {
  position: relative;
}

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

.editor {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
}

.editor img {
  display: block;
}

.editor::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.quad-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.quad-shade {
  fill: rgba(15, 20, 28, 0.55);
  fill-rule: evenodd;
}

.quad-polygon {
  fill: rgba(247, 240, 223, 0.14);
  stroke: #f7f0df;
  stroke-width: 0.5;
  stroke-dasharray: 2 1.5;
}

.side-handle {
  position: absolute;
  min-height: 14px;
  padding: 0;
  border: 2px solid #f7f0df;
  border-radius: 999px;
  background: var(--brand-copper);
  box-shadow: 0 0 0 4px rgba(15, 20, 28, 0.22);
  cursor: grab;
  touch-action: none;
}

.side-handle-top,
.side-handle-bottom {
  left: 50%;
  width: 72px;
  height: 16px;
  margin-left: -36px;
}

.side-handle-left,
.side-handle-right {
  top: 50%;
  width: 16px;
  height: 72px;
  margin-top: -36px;
}

.side-handle:active {
  cursor: grabbing;
}

.editor-controls {
  margin-top: 16px;
}

.quality-status {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #eadfcc;
  background: #f7f1e5;
  font-weight: 700;
}

.quality-status.ok {
  background: #dff3e8;
  border-color: #b9dfca;
  color: #1f6f4a;
}

.quality-status.warning {
  background: #fff2cc;
  border-color: #ecd48a;
  color: #8a5a00;
}

.quality-status.error {
  background: #ffe0dc;
  border-color: #f0b6ad;
  color: #a53725;
}

.result-preview-shell {
  display: flex;
  flex-direction: column;
}

.result-preview {
  width: 100%;
  min-height: 280px;
  background: #1f2933;
  border-radius: 16px;
  object-fit: contain;
}

.capture-step {
  min-width: 0;
}

.capture-grid {
  grid-template-columns: minmax(0, 1.5fr) minmax(400px, 1fr);
  align-items: start;
}

.camera-shell {
  height: clamp(360px, 26vw, 520px);
  background: #1f2933;
}

.camera-shell.ready {
  box-shadow: 0 0 0 3px var(--green);
}

.result-preview-shell {
  height: clamp(260px, 19vw, 400px);
}

.camera-shell video,
.result-preview-shell canvas {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.result-preview-shell {
  justify-content: center;
  overflow: hidden;
  border-radius: 16px;
  background: #1f2933;
}

.capture-flash {
  position: absolute;
  inset: 0;
  z-index: 9;
  background: rgba(255, 250, 234, 0.86);
  opacity: 0;
  pointer-events: none;
}

.capture-flash.active {
  animation: capture-flash 240ms ease-out;
}

@keyframes capture-flash {
  0% { opacity: 0.9; }
  100% { opacity: 0; }
}

.capture-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.capture-actions #uploadButton {
  grid-column: 1 / -1;
  min-height: 62px;
  background: var(--brand-copper-dark);
  font-size: 1.12rem;
}

.capture-actions #uploadButton:not(:disabled):hover {
  background: var(--brand-brown-dark);
}

.capture-actions #uploadButton:disabled {
  background: #a7b0aa;
}

.capture-readiness {
  margin-top: 16px;
}

.capture-readiness-label {
  display: block;
  margin: 0 0 8px 2px;
  color: var(--brand-brown-dark);
  font-size: 0.83rem;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.capture-readiness .quality-status {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 96px;
  margin: 0;
  padding: 18px 22px;
  border-width: 2px;
  font-size: clamp(1.2rem, 1.35vw, 1.55rem);
  font-weight: 850;
  line-height: 1.25;
  box-shadow: 0 10px 24px rgba(49, 31, 19, 0.1);
}

.capture-readiness .quality-status::before {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.capture-feedback {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  font-weight: 750;
}

.capture-feedback.ok {
  border-color: #b9dfca;
  background: #dff3e8;
  color: var(--green-dark);
}

.capture-feedback.warning {
  border-color: #ecd48a;
  background: #fff2cc;
  color: #8a5a00;
}

.capture-feedback.error {
  border-color: #f0b6ad;
  background: #ffe0dc;
  color: #a53725;
}

.capture-shortcut-settings {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.capture-shortcut-settings .switch-row {
  min-height: 68px;
}

.capture-shortcut-key {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.capture-preview-primary {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.capture-preview-primary .quality-status {
  margin: 0;
}

.capture-tools {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-elevated);
}

.capture-tools summary {
  cursor: pointer;
  color: var(--brand-brown);
  font-weight: 800;
}

.capture-tools .editor-controls {
  margin-top: 16px;
}

.result-preview-shell .empty {
  align-self: center;
  max-width: 28rem;
  padding: 24px;
  color: #d9d4cc;
  text-align: center;
}

.capture-preview-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.capture-preview-heading h2 {
  margin-bottom: 0;
}

.capture-preview-controls {
  display: grid;
  justify-items: end;
  gap: 5px;
}

.capture-preview-toggle {
  grid-template-columns: repeat(2, minmax(90px, 1fr));
  width: 220px;
}

.capture-preview-toggle button:disabled {
  opacity: 0.48;
}

.capture-template-availability {
  color: var(--green-dark);
  font-size: 0.72rem;
}

.capture-template-availability.missing {
  max-width: 260px;
  color: var(--muted);
  text-align: right;
}

.capture-template-preview {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 0;
  background: #1f2933;
  object-fit: contain;
}

.result-preview-shell .preview-error {
  align-self: center;
  max-width: 28rem;
  padding: 24px;
  color: #ffc4bb;
  text-align: center;
}

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

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

.form-grid {
  align-items: end;
  margin: 16px 0;
}

label {
  display: grid;
  font-weight: 800;
  gap: 6px;
}

input,
select {
  border: 1px solid #cbbda7;
  border-radius: 12px;
  font: inherit;
  padding: 10px 12px;
  min-height: var(--control-height);
  background: #fff9ef;
  color: #2d2118;
}

input[type="range"] {
  padding: 0;
  accent-color: var(--brand-copper-dark);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--brand-brown);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  line-height: 1.15;
  padding: 10px 16px;
  text-align: center;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

button.secondary,
.tab {
  background: #ede2cf;
  color: #5f4428;
}

.tabs .tab {
  border-color: transparent;
  background: transparent;
  color: #faedda;
}

button.secondary {
  border-color: #dfd0b8;
}

button.danger {
  border-color: #efb4aa;
  background: #fff3f1;
  color: #a53725;
}

button:not(:disabled):hover {
  background: var(--brand-brown-dark);
  transform: translateY(-1px);
}

button.secondary:not(:disabled):hover,
.tab:not(:disabled):hover {
  border-color: #cbb89a;
  background: #e5d6bd;
  color: #4e351f;
}

button.danger:not(:disabled):hover {
  border-color: #d98779;
  background: #ffe3de;
  color: #8f2d1d;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(185, 112, 55, 0.38);
  outline-offset: 2px;
}

.tab.active {
  background: linear-gradient(135deg, var(--brand-copper-dark), var(--brand-brown));
  color: #fff;
  box-shadow: 0 6px 14px rgba(34, 19, 10, 0.3);
}

.tabs .tab:not(:disabled):hover {
  border-color: rgba(255, 235, 205, 0.28);
  background: rgba(255, 244, 225, 0.12);
  color: #fff;
}

.tabs .tab.active:not(:disabled):hover {
  border-color: transparent;
  background: linear-gradient(135deg, #955027, var(--brand-brown-dark));
}

button:disabled {
  background: #a7b0aa;
  cursor: not-allowed;
}

.status,
.badge {
  border-radius: 999px;
  background: #ede2cf;
  color: #5f4428;
  display: inline-block;
  font-weight: 800;
  padding: 10px 16px;
  white-space: nowrap;
}

.status.ok,
.badge.valid,
.badge.analyzed {
  background: #dff3e8;
  color: #1f6f4a;
}

.status.error,
.badge.invalid,
.badge.analysis_failed {
  background: #ffe0dc;
  color: #a53725;
}

.badge.warning,
.badge.queued,
.badge.pending {
  background: #fff2cc;
  color: #8a5a00;
}

.badge.analyzing {
  background: #dce9ff;
  color: #24528a;
}

.badge.confirmed {
  background: #dce9ff;
  color: #24528a;
}

.empty,
.hint {
  color: #7d7164;
}

.issue-list {
  margin: 16px 0 0;
  padding-left: 18px;
}

.review-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.review-pagination-actions {
  margin-top: 0;
}

.review-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  margin-top: 20px;
}

.review-header {
  display: grid;
  gap: 18px;
}

.review-header h2 {
  margin-bottom: 0;
}

.review-command-row {
  display: grid;
  grid-template-columns: auto auto auto minmax(280px, 1fr);
  gap: 10px;
}

.review-search,
.review-search input {
  width: 100%;
}

.review-filter-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-elevated);
  padding: 14px;
}

.review-filter-panel summary {
  display: none;
  cursor: pointer;
  color: var(--brown);
  font-weight: 800;
}

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

.review-filter-grid label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.review-filter-grid select {
  width: 100%;
  color: #27221d;
  font-size: 0.92rem;
  font-weight: 500;
}

.analysis-queue-panel {
  display: grid;
  gap: 12px;
  border: 1px solid #ddc29d;
  border-radius: 18px;
  background: linear-gradient(145deg, #f6e5cb 0%, var(--surface) 100%);
  padding: 18px;
}

.analysis-queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.analysis-queue-header h3,
.analysis-queue-summary {
  margin: 0;
}

.analysis-queue-summary {
  color: var(--brand-brown);
  font-weight: 800;
}

.analysis-queue-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.analysis-queue-list.empty {
  display: block;
  border: 1px dashed #cfad7e;
  border-radius: 12px;
  padding: 14px;
}

.analysis-queue-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid #dfc7a4;
  border-radius: 14px;
  background: rgba(255, 246, 231, 0.9);
  padding: 10px;
}

.analysis-queue-thumb {
  width: 52px;
  height: 64px;
  min-height: 64px;
  border: 1px solid #d8ccb7;
  border-radius: 9px;
  background: #e6d9c3;
  object-fit: cover;
}

.analysis-queue-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.analysis-queue-copy strong {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.analysis-queue-copy small {
  color: var(--muted);
}

.analysis-queue-copy .badge {
  justify-self: start;
  padding: 7px 10px;
}

.queue-position {
  color: var(--brand-copper-dark);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.confirm-dialog {
  width: min(92vw, 560px);
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  color: #2d2118;
  padding: 0;
  box-shadow: 0 24px 80px rgba(43, 30, 18, 0.3);
}

.confirm-dialog::backdrop {
  background: rgba(25, 20, 15, 0.62);
  backdrop-filter: blur(3px);
}

.confirm-dialog-content {
  padding: 28px;
}

.confirm-dialog-content h2 {
  margin-top: 4px;
}

.confirm-dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  margin-top: 24px;
}

.image-archive-dialog {
  width: min(92vw, 720px);
}

.image-archive-dialog .segmented-control {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 18px 0;
}

.archive-selection-panel {
  display: grid;
  gap: 12px;
}

.archive-selection-actions {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
}

.archive-card-list {
  display: grid;
  gap: 8px;
  max-height: min(42vh, 360px);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff9ef;
  padding: 10px;
  scrollbar-gutter: stable;
}

.archive-card-option {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 10px;
  cursor: pointer;
}

.archive-card-option:hover {
  border-color: #d8b689;
  background: #f4e6d1;
}

.archive-card-option input {
  width: 18px;
  height: 18px;
}

.archive-card-option span {
  display: grid;
  gap: 2px;
}

.archive-card-option small {
  color: var(--muted);
}

.archive-range-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.review-queue,
.review-detail {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-elevated);
  min-height: 320px;
  padding: 16px;
}

.review-queue {
  display: grid;
  gap: 12px;
  align-content: start;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  scrollbar-gutter: stable;
}

.review-queue-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid #eadfcc;
  border-radius: 16px;
  background: var(--surface);
  color: #27221d;
  padding: 10px;
  text-align: left;
}

.review-queue-card.active {
  border-color: var(--brand-copper);
  box-shadow: 0 0 0 2px rgba(185, 112, 55, 0.2);
}

.review-queue-card.status-ok {
  border-left: 5px solid var(--green);
}

.review-queue-card.status-warning {
  border-left: 5px solid #d49a25;
}

.review-queue-card.status-missing {
  border-left: 5px solid #b84b39;
}

.review-queue-card.status-pending {
  border-left: 5px solid #9a8975;
}

.review-queue-card.problem {
  background: linear-gradient(180deg, #fff0ec 0%, var(--surface) 100%);
}

.review-queue-card.clean {
  background: linear-gradient(180deg, #edf8f1 0%, var(--surface) 100%);
}

.review-queue-thumb {
  width: 76px;
  min-height: 96px;
  height: 96px;
  border: 1px solid #d8ccb7;
  border-radius: 12px;
  object-fit: cover;
}

.review-queue-thumb-empty {
  background: #e6d9c3;
}

.review-queue-copy {
  min-width: 0;
}

.review-queue-topline,
.review-detail-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.review-queue-meta,
.review-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.card-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.card-status.ok {
  border-color: #9fcdb4;
  background: #dff3e8;
  color: #155c3b;
}

.card-status.warning {
  border-color: #e4c360;
  background: #fff2cc;
  color: #704700;
}

.card-status.missing {
  border-color: #e4a398;
  background: #ffe0dc;
  color: #8a281a;
}

.card-status.pending {
  border-color: #d2c1a8;
  background: #eee3d2;
  color: #625447;
}

.review-queue-summary {
  margin: 10px 0 6px;
  font-weight: 700;
  line-height: 1.35;
}

.review-queue-subline {
  color: #7d7164;
  font-size: 0.9rem;
  margin: 0;
}

.card-uid {
  display: block;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  margin: 5px 0 0;
  overflow-wrap: anywhere;
}

.review-detail-header .card-uid {
  margin-bottom: 5px;
}

.review-detail-image-button {
  display: block;
  width: 100%;
  border-radius: 18px;
  background: transparent;
  padding: 0;
  margin-top: 16px;
}

.review-detail-workspace {
  display: grid;
  grid-template-columns: clamp(280px, 26vw, 520px) minmax(0, 1fr);
  align-items: start;
  gap: 20px;
  margin-top: 16px;
}

.review-detail-media {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.review-detail-media .review-detail-image-button {
  margin-top: 0;
}

.review-detail-media > small {
  color: var(--muted);
  text-align: center;
}

.review-detail-image {
  width: 100%;
  min-height: 260px;
  max-height: min(82vh, 900px);
  border: 1px solid #d8ccb7;
  border-radius: 18px;
  object-fit: contain;
}

.review-detail-image-empty {
  background: #e6d9c3;
}

.review-detail-groups {
  display: grid;
  gap: 18px;
  margin-top: 0;
}

.review-field-group {
  border-top: 1px solid #eadfcc;
  padding-top: 16px;
}

.review-field-group h4 {
  margin: 0 0 12px;
}

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

.review-single-field {
  grid-template-columns: minmax(160px, 240px);
}

.review-loser-field-grid {
  grid-template-columns: repeat(3, minmax(120px, 1fr));
}

.review-player-group {
  display: grid;
  gap: 10px;
}

.review-player-group > h4 {
  margin-bottom: 2px;
}

.review-player-result-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
}

.review-player-result-row h5 {
  display: flex;
  align-items: center;
  margin: 0;
  color: var(--brown);
  font-size: 0.83rem;
}

.review-player-fields {
  display: grid;
  grid-template-columns: minmax(130px, 1.55fr) minmax(105px, 0.75fr);
  gap: 10px;
}

.review-player-fields .review-field-card {
  min-height: 78px;
  padding: 10px 12px;
}

.review-field-card {
  display: grid;
  gap: 8px;
  border: 1px solid #eadfcc;
  border-radius: 14px;
  background: var(--surface);
  min-height: 84px;
  padding: 12px 14px;
}

.review-field-card.ok {
  background: #dff3e8;
  border-color: #b9dfca;
  color: #1f6f4a;
}

.review-field-card.warning {
  background: #fff2cc;
  border-color: #ecd48a;
  color: #8a5a00;
}

.review-field-card.neutral {
  background: #f4efe6;
  border-color: #dfd4c4;
  color: #62584d;
}

.review-field-card.missing {
  background: #ffe0dc;
  border-color: #f0b6ad;
  color: #a53725;
}

.review-field-card.corrected {
  box-shadow: inset 4px 0 #3f6fa8;
}

.review-field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.review-field-label {
  color: #7d7164;
  font-size: 0.88rem;
  font-weight: 800;
}

.review-field-value {
  font-size: 1.25rem;
  line-height: 1.1;
  min-height: 1.4rem;
}

.review-field-input {
  width: 100%;
  min-width: 0;
  border-color: currentColor;
  background: rgba(255, 255, 255, 0.82);
  font-size: 1.18rem;
  font-weight: 800;
}

.confidence-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  border-radius: 999px;
  padding: 5px 8px;
  background: #ede2cf;
  color: #5f4428;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.confidence-pill.ok {
  background: #bfe7d0;
  color: #155c3b;
}

.confidence-pill.warning {
  background: #f5d97f;
  color: #704700;
}

.confidence-pill.missing {
  background: #f2b7ae;
  color: #8a281a;
}

.confidence-pill.neutral {
  background: #ddd4c6;
  color: #62584d;
}

.manual-check {
  color: #24528a;
  font-weight: 800;
}

.review-confidence-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 12px;
  border: 1px solid #dfd0b8;
  border-radius: 14px;
  background: #f8f1e5;
  padding: 14px;
}

.review-confidence-summary small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.review-edit-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  border: 1px solid #eadfcc;
  border-radius: 14px;
  background: rgba(255, 246, 231, 0.96);
  margin-top: 2px;
  padding: 12px;
}

/* Kartenprüfung: Arbeitsfläche zuerst, KI-Steuerung in einer eigenen Ansicht. */
.review-view-switch,
.review-quick-filters,
.review-utility-row,
.review-primary-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.review-view-switch {
  border-bottom: 1px solid var(--border);
}

.review-view-button,
.review-quick-filters button {
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--brown);
  border-radius: 12px 12px 0 0;
}

.review-view-button.active,
.review-quick-filters button.active {
  background: var(--brown);
  border-color: var(--brown);
  color: #fff7e8;
}

.review-waiting-badge,
.review-quick-filters span {
  display: inline-block;
  min-width: 1.45em;
  margin-left: 4px;
  font-size: .82em;
  opacity: .8;
}

.review-subview {
  margin-top: 18px;
}

.review-subview.hidden {
  display: none;
}

.review-primary-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px);
}

.review-primary-filters label {
  display: grid;
  gap: 5px;
  font-size: .8rem;
  font-weight: 750;
  color: var(--muted);
}

.review-primary-filters input,
.review-primary-filters select {
  width: 100%;
}

.review-quick-filters {
  margin-top: 14px;
  gap: 6px;
}

.review-quick-filters button {
  border-radius: 999px;
  padding: 8px 13px;
}

.review-utility-row {
  justify-content: space-between;
  margin-top: 12px;
}

.review-filter-panel {
  flex: 1 1 560px;
  padding: 0;
  background: transparent;
  border: 0;
}

.review-filter-panel summary,
.review-more-actions summary {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-elevated);
  color: var(--brown);
  font-weight: 750;
  cursor: pointer;
}

.review-filter-panel[open] summary {
  margin-bottom: 10px;
}

.review-filter-grid {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
}

.review-more-actions {
  position: relative;
}

.review-more-menu {
  position: absolute;
  z-index: 10;
  right: 0;
  display: grid;
  gap: 5px;
  width: min(280px, 80vw);
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-elevated);
  box-shadow: 0 12px 28px rgba(35, 20, 10, .18);
}

.review-more-menu button {
  width: 100%;
  text-align: left;
}

.review-layout {
  grid-template-columns: clamp(300px, 18vw, 380px) minmax(0, 1fr);
  gap: 14px;
  margin-top: 10px;
}

.review-queue {
  gap: 7px;
  padding: 9px;
}

.review-queue-card {
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 9px;
  padding: 7px;
  border-radius: 11px;
}

.review-queue-card.problem,
.review-queue-card.clean {
  background: var(--surface);
}

.review-queue-thumb {
  width: 52px;
  height: 68px;
  min-height: 68px;
  border-radius: 8px;
}

.review-queue-topline {
  align-items: center;
}

.review-queue-topline .card-status {
  min-height: 0;
  padding: 4px 6px;
  font-size: .67rem;
}

.review-queue-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: .76rem;
}

.review-queue-summary {
  margin: 3px 0 0;
  font-size: .76rem;
  font-weight: 550;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.review-unsaved {
  display: inline-block;
  color: #845015;
  font-size: .74rem;
  font-weight: 800;
}

.review-detail-groups .review-edit-actions {
  position: sticky;
  top: 8px;
  z-index: 5;
  margin: 0;
  box-shadow: 0 8px 20px rgba(35, 20, 10, .12);
}

.review-issues-first {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.review-issues-first .issue-list {
  margin-bottom: 0;
}

.review-issue-link {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brown);
  font: inherit;
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
}

.review-field-card.ok,
.review-field-card.warning,
.review-field-card.missing,
.review-field-card.neutral {
  background: var(--surface);
  border-color: var(--border);
  color: #27221d;
}

.review-field-card.ok { border-left: 4px solid var(--green); }
.review-field-card.warning { border-left: 4px solid #d49a25; }
.review-field-card.missing { border-left: 4px solid #b84b39; }
.review-field-card.neutral { border-left: 4px solid #a99b86; }

.review-field-output {
  display: block;
  min-height: 40px;
  padding: 8px 0;
  font-size: 1.18rem;
  font-weight: 800;
}

.review-readonly-note,
.review-all-done {
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.review-failed-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-elevated);
}

.review-failed-card {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

#reviewStation {
  min-width: 1080px;
}

.thumbnail-link {
  display: inline-flex;
  padding: 0;
  background: transparent;
  border-radius: 12px;
}

.thumbnail-stack {
  display: grid;
  gap: 8px;
}

.scorecard-thumbnail {
  width: 84px;
  min-height: 84px;
  height: 112px;
  background: #1f2933;
  border: 1px solid #d8ccb7;
  border-radius: 12px;
  object-fit: cover;
}

.thumbnail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 140px;
}

.meta-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #ede2cf;
  color: #5f4428;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
  padding: 7px 10px;
}

.meta-badge.ok {
  background: #dff3e8;
  color: #1f6f4a;
}

.meta-badge.warning {
  background: #fff2cc;
  color: #8a5a00;
}

.meta-badge.error {
  background: #ffe0dc;
  color: #a53725;
}

.batch-panel {
  border-top: 1px solid #eadfcc;
  padding-top: 8px;
}

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

.settings-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: start;
  gap: 24px;
}

.settings-menu {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-elevated);
}

.settings-menu-button {
  justify-content: flex-start;
  width: 100%;
  background: transparent;
  color: var(--brand-brown);
  text-align: left;
}

.settings-menu-button.active,
.settings-menu-button.active:not(:disabled):hover {
  background: var(--brand-brown);
  color: #fff6e7;
}

.settings-content {
  min-width: 0;
  max-width: 1320px;
}

.settings-pane {
  display: grid;
  align-content: start;
  gap: 16px;
}

.settings-pane .settings-card {
  width: 100%;
}

.settings-pane .settings-api-output {
  margin-bottom: 0;
}

.settings-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-elevated);
  padding: 20px;
}

.settings-card h3,
.settings-card h4 {
  margin-top: 0;
}

.settings-card:first-child,
.settings-card:nth-child(2) {
  grid-column: 1 / -1;
}

.data-management-card {
  grid-column: 1 / -1;
  border-color: #d4a092;
  background: #f9e8e1;
}

.data-management-card .section-kicker {
  color: #9e3525;
}

.maintenance-action-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
  margin: 16px 0 22px;
  border: 1px solid #c8ae83;
  border-radius: 14px;
  background: #f3e8d4;
  padding: 16px;
}

.maintenance-action-card h4,
.maintenance-action-card p {
  margin-top: 0;
}

.maintenance-action-card .quality-status {
  margin-bottom: 0;
}

.round-context-banner,
.round-context-inline {
  border: 1px solid #c8ae83;
  border-radius: 14px;
  background: #eadbc1;
  color: #553f2b;
  padding: 12px 16px;
  font-weight: 700;
}

.round-context-banner {
  margin: 0 0 20px;
}

.round-context-inline {
  display: inline-flex;
  margin-top: 8px;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.round-context-banner.active,
.round-context-inline.active {
  border-color: #a96f38;
  background: #f0dfbf;
}

.round-context-banner.test,
.round-context-inline.test {
  border-color: #cf9d35;
  background: #f7e8bf;
}

.rounds-heading {
  align-items: center;
}

.rounds-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 22px;
  align-items: start;
}

.round-list {
  display: grid;
  gap: 16px;
}

.round-card,
.local-sync-card {
  border: 1px solid #c8ae83;
  border-radius: 18px;
  background: #f7eedf;
  box-shadow: 0 12px 30px rgba(51, 35, 22, 0.14);
  padding: 20px;
}

.round-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
}

.round-card.status-active {
  border-color: #a96f38;
  box-shadow: 0 14px 34px rgba(128, 76, 35, 0.2);
}

.round-card-title,
.round-card-metrics,
.round-card-actions,
.round-sync-actions {
  display: flex;
  gap: 10px;
}

.round-card-title {
  justify-content: space-between;
  align-items: flex-start;
}

.round-card-title h3,
.round-card-title p {
  margin-top: 0;
}

.round-card-metrics {
  flex-wrap: wrap;
  margin: 10px 0;
}

.round-card-metrics span {
  border-radius: 999px;
  background: #eadbc1;
  padding: 6px 10px;
  font-size: 0.86rem;
}

.round-status {
  border-radius: 999px;
  padding: 6px 10px;
  background: #d8c4a2;
  color: #553f2b;
  font-weight: 800;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.round-status.active {
  background: #a96f38;
  color: #fff8ec;
}

.round-status.completed {
  background: #60704c;
  color: #fff;
}

.round-card-actions {
  flex-direction: column;
  justify-content: center;
  min-width: 180px;
}

.local-sync-card {
  position: sticky;
  top: 16px;
}

.local-sync-card h3,
.local-sync-card p {
  margin-top: 0;
}

.local-sync-card label {
  display: grid;
  gap: 6px;
  margin: 14px 0;
}

.round-sync-actions {
  flex-wrap: wrap;
}

.round-dialog .confirm-dialog-content {
  max-width: 560px;
}

.round-dialog label {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

@media (max-width: 720px) {
  .maintenance-action-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .rounds-workspace,
  .round-card {
    grid-template-columns: 1fr;
  }

  .round-card-actions {
    min-width: 0;
  }

  .local-sync-card {
    position: static;
  }
}

.template-settings-preview {
  display: grid;
  grid-template-columns: minmax(100px, 150px) 1fr;
  align-items: center;
  gap: 14px;
  min-height: 150px;
  margin-bottom: 14px;
  border: 1px dashed #cbbda7;
  border-radius: 14px;
  background: #f8f1e5;
  padding: 12px;
}

.template-settings-preview.empty {
  display: grid;
  grid-template-columns: 1fr;
  color: var(--muted);
}

.template-settings-preview img {
  width: 100%;
  max-height: 210px;
  border-radius: 10px;
  object-fit: contain;
  background: #231f1b;
}

.template-settings-preview div {
  display: grid;
  gap: 6px;
}

.template-settings-preview span,
.template-settings-preview small {
  color: var(--muted);
}

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

.settings-input-group {
  display: grid;
  gap: 10px;
}

.range-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

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

.settings-rule {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 14px 16px;
}

.settings-rule-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.settings-rule.disabled {
  opacity: 0.66;
}

.settings-rule-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.settings-rule-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-copper-dark);
}

textarea {
  border: 1px solid #cbbda7;
  border-radius: 12px;
  background: #fff9ef;
  color: #2d2118;
  font: inherit;
  min-height: 168px;
  padding: 10px 12px;
  resize: vertical;
}

.settings-api-output {
  margin: 0 0 1rem;
  border: 1px solid #eadfcc;
  border-radius: 14px;
  background: var(--surface);
  color: #2d2118;
  font: inherit;
  min-height: 72px;
  padding: 12px 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.usage-header,
.usage-projection-heading,
.usage-table-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.usage-header .hint {
  margin-bottom: 0;
}

.usage-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 220px));
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.usage-controls label {
  display: grid;
  gap: 6px;
  color: var(--brown);
  font-size: 0.86rem;
  font-weight: 800;
}

.usage-official-grid,
.usage-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.usage-official-card,
.usage-metric-grid article,
.usage-projection-panel,
.usage-table-panel {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-elevated);
}

.usage-official-card,
.usage-metric-grid article {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 126px;
  padding: 18px;
}

.usage-official-card.emphasis {
  border-color: #d0a46f;
  background: #f6dfc0;
}

.usage-official-card span,
.usage-metric-grid span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.usage-official-card strong,
.usage-metric-grid strong {
  color: #2f291f;
  font-size: clamp(1.28rem, 2.3vw, 1.9rem);
  line-height: 1.15;
}

.usage-official-card small,
.usage-metric-grid small,
.usage-table small {
  color: var(--muted);
}

.usage-projection-panel,
.usage-table-panel {
  margin-top: 20px;
  padding: 20px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(95px, 1fr));
  gap: 4px;
  border-radius: 14px;
  background: #e9d4b5;
  padding: 4px;
}

.segmented-control button {
  min-height: 38px;
  border-radius: 10px;
  background: transparent;
  color: var(--brown);
  padding: 8px 12px;
}

.segmented-control button.active {
  background: linear-gradient(135deg, var(--brand-brown), var(--brand-brown-dark));
  color: #fff;
  box-shadow: 0 5px 12px rgba(53, 33, 20, 0.24);
}

.usage-metric-grid {
  margin: 16px 0 0;
}

.usage-metric-grid article.cost {
  border-color: #d0a46f;
  background: #fae9d1;
}

.usage-table-scroll {
  overflow-x: auto;
  border: 1px solid #eadfcc;
  border-radius: 14px;
}

.usage-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: var(--surface);
}

.usage-table th,
.usage-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #eee3d1;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.usage-table th {
  background: #e9d4b5;
  color: var(--brown);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.usage-table tbody tr:last-child td {
  border-bottom: 0;
}

.usage-table td small {
  display: block;
  margin-top: 4px;
}

.usage-badge {
  display: block;
  width: max-content;
  margin-top: 5px;
  border-radius: 999px;
  background: #fff0d7;
  color: #8a561f;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 7px;
}

.usage-pagination {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.settings-header {
  align-items: center;
  margin-bottom: 18px;
  position: sticky;
  top: 0;
  z-index: 8;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(35, 20, 10, 0.08);
}

.settings-actions {
  justify-content: flex-end;
  margin-top: 0;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(18, 24, 31, 0.76);
  padding: 24px;
}

.image-modal-preview {
  width: 224px;
  height: 298px;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 96px);
  background: #1f2933;
  border: 1px solid #d8ccb7;
  border-radius: 18px;
  object-fit: contain;
}

.image-modal-close {
  position: absolute;
  top: 24px;
  right: 24px;
}

.image-modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.image-modal-prev {
  left: 24px;
}

.image-modal-next {
  right: 24px;
}

.app-footer {
  position: fixed;
  right: 20px;
  bottom: 20px;
  left: auto;
  z-index: 20;
  display: flex;
  width: min(420px, calc(100vw - 40px));
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

.footer-status,
.footer-messages {
  background: rgba(255, 246, 231, 0.97);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 16px 36px rgba(28, 17, 10, 0.24);
  padding: 14px 16px;
  pointer-events: auto;
}

.footer-status {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.footer-status .status {
  padding: 8px 12px;
  font-size: 0.8rem;
  box-shadow: 0 8px 20px rgba(81, 57, 28, 0.12);
}

.footer-messages {
  display: none;
  width: 100%;
  border-color: #d8c8ae;
  animation: toast-in 180ms ease-out;
}

.footer-messages.is-visible {
  display: block;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.footer-label {
  display: block;
  color: #7d7164;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.footer-status .footer-label {
  display: none;
}

.footer-messages #resultPanel {
  min-height: 24px;
}

@media (max-width: 1100px) {
  .app-shell {
    padding-inline: 20px;
  }

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

  .dashboard-grid,
  .evaluation-batch-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .hero,
  .grid,
  .preview-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    flex-direction: column;
  }

  .dashboard-hero,
  .station-heading,
  .dashboard-panel-heading,
  .capture-preview-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .capture-preview-controls {
    justify-items: stretch;
  }

  .capture-preview-toggle {
    width: 100%;
  }

  .capture-template-availability,
  .capture-template-availability.missing {
    max-width: none;
    text-align: left;
  }

  .dashboard-hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .capture-queue-status {
    justify-items: start;
    min-width: 0;
    text-align: left;
  }

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

  .settings-grid,
  .range-row,
  .usage-official-grid,
  .usage-metric-grid {
    grid-template-columns: 1fr;
  }

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

  .usage-header,
  .usage-projection-heading,
  .usage-table-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .segmented-control {
    width: 100%;
  }

  .app-shell {
    padding: 12px 12px 40px;
  }

  .brand-header {
    min-height: 132px;
    margin-bottom: 12px;
    padding: 14px 20px 18px;
  }

  .brand-lockup {
    width: 100%;
    justify-content: center;
  }

  .brand-logo {
    width: 172px;
  }

  .card {
    padding: 20px;
  }

  .compact-hero {
    padding: 16px 20px;
    margin-bottom: 16px;
  }

  .eyebrow {
    font-size: 0.88rem;
  }

  .user-summary .hint {
    display: none;
  }

  .tabs {
    width: 100%;
    margin-bottom: 24px;
  }

  .tabs .tab {
    padding-inline: 6px;
    font-size: 0.82rem;
  }

  .camera-shell,
  .result-preview-shell {
    height: min(420px, 112vw);
  }

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

  .capture-actions #uploadButton {
    grid-column: 1 / -1;
  }

  .batch-actions {
    grid-template-columns: 1fr;
  }

  .app-footer {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }

  .image-modal-nav {
    top: auto;
    bottom: 24px;
    transform: none;
  }

  .image-modal-prev {
    left: 24px;
  }

  .image-modal-next {
    right: 24px;
  }
}

@media (max-width: 520px) {
  .brand-header {
    min-height: 154px;
  }

  .brand-lockup {
    flex-direction: column;
    gap: 7px;
  }

  .brand-logo {
    width: 156px;
  }

  .brand-app-label {
    padding-top: 7px;
    padding-left: 0;
    border-top: 1px solid rgba(85, 63, 43, 0.3);
    border-left: 0;
    font-size: 0.7rem;
  }

  .app-card {
    padding: 18px 16px;
  }

  .user-toolbar {
    align-items: center;
  }

  .user-summary strong {
    display: block;
    max-width: 210px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tabs .tab {
    font-size: 0.78rem;
  }

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

  .dashboard-metrics,
  .dashboard-hero-actions {
    grid-template-columns: 1fr;
  }

  .dashboard-metric {
    min-height: 118px;
  }

  .capture-actions,
  .preview-actions,
  .settings-actions {
    grid-template-columns: 1fr;
  }

  .usage-controls,
  .segmented-control {
    grid-template-columns: 1fr;
  }

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

  .usage-projection-panel,
  .usage-table-panel {
    padding: 16px;
  }

  .capture-actions #uploadButton {
    grid-column: auto;
  }

  .settings-actions {
    display: grid;
    width: 100%;
  }

  .confirm-dialog-actions {
    grid-template-columns: 1fr;
  }

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

  .archive-selection-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .footer-status .status {
    font-size: 0.74rem;
  }
}
