/* Urbnix Ops. Brand: navy #0f1d33, gold #C9A24B, Cormorant Garamond + Outfit (self-hosted, SIL OFL). */
@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 500 700; font-display: swap; src: url(fonts/CormorantGaramond.woff2) format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: italic; font-weight: 500; font-display: swap; src: url(fonts/CormorantGaramond-italic.woff2) format('woff2'); }
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 300 600; font-display: swap; src: url(fonts/Outfit.woff2) format('woff2'); }

:root {
  --navy: #0f1d33;
  --navy-2: #182a47;
  --navy-3: #243a5e;
  --gold: #c9a24b;
  --gold-soft: #f3ead6;
  --bg: #f5f3ee;
  --card: #ffffff;
  --line: #e3dfd5;
  --text: #1b2433;
  --muted: #6b7280;
  --red: #b42318;
  --red-soft: #fdecea;
  --orange: #b54708;
  --orange-soft: #fef0e1;
  --blue: #2f5d8a;
  --blue-soft: #e8f0f8;
  --green: #18794e;
  --green-soft: #e6f4ec;
  --grey-soft: #eef0f3;
  --radius: 10px;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--sans); color: var(--text); background: var(--bg); }
a { color: var(--navy-3); }
a:hover { color: var(--navy); }
h1, h2, h3 { font-family: var(--serif); color: var(--navy); line-height: 1.15; margin: 0 0 .5rem; }
h1 { font-size: 2rem; font-weight: 600; }
h2 { font-size: 1.35rem; font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 600; margin-top: 1rem; }
code { font-size: .85em; background: var(--grey-soft); padding: .1em .35em; border-radius: 4px; }
.muted { color: var(--muted); }
.small, small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.wrap { word-break: break-all; }
.empty { color: var(--muted); font-style: italic; }

/* Shell */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: 56px; display: flex; align-items: center; gap: 1rem; padding: 0 1.25rem; background: var(--navy); color: #fff; z-index: 20; border-bottom: 2px solid var(--gold); }
.brand { display: flex; align-items: baseline; gap: .45rem; text-decoration: none; color: #fff; }
.brand-mark { font-family: var(--serif); font-weight: 700; font-size: 1.45rem; letter-spacing: .18em; color: #fff; }
.brand-sub { font-family: var(--sans); font-size: .8rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.who { color: #fff; text-decoration: none; text-align: right; line-height: 1.2; }
.who small { display: block; color: var(--gold); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.who:hover { color: var(--gold-soft); }
.demo-flag { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; border: 1px solid var(--gold); color: var(--gold); padding: .15rem .5rem; border-radius: 99px; }
.nav-toggle { display: none; background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 6px; padding: .3rem .6rem; font: inherit; }
.sidenav { position: fixed; top: 56px; bottom: 0; left: 0; width: 220px; background: var(--navy-2); padding: 1rem 0; display: flex; flex-direction: column; z-index: 15; overflow-y: auto; }
.sidenav a, .sidenav .linklike { display: block; padding: .6rem 1.4rem; color: #d6dbe4; text-decoration: none; font-size: .95rem; border-left: 3px solid transparent; }
.sidenav a:hover, .sidenav .linklike:hover { color: #fff; background: rgba(255,255,255,.05); }
.sidenav a.active { color: #fff; border-left-color: var(--gold); background: rgba(201,162,75,.12); }
.signout { margin-top: 1rem; border-top: 1px solid rgba(255,255,255,.08); padding-top: .5rem; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; width: 100%; text-align: left; }
.nav-foot { margin-top: auto; padding: 1rem 1.4rem 0; color: #7f8aa0; font-size: .75rem; }
.main { padding: 1.5rem 2rem 3rem; max-width: 1400px; }
.has-nav .main { margin: 56px 0 0 220px; }
.no-nav .main { margin: 0 auto; min-height: 100vh; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 1.5rem 1rem; }

/* Page */
.page-head { margin-bottom: 1.25rem; }
.page-head p { margin: .2rem 0 0; }
.with-actions { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.crumbs { margin: 0 0 .25rem !important; font-size: .85rem; }
.crumbs a { color: var(--muted); }
.meta-line { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; margin-bottom: 1.25rem; box-shadow: 0 1px 2px rgba(15,29,51,.04); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.25rem; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 0 1.25rem; }
.prose { white-space: normal; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .9rem; margin-bottom: 1.25rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--navy-3); border-radius: var(--radius); padding: .9rem 1rem; text-decoration: none; color: var(--text); display: flex; flex-direction: column; }
.kpi:hover { border-top-color: var(--gold); }
.kpi-n { font-family: var(--serif); font-size: 2rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.kpi-l { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kpi-alert { border-top-color: var(--red); background: var(--red-soft); }
.kpi-alert .kpi-n { color: var(--red); }
.kpi-warn { border-top-color: var(--orange); }
.kpi-warn .kpi-n { color: var(--orange); }

/* Charts (inline SVG) */
.bars { width: 100%; max-width: 560px; height: auto; display: block; margin: .25rem 0 .75rem; }
.bar-label { font: 13px var(--sans); fill: var(--text); }
.bar-value { font: 600 13px var(--sans); fill: var(--navy); }
.bar { fill: var(--navy-3); }
.bar.prio-p1 { fill: var(--red); }
.bar.prio-p2 { fill: var(--orange); }
.bar.prio-p3 { fill: var(--blue); }
.bar.prio-p4 { fill: #98a2b3; }
.bar.won { fill: var(--green); }
.bar.lost { fill: #98a2b3; }
.bar.region { fill: var(--gold); }

/* Tables */
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 500; padding: .7rem .9rem; border-bottom: 1px solid var(--line); background: #faf9f6; }
.table td { padding: .7rem .9rem; border-bottom: 1px solid #efece5; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table.compact td, .table.compact th { padding: .45rem .5rem; }
.card .table.compact th { background: transparent; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-alert td { background: #fff7f6; }
.table-wrap .table td:first-child, .table-wrap .table th:first-child { padding-left: 1.4rem; }
.audit .detail { max-width: 420px; word-break: break-word; color: var(--muted); }

/* Pills */
.pill { display: inline-block; font-size: .74rem; font-weight: 500; padding: .12rem .55rem; border-radius: 99px; background: var(--grey-soft); color: #344054; white-space: nowrap; }
.prio-p1 { background: var(--red-soft); color: var(--red); }
.prio-p2 { background: var(--orange-soft); color: var(--orange); }
.prio-p3 { background: var(--blue-soft); color: var(--blue); }
.prio-p4 { background: var(--grey-soft); color: #475467; }
.pill-new, .pill-new-lead, .pill-unassigned { background: var(--gold-soft); color: #7a5c14; }
.pill-open, .pill-dispatched, .pill-contacted, .pill-prospect { background: var(--blue-soft); color: var(--blue); }
.pill-in-progress, .pill-consultation-booked, .pill-quote-sent, .pill-negotiating { background: #ede9fe; color: #5b21b6; }
.pill-waiting-on-client, .pill-on-hold { background: var(--orange-soft); color: var(--orange); }
.pill-resolved, .pill-closed, .pill-completed, .pill-won, .pill-client, .pill-active { background: var(--green-soft); color: var(--green); }
.pill-lost, .pill-cancelled, .pill-former-client, .pill-off { background: var(--grey-soft); color: #667085; }
.pill-internal { background: #fff4d6; color: #7a5c14; }
.sla { font-size: .8rem; font-weight: 500; white-space: nowrap; }
.sla-ok { color: var(--green); }
.sla-soon { color: var(--orange); }
.sla-breached, .sla-missed { color: var(--red); font-weight: 600; }
.sla-met { color: var(--green); }
.chip { display: inline-block; font-size: .78rem; border: 1px solid var(--line); border-radius: 6px; padding: .1rem .45rem; margin: 0 .2rem .3rem 0; background: #faf9f6; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.span-2 { grid-column: span 2; }
.field { display: block; margin-bottom: .9rem; }
.field > span { display: block; font-size: .8rem; font-weight: 500; color: #475467; margin-bottom: .3rem; }
.field small { display: block; color: var(--muted); margin-top: .25rem; }
input, select, textarea { font: inherit; width: 100%; padding: .55rem .7rem; border: 1px solid #cfd4dc; border-radius: 7px; background: #fff; color: var(--text); }
input[type=checkbox], input[type=radio] { width: auto; margin-right: .35rem; accent-color: var(--navy); }
input[type=file] { padding: .45rem; background: #faf9f6; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(201,162,75,.55); outline-offset: 1px; border-color: var(--gold); }
textarea { resize: vertical; }
.checks { border: 1px solid var(--line); border-radius: 8px; padding: .75rem 1rem; margin: 0 0 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .2rem 1rem; }
.checks legend { font-size: .8rem; font-weight: 500; color: #475467; padding: 0 .3rem; }
.checks label, .check { font-size: .9rem; display: flex; align-items: center; }
.check { margin-bottom: .9rem; }
.stack > * { margin-bottom: .75rem; }
.stack form { margin: 0 0 .6rem; }
.inline-row { display: flex; gap: .5rem; }
.inline-row input { flex: 1; }
.seg { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-bottom: .75rem; }
.seg label { display: flex; align-items: center; font-size: .92rem; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filters input, .filters select { width: auto; min-width: 150px; }
.filters input[name=q] { min-width: 260px; }
.inline-form summary { cursor: pointer; color: var(--navy-3); font-weight: 500; margin: .5rem 0; }
.role-help { color: #475467; padding-left: 1.1rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: 500 .9rem var(--sans); padding: .55rem 1rem; border-radius: 7px; border: 1px solid #cfd4dc; background: #fff; color: var(--navy); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--navy-3); color: var(--navy); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-3); color: #fff; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy); font-weight: 600; }
.btn-gold:hover { background: #b8913c; color: var(--navy); }
.btn-active { background: var(--gold-soft); border-color: var(--gold); }
.btn-block { width: 100%; }
.btn-xl { padding: 1rem 1.2rem; font-size: 1.1rem; }
.pager { display: flex; gap: .5rem; }

/* Flash */
.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; width: 100%; }
.flash-ok { background: var(--green-soft); border-color: #a6d8bd; color: #0f5132; }
.flash-error { background: var(--red-soft); border-color: #f4b4ad; color: #7a1a12; }
.flash-info { background: var(--blue-soft); border-color: #b7cde3; color: #1e3a5f; }

/* Detail lists and timeline */
.dl { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: .45rem 1rem; margin: 0; }
.dl dt { color: var(--muted); font-size: .85rem; }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-left: 2px solid var(--line); padding: .2rem 0 .9rem 1rem; position: relative; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: .45rem; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.timeline li.tl-client::before { background: var(--green); }
.timeline li.tl-kind-note::before { background: var(--gold); }
.timeline li.tl-client { background: linear-gradient(90deg, rgba(24,121,78,.05), transparent 60%); }
.tl-meta { font-size: .8rem; color: var(--muted); display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.tl-body { margin-top: .2rem; }
.files { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .5rem; }
.file { display: flex; flex-direction: column; width: 132px; font-size: .75rem; text-decoration: none; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #faf9f6; }
.file img { width: 100%; height: 96px; object-fit: cover; display: block; }
.file span { padding: .3rem .45rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Pipeline board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: .8rem; overflow-x: auto; padding-bottom: 1rem; }
.board-col { background: #ece8df; border-radius: var(--radius); padding: .75rem; min-height: 200px; }
.board-col h3 { margin: 0; font-size: 1.05rem; display: flex; justify-content: space-between; }
.board-col .count { font-family: var(--sans); font-size: .8rem; background: #fff; border-radius: 99px; padding: 0 .5rem; color: var(--muted); }
.board-sum { margin: 0 0 .6rem; font-size: .8rem; color: var(--muted); }
.lead-card { display: flex; flex-direction: column; gap: .1rem; background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--navy-3); border-radius: 8px; padding: .6rem .7rem; margin-bottom: .55rem; text-decoration: none; color: var(--text); font-size: .88rem; }
.lead-card:hover { border-left-color: var(--gold); }
.lead-foot { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); margin-top: .25rem; }

/* Technician (mobile-first cards) */
.mobile-section { max-width: 720px; margin-bottom: 1.5rem; }
.job-card { display: flex; flex-direction: column; gap: .15rem; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--navy-3); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: .75rem; text-decoration: none; color: var(--text); }
.job-card.status-in-progress { border-left-color: var(--gold); background: #fffdf7; }
.job-card.status-completed { border-left-color: var(--green); }
.job-card strong { font-size: 1.05rem; color: var(--navy); }
.job-when { font-size: .8rem; font-weight: 600; color: var(--navy-3); text-transform: uppercase; letter-spacing: .05em; }
.job-foot { display: flex; justify-content: space-between; align-items: center; margin-top: .35rem; }
.job-action { border: 2px solid var(--gold); background: #fffdf7; }

/* Sign-in */
.auth-card { background: #fff; width: 100%; max-width: 420px; border-radius: 14px; padding: 2rem; border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(15,29,51,.12); border-top: 4px solid var(--gold); }
.auth-wide { max-width: 560px; }
.auth-brand { display: flex; align-items: baseline; gap: .5rem; justify-content: center; background: var(--navy); margin: -2rem -2rem 1.5rem; padding: 1.1rem; border-radius: 10px 10px 0 0; }
.auth-card h1 { font-size: 1.7rem; }
.steps { padding-left: 1.2rem; }
.steps li { margin-bottom: .5rem; }
.secret { font-size: 1.05rem; letter-spacing: .08em; padding: .25rem .5rem; display: inline-block; }
.demo-note { text-align: center; color: var(--muted); font-size: .8rem; margin: 1rem 0 0; }
.no-nav { background: radial-gradient(circle at 30% 20%, #1d3256, var(--navy) 70%); }
.no-nav > .main > .flash { max-width: 420px; }

/* Responsive */
@media (max-width: 1100px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .nav-toggle { display: inline-block; }
  .sidenav { transform: translateX(-100%); transition: transform .2s ease; width: 240px; }
  .sidenav.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.25); }
  .has-nav .main { margin-left: 0; padding: 1rem 1rem 3rem; }
  .grid-2, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .demo-flag, .who small { display: none; }
  h1 { font-size: 1.6rem; }
  .dl { grid-template-columns: 110px minmax(0, 1fr); }
  .filters input[name=q] { min-width: 0; flex: 1 1 100%; }
  .table-wrap .table { min-width: 720px; }
  input, select, textarea { font-size: 16px; } /* prevents zoom on iPhone */
}

@media print {
  .topbar, .sidenav, .actions, .crumbs { display: none !important; }
  .has-nav .main { margin: 0; padding: 0; }
  .card { border: 0; box-shadow: none; }
  body { background: #fff; }
}

/* two-factor QR code */
.qr-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 14px 0 6px; }
.qr { width: 220px; height: 220px; background: #fff; padding: 8px; border-radius: 6px; }
.qr svg { width: 100%; height: 100%; display: block; }
.qr { position: relative; }
.qr-logo { position: absolute; left: 50%; top: 50%; width: 22%; height: 22%; transform: translate(-50%, -50%); background: #fff; border-radius: 6px; padding: 3px; display: grid; place-items: center; box-shadow: 0 0 0 2px #fff; }
.qr-logo img { width: 100%; height: 100%; object-fit: contain; }
