/* NWLEPG document desk. 8px grid, the agency palette, system fonts (Inter when installed). */
:root {
  --water: #1d5f7a;
  --water-deep: #143f52;
  --water-tint: #e8f1f4;
  --wheat: #d9b86a;
  --wheat-tint: #fbf4e2;
  --bg: #f4f3ee;
  --panel: #ffffff;
  --ink: #1f2a30;
  --muted: #5a666c;
  --line: #e2dfd5;
  --line-strong: #cfcabb;
  --ok: #1e7a4c;
  --ok-tint: #e5f4ec;
  --warn: #8a5a00;
  --warn-tint: #fdf1d8;
  --bad: #b3261e;
  --bad-tint: #fbe9e7;
  --info: #1d5f7a;
  --focus: #b8860b;
  --r: 8px;
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s5: 40px; --s6: 48px;
  --shadow: 0 1px 2px rgba(20, 40, 50, .06), 0 4px 16px rgba(20, 40, 50, .06);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: "cv11", "ss01";
}
*, *::before, *::after { box-sizing: border-box; }
body.desk { margin: 0; min-height: 100vh; }
a { color: var(--water); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: var(--s1); background: var(--ink); color: #fff; padding: var(--s1) var(--s2); z-index: 50; border-radius: var(--r); }
.skip:focus { left: var(--s1); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: #f1efe8; padding: 1px 6px; border-radius: 4px; }

/* ---- chrome ---- */
.ro-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.ro-fieldset :is(.btn, .file-pick, input, select, textarea, summary) { cursor: not-allowed; }
.ro-fieldset .btn:disabled, .ro-fieldset .file-pick { opacity: .5; }
.ro-note { display: inline-block; margin-left: var(--s1); font-weight: 700; }
.demo-banner { background: var(--wheat); color: var(--ink); text-align: center; padding: var(--s1) var(--s2); font-size: 14px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; padding: var(--s1) var(--s3); background: var(--water-deep); color: #fff; }
.logo { display: inline-flex; align-items: center; gap: var(--s1); color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .01em; min-height: 48px; }
.logo-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r); background: var(--wheat); color: var(--water-deep); font-weight: 800; }
.tabs { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.tabs a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--s2); border-radius: var(--r); color: #d8e6ec; text-decoration: none; font-weight: 500; }
.tabs a:hover { background: rgba(255,255,255,.08); color: #fff; }
.tabs a[aria-current="page"] { background: rgba(255,255,255,.16); color: #fff; }
.who { margin-left: auto; display: flex; align-items: center; gap: var(--s2); font-size: 13px; }
.who .ghost { color: #fff; }
.actor { background: rgba(255,255,255,.12); padding: 4px 12px; border-radius: 999px; max-width: 24ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desk-main { max-width: 1120px; margin: 0 auto; padding: var(--s4) var(--s3) var(--s6); }
.desk-main:focus { outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s3); }
.page-head h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: -.01em; color: var(--water-deep); }
.page-head p { margin: 0; max-width: 64ch; }
h2 { font-size: 18px; margin: 0 0 var(--s2); color: var(--water-deep); }
.h-small { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 var(--s1); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: calc(var(--r) * 1.5); box-shadow: var(--shadow); padding: var(--s3); margin-bottom: var(--s3); }
.empty { color: var(--muted); text-align: center; padding: var(--s4) 0; margin: 0; }

/* ---- buttons, pills ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 var(--s2); border-radius: var(--r); border: 1px solid var(--line-strong); background: #fff; color: var(--ink); font: inherit; font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; transition: background .12s, border-color .12s, box-shadow .12s; white-space: nowrap; }
.btn:hover { border-color: var(--water); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--water); border-color: var(--water); color: #fff; }
.btn-primary:hover { background: var(--water-deep); border-color: var(--water-deep); }
.btn-quiet { min-height: 32px; font-size: 13px; }
.btn-icon { width: 40px; padding: 0; font-size: 16px; }
.btn-danger-quiet { color: var(--bad); border-color: transparent; background: transparent; }
.ghost { background: none; border: 0; color: var(--water); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; padding: 4px 8px; }
.file-pick { position: relative; }
.file-pick:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .01em; white-space: nowrap; }
.pill-ok { background: var(--ok-tint); color: var(--ok); }
.pill-warn { background: var(--warn-tint); color: var(--warn); }
.pill-bad { background: var(--bad-tint); color: var(--bad); }
.pill-info { background: var(--water-tint); color: var(--info); }
.pill-mute { background: #efede6; color: var(--muted); }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: #efede6; color: var(--muted); font-size: 12px; font-weight: 700; }

/* ---- sections ---- */
.sections ul { display: flex; gap: var(--s1); list-style: none; padding: 0; margin: 0 0 var(--s2); flex-wrap: wrap; }
.sections a { display: inline-flex; align-items: center; gap: var(--s1); min-height: 40px; padding: 0 var(--s2); border-radius: 999px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; }
.sections a[aria-current="page"] { background: var(--water); border-color: var(--water); color: #fff; }
.sections a[aria-current="page"] .count { background: rgba(255,255,255,.2); color: #fff; }

/* ---- document rows ---- */
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.doc-row { border: 1px solid var(--line); border-radius: var(--r); background: #fff; transition: box-shadow .15s; }
.doc-row:hover { box-shadow: var(--shadow); }
.drop { position: relative; display: grid; grid-template-columns: 1fr auto; gap: var(--s2); align-items: center; padding: var(--s2) var(--s3); border-radius: var(--r); transition: background .15s, outline-color .15s; outline: 2px dashed transparent; outline-offset: -6px; }
.doc-title-line { display: flex; align-items: center; gap: var(--s1); flex-wrap: wrap; }
.doc-title { font-size: 16px; font-weight: 650; color: var(--ink); text-decoration: none; }
.doc-title:hover { color: var(--water); text-decoration: underline; }
.filetype { display: inline-grid; place-items: center; height: 22px; padding: 0 6px; border-radius: 4px; font-size: 11px; font-weight: 800; letter-spacing: .04em; color: #fff; }
.filetype-pdf { background: #b3261e; }
.filetype-docx { background: #2b579a; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 4px var(--s2); margin-top: 4px; color: var(--muted); font-size: 13px; }
.doc-meta span:empty { display: none; }
.doc-note { margin: var(--s1) 0 0; color: var(--muted); }
.doc-actions { display: flex; align-items: center; gap: var(--s1); flex-wrap: wrap; justify-content: flex-end; }
.order { display: inline-flex; gap: 4px; }
.drop-hint { display: none; position: absolute; inset: 0; margin: 0; place-items: center; font-weight: 700; color: var(--water-deep); background: rgba(232, 241, 244, .94); border-radius: var(--r); pointer-events: none; }
body.is-dragging .drop { outline-color: var(--line-strong); }
.drop.is-over { outline-color: var(--water); background: var(--water-tint); }
.drop.is-over .drop-hint { display: grid; }
.is-busy { opacity: .6; pointer-events: none; }
.more { border-top: 1px solid var(--line); }
.more summary { cursor: pointer; padding: var(--s1) var(--s3); color: var(--muted); font-size: 13px; font-weight: 600; min-height: 40px; display: flex; align-items: center; gap: var(--s1); }
.more summary:hover { color: var(--water); }
.more-body { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); padding: 0 var(--s3) var(--s3); }
.versions { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.versions li { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); padding: var(--s1) var(--s2); border: 1px solid var(--line); border-radius: var(--r); background: #fbfaf7; }

/* ---- forms ---- */
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s2); align-items: end; }
.grid-form .wide, .grid-form .drop-field { grid-column: 1 / -1; }
.grid-form label, .inline-form label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.grid-form label.check { display: flex; align-items: center; gap: var(--s1); color: var(--ink); min-height: 40px; }
input, select, textarea { font: inherit; font-size: 14px; font-weight: 400; color: var(--ink); min-height: 40px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--r); background: #fff; width: 100%; }
input[type="checkbox"] { width: 20px; min-height: 20px; height: 20px; accent-color: var(--water); }
input[type="file"] { padding: 6px; background: #fbfaf7; border-style: dashed; }
::placeholder { color: #8d979c; font-weight: 400; }
input:focus, select:focus, textarea:focus { border-color: var(--water); outline: 3px solid rgba(29, 95, 122, .2); outline-offset: 0; }
.prefix { font-size: 12px; font-weight: 500; color: var(--muted); }
.form-actions { display: flex; gap: var(--s1); grid-column: 1 / -1; }
.inline-form { display: flex; gap: var(--s1); align-items: end; margin-top: var(--s1); }
.add-panel { border-style: dashed; box-shadow: none; background: #fbfaf7; }

/* ---- tables, cards ---- */
/* Long addresses break anywhere so the links table fits its card (this also lowers the column's min-content width). */
.url { overflow-wrap: anywhere; }
.links-table td:first-child { overflow-wrap: anywhere; }
.links-table td:nth-child(2), .links-table td:last-child { white-space: nowrap; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: var(--s1) var(--s2); border-bottom: 1px solid var(--line-strong); }
.table td { padding: var(--s2); border-bottom: 1px solid var(--line); vertical-align: top; }
.table details summary { cursor: pointer; color: var(--water); font-weight: 600; font-size: 13px; }
.cards { list-style: none; margin: 0 0 var(--s3); padding: 0; display: grid; gap: var(--s2); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.card-head h2 { margin: 0; }
.program-card details summary { cursor: pointer; color: var(--water); font-weight: 600; margin-top: var(--s1); }
.program-card form { margin-top: var(--s2); }

/* ---- toast ---- */
.toast { position: fixed; right: var(--s3); bottom: var(--s3); z-index: 60; max-width: min(440px, calc(100vw - 32px)); background: var(--ink); color: #fff; border-radius: calc(var(--r) * 1.5); padding: var(--s2) var(--s5) var(--s2) var(--s2); box-shadow: 0 12px 32px rgba(0,0,0,.25); border-left: 6px solid #5fd39a; animation: toast-in .2s ease-out; }
.toast-error { border-left-color: #ff8a80; }
.toast p { margin: 0 0 4px; }
.toast a { color: var(--wheat); font-weight: 700; }
.toast-close { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border: 0; border-radius: var(--r); background: transparent; color: #fff; font-size: 20px; cursor: pointer; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- preview ---- */
.preview { width: min(960px, 96vw); height: min(90vh, 1100px); padding: 0; border: 0; border-radius: calc(var(--r) * 1.5); box-shadow: 0 24px 64px rgba(0,0,0,.35); }
.preview::backdrop { background: rgba(20, 30, 36, .55); }
.preview-head { display: flex; align-items: center; gap: var(--s2); padding: var(--s1) var(--s2); border-bottom: 1px solid var(--line); }
.preview-head h2 { margin: 0 auto 0 0; font-size: 16px; }
.preview iframe { width: 100%; height: calc(100% - 57px); border: 0; }

/* ---- assistant ---- */
.chat { display: grid; gap: var(--s2); }
.chat-log { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); max-height: 60vh; overflow: auto; }
.msg { max-width: 72ch; padding: var(--s2); border-radius: calc(var(--r) * 1.5); }
.msg p { margin: 0 0 var(--s1); }
.msg p:last-child { margin: 0; }
.msg-assistant { background: #f4f3ee; }
.msg-user { background: var(--water); color: #fff; justify-self: end; }
.msg-card { padding: 0; max-width: 560px; }
.is-thinking { color: var(--muted); font-style: italic; }
.msg.is-error { background: var(--bad-tint); color: var(--bad); }
.confirm-card { border: 2px solid var(--wheat); background: var(--wheat-tint); border-radius: calc(var(--r) * 1.5); padding: var(--s2) var(--s3); }
.confirm-card h3 { margin: 0 0 var(--s1); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--warn); }
.confirm-card p { margin: 0 0 var(--s1); }
.card-actions { display: flex; gap: var(--s1); margin-top: var(--s2); }
.card-status { margin: var(--s1) 0 0; font-weight: 600; }
.confirm-card.is-done { border-color: var(--ok); background: var(--ok-tint); }
.confirm-card.is-done .card-status { color: var(--ok); }
.confirm-card.is-error .card-status { color: var(--bad); }
.confirm-card.is-cancelled { opacity: .7; }
.chat-form { display: grid; gap: var(--s1); border: 2px dashed transparent; border-radius: var(--r); padding: 4px; }
.chat-form.is-over { border-color: var(--water); background: var(--water-tint); }
.chat-tools { display: flex; align-items: center; gap: var(--s1); flex-wrap: wrap; }
#chat-send { margin-left: auto; }
.attachments { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 999px; background: var(--water-tint); color: var(--water-deep); font-size: 13px; font-weight: 600; }

/* ---- phones ---- */
@media (max-width: 720px) {
  .topbar { position: static; padding: var(--s1) var(--s2); gap: var(--s1); }
  /* The nav (not the list) is the topbar's flex item: give it its own full-width row, wrap the tabs, 44px targets. */
  .topbar > nav { order: 3; flex: 1 1 100%; min-width: 0; }
  .tabs { flex-wrap: wrap; }
  .tabs a { min-height: 44px; }
  .who .ghost { display: none; }
  .desk-main { padding: var(--s3) var(--s2) var(--s6); }
  .drop { grid-template-columns: 1fr; padding: var(--s2); }
  .doc-actions { justify-content: flex-start; }
  .more-body { grid-template-columns: 1fr; padding: 0 var(--s2) var(--s2); }
  .more summary { padding: var(--s1) var(--s2); }
  .panel { padding: var(--s2); }
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }
  /* Links: four columns cannot share 358px, so each row stacks: the link full width, status and Edit under it. */
  .links-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .links-table tr { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--s1) var(--s2); padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
  .links-table td { display: block; padding: 0; border: 0; }
  .links-table td:first-child { grid-column: 1 / -1; }
  .links-table td:nth-child(3) { display: none; }
  .links-table td:last-child { white-space: normal; justify-self: end; }
  .links-table td:last-child:has(details[open]) { grid-column: 1 / -1; justify-self: stretch; }
  .versions li { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
