:root {
  color-scheme: light;
  --ink: #172b2b;
  --muted: #4f6362;
  --paper: #fffefb;
  --page: #f1f5f1;
  --stroke: #d4ded8;
  --green: #165d50;
  --light: #e0efe6;
  --charcoal: #183333;
  --alert: #834226;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--page); font: 16px/1.5 system-ui, -apple-system, sans-serif; }
a { color: var(--green); text-underline-offset: .22em; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #207ba6; outline-offset: 3px; }
h1, h2, h3, h4, p { margin-top: 0; overflow-wrap: anywhere; }
h1, h2, h3 { margin-bottom: 10px; letter-spacing: -.04em; line-height: 1.08; }
h1 { font-size: clamp(1.85rem, 4vw, 3rem); }
h2 { font-size: clamp(1.55rem, 4.6vw, 2.75rem); }
h3 { font-size: 1.43rem; }
h4 { font-size: 1.12rem; margin-bottom: 4px; }
p { margin-bottom: 12px; }
.masthead { background: var(--charcoal); color: #fff; }
.header-inner, .shell { width: min(100% - 36px, 1350px); margin-inline: auto; }
.header-inner { min-height: 66px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 730; }
.brand-icon { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; background: #caefda; color: var(--charcoal); font-family: Georgia, serif; font-style: italic; font-weight: 700; }
.shell { padding-block: clamp(20px, 4.6vw, 54px); }
.panel, .sidebar { border: 1px solid var(--stroke); background: var(--paper); border-radius: 18px; padding: clamp(16px, 2.8vw, 30px); }
.access { max-width: 535px; margin: clamp(0px, 6vh, 58px) auto 0; }
.quiet { color: var(--muted); }
fieldset { min-width: 0; padding: 0; border: 0; margin: 0; }
label { display: block; margin: 9px 0 5px; font-size: .92rem; font-weight: 680; }
input, textarea, select { display: block; width: 100%; min-width: 0; border: 1px solid #a3b8ae; border-radius: 8px; padding: 9px 11px; background: #fff; color: var(--ink); font: inherit; }
textarea { resize: vertical; }
button { font: inherit; cursor: pointer; }
button:disabled { opacity: .62; cursor: default; }
.button { min-height: 43px; border: 1px solid transparent; border-radius: 9px; padding: 8px 13px; font-weight: 650; line-height: 1.2; }
form button[type="submit"] { margin-top: 13px; }
.button-primary { background: var(--green); color: #fff; }
.button-primary:hover:not(:disabled) { background: #0d473d; }
.button-outline { background: transparent; color: var(--green); border-color: #a3b8ae; }
.button-outline:hover:not(:disabled) { background: var(--light); }
.button-quiet { border-color: #6a8c80; background: transparent; color: #fff; }
.button-quiet:hover { background: #284c43; }
.feedback { min-height: 0; margin: 0; }
.feedback:not(:empty) { padding: 10px 12px; margin: 0 0 12px; background: var(--light); border: 1px solid #c1d8cb; border-radius: 8px; }
.access .feedback:not(:empty) { margin-top: 12px; }
.feedback[data-error="true"] { background: #fbebe1; border-color: #edc4b3; color: var(--alert); }
.workspace { display: grid; grid-template-columns: minmax(200px, 262px) minmax(0, 1fr); align-items: start; gap: 18px; }
.sidebar { padding: 17px; position: sticky; top: 15px; }
.sidebar-head, .section-heading, .actions { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sidebar h1 { font-size: 1.43rem; margin-bottom: 0; }
.sidebar label { margin-top: 14px; }
.cases, .stack { display: grid; gap: 8px; margin-top: 12px; }
.case-button { text-align: left; min-width: 0; background: #f6f8f3; border: 1px solid transparent; color: var(--ink); padding: 8px 10px; border-radius: 8px; overflow-wrap: anywhere; }
.case-button:hover, .case-button[aria-current="true"] { background: var(--light); border-color: #a2c5b7; }
.case-button strong, .case-button span { display: block; }
.case-button span { color: var(--muted); font-size: .87rem; }
.case-view { min-width: 0; }
.case-header { padding: 4px 3px; }
.case-number { margin-bottom: 6px; color: var(--green); font-size: .88rem; font-weight: 700; }
.case-header .quiet { white-space: pre-wrap; }
.case-map { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 6px 0 15px; }
.map-item { border: 1px solid var(--stroke); background: #fbfdf9; color: var(--ink); border-radius: 14px; padding: 13px 11px; text-align: left; display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.map-item[aria-pressed="true"] { background: var(--charcoal); border-color: var(--charcoal); color: #fff; }
.map-item span:last-child { font-size: .81rem; }
.map-label { font-weight: 680; }
.map-item strong { font-size: 1.6rem; line-height: 1; }
.editor { margin-bottom: 13px; }
.source-editor { background: #f2f7f2; border: 1px solid var(--stroke); padding: 12px; border-radius: 10px; }
.actions { justify-content: flex-start; align-items: end; }
.two-cols { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.record { border: 1px solid var(--stroke); border-radius: 10px; padding: 13px; overflow-wrap: anywhere; }
.record .quiet { margin-bottom: 4px; }
.record p, .record dd { white-space: pre-wrap; }
.record dl { margin: 8px 0; }
.record dt { font-weight: 700; }
.record dd { margin: 0 0 7px; }
.subline { font-size: .87rem; }
.file-list { list-style: none; margin: 9px 0 0; padding: 0; }
.file-list li { margin-top: 7px; }
.file-list .button { overflow-wrap: anywhere; text-align: left; max-width: 100%; }
.file-hash { display: block; }
.invite-result { padding: 12px; border: 1px solid #9ac3b4; background: var(--light); border-radius: 10px; margin-top: 13px; }
.invite-result p { margin: 8px 0; }
@media (max-width: 730px) {
  .workspace { grid-template-columns: 1fr; gap: 14px; }
  .sidebar { position: static; }
  .cases { grid-template-columns: repeat(auto-fit,minmax(135px,1fr)); }
}
@media (max-width: 390px) {
  .header-inner, .shell { width: calc(100% - 24px); }
  .map-item { padding-inline: 7px; }
  .map-item strong { font-size: 1.32rem; }
  .map-label { font-size: .83rem; }
  .map-item span:last-child { font-size: .72rem; }
  .two-cols { grid-template-columns: 1fr; gap: 0; }
}
