/* NuPermits. Palette from the trade: blueprint blue, highway-sign green, stamp red, drafting-vellum grey. */
@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-latin-wdth-normal.woff2") format("woff2-variations");
  font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-latin-ext-wdth-normal.woff2") format("woff2-variations");
  font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --paper: #f3f5f8; --surface: #ffffff; --sunk: #e9edf2;
  --ink: #15202f; --muted: #566273; --faint: #8a94a3; --line: #d9dfe7;
  --blue: #2146c7; --blue-soft: #e4eafc; --nav: #0f2148; --nav-ink: #c9d4ee; --nav-on: #ffffff;
  --green: #17764b; --green-soft: #dff2e8; --amber: #a15e00; --amber-soft: #fbeed3;
  --red: #b3291f; --red-soft: #fbe3e0; --violet: #5d44b8; --violet-soft: #ebe6fa;
  --bar: #2f5be0; --bar-soft: #b9c8f5;
  --radius: 10px; --radius-s: 6px;
  --shadow: 0 1px 2px rgba(16, 32, 72, .06), 0 6px 20px -12px rgba(16, 32, 72, .25);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0d1420; --surface: #151f30; --sunk: #1c2940;
    --ink: #e7ecf4; --muted: #a3afc2; --faint: #76839a; --line: #2a3850;
    --blue: #8eabff; --blue-soft: #1d2d57; --nav: #0a111d; --nav-ink: #9eadc9; --nav-on: #ffffff;
    --green: #5fcf9a; --green-soft: #143526; --amber: #f0b354; --amber-soft: #3a2b0d;
    --red: #ff8f85; --red-soft: #47201c; --violet: #b6a4ff; --violet-soft: #2b2450;
    --bar: #6f93ff; --bar-soft: #2c4179;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 15px/1.5 "Archivo", system-ui, sans-serif; font-stretch: 100%;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { font-stretch: 78%; font-weight: 700; line-height: 1.12; margin: 0; letter-spacing: -.005em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; font-stretch: 88%; }
p { margin: 0 0 .75rem; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.right { text-align: right; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
[hidden] { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.nav { background: var(--nav); color: var(--nav-ink); padding: 20px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; color: var(--nav-on); font-stretch: 70%; font-weight: 800; font-size: 1.45rem; letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.brand svg { width: 30px; height: 30px; }
.nav a.item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-s); color: var(--nav-ink); font-weight: 500; }
.nav a.item:hover { background: rgba(255, 255, 255, .07); color: var(--nav-on); text-decoration: none; }
.nav a.item.on { background: #fff; color: #0f2148; }
.nav .count { margin-left: auto; background: #ffd24a; color: #2a2000; border-radius: 99px; padding: 0 7px; font-size: .78rem; font-weight: 700; }
.nav .sep { margin: 14px 10px 6px; font-size: .78rem; color: #8493b8; }
.nav .foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .85rem; }
.nav .foot a { color: var(--nav-ink); text-decoration: underline; }
.nav .foot .who { color: var(--nav-on); font-weight: 600; }
.nav .foot button { background: none; border: 0; padding: 0; color: var(--nav-ink); font: inherit; cursor: pointer; text-decoration: underline; }
main { padding: 28px 32px 64px; min-width: 0; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px; margin-bottom: 22px; }
.head .grow { flex: 1 1 320px; min-width: 0; }
.head p { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }
.crumb { font-size: .85rem; margin-bottom: 6px; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 8px; gap: 4px; }
  .brand { padding: 0 8px; font-size: 1.2rem; } .brand span, .nav .sep, .nav .foot .who { display: none; }
  .nav a.item { white-space: nowrap; padding: 8px 10px; }
  .nav .foot { margin: 0 0 0 auto; border: 0; padding: 0 8px; white-space: nowrap; }
  main { padding: 18px 16px 48px; }
  h1 { font-size: 1.6rem; }
}

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--radius-s); padding: 8px 13px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--faint); text-decoration: none; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0b1530; } }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--red); }
.btn.small { padding: 4px 9px; font-size: .85rem; }
.btn.link { border: 0; background: none; padding: 0; color: var(--blue); font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 10px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 4px; }
label .hint, .hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
.field { margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 18px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }
form.inline { display: inline; }
.row > input, .row > select { width: auto; flex: 0 1 220px; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > header { display: flex; align-items: baseline; gap: 10px; padding: 14px 18px 0; }
.card > header h2 { flex: 1; }
.card .body { padding: 14px 18px 18px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; margin-bottom: 18px; }
.cols.wide { grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); }
@media (max-width: 1100px) { .cols.wide { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 18px; }
.flash { border-radius: var(--radius-s); padding: 10px 14px; margin-bottom: 14px; border: 1px solid; font-weight: 500; }
.flash.ok { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.flash.error { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.flash.warn { background: var(--amber-soft); border-color: var(--amber); color: var(--amber); }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }

/* ---------- the permit route (signature element) ---------- */
.route { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin-bottom: 18px; filter: drop-shadow(0 6px 14px rgba(16, 32, 72, .12)); }
.route a { position: relative; display: block; padding: 16px 14px 14px 34px; background: var(--surface); color: var(--ink); min-height: 104px;
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 50%, calc(100% - 20px) 100%, 0 100%, 20px 50%); margin-right: -14px; }
.route a:first-child { clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 50%, calc(100% - 20px) 100%, 0 100%); padding-left: 18px; border-radius: var(--radius) 0 0 var(--radius); }
.route a:last-child { margin-right: 0; }
.route a:hover { background: var(--blue); color: #fff; text-decoration: none; }
@media (prefers-color-scheme: dark) { .route a:hover { color: #0b1530; } }
.route .n { font-size: 2.6rem; font-weight: 800; font-stretch: 68%; line-height: 1; display: block; }
.route .l { font-weight: 600; display: block; margin-top: 4px; }
.route .s { display: block; font-size: .8rem; opacity: .75; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 14px; }
.route a.zero .n { color: var(--faint); }
@media (max-width: 760px) { .route { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; filter: none; }
  .route a, .route a:first-child { clip-path: none; margin: 0; padding: 12px 14px; min-height: 0; border-radius: var(--radius-s); border: 1px solid var(--line); } }

.track { display: flex; gap: 3px; margin: 10px 0 0; padding: 0; list-style: none; max-width: 560px; }
.track li { flex: 1; text-align: center; font-size: .8rem; font-weight: 600; padding: 5px 4px 5px 12px; background: var(--sunk); color: var(--muted);
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%, 9px 50%); }
.track li:first-child { clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%); padding-left: 6px; }
.track li.done { background: var(--bar-soft); color: var(--ink); }
.track li.now { background: var(--blue); color: #fff; }
@media (prefers-color-scheme: dark) { .track li.now { color: #0b1530; } }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 2px 10px 2px 8px; font-size: .82rem; font-weight: 600; white-space: nowrap; background: var(--sunk); color: var(--muted); }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.intake { background: var(--sunk); color: var(--ink); }
.chip.review { background: var(--blue-soft); color: var(--blue); }
.chip.issued { background: var(--green-soft); color: var(--green); }
.chip.inspection { background: var(--amber-soft); color: var(--amber); }
.chip.billing { background: var(--violet-soft); color: var(--violet); }
.chip.failed { background: var(--red-soft); color: var(--red); }
.tag { display: inline-block; border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; font-size: .78rem; font-weight: 600; color: var(--muted); }
.tag.high { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.tag.warn { border-color: var(--amber); color: var(--amber); background: var(--amber-soft); }
.tag.info { border-color: var(--line); }

/* ---------- tables and lists ---------- */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .8rem; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th a { color: inherit; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--blue-soft) 45%, transparent); }
td .sub { display: block; color: var(--muted); font-size: .85rem; }
td.tight, th.tight { width: 1%; white-space: nowrap; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: flex-start; padding: 11px 18px; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .t { font-weight: 600; color: var(--ink); display: block; }
.list .b { color: var(--muted); font-size: .88rem; display: block; overflow-wrap: anywhere; }
.list li.unread { background: color-mix(in srgb, var(--blue-soft) 55%, transparent); }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; }
.tabs a { padding: 6px 12px; border-radius: 99px; color: var(--muted); font-weight: 600; }
.tabs a:hover { background: var(--sunk); text-decoration: none; }
.tabs a.on { background: var(--ink); color: var(--paper); }
.filters { display: grid; grid-template-columns: minmax(200px, 2fr) repeat(3, minmax(140px, 1fr)) auto; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
@media (max-width: 900px) { .filters { grid-template-columns: 1fr 1fr; } }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); }

/* ---------- stats and charts ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; margin-bottom: 18px; }
.stats a { display: block; padding: 4px 18px 4px 0; color: var(--ink); border-left: 3px solid var(--line); padding-left: 14px; }
.stats a:hover { border-color: var(--blue); text-decoration: none; }
.stats .n { font-size: 1.7rem; font-weight: 800; font-stretch: 72%; line-height: 1.1; display: block; }
.stats .l { color: var(--muted); font-size: .88rem; }
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--bar); }
.chart .bar.now { fill: var(--bar-soft); stroke: var(--bar); stroke-width: 1.5; stroke-dasharray: 3 3; }
.chart .bar:hover, .hbar:hover rect.v { fill: var(--blue); }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .val { fill: var(--ink); font-weight: 700; font-size: 12px; }
.hbars { display: grid; grid-template-columns: minmax(90px, max-content) minmax(60px, 1fr) max-content; gap: 9px 12px; align-items: center; }
.hbars svg { width: 100%; height: 10px; display: block; }
.hbars rect.bg { fill: var(--sunk); } .hbars rect.v { fill: var(--bar); }
.hbars .num { font-weight: 700; }
#tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--paper); padding: 5px 9px; border-radius: 6px; font-size: .82rem; font-weight: 600; white-space: nowrap; }

/* ---------- job page ---------- */
dl.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 16px; margin: 0; }
dl.facts dt { color: var(--muted); font-size: .88rem; padding-top: 1px; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
dl.facts.site { gap: 10px 16px; }
dl.facts.site dt { max-width: 150px; }
.callout { border-left: 4px solid var(--amber); background: var(--amber-soft); padding: 12px 16px; border-radius: 0 var(--radius-s) var(--radius-s) 0; }
.callout.high { border-color: var(--red); background: var(--red-soft); }
.callout h3 { margin-bottom: 4px; }
.log { list-style: none; margin: 0; padding: 0 18px 8px; }
.log li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; padding: 9px 0; border-top: 1px solid var(--line); }
.log li:first-child { border-top: 0; }
.log .when { color: var(--muted); font-size: .85rem; font-weight: 600; }
.log .when small { display: block; font-weight: 400; color: var(--faint); }
.log li.status .what, .log li.system .what { color: var(--muted); font-style: italic; }
.log li.ai .what { display: flex; gap: 10px; align-items: flex-start; }
.log li.ai { background: color-mix(in srgb, var(--violet-soft) 60%, transparent); margin: 0 -18px; padding: 9px 18px; }
.log .by { color: var(--faint); font-size: .82rem; }
details > summary { cursor: pointer; color: var(--blue); font-weight: 600; }

/* ---------- brain ---------- */
.brainbtn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; padding: 0; }
.brainbtn:hover { color: var(--violet); border-color: var(--violet); background: var(--violet-soft); }
.brainbtn.has { color: var(--violet); border-color: var(--violet); }
#drawer { position: fixed; inset: 0 0 0 auto; width: min(560px, 100vw); background: var(--surface); border-left: 1px solid var(--line); box-shadow: -18px 0 40px -20px rgba(8, 16, 40, .45); z-index: 40; display: flex; flex-direction: column; }
#drawer > header { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
#drawer > header h2 { flex: 1; }
#drawer .scroll { overflow-y: auto; padding: 18px 20px 40px; }
#scrim { position: fixed; inset: 0; background: rgba(8, 16, 40, .35); z-index: 39; }
.ai h3 { margin: 20px 0 8px; }
.ai ul { margin: 0; padding-left: 18px; } .ai li { margin-bottom: 6px; }
.ai .job { color: var(--muted); margin-bottom: 14px; }
.verdict { border-radius: var(--radius); padding: 14px 16px; background: var(--sunk); border-left: 5px solid var(--faint); }
.verdict.likely { background: var(--green-soft); border-color: var(--green); }
.verdict.possible { background: var(--amber-soft); border-color: var(--amber); }
.verdict.unlikely { background: var(--red-soft); border-color: var(--red); }
.verdict .call { font-size: 1.5rem; font-weight: 800; font-stretch: 72%; }
.verdict p { margin: 6px 0 0; }
.docs { list-style: none !important; padding: 0 !important; }
.docs li { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.docs li:first-child { border-top: 0; }
.spin { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--violet); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 4s; } }
.working { display: flex; gap: 14px; align-items: center; padding: 18px; background: var(--violet-soft); border-radius: var(--radius); }

/* ---------- sign-in ---------- */
.gate { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 460px); }
.gate .art { background: var(--nav); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
  background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px); background-size: 28px 28px; }
.gate .art h1 { font-size: clamp(2.4rem, 5vw, 4.2rem); font-stretch: 66%; font-weight: 800; line-height: .98; max-width: 11ch; }
.gate .art p { color: #c9d4ee; max-width: 44ch; margin-top: 16px; }
.gate .panel { padding: 48px 40px; display: flex; flex-direction: column; justify-content: center; background: var(--surface); }
.gate .panel h2 { font-size: 1.6rem; margin-bottom: 6px; }
.gate .panel form { margin-top: 18px; }
.gate .btn.primary { width: 100%; justify-content: center; padding: 11px; }
@media (max-width: 800px) { .gate { grid-template-columns: 1fr; } .gate .art { padding: 28px 24px; } .gate .art p { display: none; } .gate .panel { padding: 28px 24px; } }
.qr { width: 200px; height: 200px; background: #fff; border-radius: var(--radius-s); border: 1px solid var(--line); display: block; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-family: ui-monospace, Menlo, monospace; font-size: 1rem; background: var(--sunk); padding: 16px; border-radius: var(--radius-s); margin: 14px 0; }
.secret { font-family: ui-monospace, Menlo, monospace; font-size: 1.05rem; background: var(--sunk); padding: 10px 12px; border-radius: var(--radius-s); overflow-wrap: anywhere; user-select: all; }
.otp { font-size: 1.5rem !important; letter-spacing: .3em; text-align: center; font-weight: 700; }

hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.geo p { margin-bottom: 6px; }
