/* App styles on the Armature tokens (brand/armature.css, loaded first). Older names map onto the brand. */
:root {
  --bg: var(--card); --card: var(--panel); --text: var(--ink); --muted: var(--slate); --line: var(--rule);
  --accent: var(--ink); --accent-2: var(--bronze); --accent-text: var(--on-ink);
  --warn-bg: var(--bronze-tint); --warn: var(--bronze-deep);
  --info-bg: var(--verdigris-tint); --chip: var(--neutral-tint); --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 var(--font-sans); }
h1, h2 { font-family: var(--font-display); font-weight: 500; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
a { color: inherit; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
h1 small { font-weight: 400; color: var(--muted); display: block; font-size: .6em; }
code { background: var(--chip); padding: 1px 5px; border-radius: 4px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px;
  background: #14181f; color: #f2f3f1; border-bottom: 2px solid #a8743a; position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.topbar a { color: #f2f3f1; text-decoration: none; margin-left: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; margin-left: 0 !important; }
.brand .mark { width: 32px; height: 32px; flex: none; }
.brand .wordmark { display: flex; flex-direction: column; line-height: 1.1; }
.brand .wordmark b { font-weight: 600; font-size: 15px; letter-spacing: .14em; }
.brand .wordmark small { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; color: #a9b0ba; }
.foot { max-width: 1100px; margin: 24px auto; padding: 0 16px; color: var(--muted); font-size: .85em; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
.btn { background: var(--accent); color: var(--accent-text); border: 0; border-radius: var(--radius-md); padding: 9px 16px;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; }
.btn.small { padding: 5px 10px; font-size: .9em; }
.topbar .btn { background: #f2f3f1; color: #14181f; }
.topbar .btn:hover { background: #ffffff; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.linklike { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.small { font-size: .85em; }
.muted { color: var(--muted); }
.banner { padding: 10px 16px; border-radius: 8px; margin: 0 0 12px; }
body > .banner { border-radius: 0; margin: 0; text-align: center; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.info { background: var(--info-bg); }
.inline { display: inline; }
.list { list-style: none; padding: 0; margin: 0; }
.list > li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.list.compact > li { padding: 4px 0; }
.actions { margin-left: auto; font-size: .9em; }
.pill { font-size: .75em; background: var(--chip); border-radius: 99px; padding: 1px 8px; white-space: nowrap; }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.search { display: flex; gap: 8px; margin: 12px 0; }
input, select, textarea { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; width: 100%; }
.search input { flex: 1; }
.form label { display: block; margin: 0 0 12px; font-weight: 600; }
.form label input, .form label textarea, .form label select { margin-top: 4px; font-weight: 400; }
.row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } }
label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
label.check input { width: auto; margin-top: 4px; }
details.chapter { border-top: 1px solid var(--line); padding: 8px 0; }
details.chapter summary { cursor: pointer; }
.instruction-text p { font-family: var(--font-display); font-size: 1.08em; }
.note { background: var(--chip); padding: 8px 14px; border-radius: 8px; }
.crumbs { color: var(--muted); font-size: .9em; }
.steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 12px; flex-wrap: wrap; }
.steps li a { display: block; padding: 6px 12px; border-radius: 99px; background: var(--chip); text-decoration: none; font-size: .9em; }
.steps li.on a { background: var(--accent); color: var(--accent-text); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 16px; }
.toolbar input { width: auto; flex: 1; min-width: 140px; }
.sticky { position: sticky; top: 52px; z-index: 5; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--chip); border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; cursor: pointer; font: inherit; color: inherit; }
.chip.small { padding: 2px 10px; font-size: .85em; }
.chip.strong { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.checklist { list-style: none; padding: 0; margin: 6px 0; }
.checklist li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 5px 4px; border-radius: 6px; }
.checklist li:hover { background: var(--chip); }
.checklist label { display: flex; gap: 8px; cursor: pointer; flex: 1; min-width: 60%; }
.checklist input[type=checkbox] { width: 18px; height: 18px; flex: none; margin-top: 3px; }
.checklist li.hidden { display: none; }
.checklist li.flash { background: var(--warn-bg); }
.why { font-size: .8em; color: var(--muted); font-style: italic; }
.peek { text-decoration: none; color: var(--muted); }
.ai textarea { margin: 8px 0; }
.export { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.export select { margin: 6px 0 10px; }
@media (max-width: 760px) { .export { grid-template-columns: 1fr; } }
ol.review { list-style: none; padding: 0; counter-reset: item; }
.item-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.item-head h3 { margin: 0; flex: 1; font-size: 1.05em; }
.move { display: flex; flex-direction: column; }
.icon { background: none; border: 1px solid var(--line); color: inherit; border-radius: 4px; cursor: pointer; font-size: .7em; padding: 0 5px; }
.flags { margin: 6px 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.item textarea { font-family: var(--font-display); line-height: 1.55; }
.inserts { font-size: .85em; color: var(--muted); margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.closing { margin-left: auto; }
@media (max-width: 640px) { .topbar { position: static; } .sticky { top: 0; } }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0 0 8px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; white-space: nowrap; }
@media (max-width: 480px) { .facts { grid-template-columns: 1fr; } .facts dd { margin-bottom: 6px; white-space: normal; } }
.intro { margin: 6px 0 10px; font-size: .92em; }
.intro p { margin: .5em 0; }
.pill.hint { background: var(--info-bg); white-space: normal; }
.direction { font-style: italic; color: var(--muted); }
.instruction-text .direction, .note .direction { font-family: var(--font-display); }
details.chapter { scroll-margin-top: 64px; }
.crumbs a { text-decoration: underline; }
.list li.flash { background: var(--warn-bg); border-radius: 6px; }
fieldset.defendant { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 6px; margin: 0 0 12px; }
fieldset.defendant legend { font-weight: 600; padding: 0 6px; }
.client-choice { align-self: end; padding-bottom: 10px; }
[hidden] { display: none !important; }
/* Automatic changes made to the official text (shown after the choice pills' colors). */
.pill.change { background: #fde2e7; color: #8b1a2b; }
@media (prefers-color-scheme: dark) { .pill.change { background: #4a1d27; color: #ffb3c1; } }
textarea.autosize { overflow: hidden; resize: none; min-height: 2.6em; }
.item-actions { margin: 4px 0; font-size: .9em; color: var(--muted); }
.modified-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.label-input { width: 8em; padding: 4px 8px; font-size: .95em; }
.row-inline { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.row-inline label { font-weight: 600; }
.row-inline input { width: 10em; }
.pill.ai-warn { background: #ede4ff; color: #4b2a8c; font-size: .75em; vertical-align: middle; }
.ai-notice { border-left: 3px solid #7c4dff; background: #f5f0ff; color: #3a2470; padding: .5em .75em; border-radius: 4px; }
@media (prefers-color-scheme: dark) {
  .pill.ai-warn { background: #35255c; color: #d9c8ff; }
  .ai-notice { background: #241a3d; color: #d9c8ff; }
}
.saved-default { border-left: 3px solid #c2185b; background: #fdf0f4; padding: .5em .75em; border-radius: 4px; margin: .75em 0; }
.saved-default p { margin: .25em 0; }
form.inline { display: inline; }
@media (prefers-color-scheme: dark) { .saved-default { background: #3a1a26; } }
/* Criminal | Civil switch: centered between the brand and the navigation; both halves the same width. */
.book-switch { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 6.8em;
  border: 1px solid rgba(242,243,241,.35); border-radius: 999px; overflow: hidden; font-size: .85em; }
/* New-case button: the same space on all four sides, sized to "+ New criminal case" in both books
   (both labels sit in one grid cell; the other book's label is invisible but keeps the width). */
.topbar .new-case { display: inline-grid; padding: 6px; line-height: 1.2; text-align: center; }
.topbar .new-case > span { grid-area: 1 / 1; }
.topbar .new-case > .sizer { visibility: hidden; }
.book-switch a { padding: .2em .8em; margin-left: 0; color: inherit; text-decoration: none; opacity: .75; text-align: center; }
.book-switch a.on { background: rgba(242,243,241,.16); box-shadow: inset 0 -2px 0 #c8955a; opacity: 1; font-weight: 600; }
fieldset.parties .party { align-items: end; }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .25em 1em; }
/* Bundle cards (and any card used as a list item): the same space on all four sides. */
.list > li.card { display: block; padding: 14px; border: 1px solid var(--line); margin-bottom: 12px; }
.list > li.card > :first-child { margin-top: 0; }
.list > li.card > :last-child { margin-bottom: 0; }
.list > li.card p { margin: 6px 0; }
.list > li.card > p:last-child, .list > li.card > form:last-child { margin-bottom: 0; }
/* Checklist quick picks: light gray with "+" until picked, then ink with "✓". */
.chip.pick::before { content: "+"; display: inline-block; width: .8em; margin-right: .3em; text-align: center; font-weight: 700; }
.chip.pick.on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.chip.pick.on::before { content: "✓"; }
/* Armature additions. */
a { text-underline-offset: 2px; }
.btn:hover { background: var(--graphite); }
.btn.ghost:hover { background: var(--chip); }
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: 2px solid var(--focus); outline-offset: 1px; }
input, select, textarea { border-color: var(--rule-strong); }
.steps li.on a { box-shadow: inset 0 -2px 0 var(--bronze); }
.crumbs, .facts dt { font-family: var(--font-sans); }
@media (prefers-color-scheme: dark) { .btn:hover { background: #ffffff; } .btn.ghost:hover { background: var(--chip); } }

/* Sign-in and accounts */
.auth { max-width: 440px; margin: 24px auto; }
.auth .form .btn { margin-top: 4px; }
.user-menu { position: relative; display: inline-block; margin-left: 14px; vertical-align: middle; }
.user-menu > summary { cursor: pointer; list-style: none; padding: 5px 10px; border: 1px solid #4a525e; border-radius: var(--radius);
  color: #f2f3f1; white-space: nowrap; max-width: 16em; overflow: hidden; text-overflow: ellipsis; }
.user-menu > summary:hover, .user-menu[open] > summary { border-color: #a9b0ba; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary::after { content: " ▾"; }
.user-menu-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 180px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 0; box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.topbar .user-menu-panel a, .user-menu-panel button { display: block; width: 100%; text-align: left; padding: 7px 16px; margin: 0;
  color: var(--ink, #14181f); text-decoration: none; font-size: 15px; }
.topbar .user-menu-panel a:hover, .user-menu-panel button:hover { background: rgba(20,24,31,.06); }
.user-menu-panel form { margin: 0; }
table.users { width: 100%; border-collapse: collapse; margin: 0 0 24px; }
table.users th, table.users td { text-align: left; vertical-align: top; padding: 10px 8px; border-bottom: 1px solid var(--line); }
table.users tr.inactive td { opacity: .6; }
table.users .actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
table.users .actions form { margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
table.users details form { margin-top: 6px; }
table.users details input { width: 13em; }
@media (max-width: 640px) { table.users thead { display: none; } table.users td { display: block; border: 0; padding: 4px 0; }
  table.users tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; } }
