:root {
  font-family:
    Inter,
    Segoe UI,
    system-ui,
    sans-serif;
  color: #1b2e2c;
  background: #f5f6f2;
  --ink: #173e36;
  --green: #246a52;
  --muted: #64736e;
  --line: #dce2d9;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}
button {
  min-height: 44px;
  cursor: pointer;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 16px;
  color: var(--ink);
  font-weight: 600;
}
button:hover {
  background: #edf3ec;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
.primary {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}
.primary:hover {
  background: #285e4d;
}
a {
  color: #246a52;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
:focus-visible {
  outline: 3px solid #d08b2d;
  outline-offset: 3px;
}
header {
  height: 80px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
}
.brand {
  letter-spacing: 2px;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 12px;
}
.mark {
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #e4f5be;
  font-size: 30px;
  border-radius: 10px;
  width: 38px;
  height: 42px;
}
.local {
  font-size: 12px;
  color: var(--muted);
  background: #f1f5eb;
  padding: 8px 12px;
  border-radius: 20px;
}
.shell {
  display: grid;
  grid-template-columns: 235px minmax(0, 1fr);
  min-height: calc(100vh - 80px);
}
aside {
  padding: 36px 20px;
  background: #fff;
  border-right: 1px solid var(--line);
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 700;
  color: var(--muted);
}
aside .eyebrow {
  padding-left: 16px;
}
nav {
  display: grid;
  gap: 8px;
  margin-top: 25px;
}
nav a {
  display: flex;
  gap: 14px;
  padding: 15px;
  border-radius: 9px;
  color: #60706a;
  font-size: 14px;
}
nav a.active {
  background: #edf3e6;
  color: var(--ink);
  font-weight: 700;
}
.aside-note {
  margin: 120px 16px 0;
  border-top: 1px solid var(--line);
  padding-top: 24px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
.aside-note strong {
  color: var(--ink);
}
main {
  max-width: 1450px;
  width: 100%;
  padding: 42px 48px 80px;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}
h1 {
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: 40px;
  letter-spacing: -1px;
  margin: 8px 0 10px;
}
h2 {
  font-size: 19px;
  margin: 0 0 18px;
}
h3 {
  font-size: 15px;
  margin: 0 0 10px;
}
p {
  line-height: 1.6;
}
.muted,
small {
  color: var(--muted);
}
.sub {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}
.metric,
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
}
.metric label {
  color: var(--muted);
  font-size: 12px;
}
.metric strong {
  display: block;
  font-weight: 500;
  font-size: 27px;
  margin: 14px 0 6px;
}
.metric small {
  font-size: 11px;
  line-height: 1.5;
  display: block;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.section-head h2 {
  margin: 0;
}
.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
input,
select,
textarea {
  border: 1px solid #cbd6cc;
  border-radius: 7px;
  background: white;
  padding: 11px 12px;
  color: #1b2e2c;
  max-width: 100%;
  min-height: 44px;
}
textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
}
.toolbar input {
  flex: 1;
  min-width: 180px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.card {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.card-image {
  height: 220px;
  background: #eaf0e6;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.card-image img {
  height: 190px;
  max-width: 90%;
  object-fit: contain;
  filter: drop-shadow(0 6px 8px #173e3622);
}
.card-image .no-image {
  font-size: 64px;
  color: #b0c3ae;
}
.card-body {
  padding: 20px;
}
.card-body h3 {
  font-size: 17px;
  margin-bottom: 7px;
}
.badge {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 5px;
  background: #eff3e8;
  font-size: 10px;
  font-weight: 700;
  color: #466243;
  letter-spacing: 0.5px;
}
.card-footer {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 16px;
  font-size: 12px;
}
.card .actions {
  margin-top: 18px;
}
.card button {
  font-size: 12px;
  padding: 7px 10px;
}
.empty {
  padding: 60px 24px;
  text-align: center;
  border: 1px dashed #cbd5c7;
  border-radius: 10px;
  background: #fbfcf8;
}
.empty .symbol {
  font-size: 45px;
  color: #8aab82;
  margin-bottom: 18px;
}
.empty h2 {
  margin-bottom: 10px;
}
.empty p {
  max-width: 480px;
  margin: 0 auto 24px;
  font-size: 14px;
  color: var(--muted);
}
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.steps {
  display: flex;
  gap: 22px;
  font-size: 12px;
  color: var(--muted);
  margin: 25px 0;
}
.steps strong {
  color: var(--green);
}
.upload {
  border: 1px dashed #b4c6ae;
  border-radius: 10px;
  padding: 28px;
  text-align: center;
  background: #f6f9f1;
}
.upload label {
  display: block;
  font-weight: 600;
  margin-bottom: 12px;
}
.upload input {
  width: 100%;
  font-size: 12px;
  background: #fff;
}
.photos {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.photos img {
  height: 140px;
  max-width: 48%;
  object-fit: contain;
  border-radius: 6px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
}
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}
.field.wide {
  grid-column: 1/-1;
}
.hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.candidates {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}
.candidate {
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 8px;
  display: flex;
  gap: 15px;
  align-items: center;
}
.candidate img {
  height: 80px;
  width: 58px;
  object-fit: contain;
}
.candidate button {
  margin-left: auto;
  font-size: 12px;
}
.error {
  color: #9e3c2e;
  background: #fff1e9;
  padding: 12px;
  border-radius: 7px;
}
.callout {
  border-left: 3px solid #a0b884;
  background: #f0f5e9;
  padding: 13px 16px;
  font-size: 12px;
  line-height: 1.7;
  margin: 20px 0;
}
.chart {
  width: 100%;
  height: 200px;
  background: #f8faf5;
  border-radius: 7px;
}
.table-wrap {
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}
td,
th {
  text-align: left;
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted);
}
details {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 18px;
}
summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 0;
}
.source-list {
  display: grid;
  gap: 12px;
}
.source {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.source strong {
  font-size: 14px;
}
.source p {
  font-size: 12px;
  margin-bottom: 0;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  width: 760px;
  max-width: calc(100vw - 24px);
  max-height: 90vh;
  overflow: auto;
}
dialog::backdrop {
  background: #162c2580;
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.dialog-head h2 {
  margin: 0;
}
.dialog-head button {
  font-size: 22px;
  padding: 3px 14px;
}
fieldset {
  border: 0;
  border-top: 1px solid var(--line);
  padding: 20px 0 0;
  margin: 15px 0;
}
legend {
  padding-right: 15px;
  font-weight: 700;
  font-size: 13px;
}
#form-error {
  font-size: 13px;
  color: #a23e31;
}
#notice {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 500px;
  background: #173e36;
  color: white;
  padding: 0;
  border-radius: 8px;
  font-size: 13px;
  z-index: 5;
}
#notice:not(:empty) {
  padding: 16px 22px;
  box-shadow: 0 6px 30px #173e3633;
}
@media (max-width: 1000px) {
  main {
    padding: 32px 24px;
  }
  .shell {
    grid-template-columns: 190px minmax(0, 1fr);
  }
  aside {
    padding: 30px 12px;
  }
  .split {
    grid-template-columns: 1fr;
  }
  .metrics {
    gap: 10px;
  }
  .metric {
    padding: 18px;
  }
}
@media (max-width: 650px) {
  header {
    height: 65px;
    padding: 0 18px;
  }
  .brand {
    font-size: 12px;
  }
  .local {
    font-size: 10px;
  }
  .shell {
    display: block;
  }
  aside {
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 2;
    border: 0;
    border-bottom: 1px solid var(--line);
  }
  aside .eyebrow,
  .aside-note {
    display: none;
  }
  nav {
    display: flex;
    margin: 0;
    gap: 0;
    justify-content: space-around;
  }
  nav a {
    padding: 12px 8px;
    font-size: 12px;
    display: grid;
    gap: 4px;
    text-align: center;
    border-radius: 0;
  }
  nav a span {
    font-size: 10px;
  }
  main {
    padding: 26px 16px 85px;
  }
  h1 {
    font-size: 32px;
  }
  .page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }
  .metrics {
    grid-template-columns: 1fr;
  }
  .metric {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 18px;
  }
  .metric strong {
    text-align: right;
    font-size: 24px;
    margin: 0;
  }
  .metric small {
    grid-column: 1/-1;
    margin-top: 8px;
  }
  .panel {
    padding: 20px;
  }
  .fields {
    grid-template-columns: 1fr;
  }
  .cards {
    grid-template-columns: 1fr;
  }
  .card-image {
    height: 240px;
  }
  .card-image img {
    height: 210px;
  }
  .steps {
    gap: 12px;
    font-size: 10px;
  }
  dialog {
    padding: 20px;
  }
  .section-head {
    align-items: flex-start;
  }
  .toolbar > * {
    width: 100%;
  }
  #notice {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }
}

/* Capture-only extension: retain Card Ledger's existing green / ivory system. */
.capture-workflow { min-width: 0; }
.capture-workflow [hidden] { display: none !important; }
.capture-workflow pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.6; }
.capture-workflow button, .capture-workflow input, .capture-workflow select { border-color: #7c9185; }
.capture-workflow .primary { border-color: var(--ink); }
.capture-workflow .capture-sides { margin-bottom: 18px; }
.capture-workflow [aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.capture-workflow .capture-uploads { display: grid; gap: 14px; }
.capture-workflow .upload { padding: 20px; }
.capture-workflow .capture-camera { background: #f6f9f1; border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-top: 16px; }
.capture-workflow video, .capture-workflow #camera-photo { width: 100%; height: auto; max-height: 440px; object-fit: contain; background: #173e36; border-radius: 6px; margin-bottom: 14px; transform: none; }
.capture-workflow .capture-canvas-wrap { background: #edf3e6; border: 1px solid var(--line); padding: 8px; border-radius: 8px; text-align: center; }
.capture-workflow #crop-canvas { display: block; width: auto; max-width: 100%; max-height: 510px; height: auto; margin-inline: auto; }
.capture-workflow #crop-editor { margin-top: 24px; }
.capture-workflow .capture-crop-fields { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-top: 18px; }
.capture-workflow .capture-crop-fields input { width: 100%; min-width: 0; }
.capture-workflow .capture-check { display: flex; gap: 10px; align-items: center; font-size: 13px; line-height: 1.6; margin: 18px 0; }
.capture-workflow .capture-check input { flex: 0 0 auto; width: 20px; height: 20px; min-height: 20px; accent-color: var(--ink); }
.capture-workflow #scan-progress { width: 100%; accent-color: var(--green); margin-top: 16px; }
.capture-workflow .capture-quality { background: #f0f5e9; border-radius: 7px; padding: 12px; }
.capture-workflow .capture-diagnostics { margin-top: 24px; }
.capture-workflow .capture-diagnostic-images { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.capture-workflow figure { margin: 0; min-width: 0; }
.capture-workflow figcaption { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.capture-workflow .capture-diagnostic-images img { max-width: 100%; max-height: 300px; object-fit: contain; }
.capture-workflow .capture-candidate { align-items: flex-start; overflow-wrap: anywhere; }
.capture-workflow .capture-candidate > div { min-width: 0; }
.capture-workflow .capture-candidate ul { padding-left: 18px; }
.capture-workflow .capture-candidate button { flex-shrink: 0; }
.capture-workflow .capture-parsed { margin-top: 24px; }
@media (max-width:650px) {
  .capture-workflow .steps { flex-wrap: wrap; gap: 10px 18px; line-height: 1.6; }
  .capture-workflow .capture-crop-fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .capture-workflow .capture-candidate { flex-wrap: wrap; }
  .capture-workflow .capture-candidate button { margin-left: 0; width: 100%; }
  .capture-workflow .capture-diagnostic-images { grid-template-columns: 1fr; }
  .capture-workflow .capture-camera { padding: 12px; }
  .capture-workflow .capture-check { min-height: 44px; }
}
