/* Tescom Feasibility. Palette drawn from fibre plant: duct blue, connector amber. */
:root {
  --bg: #EDF1F4;
  --surface: #FFFFFF;
  --ink: #142433;
  --muted: #5A6A79;
  --line: #D3DCE3;
  --duct: #0B5C7A;
  --duct-dark: #08465D;
  --amber: #F2A900;
  --ok: #1F7A45;
  --ok-bg: #E3F2E8;
  --bad: #B3372F;
  --bad-bg: #FBE7E5;
  --wait: #8A5A00;
  --wait-bg: #FFF2D1;
  --info-bg: #E2EEF4;
  --radius-sm: 4px;
  --radius: 8px;
  --font: "Barlow", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-head: "Barlow Semi Condensed", "Barlow", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); }
a { color: var(--duct); }
a:hover { color: var(--duct-dark); }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 .5rem; }
h1 { font-size: 2rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.35rem; font-weight: 600; margin-top: 1.75rem; }
h3 { font-size: 1.1rem; font-weight: 600; margin-top: 1.5rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* top bar: a dark duct with an amber strand along the bottom */
.topbar { background: var(--ink); color: #fff; display: flex; align-items: center; gap: 1.5rem;
  padding: 0 1.5rem; min-height: 58px; border-bottom: 3px solid var(--amber); position: sticky; top: 0; z-index: 1000; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none;
  font-family: var(--font-head); font-weight: 700; font-size: 1.2rem; white-space: nowrap; }
.brand:hover { color: #fff; }
.mainnav { display: flex; align-items: center; gap: .25rem; flex: 1; }
.mainnav a { color: #C9D6E0; text-decoration: none; padding: .4rem .7rem; border-radius: var(--radius-sm); font-weight: 500; }
.mainnav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.mainnav a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.14); }
.nav-spacer { flex: 1; }
.nav-toggle { display: none; margin-left: auto; background: none; color: #fff; border: 1px solid rgba(255,255,255,.4);
  border-radius: var(--radius-sm); padding: .35rem .8rem; font: inherit; }
.demo-banner { background: var(--wait-bg); color: var(--wait); text-align: center; padding: .4rem 1rem; font-weight: 500; }

.page { max-width: 1280px; margin: 0 auto; padding: 1.75rem 1.5rem 4rem; }
section { margin-bottom: 1.5rem; }

/* flash messages */
.flash { padding: .7rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border-left: 4px solid; }
.flash-success { background: var(--ok-bg); border-color: var(--ok); }
.flash-error { background: var(--bad-bg); border-color: var(--bad); }
.flash-warning { background: var(--wait-bg); border-color: var(--amber); }
.flash-info { background: var(--info-bg); border-color: var(--duct); }

/* forms */
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 500; font-size: .92rem; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
label.inline { flex-direction: row; align-items: center; gap: .4rem; font-weight: 400; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #B9C6D0;
  border-radius: var(--radius-sm); padding: .5rem .65rem; min-height: 40px; width: 100%; }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--duct); flex: none; }
input[type="file"] { padding: .4rem; }
input:focus, select:focus, textarea:focus { border-color: var(--duct); outline: 2px solid rgba(11,92,122,.25); outline-offset: 0; }
.stack { display: flex; flex-direction: column; gap: .9rem; max-width: 520px; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem 1rem; }
.span-2 { grid-column: span 2; }
.narrow { max-width: 520px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: 500 .95rem var(--font);
  padding: .5rem 1rem; min-height: 40px; border-radius: var(--radius-sm); border: 1px solid #A9B8C4; background: #fff;
  color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--duct); color: var(--duct); }
.btn-primary { background: var(--duct); border-color: var(--duct); color: #fff; }
.btn-primary:hover { background: var(--duct-dark); border-color: var(--duct-dark); color: #fff; }
.btn-lg { font-size: 1.05rem; padding: .7rem 1.6rem; min-height: 48px; }
.btn-sm { padding: .25rem .6rem; min-height: 32px; font-size: .85rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: var(--duct); cursor: pointer; font: inherit; text-decoration: underline; }
.link-btn.danger { color: var(--bad); }
.danger-zone { margin-top: 1.5rem; }

/* home: the search is the hero */
.search-hero { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 2rem 2rem 1.75rem; border-top: 6px solid var(--duct); }
.search-hero h1 { font-size: 2.3rem; max-width: 22ch; }
.search-hero > p { max-width: 70ch; }
.grid-search { display: grid; grid-template-columns: repeat(4, 1fr); gap: .9rem 1rem; margin: 1.25rem 0 1.25rem; }
.grid-search .span-2 { grid-column: span 2; }

.stats-row { display: grid; grid-template-columns: repeat(3, auto) 1fr; gap: 2.5rem; align-items: end;
  padding: 1.25rem .25rem; border-bottom: 1px solid var(--line); }
.stats-row strong { display: block; font-family: var(--font-head); font-size: 1.8rem; line-height: 1; }
.stats-row span { color: var(--muted); font-size: .88rem; }
.usage { justify-self: end; width: min(320px, 100%); }
.meter { height: 8px; background: #D9E1E7; border-radius: 4px; margin-top: .35rem; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--duct); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section-head h1, .section-head h2 { margin-bottom: .5rem; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-start; }
.head-actions form { margin: 0; }
.crumb { font-size: .9rem; color: var(--muted); margin-bottom: .3rem; }

/* tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; background: var(--surface); }
th { text-align: left; font-weight: 600; font-size: .82rem; color: var(--muted); padding: .6rem .75rem;
  border-bottom: 1px solid var(--line); background: #F6F8FA; white-space: nowrap; }
td { padding: .6rem .75rem; border-bottom: 1px solid #E6EBEF; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tr.dim td { opacity: .55; }
tr.best td { background: #F3FAF5; }
.empty { background: var(--surface); border: 1px dashed #B9C6D0; border-radius: var(--radius); padding: 1.1rem 1.25rem; color: var(--muted); }

.pill { display: inline-block; font-size: .78rem; font-weight: 600; padding: .1rem .55rem; border-radius: 999px;
  background: #E4E9ED; color: var(--ink); white-space: nowrap; }
.pill-feasible, .pill-closed { background: var(--ok-bg); color: var(--ok); }
.pill-not_feasible { background: var(--bad-bg); color: var(--bad); }
.pill-open { background: var(--info-bg); color: var(--duct-dark); }
.pill-on_hold { background: var(--wait-bg); color: var(--wait); }

.lic { font-size: .75rem; font-weight: 600; padding: .05rem .45rem; border-radius: var(--radius-sm); margin-left: .35rem; white-space: nowrap; }
.lic-licensed { background: var(--ok-bg); color: var(--ok); }
.lic-unverified { background: #E9EDF0; color: var(--muted); }
.lic-not_found { background: var(--bad-bg); color: var(--bad); }

.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin: .5rem 0 1rem; }
.filters input:not([type]), .filters input[name="q"] { width: 260px; }
.filters select, .filters input[type="date"] { width: auto; }
.pager { display: flex; gap: 1rem; justify-content: center; margin-top: 1rem; }

/* request detail */
.req-head { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.req-head .addr { font-size: 1.05rem; max-width: 75ch; }
.need { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.need span:not(.pill) { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .1rem .55rem; font-size: .9rem; font-weight: 500; }
.map-wrap { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
#map { height: 420px; background: #DCE4EA; }

/* distance rank: the numbers on the list match the numbers on the map */
.rank { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--duct); color: #fff; font: 600 .82rem var(--font-head); }
.isp-marker { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--duct);
  color: #fff; font: 600 12px var(--font-head); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(20,36,51,.45); }
.isp-marker.st-feasible, .isp-marker.st-quote_received { background: var(--ok); }
.isp-marker.st-not_feasible { background: var(--bad); }
.isp-marker.st-contacted { background: var(--wait); }
.isp-marker.st-no_response { background: #7A8894; }
.client-marker { width: 22px; height: 22px; border-radius: 50%; background: var(--amber); border: 4px solid var(--ink); }
tr[data-status="feasible"] .rank, tr[data-status="quote_received"] .rank { background: var(--ok); }
tr[data-status="not_feasible"] .rank { background: var(--bad); }
tr[data-status="contacted"] .rank { background: var(--wait); }
tr[data-status="no_response"] .rank { background: #7A8894; }
tr.flash-row td { background: #FFF8E1; transition: background 1.2s; }

.isp-table .isp-name { font-weight: 600; }
.isp-cell { min-width: 220px; }
.contact { display: flex; flex-direction: column; gap: .1rem; white-space: nowrap; }
.status-cell { min-width: 210px; }
.status-cell select, .status-cell input { min-height: 34px; padding: .3rem .5rem; font-size: .88rem; }
.status-cell input { margin-top: .3rem; }
.save-state { color: var(--ok); }
.save-state.err { color: var(--bad); }
.row-actions { display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
.rfq-bar { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-top: .9rem; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: start; }
.two-col > section { min-width: 0; }

/* login */
.page-login { min-height: 100vh; display: grid; place-items: center; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-top: 6px solid var(--duct);
  border-radius: var(--radius); padding: 2.25rem; width: min(420px, 100%); }
.login-card h1 { margin-top: .75rem; }
.login-card .stack { margin: 1.25rem 0 1rem; }

.users-table input:not([type="checkbox"]), .users-table select { min-height: 34px; padding: .3rem .5rem; min-width: 140px; }

@media (max-width: 1000px) {
  .grid-search { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; gap: 0; }
  .stats-row { grid-template-columns: repeat(3, 1fr); gap: 1rem; }
  .usage { grid-column: 1 / -1; justify-self: stretch; width: 100%; }
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; padding: .5rem 1rem; gap: .5rem; }
  .nav-toggle { display: block; }
  .mainnav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-bottom: .5rem; }
  .mainnav.open { display: flex; }
  .nav-spacer { display: none; }
  .page { padding: 1.25rem 1rem 3rem; }
  .search-hero { padding: 1.25rem; }
  .search-hero h1 { font-size: 1.75rem; }
  .grid-search, .grid-form { grid-template-columns: 1fr; }
  .grid-search .span-2, .span-2 { grid-column: auto; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  #map { height: 300px; }
  .filters input[name="q"] { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
