/* Customer portal — light, branded, mobile-first. The tenant's accent
   arrives as --pt-accent (inline on .pt-page); everything else is a calm
   neutral system so ANY accent color reads well. Shared across the
   Features/Portal pages (scoped .razor.css can't share a design system). */

.pt-page {
    --pt-accent: #7c5cff;
    --pt-ink: #16181d;
    --pt-ink-soft: #4b5160;
    --pt-ink-muted: #8b91a0;
    --pt-bg: #f5f6f8;
    --pt-card: #ffffff;
    --pt-border: #e4e6ec;
    --pt-radius: 14px;
    --pt-shadow: 0 1px 2px rgba(22, 24, 29, 0.05), 0 8px 24px rgba(22, 24, 29, 0.06);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--pt-bg);
    color: var(--pt-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.pt-muted { color: var(--pt-ink-muted); font-size: 0.86rem; }
.pt-center { text-align: center; }
.pt-error-text { color: #c0392b; font-weight: 600; }
.pt-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Header / nav / footer ─────────────────────────────────── */

.pt-header {
    background: var(--pt-card);
    border-bottom: 1px solid var(--pt-border);
    border-top: 4px solid var(--pt-accent);
    position: sticky;
    top: 0;
    z-index: 30;
}

.pt-header-inner {
    max-width: 980px;
    margin: 0 auto;
    padding: 0.65rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.pt-brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--pt-ink); min-width: 0; }
.pt-logo { height: 34px; max-width: 140px; object-fit: contain; }
.pt-brand-name { font-weight: 700; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pt-nav { display: flex; gap: 0.15rem; overflow-x: auto; scrollbar-width: none; flex: 1; }
.pt-nav::-webkit-scrollbar { display: none; }

.pt-nav-link {
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    text-decoration: none;
    color: var(--pt-ink-soft);
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}

.pt-nav-link:hover { background: var(--pt-bg); color: var(--pt-ink); }
.pt-nav-active, .pt-nav-active:hover { background: var(--pt-accent); color: #fff; }

.pt-signout {
    border: 1px solid var(--pt-border);
    background: transparent;
    color: var(--pt-ink-muted);
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    cursor: pointer;
}
.pt-signout:hover { color: var(--pt-ink); border-color: var(--pt-ink-muted); }

.pt-main {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    padding: 1.4rem 1rem 3rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pt-footer { border-top: 1px solid var(--pt-border); background: var(--pt-card); }
.pt-footer-inner {
    max-width: 980px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    color: var(--pt-ink-muted);
    font-size: 0.82rem;
}
.pt-powered strong { color: var(--pt-ink-soft); letter-spacing: 0.04em; }

/* ── Cards / hero / stats ──────────────────────────────────── */

.pt-hero { margin-top: 0.4rem; }
.pt-greeting, .pt-section-title { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 0.15rem; }

.pt-card {
    background: var(--pt-card);
    border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius);
    box-shadow: var(--pt-shadow);
    padding: 1.1rem 1.2rem;
}

.pt-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.pt-card-title { font-size: 1.02rem; font-weight: 700; margin: 0; }

.pt-stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.7rem; }
.pt-stat {
    background: var(--pt-card);
    border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.pt-stat-num { font-size: 1.35rem; font-weight: 800; color: var(--pt-accent); }
.pt-stat-label { font-size: 0.78rem; color: var(--pt-ink-muted); }
.pt-stat-due .pt-stat-num { color: #c0392b; }

/* ── Next visit / action cards ─────────────────────────────── */

.pt-next-visit { border-left: 4px solid var(--pt-accent); }
.pt-next-visit-when { font-size: 1.15rem; font-weight: 700; }

.pt-action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.7rem; }
.pt-action-card { display: flex; flex-direction: column; gap: 0.25rem; text-decoration: none; color: var(--pt-ink); transition: transform 0.12s ease, box-shadow 0.12s ease; }
.pt-action-card:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(22,24,29,0.08), 0 12px 32px rgba(22,24,29,0.10); }
.pt-action-kicker { font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--pt-accent); }
.pt-action-due .pt-action-kicker { color: #c0392b; }
.pt-action-title { font-weight: 700; font-size: 1.02rem; }
.pt-action-cta { margin-top: 0.35rem; font-size: 0.86rem; font-weight: 700; color: var(--pt-accent); }

/* ── Map ───────────────────────────────────────────────────── */

.pt-map { height: 340px; border-radius: 10px; overflow: hidden; border: 1px solid var(--pt-border); }
.pt-map-hint { margin: 0.5rem 0 0; }
.s5pm-pop { font: 0.82rem/1.45 -apple-system, "Segoe UI", Roboto, sans-serif; color: #16181d; padding: 2px 2px 4px; }
.s5pm-pop-title { font-weight: 700; font-size: 0.9rem; }
.s5pm-pop-addr { color: #6b7180; margin-bottom: 0.35rem; }
.s5pm-pop-eqhead { font-weight: 600; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.05em; color: #8b91a0; margin: 0.25rem 0 0.15rem; }
.s5pm-pop-eq { color: #35394a; }

/* ── Activity strip ────────────────────────────────────────── */

.pt-activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pt-activity-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0; border-top: 1px solid var(--pt-border); }
.pt-activity-row:first-child { border-top: none; }
.pt-activity-icon { width: 2rem; height: 2rem; border-radius: 10px; display: grid; place-items: center; background: var(--pt-bg); flex: none; }
.pt-activity-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pt-activity-text > span:first-child { font-weight: 600; font-size: 0.92rem; }
.pt-activity-date { color: var(--pt-ink-muted); font-size: 0.8rem; flex: none; }

/* ── Document cards (quotes / visits / invoices) ───────────── */

.pt-doc-card { padding: 0; overflow: hidden; }
.pt-doc-head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    flex-wrap: wrap;
    padding: 0.95rem 1.2rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: left;
}
.pt-doc-head:hover { background: #fafbfc; }
.pt-doc-open .pt-doc-head { border-bottom: 1px solid var(--pt-border); }
.pt-doc-id { font-weight: 700; }
.pt-doc-meta { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.pt-doc-total { font-weight: 700; }
.pt-doc-body { padding: 1rem 1.2rem 1.2rem; display: flex; flex-direction: column; gap: 0.8rem; }
.pt-doc-desc { margin: 0; }
.pt-doc-block { font-size: 0.92rem; white-space: pre-line; }
.pt-doc-label { display: block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--pt-ink-muted); margin-bottom: 0.1rem; }
.pt-doc-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.6rem; font-size: 0.92rem; }

.pt-table-wrap { overflow-x: auto; }
.pt-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.pt-table th { text-align: left; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--pt-ink-muted); padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--pt-border); }
.pt-table td { padding: 0.5rem; border-bottom: 1px solid var(--pt-border); vertical-align: top; }
.pt-num { text-align: right; white-space: nowrap; }

.pt-totals { margin-left: auto; min-width: 220px; display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.92rem; }
.pt-totals > div { display: flex; justify-content: space-between; gap: 2rem; }
.pt-totals-grand { font-weight: 800; border-top: 1px solid var(--pt-border); padding-top: 0.3rem; }
.pt-totals-due { color: #c0392b; font-weight: 700; }
.pt-totals-ok { color: #1e8e5a; font-weight: 700; }

.pt-list { margin: 0.2rem 0 0; padding-left: 1.1rem; font-size: 0.9rem; }

/* ── Chips / notices / empty states ────────────────────────── */

.pt-chip {
    display: inline-block;
    padding: 0.18rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    background: #eef0f4;
    color: var(--pt-ink-soft);
    border: 1px solid var(--pt-border);
    white-space: nowrap;
}
.pt-chip-good { background: #e5f6ee; color: #1e8e5a; border-color: #bfe8d2; }
.pt-chip-info { background: #e8f0fe; color: #2b5fd9; border-color: #c8d9f8; }
.pt-chip-warn { background: #fdf3e0; color: #a4700f; border-color: #f2ddb2; }
.pt-chip-bad { background: #fdeae7; color: #c0392b; border-color: #f5c9c1; }

.pt-notice {
    background: color-mix(in srgb, var(--pt-accent) 9%, #ffffff);
    border: 1px solid color-mix(in srgb, var(--pt-accent) 30%, #ffffff);
    border-radius: 10px;
    padding: 0.7rem 0.95rem;
    font-size: 0.92rem;
}

.pt-empty { text-align: center; padding: 2rem 1.2rem; }
.pt-empty p:first-child { font-weight: 700; margin: 0 0 0.2rem; }

.pt-loading { flex: 1; min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.8rem; }

.pt-spinner {
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 3px solid var(--pt-border);
    border-top-color: var(--pt-accent);
    animation: pt-spin 0.8s linear infinite;
    display: inline-block;
}
@keyframes pt-spin { to { transform: rotate(360deg); } }

/* ── Equipment page ────────────────────────────────────────── */

.pt-site-group { display: flex; flex-direction: column; gap: 0.6rem; }
.pt-site-title { font-size: 1.05rem; font-weight: 700; margin: 0.4rem 0 0; display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.pt-site-addr { font-weight: 500; }
.pt-equip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.7rem; }
.pt-equip-card { display: flex; flex-direction: column; gap: 0.2rem; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.pt-equip-card:hover { border-color: var(--pt-accent); }
.pt-equip-active { border-color: var(--pt-accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--pt-accent) 30%, transparent); }
.pt-equip-label { font-weight: 700; }
.pt-subhead { font-size: 0.95rem; font-weight: 700; margin: 0.6rem 0 0.3rem; }
.pt-history { list-style: none; margin: 0; padding: 0; }
.pt-history-row { display: flex; gap: 1rem; padding: 0.55rem 0; border-top: 1px solid var(--pt-border); }
.pt-history-date { flex: none; width: 9.5rem; color: var(--pt-ink-muted); font-size: 0.85rem; }
.pt-history-text { display: flex; flex-direction: column; min-width: 0; }
.pt-history-text > span:first-child { font-weight: 600; font-size: 0.92rem; }

/* ── Sign-in page ──────────────────────────────────────────── */

.pt-login-page { align-items: center; justify-content: center; padding: 2rem 1rem; border-top: 4px solid var(--pt-accent); }
.pt-login-card {
    width: 100%;
    max-width: 400px;
    background: var(--pt-card);
    border: 1px solid var(--pt-border);
    border-radius: 18px;
    box-shadow: var(--pt-shadow);
    padding: 1.8rem 1.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}
.pt-login-brand { text-align: center; display: flex; flex-direction: column; gap: 0.15rem; margin-bottom: 0.3rem; }
.pt-login-logo { max-height: 64px; max-width: 220px; object-fit: contain; margin: 0 auto 0.3rem; }
.pt-login-wordmark { font-size: 1.5rem; font-weight: 800; color: var(--pt-accent); }
.pt-login-kicker { margin: 0; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.18em; color: var(--pt-ink-muted); }
.pt-login-tagline { margin: 0; }
.pt-login-title { margin: 0; font-size: 1.3rem; }

.pt-field { display: flex; flex-direction: column; gap: 0.25rem; }
.pt-field-label { font-size: 0.8rem; font-weight: 600; color: var(--pt-ink-soft); }

.pt-input {
    width: 100%;
    box-sizing: border-box;
    border: 1.5px solid var(--pt-border);
    border-radius: 10px;
    padding: 0.7rem 0.85rem;
    font-size: 1rem;
    color: var(--pt-ink);
    background: #fff;
    outline: none;
}
.pt-input:focus { border-color: var(--pt-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pt-accent) 18%, transparent); }
.pt-code-input { text-align: center; font-size: 1.6rem; letter-spacing: 0.5em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.pt-cta {
    width: 100%;
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    background: var(--pt-accent);
    color: #fff;
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.12s ease;
}
.pt-cta:hover:not(:disabled) { filter: brightness(1.08); }
.pt-cta:disabled { opacity: 0.55; cursor: default; }
.pt-cta-inline { display: inline-block; width: auto; text-decoration: none; text-align: center; }

.pt-login-hint, .pt-login-sent { margin: 0; font-size: 0.88rem; }
.pt-login-actions { display: flex; flex-direction: column; gap: 0.3rem; align-items: center; }
.pt-link-btn { background: none; border: none; padding: 0; color: var(--pt-accent); font-size: 0.86rem; font-weight: 600; cursor: pointer; text-decoration: none; }
.pt-link-btn:disabled { color: var(--pt-ink-muted); cursor: default; }
.pt-login-error {
    background: #fdeae7;
    border: 1px solid #f5c9c1;
    color: #c0392b;
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    font-size: 0.87rem;
    text-align: center;
}
.pt-login-help { border-top: 1px solid var(--pt-border); padding-top: 0.8rem; font-size: 0.82rem; color: var(--pt-ink-muted); text-align: center; }
.pt-login-help a { color: var(--pt-accent); }
.pt-login-powered { margin-top: 1.2rem; font-size: 0.78rem; color: var(--pt-ink-muted); }

/* ── Mobile ────────────────────────────────────────────────── */

@media (max-width: 720px) {
    .pt-stat-row { grid-template-columns: repeat(2, 1fr); }
    .pt-header-inner { padding: 0.55rem 0.75rem; }
    .pt-brand-name { max-width: 40vw; }
    .pt-nav { order: 3; width: 100%; }
    .pt-signout { margin-left: auto; }
    .pt-greeting, .pt-section-title { font-size: 1.3rem; }
    .pt-map { height: 260px; }
    .pt-totals { min-width: 0; width: 100%; }
    .pt-history-date { width: 7rem; }
}

/* ── Quote options (Good/Better/Best) + accept flow ─────────── */

.pt-optgrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.8rem;
    margin: 0.8rem 0;
}
.pt-opt {
    border: 1.5px solid var(--pt-border);
    border-radius: 12px;
    padding: 0.8rem 0.9rem;
    display: flex;
    flex-direction: column;
    background: var(--pt-card);
}
.pt-opt-reco { border-color: var(--pt-accent); box-shadow: 0 0 0 1px var(--pt-accent); }
.pt-opt-accepted { border-color: #2f9e44; box-shadow: 0 0 0 1px #2f9e44; }
.pt-opt-greyed { opacity: 0.55; filter: grayscale(0.5); }
.pt-opt-head { display: flex; justify-content: space-between; align-items: center; gap: 0.4rem; }
.pt-opt-name { font-weight: 700; font-size: 1rem; }
.pt-opt-badge {
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--pt-accent);
    color: #fff;
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    white-space: nowrap;
}
.pt-opt-badge-accepted { background: #2f9e44; }
.pt-opt-badge-grey { background: var(--pt-ink-muted); }
.pt-opt-headline { margin: 0.3rem 0 0.5rem; color: var(--pt-ink-soft); font-size: 0.85rem; }
.pt-opt-lines { list-style: none; margin: 0; padding: 0; flex: 1; }
.pt-opt-lines li {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.28rem 0;
    border-bottom: 1px solid var(--pt-border);
    font-size: 0.84rem;
}
.pt-opt-lines li span:last-child { white-space: nowrap; }
.pt-opt-totals { margin-top: 0.55rem; font-size: 0.84rem; }
.pt-opt-totals > div { display: flex; justify-content: space-between; padding: 0.1rem 0; }
.pt-opt-grand { border-top: 1.5px solid var(--pt-border); font-weight: 700; font-size: 0.95rem; padding-top: 0.3rem !important; }

.pt-accept-btn {
    margin-top: 0.7rem;
    background: var(--pt-accent);
    color: #fff;
    border: none;
    border-radius: 9px;
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}
.pt-accept-btn:hover { filter: brightness(1.07); }
.pt-accept-btn:disabled { opacity: 0.6; cursor: default; }
.pt-ghost-btn {
    background: none;
    border: 1px solid var(--pt-border);
    border-radius: 9px;
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
    color: var(--pt-ink-soft);
    cursor: pointer;
}
.pt-accept-row { margin: 0.8rem 0 0.3rem; }
.pt-accept-confirm {
    border: 1.5px solid var(--pt-accent);
    border-radius: 12px;
    padding: 0.8rem 0.9rem;
    margin: 0.8rem 0;
    background: color-mix(in srgb, var(--pt-accent) 6%, var(--pt-card));
}
.pt-accept-confirm p { margin: 0 0 0.6rem; font-size: 0.9rem; }
.pt-accept-confirm-actions { display: flex; gap: 0.6rem; }
.pt-accepted-banner {
    background: rgba(47, 158, 68, 0.1);
    border: 1px solid rgba(47, 158, 68, 0.45);
    color: #22713a;
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.8rem;
    font-size: 0.88rem;
}
.pt-notice-warn { border-color: #e8a33d; color: #8a5a12; }
