/* Customer portal. Builds on /styles.css (brand red #c52227, charcoal #231F20). Mobile first. */
body.portal { background: var(--bg-soft); min-height: 100vh; display: flex; flex-direction: column; }
.portal-header { background: #fff; border-bottom: 4px solid var(--red); position: sticky; top: 0; z-index: 20; }
.portal-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.portal-header .logo-img { width: 150px; height: auto; }
.portal-header-actions { display: flex; align-items: center; gap: 12px; }
.portal-back { color: var(--charcoal); font-weight: 600; text-decoration: none; font-size: .95rem; }
.portal-back:hover { color: var(--red); }
.portal-nav { display: none; align-items: center; gap: 16px; }
.portal-nav a:not(.btn) { color: var(--charcoal); font-weight: 600; text-decoration: none; font-size: .95rem; }
.portal-nav a:not(.btn):hover, .portal-nav a[aria-current="page"] { color: var(--red); }
.portal-main { flex: 1; padding: 22px 0 96px; width: min(860px, 100% - 28px); }
.portal-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 18px; margin-bottom: 18px; }
.portal-center { text-align: center; }
.portal h1 { font-size: clamp(1.6rem, 6vw, 2.15rem); margin-bottom: .35em; }
.portal h2 { font-size: 1.2rem; }
.portal-lead { color: var(--muted); }
.portal-muted { color: var(--muted); }
.portal-small { font-size: .92rem; }
.portal label { display: block; font-weight: 600; color: var(--charcoal); margin: 14px 0 6px; font-size: .97rem; }
.portal input, .portal select, .portal textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
.portal input:focus, .portal select:focus, .portal textarea:focus { border-color: var(--red); outline: none; box-shadow: 0 0 0 3px var(--red-100); }
.portal-postcode { text-transform: uppercase; max-width: 220px; }
.portal-turnstile { margin: 16px 0 4px; min-height: 65px; }
.portal-wide { width: 100%; margin-top: 12px; }
.portal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.portal-actions .btn { flex: 1 1 160px; }
.portal-error { background: var(--red-50); border: 1px solid var(--red-100); color: var(--red-800); border-radius: 10px; padding: 10px 14px; margin: 14px 0 0; }
.portal-notice { background: #edf7ef; border: 1px solid #c9e8cf; color: #1d5b2a; border-radius: 12px; padding: 12px 16px; font-weight: 600; margin: 0 0 16px; }
.portal-dev { margin-top: 16px; padding: 12px 14px; border: 2px dashed #d9a400; background: #fff9e6; border-radius: 10px; font-size: .92rem; word-break: break-all; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.portal-hello { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.portal-hello h1 { margin: 0; }
.portal-hello p { margin: 2px 0 0; }
.portal-hello .btn { align-self: stretch; text-align: center; }
.portal-crumb { margin: 0 0 8px; font-size: .92rem; font-weight: 600; }
.portal-crumb a { text-decoration: none; }
.portal-jobs { display: grid; gap: 12px; }
.portal-group { font-family: var(--font-head); font-size: .85rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 18px 0 0; }
.job, .cert, .prop-card {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 16px; border-left: 6px solid var(--line); text-decoration: none; color: inherit;
}
a.prop-card { display: block; }
a.prop-card:hover { box-shadow: 0 12px 28px rgba(31, 34, 40, .12); }
.job-top, .cert-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 10px; align-items: flex-start; }
.job-service, .cert-type, .prop-address { font-family: var(--font-head); font-weight: 700; color: var(--charcoal); font-size: 1.05rem; line-height: 1.3; }
.job-address, .cert-meta, .prop-meta { color: var(--muted); font-size: .95rem; margin-top: 2px; }
.badge { display: inline-block; border-radius: 999px; padding: 4px 11px; font-size: .82rem; font-weight: 600; white-space: nowrap; background: var(--bg-soft); color: var(--charcoal); }
.badge.ok { background: #e3f3e6; color: #1d5b2a; }
.badge.soon { background: #fff4d1; color: #6b5200; }
.badge.bad { background: var(--red); color: #fff; }
.badge.muted { background: #eceef1; color: var(--muted); }
.job-when { margin-top: 10px; font-weight: 600; color: var(--charcoal); }
.job-when .slot { display: inline-block; margin-left: 4px; background: var(--charcoal); color: #fff; border-radius: 8px; padding: 2px 9px; font-size: .92rem; }
.job-detail { margin: 6px 0 0; color: var(--muted); font-size: .95rem; }
.job-steps { display: flex; gap: 4px; margin-top: 12px; }
.job-steps span { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.job-steps span.on { background: var(--red); }
.job.s-received, .job.s-arranging { border-left-color: #d9a400; }
.job.s-received .badge, .job.s-arranging .badge { background: #fff4d1; color: #6b5200; }
.job.s-booked { border-left-color: var(--red); }
.job.s-booked .badge { background: var(--red); color: #fff; }
.job.s-in_progress, .job.s-visit_done { border-left-color: var(--charcoal); }
.job.s-in_progress .badge, .job.s-visit_done .badge { background: var(--charcoal); color: #fff; }
.job.s-certificate_ready, .job.s-completed { border-left-color: #2e8540; }
.job.s-certificate_ready .badge, .job.s-completed .badge { background: #e3f3e6; color: #1d5b2a; }
.job.s-on_hold .badge { background: #eceef1; color: var(--muted); }
.cert.st-valid { border-left-color: #2e8540; }
.cert.st-expiring { border-left-color: #d9a400; }
.cert.st-expired { border-left-color: var(--red); }
.cert.st-awaiting_visit { border-left-color: #3b6ea5; }
.cert.st-not_on_file { border-left-color: #9aa0a6; }
.cert-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.cert-actions a { font-weight: 600; }
.prop-warn { margin-top: 8px; font-weight: 600; font-size: .92rem; }
.prop-warn.bad { color: var(--red-800); }
.prop-warn.soon { color: #6b5200; }
.portal-empty { text-align: center; color: var(--muted); background: #fff; border-radius: 14px; padding: 22px 16px; }
.portal-help { margin-top: 22px; text-align: center; }
.portal-footer { background: var(--charcoal); color: #fff; font-size: .88rem; padding: 16px 0; text-align: center; }
.portal-footer a { color: #fff; }
.portal-header-actions .btn { white-space: nowrap; padding: .5em 1em; }

.landing-grid { display: grid; gap: 18px; margin-bottom: 18px; }
.landing-copy { background: var(--charcoal); color: #fff; border-radius: var(--radius); padding: 26px 20px 22px; border-top: 6px solid var(--red); }
.landing-copy h1, .landing-copy .eyebrow { color: #fff; }
.landing-copy .eyebrow { color: #ff8a82; }
.landing-copy .portal-lead { color: #e4e2e2; }
.landing-points { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.landing-points li { position: relative; padding-left: 22px; font-weight: 600; }
.landing-points li::before { content: ""; position: absolute; left: 0; top: .55em; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.landing-signin h2 { margin-bottom: .25em; }
.landing-features { display: grid; gap: 12px; }
.feature { background: #fff; border-radius: 14px; padding: 18px 16px; border-top: 4px solid var(--red); box-shadow: var(--shadow); }
.feature h2 { font-size: 1.05rem; margin-bottom: .35em; }
.feature p { margin: 0; color: var(--muted); font-size: .95rem; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 8px; }
.stat { display: flex; flex-direction: column; gap: 2px; background: #fff; border-radius: 14px; padding: 14px 12px; text-decoration: none; box-shadow: var(--shadow); min-height: 88px; }
.stat:hover { box-shadow: 0 12px 28px rgba(31, 34, 40, .12); }
.stat-n { font-family: var(--font-head); font-weight: 800; font-size: 1.7rem; color: var(--charcoal); line-height: 1.1; }
.stat-l { font-weight: 600; color: var(--charcoal); font-size: .92rem; }
.stat-hint { color: var(--red-800); font-size: .8rem; font-weight: 600; }
.job.inv-paid { border-left-color: #2e8540; }
.job.inv-paid .badge { background: #e3f3e6; color: #1d5b2a; }
.job.inv-unpaid, .job.inv-part_paid { border-left-color: #d9a400; }
.job.inv-unpaid .badge, .job.inv-part_paid .badge { background: #fff4d1; color: #6b5200; }
.job.inv-overdue { border-left-color: var(--red); }
.job.inv-overdue .badge { background: var(--red); color: #fff; }
.inv-left { font-weight: 500; color: var(--muted); }
.inv-link { font-weight: 600; }

.portal-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.portal-tabbar a {
  flex: 1; text-align: center; text-decoration: none; color: var(--charcoal);
  font-size: .75rem; font-weight: 700; padding: 8px 2px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
}
.portal-tabbar a[aria-current="page"] { color: var(--red); }

@media (min-width: 640px) {
  .portal-card { padding: 28px 30px; }
  .portal-header .logo-img { width: 190px; }
  .landing-features { grid-template-columns: repeat(3, 1fr); }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 800px) {
  .portal-main { padding-bottom: 48px; }
  .portal-nav { display: flex; }
  .portal-tabbar { display: none; }
  .portal-hello { flex-direction: row; align-items: flex-end; justify-content: space-between; }
  .portal-hello .btn { align-self: auto; }
  .landing-grid { grid-template-columns: 1.15fr .85fr; align-items: stretch; }
  .landing-copy { padding: 36px 32px; }
  .stat-grid { grid-template-columns: repeat(5, 1fr); }
  .job, .cert, .prop-card { padding: 18px 20px; }
}
.portal [hidden] { display: none !important; }
