/* NeatScore customer portal. Builds on ../assets/css/site.css. */

.portal {
  --surface: #fff;
  --surface-2: var(--mist);
  --text-2: var(--muted);
  --good: #2E7D32; --good-bg: #E8F3E9;
  --warn: #8A5A00; --warn-bg: #FFF4D6; --warn-mark: #F9A825;
  --bad: #C62828;  --bad-bg: #FDECEC;
  --chart-line: var(--navy);
  --chart-grid: #E6EBF0;
  background: var(--mist);
  min-height: 100vh;
  display: flex; flex-direction: column;
  font-size: 16px;
}
.portal-main { flex: 1; padding: 34px 0 60px; }
.portal .muted { color: var(--text-2); }
.portal .small { font-size: 14px; }
.portal .block { display: block; }
.portal [hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.portal-tag {
  font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--navy); background: var(--lime); padding: 3px 9px; border-radius: 999px;
}
.portal .nav a.is-active { color: #fff; box-shadow: inset 0 -2px 0 var(--lime); }
.portal .nav .nav-signout { color: #9fb0cc; }
@media (min-width: 901px) { .portal .nav a { padding: 24px 0; } }

.portal-footer { padding: 22px 0; border-top: 1px solid var(--line); font-size: 14px; color: var(--text-2); }
.portal-footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.portal-footer a { color: inherit; }

/* ---------- Loading / notices ---------- */
.loading { display: flex; align-items: center; gap: 12px; justify-content: center; padding: 80px 0; color: var(--text-2); font-weight: 600; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--navy); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice { padding: 12px 16px; border-radius: 12px; margin: 0 0 16px; font-size: 15px; }
.notice--error { background: var(--bad-bg); color: #8c1d1d; }
.notice--ok { background: var(--good-bg); color: #1d5a21; }

.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: #F1FBDC; border: 1px solid #d6efa2; border-radius: 14px; padding: 12px 16px; margin-bottom: 22px; font-size: 15px;
}
.banner--bad { background: var(--bad-bg); border-color: #f3c3c3; }

/* ---------- Sign in ---------- */
.auth { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; padding: 20px 0 40px; }
.auth h1 { font-size: clamp(30px, 4.4vw, 46px); }
.auth-points { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; }
.auth-points li { padding-left: 28px; position: relative; font-weight: 600; }
.auth-points li::before { content: ''; position: absolute; left: 0; top: 5px; width: 16px; height: 16px; border-radius: 50%; background: var(--lime); box-shadow: inset 0 0 0 4px var(--navy); }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 30px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.auth-card h2 { font-size: 24px; margin: 0; }
.auth-card label, .filters label { display: grid; gap: 6px; font-size: 14px; font-weight: 700; }
.auth-card input, .filters select, .filters input {
  font: inherit; font-weight: 500; font-size: 16px; padding: 12px 14px; border-radius: 11px;
  border: 1.5px solid var(--line); background: var(--surface); color: inherit; width: 100%;
}
.auth-card input:focus, .filters select:focus, .filters input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(184, 242, 60, .45); }
.linkish { background: none; border: 0; font: inherit; font-size: 14px; font-weight: 700; color: var(--text-2); cursor: pointer; justify-self: center; padding: 4px; text-decoration: underline; }
.auth-foot { margin: 4px 0 0; font-size: 14px; text-align: center; color: var(--text-2); }
.btn:disabled { opacity: .6; cursor: default; transform: none; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; gap: 26px; } }

.blocked { max-width: 560px; margin: 40px auto; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 40px 28px; box-shadow: var(--shadow-sm); }
.blocked img { margin: 0 auto 16px; }
.blocked h1 { font-size: 28px; }
.blocked .btn-row { margin: 22px 0 16px; }

/* ---------- Page layout ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: clamp(26px, 3.4vw, 36px); margin: 0 0 4px; }
.page-head p { margin: 0; }

.filters { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.filters label { min-width: 170px; }
.filters label span { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); }
.filters .grow { flex: 1; min-width: 220px; }
.filters select, .filters input { padding: 10px 12px; font-size: 15px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow-sm); min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { font-size: 18px; margin: 0; }
.panel-head a { color: var(--text-2); font-weight: 700; text-decoration: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2 > .panel { margin-bottom: 18px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; gap: 0; } }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 2px; box-shadow: var(--shadow-sm); }
.kpi-label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.kpi-value { font-size: 32px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.kpi-sub { font-size: 13px; color: var(--text-2); }
.kpis .kpi:first-child { background: var(--navy); border-color: var(--navy); color: #fff; }
.kpis .kpi:first-child .kpi-label, .kpis .kpi:first-child .kpi-sub { color: #B9C4D8; }
.kpis .kpi:first-child .kpi-value { color: var(--lime); }
@media (max-width: 860px) { .kpis { grid-template-columns: 1fr 1fr; } .kpi-value { font-size: 26px; } }

/* ---------- Level badges ---------- */
.lvl { display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 14px; white-space: nowrap; }
.lvl b { font-weight: 800; }
.lvl span { font-size: 12px; font-weight: 700; opacity: .85; }
.lvl--good { background: var(--good-bg); color: var(--good); }
.lvl--warn { background: var(--warn-bg); color: var(--warn); }
.lvl--bad { background: var(--bad-bg); color: var(--bad); }
.lvl--none { background: var(--surface-2); color: var(--text-2); font-weight: 700; }
.lvl--good::before, .lvl--warn::before, .lvl--bad::before { content: ''; width: 8px; height: 8px; border-radius: 50%; align-self: center; }
.lvl--good::before { background: var(--good); }
.lvl--warn::before { background: var(--warn-mark); }
.lvl--bad::before { background: var(--bad); }

.chip { display: inline-block; min-width: 40px; text-align: center; padding: 3px 8px; border-radius: 8px; font-size: 13px; font-weight: 800; }
.chip--good { background: var(--good-bg); color: var(--good); }
.chip--warn { background: var(--warn-bg); color: var(--warn); }
.chip--bad { background: var(--bad); color: #fff; }
.chip--muted { background: var(--surface-2); color: var(--text-2); }

.status { font-size: 13px; font-weight: 800; padding: 4px 10px; border-radius: 999px; }
.status--good { background: var(--good-bg); color: var(--good); }
.status--warn { background: #F1FBDC; color: #3f5a0b; }
.status--bad { background: var(--bad-bg); color: var(--bad); }
.crit { color: var(--bad); font-weight: 700; }

/* ---------- Lists ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li + li { border-top: 1px solid var(--line); }
.row-link { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 4px; text-decoration: none; border-radius: 10px; }
.row-link:hover { background: var(--surface-2); }
.row-main { display: grid; min-width: 0; }
.row-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bars li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.bar-label { font-size: 14px; font-weight: 600; grid-column: 1 / -1; }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--navy); border-radius: 4px; }
.bar-val { font-size: 13px; font-weight: 800; color: var(--text-2); min-width: 28px; text-align: right; }

.meter { height: 10px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin: 4px 0 16px; }
.meter span { display: block; height: 100%; background: var(--navy); border-radius: 4px; }

.empty { text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 44px 24px; }
.empty img { margin: 0 auto 10px; opacity: .8; }

/* ---------- Trend chart ---------- */
.trend { width: 100%; min-height: 240px; }
.trend svg { display: block; width: 100%; height: auto; overflow: visible; }
.trend .grid { stroke: var(--chart-grid); stroke-width: 1; }
.trend .ax { fill: var(--text-2); font-size: 12px; font-family: var(--font); }
.trend .line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend .dot { fill: var(--chart-line); stroke: var(--surface); stroke-width: 2; }
.trend .dot.on { r: 6; }
.trend .cross { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip {
  position: absolute; z-index: 80; pointer-events: none; background: var(--navy); color: #fff;
  padding: 8px 11px; border-radius: 10px; font-size: 13px; line-height: 1.4; box-shadow: var(--shadow);
}
.chart-tip b { color: var(--lime); }
.chart-tip span { color: #B9C4D8; }

/* ---------- Inspections table ---------- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 10px; font-size: 15px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); padding: 12px 14px; background: var(--surface-2); }
.table td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.table td a { font-weight: 700; }
.table .go { text-align: right; }
@media (max-width: 760px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { padding: 10px 14px; border-top: 1px solid var(--line); }
  .table tr:first-child { border-top: 0; }
  .table td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table td::before { content: attr(data-l); font-size: 13px; font-weight: 700; color: var(--text-2); text-align: left; }
  .table td.go { justify-content: flex-end; padding-top: 8px; }
  .table td.go::before { content: none; }
}

/* ---------- Report ---------- */
.report-actions { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.report { background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(18px, 4vw, 40px); box-shadow: var(--shadow-sm); }
.report-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid #E2E8ED; }
.co-logo { max-height: 56px; max-width: 200px; width: auto; }
.co-name { font-size: 20px; font-weight: 800; }
.ns-logo { height: 26px; width: auto; }
.report-title { padding: 22px 0 8px; }
.report-title h1 { font-size: clamp(26px, 4vw, 38px); margin-bottom: 12px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 0; }
.meta dt, .dl dt { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: #5A6B78; font-weight: 700; }
.meta dd, .dl dd { margin: 0; font-weight: 600; }
.score-panel {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap; background: var(--navy); color: #fff;
  border-radius: 18px; padding: 20px 24px; margin: 18px 0 8px;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.sp-main { display: grid; }
.sp-main b { font-size: 44px; line-height: 1; color: var(--lime); letter-spacing: -.03em; }
.sp-main span { color: #C9D2E3; font-weight: 600; margin-top: 6px; }
.sp-stats { margin-left: auto; display: flex; gap: 22px; }
.sp-stats div { display: grid; text-align: center; }
.sp-stats b { font-size: 24px; }
.sp-stats span { font-size: 12px; color: #B9C4D8; text-transform: uppercase; letter-spacing: .08em; }
@media (max-width: 640px) { .sp-stats { margin-left: 0; width: 100%; justify-content: space-between; } }

.floor h2 { font-size: 20px; margin: 28px 0 12px; padding-bottom: 6px; border-bottom: 2px solid var(--lime); display: inline-block; }
.area { border: 1px solid #E2E8ED; border-radius: 16px; padding: 16px 18px; margin-bottom: 14px; break-inside: avoid; page-break-inside: avoid; }
.area--fail { border-color: #f0b9b9; box-shadow: inset 4px 0 0 var(--bad); }
.area header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.area h3 { font-size: 17px; margin: 0 0 2px; }
.area-score { display: flex; gap: 8px; align-items: center; }
.pf { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 4px 9px; border-radius: 8px; }
.pf--pass { background: var(--good-bg); color: var(--good); }
.pf--fail { background: var(--bad); color: #fff; }
.crit-msg { background: var(--bad-bg); color: #8c1d1d; font-size: 14px; font-weight: 600; padding: 8px 12px; border-radius: 10px; margin: 10px 0 0; }
.crit-tag { font-size: 11px; font-weight: 800; color: var(--bad); border: 1px solid currentColor; border-radius: 6px; padding: 0 5px; margin-left: 4px; vertical-align: 1px; }
.items { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 15px; }
.items td { padding: 8px 0; border-top: 1px solid #EEF2F5; vertical-align: top; }
.items td.lv { text-align: right; width: 70px; }
.items tr.is-poor td:first-child { font-weight: 700; }
.note { font-size: 14px; color: #5A6B78; margin-top: 3px; font-style: italic; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.photos figure { margin: 0; width: 132px; height: 99px; border-radius: 10px; overflow: hidden; background: #EEF2F5; display: grid; place-items: center; }
.photos img { width: 100%; height: 100%; object-fit: cover; }
.photo-missing { font-size: 12px; color: #5A6B78; padding: 6px; text-align: center; }
.report-note { margin: 22px 0 0; padding: 14px 16px; background: #F4F6FA; border-radius: 12px; font-size: 14px; }
.report-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12px; color: #5A6B78; margin-top: 26px; padding-top: 14px; border-top: 1px solid #E2E8ED; }

/* ---------- Account ---------- */
.dl { display: grid; gap: 12px; margin: 0 0 16px; }
.acct-logo { max-height: 36px; width: auto; }

/* ---------- Dark mode ---------- */
@media (prefers-color-scheme: dark) {
  .portal {
    --surface: #131A1E; --surface-2: #1A2328; --line: #243037; --text-2: #9FADB9;
    --good: #7BC67F; --good-bg: #16301A; --warn: #F2C75C; --warn-bg: #3A2F12; --bad: #F08080; --bad-bg: #3A1A1A;
    --chart-line: var(--lime); --chart-grid: #243037;
    background: #0B1013;
  }
  .kpis .kpi:first-child { border-color: #243037; }
  .banner { background: #1d2a0d; border-color: #3b5214; }
  .banner--bad { background: var(--bad-bg); border-color: #5a2626; }
  .status--warn { background: #1d2a0d; color: var(--lime); }
  .chip--bad, .pf--fail { background: #C62828; color: #fff; }
  .notice--error { color: #f7b4b4; }
  .notice--ok { color: #a9dcab; }
  .bar-fill, .meter span { background: var(--lime); }
  .spinner { border-top-color: var(--lime); }
  .portal-tag { color: var(--navy); }
  .auth-points li::before { box-shadow: inset 0 0 0 4px #0B1013; }
  /* The report stays a light "paper" page in dark mode, like a PDF. */
  .report { --text-2: #5A6B78; --line: #E2E8ED; --surface-2: #F4F6FA;
    --good: #2E7D32; --good-bg: #E8F3E9; --warn: #8A5A00; --warn-bg: #FFF4D6; --bad: #C62828; --bad-bg: #FDECEC; }
  .report .crit-msg { color: #8c1d1d; }
}

/* ---------- Print: only the report ---------- */
@media print {
  @page { margin: 14mm; }
  .portal { background: #fff; display: block; }
  .site-header, .portal-footer, .no-print, .chart-tip, .filters, .banner { display: none !important; }
  .portal-main { padding: 0; }
  .wrap { max-width: none; padding: 0; }
  .report { border: 0; box-shadow: none; padding: 0; border-radius: 0; }
  .lvl, .chip, .pf, .crit-msg, .area--fail { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .photos figure { width: 110px; height: 82px; }
  a { text-decoration: none; }
}

/* ---------- Sign-up ---------- */
.auth-card .checks { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.auth-card .checks legend { font-size: 14px; font-weight: 700; margin-bottom: 8px; padding: 0; }
.auth-card .checks p { grid-column: 1 / -1; margin: 2px 0 0; }
.auth-card label.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; font-size: 15px; cursor: pointer; }
.auth-card label.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--navy); flex: 0 0 auto; padding: 0; box-shadow: none; }
.auth-card label.check a { color: inherit; }
.auth-foot.small { font-size: 13px; margin-top: -4px; }
.nowrap { white-space: nowrap; }

/* ---------- Get the app ---------- */
.getapp { max-width: 980px; margin: 0 auto; }
.getapp-head { text-align: center; max-width: 680px; margin: 10px auto 28px; }
.getapp-head h1 { font-size: clamp(30px, 4.6vw, 46px); }
.getapp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.getapp-grid .panel { margin: 0; padding: 26px; }
.getapp-grid h2 { font-size: 20px; margin-bottom: 6px; }
.getapp-download { display: flex; gap: 22px; align-items: center; }
.phone {
  flex: 0 0 auto; width: 96px; height: 170px; border-radius: 22px; background: var(--navy);
  border: 5px solid #1d2b52; display: grid; place-content: center; justify-items: center; gap: 8px;
  box-shadow: var(--shadow);
}
.phone img { width: 40px; height: 40px; }
.phone span { color: #fff; font-weight: 800; font-size: 13px; letter-spacing: -.02em; }
.btn-row--stack { flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 14px; }
.steps-list { margin: 10px 0 0; padding-left: 22px; display: grid; gap: 12px; }
.steps-list li { padding-left: 4px; }
.steps-list li::marker { font-weight: 800; color: var(--navy); }
.getapp-next {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: 18px; padding: 18px 22px; border-radius: var(--radius); background: #F1FBDC; border: 1px solid #d6efa2; font-size: 15px;
}
.getapp > .btn-row { margin-top: 20px; }
@media (max-width: 820px) { .getapp-grid { grid-template-columns: 1fr; } }
@media (max-width: 460px) { .getapp-download { flex-direction: column; align-items: flex-start; } .auth-card .checks { grid-template-columns: 1fr; } }
@media (prefers-color-scheme: dark) {
  .getapp-next { background: #1d2a0d; border-color: #3b5214; }
  .steps-list li::marker { color: var(--lime); }
  .phone { border-color: #243037; }
}
