/* Customer portal — loaded after /styles.css (tokens, buttons, header come from there).
   Same Catalog look: white, Inter, cobalt actions. Mono only for reference numbers and file names. */

body.portal { min-height: 100vh; display: flex; flex-direction: column; }
.portal-main { flex: 1; padding: 44px 0 72px; }
.portal-main .wrap { display: flex; flex-direction: column; gap: 14px; }
.portal-narrow { max-width: 640px; }
.portal-detail { max-width: 860px; }
.portal-main h1 { margin: 0; font-size: clamp(28px, 4vw, 38px); line-height: 1.15; letter-spacing: -0.02em; font-weight: 800; }
.portal-main h1.mono { font-weight: 500; letter-spacing: 0; color: var(--cobalt); font-size: clamp(24px, 3.4vw, 32px); }
.portal-main h2 { margin: 26px 0 8px; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.portal-main .lede { margin: 0; font-size: 17px; color: var(--text-2); max-width: 720px; }
.portal-main .fine { margin: 18px 0 0; font-size: 14px; color: var(--muted); line-height: 1.6; }
.portal-main .muted { color: var(--muted); margin: 0; }
.portal-main .crumb { margin: 0 0 4px; font-size: 14px; }
.portal-main .crumb a { text-decoration: none; font-weight: 600; }
.portal-main .crumb a:hover { text-decoration: underline; }
.loading { color: var(--muted); margin: 8px 0 0; }

/* Header extras */
.site-nav .who { font-size: 14px; color: var(--muted); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-nav .inline-form { display: inline; margin: 0; }
.linklike {
  background: none; border: 0; padding: 0; font: inherit; font-size: 15px; font-weight: 600;
  color: var(--text-2); cursor: pointer; text-decoration: none;
}
.linklike:hover { color: var(--cobalt); }
.linklike:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; border-radius: 2px; }

/* Sign-in form */
.portal-form { display: flex; flex-direction: column; gap: 16px; margin-top: 10px; max-width: 460px; }
.p-field { display: flex; flex-direction: column; gap: 6px; }
.p-field-label { font-size: 14px; font-weight: 600; color: var(--text-2); }
.portal-form input[type="email"], .portal-form input[type="text"], .portal-form input[type="password"] {
  height: 50px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--radius);
  font: inherit; font-size: 16px; color: var(--text); background: #fff;
}
.portal-form input:focus { outline: 2px solid var(--cobalt); outline-offset: 1px; border-color: var(--cobalt); }
.portal-form .btn { align-self: flex-start; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Notices */
.notice { margin: 0; padding: 12px 14px; border-radius: var(--radius); font-size: 14.5px; line-height: 1.5; }
.notice-err { background: #FDF1EF; border: 1px solid #F0C9C3; color: #8E2E24; }
.notice-ok { background: var(--cobalt-soft); border: 1px solid var(--cobalt-line); color: var(--text); }
.notice-demo { background: #FFF8DB; border: 1px solid #F1DE8A; color: #4A3B00; }

/* Roster */
.empty { padding: 28px; border: 1px dashed var(--line-2); border-radius: var(--radius); margin-top: 8px; }
.empty h2 { margin: 0 0 6px; }
.empty p { margin: 0; color: var(--text-2); }

/* Status pills */
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; line-height: 1.5;
  border: 1px solid var(--line-2); background: var(--bg-3); color: var(--text-2); white-space: nowrap;
}
.pill[data-status="In progress"] { background: var(--cobalt-soft); border-color: var(--cobalt-line); color: var(--cobalt); }
.pill[data-status="Quoted"] { background: #E9F6EE; border-color: #BFE3CD; color: var(--ok); }
.pill[data-status="Closed"] { background: #fff; color: var(--muted); }
.pill[data-status="Pricing to follow"] { background: #FFF8DB; border-color: #F1DE8A; color: #6B5300; }
.pill[data-status="No bid"] { background: #fff; color: var(--muted); border-style: dashed; }

/* Detail page */
.status-card {
  display: grid; grid-template-columns: auto 1fr; gap: 10px 32px; align-items: start;
  padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); margin-top: 6px;
}
.status-card .status-label { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.status-card .pill { font-size: 15px; padding: 5px 14px; }
.status-meta { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0; }
.status-meta div { display: flex; flex-direction: column; }
.status-meta dt { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.status-meta dd { margin: 2px 0 0; font-size: 15px; }
.status-note { grid-column: 1 / -1; margin: 4px 0 0; font-size: 15px; color: var(--text-2); }

.description {
  margin: 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
  font: inherit; font-size: 15.5px; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; color: var(--text);
}
.description:empty::before { content: 'No written description. See the files below.'; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 20px; margin: 14px 0 0; }
.facts div { display: flex; flex-direction: column; }
.facts dt { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-size: 15px; }

.p-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.p-files li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 14.5px; }
.p-files .fname { font-family: var(--monof); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-files .ftype { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 2px 8px; border: 1px solid var(--line-2); border-radius: 4px; }
.p-files .fsize { margin-left: auto; color: var(--muted); white-space: nowrap; }

/* Footer */
.portal-footer { background: var(--bg-2); border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.portal-footer .wrap { display: flex; justify-content: space-between; gap: 16px; padding-top: 18px; padding-bottom: 18px; flex-wrap: wrap; }
.portal-footer a { font-weight: 600; text-decoration: none; }
.portal-footer a:hover { text-decoration: underline; }

/* Phones: roster becomes stacked cards */
@media (max-width: 720px) {
  .portal-main { padding-top: 28px; }
  .site-nav .who { display: none; }
  .status-card { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- line-item table */
.wrap-wide { max-width: 1440px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-top: 10px; padding: 14px 16px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.tool { display: flex; flex-direction: column; gap: 4px; }
.tool-label { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.tool input[type="search"], .tool select {
  height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--radius);
  font: inherit; font-size: 14.5px; color: var(--text); background: #fff;
}
.tool input[type="search"] { width: 300px; max-width: 100%; }
.tool input:focus, .tool select:focus { outline: 2px solid var(--cobalt); outline-offset: 1px; border-color: var(--cobalt); }
.tool-end { flex-direction: row; align-items: center; gap: 10px; margin-left: auto; }
.sel-count { font-size: 14px; color: var(--text-2); font-weight: 600; }

.table-scroll { overflow-x: auto; margin-top: 4px; border: 1px solid var(--line); border-radius: var(--radius); }
.items-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.items-table th, .items-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.items-table thead th { background: #fff; border-bottom: 2px solid var(--line-2); padding: 0; white-space: nowrap; }
.items-table thead th.c-sel { padding: 10px 12px; }
.items-table thead th button {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 12px; background: none; border: 0; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); text-align: left;
}
.items-table thead th.num button { justify-content: flex-end; }
.items-table thead th button:hover { color: var(--text); }
.items-table thead th button:focus-visible { outline: 2px solid var(--cobalt); outline-offset: -2px; }
.items-table thead th[aria-sort="ascending"] button, .items-table thead th[aria-sort="descending"] button { color: var(--cobalt); }
.items-table thead th[aria-sort="ascending"] button::after { content: "\25B2"; font-size: 9px; }
.items-table thead th[aria-sort="descending"] button::after { content: "\25BC"; font-size: 9px; }
.items-table .num, .items-table td.c-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.items-table .c-sel { width: 40px; text-align: center; }
.items-table input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--cobalt); cursor: pointer; vertical-align: middle; }
.items-table input[type="checkbox"]:disabled { cursor: not-allowed; opacity: 0.35; }
.items-table td.c-ref { white-space: nowrap; }
.items-table td.c-ref .mono { font-weight: 500; color: var(--cobalt); }
.items-table td.c-ref .ref-line { color: var(--text-2); }
.items-table td .sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.items-table td.c-ref .sub.mono { color: var(--muted); font-weight: 500; }
.items-table td.c-date { white-space: nowrap; color: var(--text-2); }
.items-table td.c-pn { white-space: nowrap; font-size: 13.5px; }
.items-table td.c-descr { min-width: 240px; max-width: 460px; }
.items-table td.c-ext { font-weight: 600; }
.items-table td.c-days { color: var(--text-2); }
.items-table td.c-status { white-space: nowrap; }
.item-row { cursor: pointer; }
.item-row:hover { background: var(--bg-2); }
.item-row:focus-visible { outline: 2px solid var(--cobalt); outline-offset: -2px; }
.item-row.is-selected { background: var(--cobalt-soft); }
.item-row.is-request td.c-descr { color: var(--text-2); }
.note-flag { display: inline-block; margin-left: 8px; padding: 0 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; color: var(--cobalt); border: 1px solid var(--cobalt-line); border-radius: 4px; vertical-align: 1px; }
.expired-tag { display: inline-block; margin-left: 6px; font-size: 12px; font-weight: 600; color: var(--err); }
.group-row { background: var(--bg-3); cursor: pointer; }
.group-row td { padding-top: 9px; padding-bottom: 9px; border-bottom: 1px solid var(--line-2); }
.group-row .caret { display: inline-block; width: 16px; color: var(--muted); }
.group-row strong { font-weight: 700; }
.group-row .group-meta { margin-left: 12px; font-size: 13px; color: var(--muted); }
.group-row:focus-visible { outline: 2px solid var(--cobalt); outline-offset: -2px; }
.no-match { color: var(--muted); margin: 10px 0 0; }

/* ---------------------------------------------------------------- item drawer */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 80; width: min(460px, 100%);
  background: #fff; border-left: 1px solid var(--line-2); box-shadow: -12px 0 32px rgba(16, 24, 40, 0.12);
  display: flex; flex-direction: column;
}
.drawer-scrim { position: fixed; inset: 0; z-index: 70; background: rgba(16, 24, 40, 0.18); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.drawer-head .eyebrow { margin: 0 0 6px; }
.drawer-head h2 { margin: 0; font-size: 20px; font-weight: 500; font-family: var(--monof); letter-spacing: 0; word-break: break-word; }
.drawer-close { width: 36px; height: 36px; flex: none; border: 1px solid var(--line-2); border-radius: var(--radius); background: #fff; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-2); }
.drawer-close:hover { border-color: var(--text); }
.drawer-close:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }
.drawer-body { padding: 18px 22px 28px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.drawer-body h3 { margin: 8px 0 0; font-size: 14px; font-weight: 700; letter-spacing: 0.02em; }
.dr-status { display: flex; align-items: center; gap: 4px; }
.dr-descr { margin: 0; font-size: 16px; line-height: 1.5; }
.dr-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin: 0; padding: 14px 16px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.dr-facts div { display: flex; flex-direction: column; }
.dr-facts dt { font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.dr-facts dd { margin: 2px 0 0; font-size: 15px; font-variant-numeric: tabular-nums; }
.dr-notes { padding: 12px 14px; border-left: 3px solid var(--cobalt); background: var(--cobalt-soft); border-radius: 0 var(--radius) var(--radius) 0; }
.dr-notes p { margin: 0; font-size: 14.5px; }
.dr-notes p + p { margin-top: 8px; }
.dr-tiers { border-collapse: collapse; font-size: 14.5px; width: 100%; }
.dr-tiers th, .dr-tiers td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.dr-tiers th { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.dr-history { list-style: none; margin: 0 0 0 6px; padding: 0 0 0 16px; border-left: 2px solid var(--line-2); display: flex; flex-direction: column; gap: 10px; }
.dr-history li { position: relative; font-size: 14.5px; display: flex; gap: 12px; }
.dr-history li::before { content: ""; position: absolute; left: -23px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: #fff; border: 2px solid var(--cobalt); }
.dr-history li:last-child::before { background: var(--cobalt); }
.dr-history .when { min-width: 92px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dr-small { margin: 0; font-size: 14px; color: var(--text-2); }
.dr-custnote { margin: 0; font-size: 14px; color: var(--text-2); white-space: pre-wrap; }
.drawer-body .btn { align-self: flex-start; margin-top: 6px; }
body.drawer-open { overflow: hidden; }

/* ---------------------------------------------------------------- export document */
.export-page { background: var(--bg-3); }
.export-bar { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line); }
.export-bar .wrap { max-width: 980px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.crumb-link { font-size: 14px; font-weight: 600; text-decoration: none; }
.export-actions { display: flex; gap: 10px; }
.export-main { max-width: 980px; margin: 0 auto; padding: 28px 16px 64px; }
.export-main .notice, .export-main .loading { margin-bottom: 16px; }
.doc { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 40px 44px; box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06); }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding-bottom: 18px; border-bottom: 3px solid var(--cobalt); }
.doc-brand { display: flex; gap: 12px; align-items: center; }
.doc-brand strong { display: block; font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.doc-brand span { font-size: 13px; color: var(--muted); }
.doc-title { text-align: right; }
.doc-title h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -0.02em; color: var(--cobalt); }
.doc-title span { font-size: 13px; color: var(--muted); }
.doc-meta dl { display: grid; grid-template-columns: 2fr 1fr 2fr 1fr; gap: 12px 24px; margin: 20px 0 22px; }
.doc-meta dt { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.doc-meta dd { margin: 3px 0 0; font-size: 14px; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.doc-table thead th { background: var(--cobalt); color: #fff; font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; text-align: left; padding: 8px 10px; }
.doc-table thead th.num { text-align: right; }
.doc-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-table td.mono { white-space: nowrap; font-size: 12.5px; }
.doc-sub { display: block; font-family: var(--sans); font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.doc-descr { display: block; color: var(--text-2); }
.doc-note { display: block; font-size: 12.5px; color: var(--cobalt); margin-top: 3px; }
.doc-table tfoot td { border-top: 2px solid var(--text); border-bottom: 0; font-weight: 700; font-size: 15px; padding-top: 12px; }
.doc-table tfoot td:first-child { text-align: right; font-size: 13px; font-weight: 600; color: var(--text-2); }
.doc-held { margin-top: 24px; padding: 14px 16px; border: 1px dashed var(--line-2); border-radius: var(--radius); }
.doc-held h2 { margin: 0 0 4px; font-size: 14px; }
.doc-held p { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.doc-held ul { margin: 0; padding-left: 18px; font-size: 13px; }
.doc-terms { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); }
.doc-terms p { margin: 0 0 6px; }

@media print {
  @page { margin: 14mm; }
  .no-print, .export-bar { display: none !important; }
  .export-page { background: #fff; }
  .export-main { padding: 0; max-width: none; }
  .doc { border: 0; box-shadow: none; padding: 0; }
  .doc-table thead th, .doc-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-table tr, .doc-terms, .doc-held { break-inside: avoid; }
}

/* ---------------------------------------------------------------- phones */
@media (max-width: 720px) {
  .toolbar { padding: 12px; }
  .tool, .tool input[type="search"] { width: 100%; }
  .tool-end { margin-left: 0; width: 100%; justify-content: flex-end; }
  .table-scroll { border: 0; overflow: visible; }
  .items-table thead { position: absolute; left: -9999px; }
  .items-table, .items-table tbody, .items-table tr, .items-table td { display: block; }
  .items-table tr.item-row { position: relative; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 12px 44px; margin-top: 10px; }
  .items-table tr.group-row { position: relative; border-radius: var(--radius); margin-top: 16px; padding: 4px 8px 4px 40px; }
  .items-table td { border: 0; padding: 2px 0; }
  .items-table td.c-sel { position: absolute; left: 12px; top: 12px; width: auto; padding: 0; }
  .items-table td.c-num { text-align: left; display: inline-block; margin-right: 14px; font-size: 13.5px; }
  .items-table td.c-num[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-size: 12px; }
  .items-table td.c-descr { min-width: 0; max-width: none; padding: 4px 0 6px; }
  .items-table td.c-status { margin-top: 6px; }
  .doc { padding: 22px 18px; }
  .doc-head { flex-direction: column; }
  .doc-title { text-align: left; }
  .doc-meta dl { grid-template-columns: 1fr 1fr; }
  .doc-table thead { display: none; }
  .doc-table, .doc-table tbody, .doc-table tfoot, .doc-table tr, .doc-table td { display: block; }
  .doc-table tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .doc-table td { border: 0; padding: 2px 0; text-align: left !important; }
  .dr-facts { grid-template-columns: 1fr; }
}
