:root {
  --rv-ink: #173a34;
  --rv-muted: #65736f;
  --rv-paper: #fffdf8;
  --rv-canvas: #f2eee4;
  --rv-line: #d9d0bd;
  --rv-accent: #be5c32;
  --rv-accent-dark: #8f3e21;
  --rv-gold: #d8aa55;
  --rv-control: #ffffff;
  --rv-control-line: #aaa496;
  --rv-subtle: #eee8dc;
  --rv-progress: #e7e0d3;
  --rv-warning-surface: #fff3d6;
  --rv-error-surface: #fbe5df;
  --rv-error-ink: #77291f;
  --rv-error-line: #c56b5d;
  --rv-success-surface: #deeee8;
  --rv-success-ink: #24594d;
  --rv-command-surface: #faf7f0;
  --rv-on-accent: #ffffff;
}

:root[data-theme="dark"] {
  --rv-ink: #edf5f1;
  --rv-muted: #a8b9b2;
  --rv-paper: #18231f;
  --rv-canvas: #101814;
  --rv-line: #3e5148;
  --rv-accent: #ed8b64;
  --rv-accent-dark: #ffad8a;
  --rv-gold: #e4b967;
  --rv-control: #111a16;
  --rv-control-line: #596b63;
  --rv-subtle: #28362f;
  --rv-progress: #34433c;
  --rv-warning-surface: #362e1b;
  --rv-error-surface: #3a2420;
  --rv-error-ink: #ffaaa0;
  --rv-error-line: #8f5a50;
  --rv-success-surface: #1d382e;
  --rv-success-ink: #8bd7b5;
  --rv-command-surface: #1d2924;
  --rv-on-accent: #1b110d;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --rv-ink: #edf5f1;
    --rv-muted: #a8b9b2;
    --rv-paper: #18231f;
    --rv-canvas: #101814;
    --rv-line: #3e5148;
    --rv-accent: #ed8b64;
    --rv-accent-dark: #ffad8a;
    --rv-gold: #e4b967;
    --rv-control: #111a16;
    --rv-control-line: #596b63;
    --rv-subtle: #28362f;
    --rv-progress: #34433c;
    --rv-warning-surface: #362e1b;
    --rv-error-surface: #3a2420;
    --rv-error-ink: #ffaaa0;
    --rv-error-line: #8f5a50;
    --rv-success-surface: #1d382e;
    --rv-success-ink: #8bd7b5;
    --rv-command-surface: #1d2924;
    --rv-on-accent: #1b110d;
  }
}

body {
  color: var(--rv-ink);
  background: var(--rv-canvas);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

h1,
h2,
h3 {
  color: var(--rv-ink);
  font-family: Georgia, "Times New Roman", serif;
}

.public-main {
  min-height: 100vh;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(20rem, 0.8fr);
  gap: clamp(2rem, 7vw, 7rem);
  min-height: 100vh;
  padding: clamp(2rem, 8vw, 8rem);
  align-items: center;
  background:
    linear-gradient(115deg, rgb(23 58 52 / 94%), rgb(23 58 52 / 76%)),
    radial-gradient(circle at 82% 15%, #c5964c 0, transparent 32%);
  color: #fffdf8;
}

.login-intro {
  max-width: 50rem;
}

.login-intro h1 {
  max-width: 14ch;
  margin: 0.35rem 0 1.25rem;
  color: #fffdf8;
  font-size: clamp(3rem, 7vw, 6.5rem);
  line-height: 0.95;
}

.login-intro > p:not(.eyebrow) {
  max-width: 48rem;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  line-height: 1.55;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--rv-accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.login-intro .eyebrow {
  color: #f0c36f;
}

.feature-list {
  display: grid;
  gap: 0.65rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

.feature-list li::before {
  content: "✓";
  margin-right: 0.65rem;
  color: #f0c36f;
  font-weight: 800;
}

.login-card,
.content-card,
.summary-card {
  border: 1px solid var(--rv-line);
  border-radius: 1.4rem;
  background: var(--rv-paper);
  box-shadow: 0 1.1rem 3rem rgb(20 45 40 / 8%);
}

.login-card {
  padding: clamp(1.5rem, 4vw, 2.5rem);
  color: var(--rv-ink);
}

.login-card h2 {
  margin: 0.25rem 0 1.5rem;
  font-size: 2rem;
}

.login-card form,
.login-card label {
  display: grid;
  gap: 0.55rem;
}

.login-card form {
  gap: 1rem;
}

.login-card label {
  font-weight: 750;
}

.login-card input {
  width: 100%;
  min-height: 3.25rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--rv-control-line);
  border-radius: 0.75rem;
  color: var(--rv-ink);
  background: var(--rv-control);
  font: inherit;
}

.demo-login {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rv-line);
}

.demo-login p {
  margin: 0;
  color: var(--rv-muted);
  font-size: 0.9rem;
}

.button {
  display: inline-flex;
  min-height: 3rem;
  padding: 0.7rem 1rem;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 0.8rem;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  color: var(--rv-on-accent);
  background: var(--rv-accent);
}

.button.primary:hover {
  background: var(--rv-accent-dark);
}

.button.secondary {
  color: var(--rv-ink);
  border-color: var(--rv-line);
  background: var(--rv-subtle);
}

.button:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(13rem, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.summary-card,
.content-card {
  padding: clamp(1.25rem, 3vw, 2rem);
}

.summary-card h2,
.content-card h2 {
  margin: 0.2rem 0 0.65rem;
}

.summary-card p {
  color: var(--rv-muted);
}

.summary-card.highlight {
  border-top: 0.4rem solid var(--rv-accent);
}

.summary-card .summary-value {
  color: var(--rv-ink);
  font-size: 1.25rem;
  font-weight: 800;
}

.summary-card .metric {
  margin: 0.2rem 0;
  color: var(--rv-ink);
  font-size: 3rem;
  font-weight: 850;
}

.summary-card .button {
  margin-top: 0.75rem;
}

.action-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.stacked-form {
  display: grid;
  gap: 0.9rem;
  margin-top: 1rem;
}

.checkbox-row {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  font-weight: 750;
}

.checkbox-row input[type="checkbox"],
.checkbox-row input[type="radio"],
.checkbox-group input[type="checkbox"],
.checkbox-group input[type="radio"] {
  width: 1.15rem;
  height: 1.15rem;
  min-height: 0;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  accent-color: var(--rv-accent);
}

.notification-row {
  color: inherit;
  text-decoration: none;
}

.notification-row span {
  display: grid;
  gap: 0.25rem;
}

.notification-row time,
.notification-row small {
  color: var(--rv-muted);
}

.request-list {
  margin-bottom: 2rem;
}

.public-request {
  width: min(58rem, calc(100% - 2rem));
}

.form-error {
  padding: 0.9rem 1rem;
  border: 1px solid var(--rv-error-line);
  border-radius: 0.75rem;
  color: var(--rv-error-ink);
  background: var(--rv-error-surface);
}

.field-workspace,
.field-sections {
  display: grid;
  gap: 1rem;
}

.field-progress {
  display: grid;
  gap: 1rem;
}

.field-section-nav {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  padding: 0.15rem 0 0.4rem;
}

.field-section-nav .button {
  flex: 0 0 auto;
}

.progress-meter {
  height: 0.7rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--rv-progress);
}

.progress-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--rv-accent);
}

.field-queue {
  border-left: 0.35rem solid var(--rv-gold);
}

.field-warning,
.field-conflicts,
.field-message {
  padding: 0.85rem 1rem;
  border-radius: 0.8rem;
  background: var(--rv-warning-surface);
}

.field-conflicts {
  background: var(--rv-error-surface);
}

.field-conflicts ul {
  padding-left: 1.25rem;
}

.field-section > header {
  margin-bottom: 1rem;
}

.field-checkpoint {
  padding: 1.25rem 0;
  border-top: 1px solid var(--rv-line);
}

.field-checkpoint-heading {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.field-checkpoint-heading h3,
.field-checkpoint-heading p {
  margin: 0;
}

.field-result-form,
.field-evidence-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.field-result-form label,
.field-evidence-form label {
  display: grid;
  gap: 0.35rem;
  font-weight: 750;
}

.field-result-form input,
.field-result-form select,
.field-result-form textarea,
.field-evidence-form input {
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--rv-control-line);
  border-radius: 0.7rem;
  color: var(--rv-ink);
  background: var(--rv-control);
  font: inherit;
}

.field-result-form textarea {
  resize: vertical;
}

.field-result-form .button,
.field-evidence-form .button {
  align-self: end;
}

.field-evidence-form,
.field-evidence-list {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--rv-line);
}

.field-evidence-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.field-lifecycle-command {
  display: grid;
  gap: 0.75rem;
}

.field-lifecycle-command .button {
  justify-self: start;
}

.status-complete {
  color: var(--rv-success-ink);
  background: var(--rv-success-surface);
}

.section-heading,
.record-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.section-heading {
  margin-bottom: 1rem;
}

.subnav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
}

.subnav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.65rem;
  color: var(--rv-muted);
  text-decoration: none;
}

.subnav a:hover,
.subnav a:focus-visible,
.subnav a[aria-current="page"] {
  color: var(--rv-ink);
  background: var(--rv-subtle);
}

.record-list {
  display: grid;
}

.record-row {
  min-width: 0;
  padding: 1rem 0;
  border-top: 1px solid var(--rv-line);
}

.record-row strong {
  font-size: 1.05rem;
}

.record-row p {
  margin: 0.2rem 0 0;
  color: var(--rv-muted);
}

.finance-row {
  flex-wrap: wrap;
}

.inline-command {
  display: flex;
  gap: 0.75rem;
  align-items: end;
  flex: 0 0 100%;
  padding-top: 0.25rem;
}

.inline-command label,
.inline-actions label,
.document-action label {
  display: grid;
  gap: 0.4rem;
  font-weight: 750;
}

.inline-command input,
.inline-command select,
.inline-actions input,
.document-action input {
  min-height: 3rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--rv-control-line);
  border-radius: 0.7rem;
  color: var(--rv-ink);
  background: var(--rv-control);
  font: inherit;
}

.inline-details {
  margin-top: 0.75rem;
}

.delivery-row {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-left: 0.2rem solid var(--rv-line);
}

.inline-details summary {
  font-weight: 750;
  cursor: pointer;
}

.inline-actions {
  display: flex;
  gap: 1rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.inline-actions form {
  display: flex;
  gap: 0.75rem;
  align-items: end;
}

.button.danger {
  color: var(--rv-on-accent);
  background: var(--rv-accent-dark);
}

.status-pill {
  flex: 0 0 auto;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  color: var(--rv-success-ink);
  background: var(--rv-success-surface);
  font-size: 0.82rem;
  font-weight: 800;
}

.empty-workspace {
  max-width: 48rem;
  padding: clamp(1rem, 3vw, 2.5rem) 0;
}

.empty-workspace > p:not(.eyebrow) {
  color: var(--rv-muted);
  font-size: 1.08rem;
  line-height: 1.55;
}

.command-panel {
  margin-top: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--rv-line);
  border-radius: 1rem;
  background: var(--rv-command-surface);
}

.command-panel summary,
.command-panel h3 {
  color: var(--rv-ink);
  font-weight: 800;
  cursor: pointer;
}

.command-panel h3 {
  margin: 0 0 1rem;
}

.form-grid,
.settings-grid {
  display: grid;
  gap: 1rem;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.form-grid label {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
  font-weight: 750;
}

.form-grid input:not([type="checkbox"]):not([type="radio"]),
.form-grid select,
.form-grid textarea {
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--rv-control-line);
  border-radius: 0.7rem;
  color: var(--rv-ink);
  background: var(--rv-control);
  font: inherit;
}

.form-grid textarea {
  min-height: 6rem;
  resize: vertical;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-grid .checkbox-row,
.form-grid .checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.checkbox-group {
  display: grid;
  gap: 0.7rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.checkbox-group legend {
  margin-bottom: 0.7rem;
  font-weight: 750;
}

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

.settings-grid .open-panel {
  grid-column: 1 / -1;
}

.compact-list {
  margin-top: 0.75rem;
}

.pagination {
  display: flex;
  margin-top: 1rem;
  justify-content: center;
}

.public-document {
  width: min(46rem, calc(100% - 2rem));
  margin: clamp(2rem, 8vw, 7rem) auto;
  padding: clamp(1.5rem, 5vw, 3rem);
  border: 1px solid var(--rv-line);
  border-radius: 1.4rem;
  background: var(--rv-paper);
  box-shadow: 0 1.1rem 3rem rgb(20 45 40 / 8%);
}

.public-document h1 {
  margin: 0.25rem 0 1.5rem;
  font-size: clamp(2rem, 6vw, 3.4rem);
}

.document-copy {
  padding: 1.25rem;
  border: 1px solid var(--rv-line);
  border-radius: 0.8rem;
  white-space: pre-wrap;
  line-height: 1.65;
}

.document-action {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.receipt-summary {
  display: grid;
  gap: 0.75rem;
}

.receipt-summary div {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rv-line);
}

.receipt-summary dt {
  color: var(--rv-muted);
}

.receipt-summary dd {
  margin: 0;
  font-weight: 800;
}

@media (max-width: 900px) {
  .login-shell,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .login-shell {
    align-items: start;
  }
}

@media (max-width: 620px) {
  .app-header .brand {
    min-width: 0;
  }

  .app-header .brand span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .login-shell {
    gap: 2rem;
    padding: 1.25rem;
  }

  .login-intro h1 {
    font-size: clamp(2.65rem, 15vw, 4rem);
  }

  .section-heading,
  .record-row {
    align-items: flex-start;
  }

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

  .record-row p {
    overflow-wrap: anywhere;
  }

  .form-grid,
  .settings-grid,
  .field-result-form,
  .field-evidence-form {
    grid-template-columns: 1fr;
  }

  .field-checkpoint-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .field-result-form .button,
  .field-evidence-form .button,
  .field-lifecycle-command .button {
    width: 100%;
  }

  .inline-command,
  .inline-actions form {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-grid .open-panel {
    grid-column: auto;
  }
}
