/* Cert IQ handoff shell (2026-11-04): white sidebar, fixed page head with a scrolling table
   region, wrapping tabs, 4-up tiles, panels below the top bar. Loaded last. */
.app { --rail-w: 232px; --top-h: 60px; }
.rail, html:not([data-tenant-branded]) .rail, html[data-tenant-branded] .rail {
  background: #fff; background-image: none; color: #222;
  border-right: 1px solid #DADADA;
}
.rail-head, .rail-head { border-bottom-color: #DADADA; }
.rail-head .tenant-logo, .rail-head .product-lockup, .rail-mark { width: 172px; max-width: 100%; height: auto; }
.rail-wordmark, .rail-wordmark::after { color: #222; }
.rail-product, .rail-app, .rail-cap, .nav-group-title { color: #5b6360; }
.nav a { color: #222; border-radius: 4px; transition: background 120ms cubic-bezier(0.2,0.8,0.2,1), color 120ms cubic-bezier(0.2,0.8,0.2,1); }
.nav a:hover { background: #F5F6F5; color: #222; }
.nav a[aria-current="page"] { background: #FDF1E4; color: #B85E05; }
/* Orange marks only where you are (Noah, 2026-11-06: "orange seems like a lot"); other icons are neutral. */
.nav-ic { color: #6B6B6B; }
.nav a:hover .nav-ic { color: #222; }
.nav a[aria-current="page"] .nav-ic { color: #DA720F; }
.nav-n { background: #E5E8E7; color: #222; }
.nav a[aria-current="page"] .nav-n { background: #F6D9B8; color: #B85E05; }
.rail-foot { border-top-color: #DADADA; }
.rail :focus-visible, .nav a:focus-visible { outline: 2px solid #DA720F; outline-offset: 2px; }

/* Stat tiles: 4-up, 2-up only on very narrow screens. */
.tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 520px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Tabs wrap instead of scrolling sideways. */
.certificate-views, .tabs, .seg-tabs, .campaign-tabs, .view [role="tablist"] {
  flex-wrap: wrap; overflow-x: visible; row-gap: 6px;
}

/* Side panels open below the fixed top bar. */
.drawer { top: var(--top-h); }
.drawer-scrim, .scrim { top: var(--top-h); }

/* Customers, Certificates, Campaigns: head, tiles and filters stay put; only rows scroll. */
@media (min-width: 901px) {
  .app { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  .main { height: 100vh; height: 100dvh; overflow: hidden; }
  .work { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  #v-certificates:not([hidden]), #v-customers:not([hidden]) {
    display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden;
  }
  .work:has(#v-certificates:not([hidden])), .work:has(#v-customers:not([hidden])) { overflow: hidden; display: flex; flex-direction: column; }
  .work:has(.view:not([hidden]) > .table-region) > .view { flex: 1 1 auto; }
  #v-certificates > .card, #v-customers #customers-list > .card:last-child {
    display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto;
  }
  #v-customers #customers-list { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
  #v-certificates .dt-wrap, #v-customers .table-region {
    overflow: auto; min-height: 0; flex: 1 1 auto;
  }
  #v-certificates .dt thead th, #v-customers .dt thead th {
    position: sticky; top: 0; z-index: 2; background: #fff;
  }
}

/* Below ~900px the sidebar collapses; the logo moves to the top bar. */
.top-logo { display: none; }
@media (max-width: 900px) {
  .top-logo { display: block; height: 28px; width: auto; }
  .app { height: auto; overflow: visible; }
  .main, .work { height: auto; overflow: visible; }
}

/* Campaigns: the approval banner is hidden until asked for. */
#v-campaigns .approval-banner, #v-campaigns [data-approval-banner] { display: none; }

/* Customers additions */
.missing-tag { display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 4px;
  background: #FDF1E4; color: #B85E05; font-size: 12px; font-weight: 500; }
.missing-bar { background: #FBEAEA; border: 1px solid #E5B4B4; color: #8F1D1D; border-radius: 4px;
  padding: 10px 14px; margin: 0 0 12px; font-size: 13px; }
.missing-bar a, .missing-bar button { color: #8F1D1D; text-decoration: underline; background: none; border: 0; cursor: pointer; font: inherit; }
.state-chip { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 4px;
  background: #FFF8F0; color: #8A4A05; border: 1px solid #DA720F; font-size: 13px; font-weight: 500; }
.state-chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; }
.cust-map-tip { position: fixed; pointer-events: none; background: #222; color: #fff; padding: 6px 10px; border-radius: 4px; font-size: 12px; z-index: 90; }

/* Customer profile completeness */
.ux-completeness { grid-column: 1 / -1; margin-bottom: 12px; }
.ux-completeness-status { margin: 0 0 6px; font-weight: 700; color: #222; }
.ux-completeness-status[data-status="Complete"] { color: #949300; }
.ux-completeness-status[data-status="Can't be emailed"] { color: #D14124; }
.ux-completeness-status[data-status="Ready with gaps"] { color: #B85E05; }
.ux-completeness-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 12px; color: #444; font-size: 13px; }
.ux-completeness-list .ok { color: #949300; }
.ux-completeness-list .gap { color: #D14124; }
.ux-missing-bar { margin: 0 0 8px; padding: 8px 12px; border-radius: 4px; background: #FDF1EE; color: #D14124; font-weight: 500; }
.ux-add-missing:focus-visible { outline: 2px solid #DA720F; outline-offset: 2px; }

/* Customer import steps */
.import-steps { display: flex; gap: 16px; list-style: none; margin: 0 0 12px; padding: 0; color: #666; }
.import-steps li { display: flex; align-items: center; gap: 6px; }
.import-step-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid #DADADA; font-size: 12px; }
.import-steps .on { color: #222; font-weight: 700; }
.import-steps .on .import-step-n { background: #DA720F; border-color: #DA720F; color: #fff; }
.import-steps .done .import-step-n { background: #949300; border-color: #949300; color: #fff; }
.import-step-h { font-family: 'Playfair Display', serif; font-size: 16px; color: #222; margin: 12px 0 4px; }
.import-template { display: inline-block; margin: 6px 0; color: #B85E05; }
.import-template:focus-visible { outline: 2px solid #DA720F; outline-offset: 2px; }
.import-counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0; }
.import-count { border: 1px solid #DADADA; border-radius: 8px; padding: 8px 12px; display: grid; }
.import-count b { font-size: 20px; color: #222; }
.import-count span { color: #666; font-size: 12px; }
.import-count:nth-child(3) b, .import-count:nth-child(4) b { color: #D14124; }

/* Certificates: By customer / By certificate toggle above the table. */
.cert-grouping[hidden] { display: none; }
.cert-grouping { display: inline-flex; width: max-content; max-width: calc(100% - 40px); margin: 0 20px 12px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.cert-grouping button { border: 0; background: #fff; color: #222; padding: 8px 14px; font: 500 13px var(--ff); cursor: pointer; }
.cert-grouping button + button { border-left: 1px solid var(--line); }
.cert-grouping button[aria-pressed="true"] { background: #222; color: #fff; }
.cert-grouping button:focus-visible { outline: 2px solid #DA720F; outline-offset: -2px; }
.cert-earlier { margin-top: 2px; font-weight: 400; }

/* Sharper lockup (Noah, 2026-11-08): a trimmed 2x copy, shown at the rail's full width. */
html.certificate-workbench:not([data-tenant-branded]) .rail-head .product-lockup{width:100%;max-width:200px;height:auto;margin:0 0 12px}

/* Browser review 2026-11-16. */
/* Certificate toolbar: wrap whenever the controls do not fit (they ran past the card at 901-1200px,
   where the sidebar takes 230px), not only under 900px. */
html.certificate-workbench #v-certificates .bar.ux-table-toolbar { flex-wrap: wrap; }
html.certificate-workbench #v-certificates .bar-find { flex: 1 1 220px; }
/* Status tabs on a phone: one row that scrolls sideways, instead of wrapping into rows whose
   underline no longer lines up with the card edge. */
@media (max-width: 600px) {
  html.certificate-workbench #v-certificates .certificate-views {
    flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; row-gap: 0; scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch; scrollbar-width: thin;
  }
  html.certificate-workbench #v-certificates .certificate-views button { flex: 0 0 auto; scroll-snap-align: start; }
}
/* Overview, recent campaigns: the date ran off the right edge on a phone. */
@media (max-width: 600px) {
  html.certificate-workbench .ov-campaign-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; padding: 16px; }
  html.certificate-workbench .ov-campaign-row strong { grid-column: 1 / -1; overflow-wrap: anywhere; }
}
/* Import: an empty count ("—") floated under the heading. */
#imp-count:empty { display: none; }
