/* LC-1637 functional app layer. Same design tokens as the LC-1610 screens (ui.js C / fonts),
   but fluid: full width on desktop, sidebar collapses to a top bar + drawer under 900px,
   single column under 640px. No fixed design-width frames. */
:root {
  --navy: #1D2951; --ink2: #3A4263; --mute: #555B72; --line: #D3D1CD; --line3: #C4C2BD;
  --bg: #E5E4E2; --paper: #F2F1EF; --terra: #B56F5B; --terraDark: #8E5140; --plum: #684F5B;
  --plumBg: #EFE9EC; --amberBg: #F8ECD9; --amber: #8A4F0E; --blueBg: #E4E7F1; --roseBg: #F3E6E1;
  --serif: 'Newsreader', Georgia, serif; --sans: 'Hanken Grotesk', system-ui, sans-serif;
}
body.lv { margin: 0; background: var(--paper); color: var(--navy); font-family: var(--sans); }
.lv * { box-sizing: border-box; }
.lv a { color: var(--terraDark); }
.lv :focus-visible { outline: 3px solid var(--plum); outline-offset: 2px; }
.lv-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100dvh; width: 100%; }
.lv-side { background: var(--navy); color: #fff; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh; overflow-y: auto; }
.lv-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 700; font-size: 15px; }
.lv-brand img { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }
.lv-brand small { display: block; font-weight: 500; opacity: .75; font-size: 12px; }
.lv-nav a { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px; border-radius: 10px; color: #fff; text-decoration: none; font-size: 14px; font-weight: 600; }
.lv-nav a:hover { background: rgba(255,255,255,.08); }
.lv-nav a[aria-current="page"] { background: rgba(255,255,255,.16); }
.lv-nav .n { margin-left: auto; background: var(--terra); border-radius: 999px; font-size: 11px; padding: 2px 7px; }
.lv-side-foot { margin-top: auto; font-size: 12px; opacity: .85; display: flex; flex-direction: column; gap: 8px; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.15); }
.lv-side-foot button, .lv-side-foot select { font: inherit; color: #fff; background: transparent; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.lv-side-foot select option { color: var(--navy); }
.lv-top { display: none; }
.lv-main { min-width: 0; display: flex; flex-direction: column; }
.lv-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 32px; border-bottom: 1px solid var(--line); background: var(--paper); flex-wrap: wrap; }
.lv-head h1 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 30px; line-height: 1.2; }
.lv-eyebrow { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--terraDark); font-weight: 700; }
.lv-body { padding: 24px 32px 48px; display: flex; flex-direction: column; gap: 20px; width: 100%; }
.lv-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.lv-cols3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lv-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.lv-card h2 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 22px; }
.lv-card h3 { margin: 0; font-size: 15px; }
.lv-hero { background: var(--navy); color: #fff; border: 0; }
.lv-hero h2 { color: #fff; font-size: 26px; }
.lv-muted { color: var(--mute); font-size: 14px; line-height: 1.5; margin: 0; }
.lv-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 10px; font: 700 14px var(--sans); cursor: pointer; border: 1px solid transparent; text-decoration: none; white-space: nowrap; }
.lv-btn.navy { background: var(--navy); color: #fff; }
.lv-btn.terra { background: var(--terra); color: #fff; }
.lv-btn.plum { background: var(--plum); color: #fff; }
.lv-btn.ghost { background: #fff; color: var(--navy); border-color: var(--line3); }
.lv-btn.text { background: transparent; color: var(--navy); font-weight: 600; }
.lv-btn[disabled] { opacity: .55; cursor: default; }
.lv-hero .lv-btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.lv-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.lv-chip { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #ECEBE8; color: var(--ink2); white-space: nowrap; }
.lv-chip.draft { background: var(--blueBg); color: var(--navy); }
.lv-chip.awaiting { background: var(--roseBg); color: var(--terraDark); }
.lv-chip.changes { background: var(--amberBg); color: var(--amber); }
.lv-chip.reviewed { background: var(--plum); color: #fff; }
.lv-chip.dismissed { background: #ECEBE8; color: var(--mute); }
.lv-chip.now { background: var(--terra); color: #fff; }
.lv-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; }
.lv-field input, .lv-field textarea, .lv-field select, .lv-input { font: 400 15px var(--sans); color: var(--navy); border: 1px solid var(--line3); border-radius: 10px; padding: 10px 12px; background: #fff; width: 100%; }
.lv-field textarea { min-height: 90px; resize: vertical; }
.lv-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.lv-tabs button { font: 700 14px var(--sans); color: var(--mute); background: none; border: 0; border-bottom: 3px solid transparent; padding: 12px 14px; cursor: pointer; white-space: nowrap; }
.lv-tabs button[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--terra); }
.lv-thread { display: flex; flex-direction: column; gap: 14px; max-height: 58dvh; overflow-y: auto; padding: 4px 2px; }
.lv-msg { display: flex; gap: 10px; align-items: flex-start; }
.lv-av { width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--navy); overflow: hidden; }
.lv-av img { width: 100%; height: 100%; object-fit: cover; }
.lv-av.me { border-radius: 50%; background: var(--terra); }
.lv-bubble { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: 15px; line-height: 1.5; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; flex: 1; }
.lv-bubble .who { font-size: 12px; font-weight: 700; color: var(--mute); display: flex; gap: 8px; justify-content: space-between; white-space: normal; }
.lv-composer { display: flex; gap: 10px; align-items: flex-end; }
.lv-composer textarea { flex: 1; min-height: 48px; max-height: 180px; resize: vertical; font: 400 15px var(--sans); border: 1px solid var(--line3); border-radius: 12px; padding: 12px; }
.lv-list { display: flex; flex-direction: column; gap: 10px; }
.lv-item { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.lv-item.sel { border-color: var(--navy); box-shadow: 0 0 0 2px var(--navy) inset; }
.lv-item p { margin: 0; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.lv-note { background: var(--amberBg); border-radius: 10px; padding: 10px 12px; font-size: 14px; line-height: 1.5; color: #5A360A; }
.lv-note.info { background: var(--blueBg); color: var(--navy); }
.lv-note.bad { background: var(--roseBg); color: var(--terraDark); }
.lv-steps { display: flex; gap: 8px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.lv-steps li { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--mute); padding: 6px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--line); }
.lv-steps li.done { color: var(--plum); border-color: var(--plum); }
.lv-steps li.cur { color: #fff; background: var(--navy); border-color: var(--navy); }
.lv-weeks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.lv-week { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.lv-week.now { border-color: var(--terra); box-shadow: 0 0 0 2px var(--terra) inset; }
.lv-dialog-scrim { position: fixed; inset: 0; background: rgba(29,41,81,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.lv-dialog { background: #fff; border-radius: 16px; width: min(620px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.lv-dialog h2 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 24px; }
.lv-toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; z-index: 60; max-width: calc(100% - 32px); }
.lv-map { width: 100%; height: auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.lv-center { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.lv-auth { width: min(460px, 100%); }
.lv-empty { border: 1px dashed var(--line3); border-radius: 12px; padding: 22px; text-align: center; color: var(--mute); font-size: 14px; }
.lv-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; margin: 0; }
.lv-dl dt { color: var(--mute); }
.lv-dl dd { margin: 0; overflow-wrap: anywhere; }
.lv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (max-width: 1100px) {
  .lv-grid { grid-template-columns: minmax(0, 1fr); }
  .lv-weeks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .lv-shell { grid-template-columns: minmax(0, 1fr); }
  .lv-top { display: flex; position: sticky; top: 0; z-index: 30; align-items: center; gap: 8px; height: 56px; padding: 0 12px; background: var(--navy); color: #fff; font-weight: 700; }
  .lv-top button { min-width: 44px; min-height: 44px; border: 0; background: transparent; color: #fff; font: inherit; cursor: pointer; border-radius: 10px; }
  .lv-side { position: fixed; inset: 56px auto 0 0; width: min(300px, 86vw); height: auto; z-index: 40; transform: translateX(-105%); transition: transform .2s ease; }
  body.lv-drawer .lv-side { transform: none; box-shadow: 0 0 0 100vmax rgba(29,41,81,.4); }
  .lv-cols3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .lv-head { padding: 14px 16px; }
  .lv-head h1 { font-size: 24px; }
  .lv-body { padding: 16px 16px 40px; }
  .lv-card { padding: 16px; }
  .lv-weeks { grid-template-columns: minmax(0, 1fr); }
  .lv-thread { max-height: none; }
  .lv-dialog { padding: 18px; }
  .lv-btn { min-height: 44px; }
}
