:root {
  --bg: #0f1115; --panel: #171a21; --ink: #e7e9ee; --muted: #99a1b3;
  --line: #262b36; --accent: #5b9dff; --green: #3fb950; --red: #f0506e; --amber: #d2a13a;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: "Cascadia Code", Consolas, monospace; color: #cdd6f4; }

.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 12px 22px; border-bottom: 1px solid var(--line); background: #12141a;
}
.topbar .brand { font-weight: 700; letter-spacing: .5px; }
.topbar nav { display: flex; gap: 16px; }
.topbar .tag { margin-left: auto; color: var(--muted); font-size: 13px; }

main { max-width: 920px; margin: 28px auto; padding: 0 22px; }
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 22px 26px; margin-bottom: 22px;
}
h1 { font-size: 22px; margin: 0 0 4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.field { display: block; margin: 14px 0; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input { width: 100%; }
.field.narrow { max-width: 240px; }
input[type=text] {
  background: #0d0f14; border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); padding: 9px 11px; font-size: 15px;
}
input[type=text]:focus { outline: none; border-color: var(--accent); }

fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 16px 0; padding: 12px 16px; }
legend { color: var(--muted); font-size: 13px; padding: 0 6px; }
fieldset.paid { border-color: #4a3a1d; background: #1c1810; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.chk.wide { align-items: baseline; margin: 3px 0; }
.chk.wide span { font-size: 13px; color: var(--muted); }
.chk.wide b { color: var(--ink); font-weight: 600; }

button {
  background: var(--accent); color: #06122b; border: 0; border-radius: 9px;
  padding: 10px 20px; font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 8px;
}
button:disabled { opacity: .6; cursor: default; }

.error { color: var(--red); margin-top: 12px; white-space: pre-wrap; }

.statusrow { display: flex; align-items: center; gap: 14px; margin: 8px 0 14px; }
.badge { padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.badge.running { background: #1d2740; color: var(--accent); }
.badge.done { background: #14301c; color: var(--green); }
.badge.failed { background: #36161f; color: var(--red); }

.log {
  background: #0a0c10; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; max-height: 62vh; overflow: auto; white-space: pre-wrap;
  font-family: "Cascadia Code", Consolas, monospace; font-size: 12.5px; color: #c7cedb;
}

.filter, input.filter {
  width: 100%; max-width: 360px; margin: 6px 0 16px;
  background: #0d0f14; border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); padding: 8px 11px;
}
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.tbl tr:hover td { background: #1b1f28; }
.badge:not(.running):not(.done):not(.failed) { background: #20242e; color: var(--muted); }

.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.btn {
  display: inline-block; background: var(--accent); color: #06122b; border-radius: 9px;
  padding: 9px 16px; font-weight: 600; font-size: 14px;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }

.artifacts { list-style: none; padding: 0; margin: 8px 0 0; }
.artifacts li { padding: 7px 0; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.artifacts li.miss { opacity: .5; }
.artifacts .miss-tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
h2 { font-size: 17px; margin: 0 0 6px; }

textarea {
  width: 100%; background: #0d0f14; border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); padding: 9px 11px; font-size: 14px; font-family: inherit; resize: vertical;
}
textarea:focus, input[type=text]:focus { outline: none; border-color: var(--accent); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; } }

/* Project-specific sub-navigation (below the top bar, on parcel-scoped pages) */
.subnav { display: flex; align-items: center; gap: 18px; padding: 8px 24px;
  background: #0d1017; border-bottom: 1px solid var(--line); font-size: 14px; }
.subnav-id { color: var(--muted); font-weight: 600; margin-right: 6px; }
.subnav a { color: var(--ink); text-decoration: none; padding: 3px 10px; border-radius: 6px; }
.subnav a:hover { background: #161b26; }
.subnav a.here { background: #161b26; color: var(--accent); }

/* Parcel hub: first-phase hero thumbnails (larger tiles than the data grid) */
.thumbs.hero .thumb { width: 240px; }
.thumbs.hero .thumb img { width: 240px; height: 170px; }
.thumbs.hero .thumb.noimg .ph-kind { width: 240px; height: 170px; }

/* Parcel hub: supplementary-data upload grid */
.upload-grid { display: flex; gap: 14px; flex-wrap: wrap; margin: 10px 0; }
.upload-grid .up-form { flex: 1 1 280px; }
.upload-grid fieldset { height: 100%; }

/* Run page: stage progress display */
.progress-outer { height: 10px; background: #0d0f14; border: 1px solid var(--line);
  border-radius: 6px; margin: 12px 0 14px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .6s; }
.stages { list-style: none; margin: 0 0 10px; padding: 0; }
.stages li { padding: 5px 2px; font-size: 14px; color: #67707e;
  border-bottom: 1px solid var(--line); }
.stages li:last-child { border-bottom: none; }
.stages li.active { color: var(--ink); font-weight: 600; }
.stages li.done { color: #7fbf7f; }
.stages li.failed { color: #e05555; font-weight: 600; }
.stages li.na { color: #67707e; font-style: italic; }
.stages .st-ico { display: inline-block; width: 20px; text-align: center; }
.stages li.active .st-ico { animation: spin 1.6s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.done-panel { margin: 14px 0; padding: 12px 14px; background: #0d1512;
  border: 1px solid #24523a; border-radius: 8px; }
.techlog { margin-top: 14px; }
.techlog .log { max-height: 320px; }

/* Proposal: considerations pick-list + generic scope menu */
.consid-grp { margin: 10px 0 2px; text-transform: uppercase; letter-spacing: .04em;
  font-size: 11px !important; color: var(--accent); }
.consid-line span { white-space: pre-line; }
.scope-row { margin: 2px 0; }
.scope-row .scope-detail { width: calc(100% - 34px); margin: 2px 0 6px 26px;
  font-size: 13px; padding: 6px 9px; }

/* New Job: form + coverage sidebar */
.newjob-grid { display: grid; grid-template-columns: 1fr 268px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .newjob-grid { grid-template-columns: 1fr; } }
.coverage h2 { font-size: 15px; margin: 0 0 8px; }
.coverage h3 { font-size: 13px; margin: 14px 0 4px; color: var(--accent); }
.coverage ul { list-style: none; margin: 6px 0 10px; padding: 0; }
.coverage li { padding: 4px 2px; font-size: 13px; border-bottom: 1px solid var(--line); }
.coverage li:last-child { border-bottom: none; }
.cov-tag { font-size: 11px; color: #8b93a3; }
.courses { margin: 8px 0 0; padding-left: 20px; font-size: 13px; color: #c7cedb; }
.courses li { padding: 2px 0; }

.figbox { background:#0a0c10; border:1px solid var(--line); border-radius:10px; padding:10px; min-height:280px; display:flex; align-items:center; justify-content:center; }
svg.figure { width: 100%; height: auto; }
svg.figure .course { fill:none; stroke:#6cd0ff; stroke-width:2; }
svg.figure .course.arc { stroke:#c792ea; }
svg.figure .closure { stroke:#f0506e; stroke-width:1.5; stroke-dasharray:5 4; }
svg.figure .pob { fill:#3fb950; }
svg.figure .pob-label { fill:#3fb950; font:11px monospace; }

.closure { font-weight:700; margin-bottom:8px; min-height:20px; }
.closure.good { color: var(--green); }
.closure.warn { color: var(--amber); }
.closure.bad  { color: var(--red); }

.banner { background:#2a1d10; border:1px solid #5a3d1d; color:#e0b070; border-radius:8px; padding:10px 14px; margin:10px 0; font-size:14px; }

/* folder pickers + in-app directory browser modal */
.folderpick { display:flex; gap:10px; align-items:center; }
.folderpick input[type=text] { flex:1; }
.filelist { margin-top:8px; font-size:13px; color:var(--muted); }

.modal { position:fixed; inset:0; background:rgba(0,0,0,.62); display:flex; align-items:center; justify-content:center; z-index:50; }
.modal[hidden] { display:none; }
.modal-box { background:var(--panel); border:1px solid var(--line); border-radius:12px; width:min(640px,93vw); max-height:88vh; display:flex; flex-direction:column; padding:18px 20px; }
.modal-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
.modal-head .x { background:transparent; color:var(--muted); font-size:22px; line-height:1; padding:0 6px; margin:0; }
.modal-head .x:hover { color:var(--ink); }
.modal-path { background:#0a0c10; border:1px solid var(--line); border-radius:8px; padding:6px 10px; margin-bottom:8px; overflow:auto; white-space:nowrap; }
.modal-list { overflow:auto; max-height:42vh; border:1px solid var(--line); border-radius:8px; }
.dm-item { padding:7px 12px; cursor:pointer; border-bottom:1px solid var(--line); font-size:14px; }
.dm-item:last-child { border-bottom:0; }
.dm-item:hover { background:#1b1f28; }
.dm-up { color:var(--accent); }
.modal-files { max-height:24vh; overflow:auto; display:flex; flex-direction:column; gap:4px; margin-top:6px; }
.modal-actions { display:flex; gap:10px; margin-top:14px; }

/* Deliverables: maps & imagery thumbnails + section sub-headings */
.deliv-sub { font-size:13px; text-transform:uppercase; letter-spacing:.5px; color:var(--muted);
  margin:16px 0 8px; }
.deliv-sub:first-of-type { margin-top:2px; }
.thumbs { display:flex; flex-wrap:wrap; gap:12px; }
.thumb { display:flex; flex-direction:column; align-items:center; gap:5px; width:150px;
  text-decoration:none; }
.thumb img { width:150px; height:110px; object-fit:cover; background:#fff;
  border:1px solid var(--line); border-radius:8px; }
.thumb:hover img { border-color:var(--accent); }
.thumb span { font-size:12.5px; color:var(--ink); text-align:center; line-height:1.3; }
/* placeholder tile when a PDF/DXF can't be rendered (too large / failed) */
.thumb .ph-kind { display:none; }
.thumb.noimg img { display:none; }
.thumb.noimg .ph-kind { display:flex; align-items:center; justify-content:center;
  width:150px; height:110px; border:1px dashed var(--line); border-radius:8px;
  background:#0d1017; color:var(--muted); font-size:13px; font-weight:700; letter-spacing:1.5px; }

/* Proposal: labeled client/owner fields (two-column) */
.client-grid { display:grid; grid-template-columns:1fr 1fr; gap:0 16px; }
.client-grid .full { grid-column:1 / -1; }
.csz { display:grid; grid-template-columns:2fr 1fr 1fr; gap:0 12px; }
@media (max-width:640px){ .client-grid { grid-template-columns:1fr; } }

/* Accumulating file lists on New Job (email threads / documents) */
.filelist { margin-top:8px; display:flex; flex-direction:column; gap:4px; }
.fl-item { display:flex; align-items:center; justify-content:space-between; gap:10px;
  background:#0d1017; border:1px solid var(--line); border-radius:7px; padding:5px 10px; font-size:13.5px; }
.fl-x { background:none; border:none; color:var(--muted); cursor:pointer; font-size:13px; padding:2px 6px; border-radius:5px; }
.fl-x:hover { color:var(--red); background:#2a1720; }

/* Breadcrumb bar on parcel sub-pages (intake / dictate / scope / proposal) */
.crumbs { color:var(--muted); font-size:13px; margin:0 0 14px; }
.crumbs a { color:var(--accent); }
.crumbs .sep { margin:0 7px; opacity:.55; }
.crumbs .here { color:var(--ink); font-weight:600; }

/* New Job: accept an APN that has no situs address on record */
.accept-panel { margin-top:14px; padding:14px 16px; border:1px solid var(--amber);
  border-left:4px solid var(--amber); border-radius:8px; background:#241f12; }
.accept-panel .ap-head { margin:0 0 4px; }
.accept-panel .field { margin-top:10px; }
.accept-panel .btn { margin-top:6px; }

/* Help page: how-to-use guide */
.panel h2 { font-size:17px; margin:0 0 10px; }
.panel.warn { border-left:4px solid var(--amber); }
.panel.warn h2 { color:var(--amber); }
.panel.attention { border:1px solid #2b4a7a; border-left:5px solid var(--accent);
  background:#0d1526; box-shadow:0 0 0 1px rgba(91,157,255,.08), 0 2px 14px rgba(91,157,255,.07); }
.panel.attention h2 { color:var(--accent); }
.badge.todo { background:#3a2a10; color:var(--amber); }
.badge.stopped { background:#3a2a10; color:var(--amber); }
.btn.stop { color:var(--red); border-color:#5a2733; margin-left:auto; }
.btn.stop:hover { background:#2a161d; }
.help-tbl { border-collapse:collapse; width:100%; margin-top:6px; font-size:13.5px; }
.help-tbl th, .help-tbl td { border:1px solid var(--line); padding:7px 10px; text-align:left; vertical-align:top; }
.help-tbl th { background:#12141a; color:var(--muted); font-weight:600; }

/* Scope page: auto-read client-email facts (free deterministic extraction) */
.email-scrape { background:#0d1526; border:1px solid var(--line); border-left:3px solid var(--accent);
  border-radius:8px; padding:10px 14px; margin:6px 0 12px; }
.email-scrape .es-head { font-weight:600; font-size:13px; margin-bottom:5px; }
.email-scrape .es-list { margin:0; padding-left:18px; }
.email-scrape .es-list li { padding:2px 0; font-size:13.5px; color:var(--ink); }
