:root {
  color-scheme: light;
  font: 16px/1.5 system-ui, sans-serif;
  --bg: #edf3ee;
  --surface: #fffefa;
  --text: #152820;
  --muted: #435b51;
  --line: #c6d6cc;
  --accent: #09594b;
  --accent-dark: #064137;
  --wash: #e6f4ee;
  --warn: #7a4110;
  --bad: #9c292b;
  color: var(--text);
  background: var(--bg);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, label[tabindex]:focus-visible, summary:focus-visible {
  outline: 3px solid #179080; outline-offset: 3px;
}
.topbar { background: #10392f; color: #fff; }
.top-inner, .shell { max-width: 90rem; margin-inline: auto; padding-inline: clamp(1rem, 3vw, 2.5rem); }
.top-inner { min-height: 3.65rem; display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.2rem; padding-block: .6rem; }
.back { color: #fff; font-weight: 650; text-decoration: none; }
.back:hover { text-decoration: underline; }
.storage { margin-left: auto; font-size: .85rem; color: #d3eee3; }
.storage.error { color: #ffd3b1; }
.top-actions, .intro-actions, .actions { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; }
.shell { padding-bottom: 4rem; }
.intro { display: flex; justify-content: space-between; align-items: end; gap: 1.15rem; padding-block: 2rem 1rem; }
h1, h2, h3 { line-height: 1.15; margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 3.25rem); letter-spacing: -.045em; }
h2 { font-size: clamp(1.55rem, 2.6vw, 2rem); letter-spacing: -.025em; }
h3 { font-size: 1.12rem; margin-top: 1.2rem; }
p { margin: .55rem 0 .85rem; }
.intro p { margin-bottom: 0; color: var(--muted); }
.intro .product-title { color: var(--accent-dark); font-size: clamp(1.2rem, 2.5vw, 1.65rem); font-weight: 720; }
.privacy { color: var(--muted); font-size: .9rem; }
.workspace { display: grid; grid-template-columns: minmax(13rem, 16rem) minmax(0, 1fr); gap: 1rem; align-items: start; margin-top: 1.2rem; }
.sidebar, .panel, .report { background: var(--surface); border-radius: .85rem; border: 1px solid var(--line); }
.sidebar { padding: .8rem; position: sticky; top: .7rem; }
.panel { min-height: 23rem; padding: clamp(1rem, 2.1vw, 1.75rem); }
.contour-select { margin-bottom: .7rem; }
#nav { display: grid; gap: .2rem; }
#nav button { width: 100%; justify-content: flex-start; text-align: left; color: var(--text); background: transparent; border-color: transparent; }
#nav button:hover { background: var(--wash); }
#nav button[aria-current="page"] { color: var(--accent-dark); background: var(--wash); font-weight: 720; }
button, .button {
  background: var(--accent); color: white; border: 1px solid var(--accent);
  border-radius: .5rem; padding: .49rem .75rem; min-height: 2.35rem;
  font: inherit; font-size: .91rem; font-weight: 650; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
button:hover, .button:hover { background: var(--accent-dark); color: white; }
button:disabled { opacity: .48; cursor: not-allowed; }
button.quiet, .button.quiet { color: var(--accent-dark); background: #fff; border-color: var(--line); }
button.quiet:hover, .button.quiet:hover { background: var(--wash); }
.topbar .quiet { border-color: #6a9688; color: #fff; background: transparent; }
.topbar .quiet:hover { background: #23594b; }
button.remove { background: white; color: var(--bad); border-color: #dec3be; min-height: 2rem; }
button.remove:hover { background: #fff0ef; }
.field { display: grid; gap: .28rem; font-weight: 630; font-size: .9rem; min-width: 0; }
.field small { font-weight: 400; color: var(--muted); }
input:not([type=checkbox]), select, textarea {
  width: 100%; min-width: 0; padding: .54rem .6rem; border: 1px solid #aebfb4;
  border-radius: .45rem; color: var(--text); background: #fff; font: inherit; font-weight: 400;
}
input:disabled, select:disabled { opacity: .72; cursor: not-allowed; background: #eff3ef; }
textarea { min-height: 5.2rem; resize: vertical; }
input[type=checkbox] { accent-color: var(--accent); inline-size: 1.05rem; block-size: 1.05rem; }
.check { display: flex; align-items: flex-start; gap: .45rem; font-size: .9rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .75rem; }
.form-grid .wide { grid-column: 1/-1; }
.section-note { color: var(--muted); max-width: 67ch; }
.card { border: 1px solid var(--line); background: #fff; border-radius: .65rem; padding: .85rem; margin: .7rem 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .55rem; }
.card-head strong, td, dd { overflow-wrap: anywhere; }
small, .muted { color: var(--muted); }
fieldset { border: 1px solid var(--line); border-radius: .6rem; margin: 1rem 0; padding: .8rem; }
summary { cursor: pointer; font-weight: 650; color: var(--accent); }
details .form-grid { margin-top: .65rem; }
details.import { margin-block: 1rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: .7rem; margin: 1rem 0; }
.stat { background: var(--wash); border-radius: .65rem; padding: .65rem .75rem; }
.stat strong { display: block; font-size: 1.28rem; line-height: 1.25; }
.stat span { font-size: .83rem; color: var(--muted); }
.status-line, .notice { border-left: .25rem solid var(--accent); background: var(--wash); padding: .65rem .8rem; }
.notice { margin-block: .8rem; border-radius: .25rem; }
.status-line.warn, .notice.error { border-color: #a45c17; color: var(--warn); background: #fff3e5; }
.status-line.bad { border-color: var(--bad); background: #fdf0ee; }
.table-wrap { overflow: auto; margin: .8rem 0; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .46rem .55rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--wash); }
td.num, th.num { text-align: right; white-space: nowrap; }
td .field { font-size: .84rem; }
.cards { max-height: 43rem; overflow: auto; padding-right: .25rem; }
.case-card summary { display: block; }
.case-card summary::before { content: '▸ '; }
.case-card[open] summary::before { content: '▾ '; }
.report { padding: 1rem; margin-top: .9rem; }
.report h2 { font-size: 1.4rem; }
.report h3 { margin-top: 1.3rem; }
.report dl { margin: .5rem 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .25rem .8rem; }
.report dt { font-weight: 650; }
.report dd { margin: 0; }
.print-only { display: none; }
@media (max-width: 840px) {
  .workspace { grid-template-columns: minmax(0, 1fr); gap: .6rem; }
  .sidebar { position: static; }
  .sidebar #nav { grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: .3rem; }
  #nav button { min-height: 2.55rem; background: #f5f8f6; }
  .intro { align-items: start; flex-direction: column; padding-top: 1.35rem; }
  .cards { max-height: none; }
}
@media (max-width: 500px) {
  .storage { margin-left: 0; }
  .top-inner { justify-content: space-between; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats .stat strong { font-size: 1.14rem; }
  .report dl { grid-template-columns: minmax(0,1fr); }
  .report dt { margin-top: .35rem; }
}
@media print {
  .topbar, .shell { display: none; }
  .print-only { display: block; }
  .report { border: 0; padding: 0; }
  body { color: #000; background: #fff; font-size: 11pt; }
  th, td { padding: .22rem .35rem; }
  tr { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
}
