/* Gantari: SIL Open Font License 1.1, The Gantari Project Authors */
@font-face { font-family: Gantari; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/gantari-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Gantari; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/gantari-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: Gantari; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/gantari-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: Gantari; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/gantari-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: Gantari; font-style: normal; font-weight: 800; font-display: swap; src: url(/fonts/gantari-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: Gantari; font-style: italic; font-weight: 700; font-display: swap; src: url(/fonts/gantari-latin-700-italic.woff2) format("woff2"); }

:root {
  /* ARO brand: PMS 7705 C, 309 C, 7702 C + support colors */
  --brand: #007096;
  --brand-dark: #003b49;
  --brand-light: #48a9c5;
  --brand-hover: #005d7d;
  --ink: #003b49;
  --text: #1f3640;
  --ink-2: #4a5f66;
  --muted: #4a5f66;
  --gray: #94abb4;
  --line: #d3dee3;
  --line-2: #e9f0f3;
  --bg: #f3f7f9;
  --card: #ffffff;
  --soft: #e2ecf0;
  --accent: #007096;
  --accent-ink: #007096;
  --accent-soft: #e2ecf0;
  --good: #2f7d5b;
  --bad: #c24b50;
  --bad-soft: #f8e6e7;
  --warn-soft: #eef5f8;
  --radius: 8px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Gantari, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 24px;
  padding: 0 20px; height: 56px;
  background: #fff; color: var(--ink); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-logo { height: 30px; width: auto; display: block; }
.brand-icon { display: none; height: 30px; width: auto; }
.brand-text { font-weight: 600; font-size: 18px; color: var(--brand-dark); padding-left: 12px; border-left: 1px solid var(--line); line-height: 26px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a {
  white-space: nowrap; text-decoration: none; padding: 8px 12px; border-radius: 6px; color: var(--muted); font-weight: 600;
}
.nav a:hover { color: var(--brand); background: var(--line-2); }
.nav a.active { color: var(--brand); background: var(--soft); }
.user { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }

/* ---------- buttons & inputs ---------- */
.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 6px; display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.btn:hover { border-color: #b9c1cc; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.dark { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.iconbtn {
  border: 0; background: transparent; cursor: pointer; color: var(--muted);
  padding: 4px 6px; border-radius: 4px; font-size: 14px; line-height: 1;
}
.iconbtn:hover { background: var(--line-2); color: var(--ink); }

input, select, textarea {
  font: inherit; color: inherit; border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 9px; background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-light); outline-offset: -1px; border-color: transparent; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
label.field > span { text-transform: uppercase; letter-spacing: .04em; font-size: 11px; }

/* ---------- layout ---------- */
#view { padding: 20px; max-width: 1600px; margin: 0 auto; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 4px 0 16px; flex-wrap: wrap; }
.pagehead h1 { margin: 0; font-weight: 800; font-size: 30px; color: var(--brand); letter-spacing: -.2px; }
.pagehead .sub { color: var(--muted); margin-top: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); gap: 12px; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 600; color: var(--brand-dark); }
.card-body { padding: 16px; }
.grid { display: grid; gap: 12px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

/* ---------- sign in ---------- */
.signin { min-height: calc(100vh - 56px); display: grid; place-items: center; padding: 20px; }
.signin-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 40px 36px; text-align: center; max-width: 360px; width: 100%; }
.signin-logo { width: 220px; max-width: 80%; height: auto; }
.signin-card h1 { font-weight: 800; color: var(--brand); font-size: 30px; margin: 18px 0 4px; }
.signin-card .btn { width: 100%; justify-content: center; margin: 18px 0 10px; padding: 11px; }

/* ---------- tables ---------- */
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); background: #f7fafb; white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #fafbfc; }
.tablewrap { overflow-x: auto; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--line-2); color: var(--ink-2); }
.pill.Bidding { background: var(--soft); color: var(--brand); }
.pill.s-estimating, .statussel.s-estimating { background: #fff1c2; color: #7a5600; }
.pill.s-bid-submitted, .statussel.s-bid-submitted { background: #d6e6ff; color: #1546a0; }
.pill.s-active, .statussel.s-active { background: #cdf0d9; color: #11663a; }
.pill.s-complete, .statussel.s-complete { background: #e3e6e8; color: #3f4a52; }
.pill.s-lost-on-hold, .statussel.s-lost-on-hold { background: #fbd5d5; color: #a11d1d; }
.pill[class*=" s-"]::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 5px; vertical-align: 1px; }
.statussel option { background: #fff; color: #1f2a30; }
.statussel { width: auto; min-width: 128px; border: 0; border-radius: 99px; font-size: 12px; font-weight: 700; padding: 3px 8px; cursor: pointer; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { font: inherit; font-weight: 600; font-size: 13px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); border-radius: 99px; padding: 6px 12px; cursor: pointer; }
.chip span { color: var(--muted); font-weight: 500; margin-left: 2px; }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.active span { color: #d6ecf3; }
.pill.Submitted { background: #dff0f6; color: var(--brand-dark); }
.pill.Awarded, .pill.Active { background: #e3f1ea; color: var(--good); }
.pill.Lost { background: var(--bad-soft); color: var(--bad); }
.pill.Imported { background: #eef1f2; color: var(--muted); }
.search { max-width: 320px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }

/* ---------- estimate editor ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button {
  font: inherit; font-weight: 600; background: none; border: 0; cursor: pointer;
  padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs .count { font-size: 11px; background: var(--bad); color: #fff; border-radius: 99px; padding: 1px 6px; margin-left: 4px; }

.totalsbar {
  position: sticky; bottom: 0; z-index: 20; margin: 16px -20px -20px;
  background: var(--brand-dark); color: #fff; padding: 10px 20px;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.totalsbar .t { display: flex; flex-direction: column; }
.totalsbar .t span { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--gray); }
.totalsbar .t b { font-size: 17px; font-variant-numeric: tabular-nums; }
.totalsbar .t.big b { font-size: 21px; color: var(--brand-light); }
.totalsbar .spacer { flex: 1; }
.dirty-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-light); display: inline-block; }
.savestate { font-size: 12px; color: #c7d6dc; display: flex; align-items: center; gap: 6px; }

.division { margin-bottom: 14px; }
.division-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--soft); border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0;
}
.division-head h3 { margin: 0; font-size: 14px; font-weight: 700; color: var(--brand-dark); flex: 1; }
.division-head .divtotal { font-weight: 700; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.lines { width: 100%; table-layout: fixed; }
.lines th, .lines td { padding: 5px 6px; }
.lines td { vertical-align: top; }
.lines input, .lines select, .lines textarea { padding: 5px 7px; border-color: transparent; background: transparent; border-radius: 4px; }
.lines input:hover, .lines select:hover, .lines textarea:hover { border-color: var(--line); background: #fff; }
.lines textarea { resize: none; overflow: hidden; min-height: 30px; line-height: 1.35; }
.lines select { padding-right: 2px; }
.lines .calc { padding: 6px 7px; font-variant-numeric: tabular-nums; text-align: right; }
.lines .calc.total { font-weight: 600; }
.lines tr.flag td { background: var(--bad-soft); }
.lines tr.flag select.sys { border-color: var(--bad); background: #fff; }
.lines input.num { text-align: right; }
.hint { display: block; font-size: 11px; color: var(--brand); cursor: pointer; padding: 0 7px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hint:hover { text-decoration: underline; }
.rowactions { display: flex; gap: 0; justify-content: flex-end; opacity: .35; }
tr:hover .rowactions { opacity: 1; }
.addline { display: flex; gap: 8px; padding: 10px 14px; align-items: center; }
.addline input { max-width: 420px; }

.banner { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; display: flex; gap: 10px; align-items: center; }
.banner.warn { background: var(--bad-soft); color: #8a2f33; border: 1px solid #ebc3c5; }
.banner.info { background: var(--warn-soft); border: 1px solid #c9dde5; color: var(--brand-dark); }

.sys-row { display: grid; grid-template-columns: 1fr 120px 32px; gap: 8px; margin-bottom: 8px; align-items: center; }
.rates { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 10px; }

/* summary */
.summary td, .summary th { padding: 7px 12px; }
.summary tr.subtotal td { font-weight: 700; color: var(--brand-dark); border-top: 1px solid var(--brand-dark); }
.summary tr.grand td { font-weight: 800; font-size: 16px; background: var(--brand); color: #fff; }
.summary tr.section td { font-weight: 700; font-style: italic; color: var(--bad); font-size: 13px; padding-top: 16px; }

/* history */
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; min-width: 140px; }
.stat span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat b { font-size: 18px; color: var(--brand-dark); font-variant-numeric: tabular-nums; }

/* dialog */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(560px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(0,59,73,.45); }
dialog .card-head { border-radius: 12px 12px 0 0; }
dialog .foot { padding: 12px 16px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }
.checks { display: flex; flex-direction: column; gap: 8px; }
.checks label { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.checks input { width: auto; }

.picker { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.picker button { display: flex; width: 100%; text-align: left; gap: 10px; border: 0; background: #fff; padding: 8px 10px; cursor: pointer; font: inherit; border-bottom: 1px solid var(--line-2); }
.picker button:hover, .picker button:focus { background: var(--soft); outline: none; }
.picker .no { font-family: var(--mono); color: var(--muted); width: 44px; flex-shrink: 0; }
.picker .rt { margin-left: auto; color: var(--muted); }

.drop { display: block; border: 2px dashed var(--gray); border-radius: 10px; padding: 36px; text-align: center; background: #fff; cursor: pointer; }
.drop.over { border-color: var(--brand); background: var(--soft); }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(20px);
  background: var(--brand-dark); color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0;
  transition: .2s; pointer-events: none; z-index: 100; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: var(--bad); }

@media (max-width: 900px) {
  .grid.cols-4, .grid.cols-3 { grid-template-columns: 1fr 1fr; }
  .rates { grid-template-columns: repeat(3, 1fr); }
  .nav a { padding: 8px 8px; }
  .user span { display: none; }
}
@media (max-width: 600px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .nav a { padding: 6px 8px; font-size: 13px; }
  .hide-sm { display: none; }
  .pagehead .actions { width: 100%; }
  .pagehead .actions .search { max-width: none; flex: 1 1 100%; }
  .grid.cols-4, .grid.cols-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .brand-text { display: none; }
  .brand-logo { display: none; }
  .brand-icon { display: block; }
  #view { padding: 14px; }
  .totalsbar { margin: 16px -14px -14px; gap: 14px; }
}
a.btn { text-decoration: none; }

.chip .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot.s-estimating { background: #e0a800; } .dot.s-bid-submitted { background: #2f6fde; } .dot.s-active { background: #1f9d55; }
.dot.s-complete { background: #7a868e; } .dot.s-lost-on-hold { background: #d63a3a; }
