:root {
  /* The Dredge look (Oct 28, docs/UI.md): deep water behind the logo, calm light screens. */
  --deep: #0D2B35;
  --deep-2: #1A3F4B;
  --deep-ink: #B7C7CC;
  --brand: #008FA9;
  --ground: #F4F7F7;
  --surface: #FFFFFF;
  --ink: #13232A;
  --muted: #4F5D63;
  --line: #DCE3E5;
  --line-soft: #E8EEEF;
  --field: #8A9A9F;
  --accent: #00687B;
  --accent-ink: #0D2B35;
  --accent-soft: #E3F3F5;
  --shield: #3B4DA8;
  --shield-soft: #EEF0FA;
  --warn: #8A4300;
  --warn-soft: #FFF1E2;
  --radius: 10px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ground);
  color: var(--ink);
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--accent); }
a:hover { color: var(--accent-ink); }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.92em; }
h1 { font-size: 28px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 600; margin: 0; }
h3 { font-size: 15px; font-weight: 600; margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #1F6FEB; outline-offset: 2px; }

/* The top bar stays put on every screen. */
.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--deep);
  color: #FFFFFF;
}
.top :focus-visible { outline-color: #9BD3DE; }
.top-in {
  max-width: 1280px; margin: 0 auto; padding: 8px 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-height: 44px; }
.brand-symbol { height: 32px; width: auto; object-fit: contain; }
.brand-wordmark { height: 15px; width: auto; object-fit: contain; }
.signin-logo { width: 180px; height: auto; object-fit: contain; }
.mainnav { display: flex; gap: 2px; flex-wrap: wrap; margin-left: 8px; }
.mainnav a, .subnav a {
  display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px;
  border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 14px;
}
.mainnav a { color: var(--deep-ink); }
.mainnav a:hover { background: var(--deep-2); color: #FFFFFF; }
.mainnav a[aria-current="page"] { background: var(--deep-2); font-weight: 600; color: #FFFFFF; }
.subnav a:hover { background: var(--line-soft); color: var(--ink); }
.subnav a[aria-current="page"] { background: var(--accent-soft); font-weight: 600; color: var(--accent); }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 14px; flex-wrap: wrap; color: var(--deep-ink); }
.top .who button.link { color: #FFFFFF; }
.top .badge { background: #12424F; color: #9BD3DE; }
.top .badge.warn { background: var(--warn-soft); color: var(--warn); }
.subnav { background: var(--surface); border-bottom: 1px solid var(--line); }
.subnav .top-in { padding-top: 2px; padding-bottom: 2px; gap: 2px; }
.count { font-size: 12px; font-weight: 700; background: var(--warn); color: #FFF; border-radius: 10px; padding: 1px 8px; }

.badge { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }

main { display: block; outline: none; }
.page { max-width: 1280px; margin: 0 auto; padding: 32px 16px 64px; display: flex; flex-direction: column; gap: 24px; }
.narrow { max-width: 960px; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.stat .k { font-size: 12px; font-weight: 600; color: var(--muted); }
.stat .v { font-size: 16px; font-weight: 600; }
.stat .big { font-size: 28px; font-weight: 600; }
.ok-text { color: var(--accent); }
.warn-text { color: var(--warn); }

button, .btn {
  font: inherit; min-height: 44px; padding: 0 18px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--surface); color: var(--accent); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
button.primary, .btn.primary { background: var(--accent); color: #FFF; border-color: var(--accent); }
button.primary:hover, .btn.primary:hover { background: var(--accent-ink); color: #FFF; }
button.danger { border-color: var(--warn); color: var(--warn); }
button.danger.primary { background: var(--warn); color: #FFF; }
button.big { min-height: 56px; padding: 0 32px; font-size: 18px; border-radius: 8px; }
button:disabled { background: #E8EEEF; border-color: #C9D3D6; color: #4F5D63; cursor: not-allowed; }
button.link { border: 0; background: none; padding: 0 4px; color: var(--accent); text-decoration: underline; font-weight: 400; }
button.ghost { border: 1px dashed var(--muted); color: var(--ink); font-weight: 400; }
button.pill { min-height: 36px; padding: 0 12px; font-size: 13px; }
button[aria-pressed="true"] { background: var(--accent); color: #FFF; }

label { font-size: 14px; font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
input[type=text], input[type=password], input[type=email], input[type=search], input[type=date], input[type=number], select, textarea {
  font: inherit; height: 44px; border: 1px solid var(--field); border-radius: 8px; padding: 0 12px;
  background: var(--surface); color: var(--ink); width: 100%;
}
textarea { height: auto; min-height: 88px; padding: 10px 12px; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 400; }
.hint { font-size: 13px; color: var(--muted); font-weight: 400; }

details.more { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 16px; }
details.more + details.more { margin-top: -13px; border-top-left-radius: 0; border-top-right-radius: 0; }
details.more summary { cursor: pointer; min-height: 48px; display: flex; align-items: center; font-weight: 600; color: var(--accent); font-size: 14px; }
details.more > div { padding: 0 0 16px; }

/* The clean room */
.room {
  border: 2px solid var(--accent); border-radius: 16px; padding: 32px 20px; min-height: 360px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center;
  background-color: #F8FAFA;
  background-image: linear-gradient(#E8EEEF 1px, transparent 1px), linear-gradient(90deg, #E8EEEF 1px, transparent 1px);
  background-size: 32px 32px;
}
.room.over { background-color: var(--accent-soft); border-style: dashed; }
.sealed { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); padding: 4px 10px; border-radius: 12px; }
.filebox { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.steps { width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.step { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; font-size: 14px; color: var(--muted); }
.step .mark { width: 20px; text-align: center; font-weight: 700; }
.step.now { color: var(--ink); }
.step.now .mark { color: var(--warn); }
.step.done { color: var(--ink); }
.step.done .mark { color: var(--accent); }

/* Chat */
.chatwrap { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.chatlist { flex: 0 0 260px; display: flex; flex-direction: column; gap: 8px; }
.chatlist a { display: flex; flex-direction: column; justify-content: center; min-height: 44px; padding: 6px 12px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 14px; }
.chatlist a:hover { background: var(--line-soft); color: var(--ink); }
.chatlist a[aria-current="true"] { background: var(--accent-soft); font-weight: 600; }
.convo { flex: 999 1 560px; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.msgs { display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; flex-direction: column; gap: 8px; }
.msg.q { align-items: flex-end; }
.bubble { max-width: 760px; border-radius: 10px; padding: 12px 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.q .bubble { background: var(--deep); color: #FFFFFF; border-radius: 14px 14px 4px 14px; }
.msg.a .bubble { background: var(--ground); }
.sources { display: flex; flex-wrap: wrap; gap: 6px; max-width: 760px; }
.sources details { border: 1px solid var(--line); border-radius: 16px; padding: 0 10px; font-size: 13px; background: var(--surface); }
.sources details[open] { border-radius: 8px; flex-basis: 100%; }
.sources summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; gap: 6px; }
.sources summary b { color: var(--accent); }
.sources .snip { padding: 4px 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.answered { font-size: 12px; color: var(--muted); max-width: 760px; }
.note { background: var(--warn-soft); border-radius: 6px; padding: 10px 14px; font-size: 13px; }
.info { background: var(--accent-soft); border-radius: 6px; padding: 10px 14px; font-size: 13px; }
.askrow { display: flex; gap: 10px; }
.askrow input { height: 48px; font-size: 15px; }

/* Tables */
.tablebox { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { font-size: 14px; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; overflow-wrap: anywhere; }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { border: 1px solid var(--line-soft); border-radius: 6px; padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-start; }
.bar { flex: 1; height: 8px; background: var(--line-soft); border-radius: 4px; min-width: 80px; }
.bar > div { height: 8px; background: var(--accent); border-radius: 4px; }
pre.log { margin: 0; background: #F8FAFA; border: 1px solid var(--line-soft); border-radius: 6px; padding: 12px; font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 560px; overflow: auto; }

/* Sign in */
.signin { min-height: 100vh; background: linear-gradient(var(--deep) 0, var(--deep) 280px, var(--ground) 280px); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 16px; gap: 24px; }
.signin form { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 32px; display: flex; flex-direction: column; gap: 20px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 50; max-width: min(720px, calc(100% - 32px)); background: var(--ink); color: #FFF; padding: 12px 16px; border-radius: 8px; font-size: 14px; white-space: pre-wrap; }
.toast.ok { background: var(--accent-ink); }

@media (max-width: 640px) {
  .who { margin-left: 0; }
  .mainnav { margin-left: 0; }
  .askrow { flex-direction: column; }
}

.consent { display: flex; gap: 8px; align-items: flex-start; text-align: left; max-width: 560px; margin: 4px auto 0; line-height: 1.4; }
.consent input { margin-top: 3px; flex: none; }

/* Find by place: outlines on a plain grid (no background map). */
.placemap { display: block; max-width: 100%; height: auto; border-radius: var(--radius); }

/* Home (UI/UX step 2): Activity and Protection, counts only. */
.home-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.period { display: flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.period button { min-height: 40px; border: 0; background: transparent; color: var(--muted); padding: 0 14px; }
.period button[aria-pressed="true"] { background: var(--deep); color: #FFFFFF; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: var(--warn-soft); border: 1px solid #F0C99F; border-radius: 12px; padding: 14px 18px; color: var(--warn); text-decoration: none; font-size: 15px; }
.banner:hover { color: var(--warn); border-color: var(--warn); }
.banner span { font-weight: 600; font-size: 14px; }
.section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 22px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.metric .k { font-size: 14px; font-weight: 500; color: var(--muted); }
.metric .n { font-size: 36px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--accent); }
.metric.shield .n { color: var(--shield); }
.spark { display: flex; align-items: flex-end; gap: 5px; height: 34px; }
.spark span { width: 12px; background: var(--brand); border-radius: 3px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.ring { flex: none; width: 72px; height: 72px; border-radius: 50%; border: 10px solid var(--shield); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; color: var(--shield); box-sizing: border-box; }
.ring.bad { border-color: var(--warn); color: var(--warn); }
.feed { display: flex; flex-direction: column; }
.feed-row { display: flex; gap: 12px; align-items: baseline; border-top: 1px solid var(--line-soft); padding: 8px 0; font-size: 14px; line-height: 1.45; }
.feed-row .mono { min-width: 108px; }

/* Clean room steps (UI/UX step 3): live stage, what each step found, how long it took. */
.steps { max-width: 560px; gap: 10px; }
.step { align-items: flex-start; gap: 14px; padding: 12px 14px; border-radius: 10px; color: var(--ink); }
.step .dot { flex: none; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; background: var(--line-soft); color: var(--muted); }
.step.now .dot { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 2px var(--brand); }
.step.done .dot { background: var(--accent); color: #FFFFFF; }
.step.wait { color: var(--muted); }
.step .body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.thin { height: 6px; background: var(--line-soft); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.thin > div { height: 100%; background: var(--brand); border-radius: 99px; transition: width .3s; }
.thin.busy > div { animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
@media (prefers-reduced-motion: reduce) { .thin.busy > div { animation: none; } }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 2px; text-align: left; }
.tile .n { font-size: 26px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.tile.shield .n { color: var(--shield); }
@media (max-width: 640px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tstep { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr) 64px; gap: 12px; align-items: center; font-size: 14px; }
.tbar { height: 12px; background: var(--line-soft); border-radius: 99px; overflow: hidden; }
.tbar > div { height: 100%; background: var(--brand); border-radius: 99px; }
.tstep .mono { text-align: right; }

/* Chat (UI/UX step 3): answers as cards, sources as chips, the model line and notice below. */
.msg.a .bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; line-height: 1.6; }
.convo { border-radius: 14px; }
.sources details { border-radius: 8px; }
.sources summary b { color: var(--accent); }
.answered { font-size: 13px; color: var(--muted); border-top: 1px solid var(--line-soft); padding-top: 8px; line-height: 1.5; }
.askrow input { border-radius: 10px; }
.chatlist a[aria-current="true"] { background: var(--accent-soft); color: var(--ink); }
.tag.shield { background: var(--shield-soft); color: var(--shield); }
/* AI providers (UI/UX step 4) */
.item.provider { align-items: center; }
.item .approval-slot { flex: 1 1 100%; }
.approval { margin-top: 4px; background: var(--ground); }

/* Three areas, Home and the admin set-up (Dredge 3.0, experience step 3; docs/UI.md) */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.home { max-width: 980px; }
.askbox { gap: 12px; padding: 16px; border-color: #C9D3D6; box-shadow: 0 1px 2px rgba(13,43,53,.06); }
.askbox textarea { border: 0; resize: none; font: inherit; font-size: 18px; line-height: 1.5; color: var(--ink); background: transparent; padding: 4px; min-height: 84px; width: 100%; }
.askbox textarea:focus-visible { outline: none; }
.askbox:focus-within { border-color: var(--accent); }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.recent { display: flex; justify-content: space-between; gap: 12px; text-decoration: none; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.recent span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-bar { height: 8px; border-radius: 4px; background: var(--line); max-width: 460px; }
.progress-bar span { display: block; height: 8px; border-radius: 4px; background: var(--accent); }
.setup-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.setup-list li { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.setup-list li:last-child { border-bottom: 0; }
.setup-list .mark { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: none; border: 2px solid #C9D3D6; color: var(--muted); }
.setup-list li.done .mark { background: var(--accent); border-color: var(--accent); color: #FFF; }
