/* Customer web portal (www/portal.html).
   Uses the marketing site's design tokens from style.css so the logged-in
   experience doesn't look like a different product. */

/* portal.js shows and hides every view, button and panel through the `hidden`
   attribute. The browser's own [hidden]{display:none} is a user-agent rule, so
   ANY author class that sets `display` beats it -- .btn (inline-flex) and
   .cart-total (flex) did exactly that, leaving "Log out", "Checkout" and the
   cart total painted on screen while logged out or with an empty cart.
   Re-asserting it here as an author rule puts the attribute back in charge. */
[hidden] { display: none !important; }

.portal-body { background: var(--gray-50); }

.portal-main {
  padding: calc(var(--nav-h) + 32px) 20px 80px;
  min-height: 100vh;
}

.portal-greeting {
  color: var(--gray-600);
  font-size: 0.95rem;
  margin-right: 12px;
}

/* ── auth cards ─────────────────────────────────────────────── */
.auth-card {
  max-width: 440px;
  margin: 0 auto;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 32px 28px;
}

.auth-card h1 { font-size: 1.6rem; margin: 0 0 6px; }
.auth-sub { color: var(--gray-600); font-size: 0.94rem; margin: 0 0 20px; }

.auth-card label,
.service-panel label,
.card label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gray-800);
  margin: 14px 0 6px;
}

.auth-card input[type="text"],
.auth-card input[type="tel"],
.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="number"],
.card input[type="text"],
.card input[type="tel"],
.card input[type="number"],
.card select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  background: var(--white);
  color: var(--ink);
}

.auth-card input:focus,
.card input:focus,
.card select:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px var(--blue-100);
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.optional { font-weight: 400; color: var(--gray-400); }

.checkbox-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 400;
  font-size: 0.86rem;
  color: var(--gray-600);
  line-height: 1.5;
  margin: 18px 0 4px;
}
.checkbox-row input { margin-top: 3px; flex-shrink: 0; }

.auth-card .btn-block { margin-top: 20px; }
.auth-switch { text-align: center; margin: 18px 0 0; font-size: 0.9rem; color: var(--gray-600); }
.auth-error {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #FEF2F2;
  color: #B91C1C;
  font-size: 0.88rem;
  border-left: 3px solid #DC2626;
}

/* ── dashboard layout ───────────────────────────────────────── */
.portal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
}
.card h2 { font-size: 1.15rem; margin: 0 0 16px; }

.service-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.service-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
}
.service-tab.is-active { color: var(--blue-500); border-bottom-color: var(--blue-500); }

.inline-field { display: flex; gap: 8px; }
.inline-field input { flex: 1; }

.field-note { font-size: 0.82rem; color: var(--gray-400); margin: 6px 0 0; }
.field-ok { color: var(--green-600); }
.field-bad { color: #B91C1C; }
.muted { color: var(--gray-400); font-size: 0.88rem; }

/* ── lookup lists (municipal accounts, fines) ───────────────── */
.lookup-list { display: flex; flex-direction: column; gap: 8px; }
.lookup-row {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
}
.lookup-row strong { display: block; font-size: 0.92rem; }
.lookup-row .muted { display: block; margin-top: 2px; }

/* ── cart ───────────────────────────────────────────────────── */
.cart-card { position: sticky; top: calc(var(--nav-h) + 16px); }
.cart-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}
.cart-row strong { display: block; font-size: 0.9rem; }
.cart-row .muted { display: block; margin-top: 2px; }

.link-btn {
  background: none;
  border: none;
  color: var(--gray-400);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.link-btn:hover { color: #B91C1C; }

.cart-total {
  display: flex;
  justify-content: space-between;
  padding: 14px 0;
  font-size: 1.05rem;
  border-top: 2px solid var(--gray-200);
  margin-top: 8px;
}

.pay-method { border: none; padding: 0; margin: 8px 0 4px; }
.pay-method legend { font-size: 0.88rem; font-weight: 600; padding: 0; margin-bottom: 8px; }
.pay-method label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--gray-800);
  margin: 6px 0;
}

/* ── history ────────────────────────────────────────────────── */
.history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}
.history-row:last-child { border-bottom: none; }
.history-left strong, .history-right strong { display: block; font-size: 0.92rem; }
.history-right { text-align: right; }

.status {
  display: inline-block;
  margin-top: 3px;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--gray-100);
  color: var(--gray-600);
}
.status-fulfilled { background: var(--green-100); color: var(--green-600); }
.status-paid, .status-fulfillment_pending { background: var(--blue-100); color: var(--blue-500); }
.status-failed, .status-fulfillment_failed_requires_support { background: #FEF2F2; color: #B91C1C; }
.status-held_for_review { background: #FEF9C3; color: #A16207; }

/* ── mobile ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .portal-grid { grid-template-columns: 1fr; }
  .cart-card { position: static; }
}

@media (max-width: 520px) {
  .portal-main { padding: calc(var(--nav-h) + 16px) 16px 60px; }
  .auth-card { padding: 24px 20px; }
  .field-row { grid-template-columns: 1fr; }
}

/* ── research insights card ─────────────────────────────────── */
.research-question label { font-weight: 600; }
.research-special {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--gray-100);
}

/* ── Identity verification (verify.html, portal notice) ─────────────── */
.auth-card input[type="file"] {
  width: 100%;
  padding: 10px;
  border: 1px dashed var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--white);
  color: var(--ink);
}
.auth-card input[type="file"]:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 2px; }
.verify-preview {
  display: block;
  max-width: 100%;
  max-height: 220px;
  margin-top: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
}
.identity-notice {
  border: 1px solid var(--blue-100);
  background: var(--blue-50, var(--blue-100));
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 20px;
}
.identity-notice h2 { font-size: 1.05rem; margin: 0 0 6px; }
.identity-notice p { margin: 0 0 10px; color: var(--gray-800); font-size: 0.94rem; }
.identity-notice p:last-child { margin-bottom: 0; }

/* ── Licence disc: address type-ahead and price lines ───────────────── */
.address-picker { position: relative; }
.card .address-picker input[type="text"] { width: 100%; }
.address-suggestions {
  position: absolute;
  z-index: 30;
  left: 0; right: 0; top: calc(100% + 4px);
  margin: 0; padding: 4px;
  list-style: none;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(17, 24, 39, 0.12));
  max-height: 280px;
  overflow-y: auto;
}
.address-option {
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.address-option strong { display: block; font-size: 0.92rem; color: var(--ink); }
.address-option .muted { display: block; font-size: 0.8rem; margin-top: 1px; }
.address-option:hover,
.address-option.is-active { background: var(--blue-50); }
.price-lines {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  margin: 16px 0 0;
  padding: 12px 14px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.price-lines dt { color: var(--gray-600); }
.price-lines dd { margin: 0; text-align: right; }
.price-lines .price-total { font-weight: 700; color: var(--ink); padding-top: 6px; border-top: 1px solid var(--gray-200); }
