/* Customer page - DESIGN.md Z1 tokens as CSS (story 1.4).
   Logical properties only (RTL/LTR both first-class). All sizes in rem (base 16)
   so user font-size settings are honored (WCAG). */

:root {
    /* Z1 palette (contrast-validated in DESIGN.md) */
    --c-canvas: #ECEEF1;
    --c-card: #FFFFFF;
    --c-ink: #101319;
    --c-black: #14161A;
    --c-muted: #646B76;
    --c-border: #E4E7EC;
    --c-hatch: #8A919C;
    --c-surface-muted: #F1F3F6;
    --c-surface-chip: #F4F6F9;
    --c-divider: #D7DBE1;
    --c-primary: #2861ED;
    --c-primary-tint: #EAF0FF;
    /* Chart-series tokens (story 4.6, DESIGN.md Z1 mapping): secondary = series-2 only
       (charts/fleet bar - never text, never buttons); faint/light = light series with a
       textual label; negative = fault/attack series + negative deltas only. */
    --c-primary-faint: #B9CCFF;
    --c-secondary: #8B5CF6;
    --c-secondary-light: #C9B8F7;
    --c-negative: #E11D48;
    --c-alert: #FF5C00;
    --c-alert-text: #C2410C;
    --c-positive: #15803D;
    --c-positive-tint: #E9F7EE;

    /* radii + shadows */
    --r-md: 10px;
    --r-lg: 16px;
    --r-xl: 20px;
    --r-xxl: 22px;
    --r-full: 9999px;
    --shadow-card: 0 10px 26px -16px rgba(16, 19, 25, .14);
    --shadow-sticky: 0 16px 32px -14px rgba(16, 19, 25, .28);

    /* customer type scale: label 13 / body-number 16 / title 28 (rem) */
    --fs-label: 0.8125rem;
    --fs-body: 1rem;
    --fs-title: 1.75rem;
}

/* ---- shell: one centered column, max 480px, sticky bar pinned to it ---- */

.customer-shell {
    min-height: 100vh; /* fallback for browsers without dvh (older iOS Safari) */
    min-height: 100dvh;
    background: var(--c-canvas);
    color: var(--c-ink);
    font-family: 'Rubik', 'Segoe UI', 'Heebo', Arial, sans-serif;
    font-size: var(--fs-body);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 18px 14px;
    padding-block-end: calc(18px + env(safe-area-inset-bottom));
}

.customer-col {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ---- cards ---- */

.c-card {
    background: var(--c-card);
    border-radius: var(--r-xl);
    padding: 20px;
    box-shadow: var(--shadow-card);
}

/* hero: product render "floats" over a soft neutral spotlight + shadow.
   The gradient/spotlight is product-render shading, NOT UI chrome (DESIGN.md exception). */
.c-hero {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 26px 20px 18px;
    overflow: hidden;
}
.c-hero::before {
    content: "";
    position: absolute;
    inset-block-start: 24px;
    inset-inline-start: 50%;
    transform: translateX(-50%);
    width: 250px;
    height: 170px;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(16, 19, 25, .05), transparent);
    pointer-events: none;
}
.c-hero-svg, .c-hero-img { position: relative; z-index: 1; }
.c-hero svg { max-width: 100%; height: auto; }
.c-hero-img { max-width: 100%; max-height: 220px; height: auto; object-fit: contain; } /* managed product image (3.5) */

/* ---- greeting header (refreshed 2026-07-17: clean, no side version pill) ---- */

.c-greeting { padding-inline: 4px; }
/* DESIGN.md token weights: customer-label 600, customer-number 800 (-0.02em) */
.c-greeting .label { font-size: var(--fs-label); color: var(--c-muted); font-weight: 600; }
.c-greeting h1 { font-size: var(--fs-title); font-weight: 800; letter-spacing: -0.02em; margin: 3px 0 0; line-height: 1.1; }

/* mono values: always LTR-isolated (MAC, versions, codes) */
.c-mono {
    font-family: Consolas, 'Segoe UI', monospace;
    direction: ltr;
    unicode-bidi: isolate;
}

/* ---- spec strip (refresh 2026-07-17): version · language · status ---- */
.c-spec {
    display: flex;
    align-items: stretch;
    background: var(--c-surface-chip);
    border-radius: var(--r-lg);
    padding: 12px 8px;
}
.c-spec-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-align: center;
}
.c-spec-item + .c-spec-item { border-inline-start: 1px solid var(--c-divider); }
.c-spec-k { font-size: 0.6875rem; color: var(--c-muted); font-weight: 600; }
.c-spec-v { font-size: 0.875rem; font-weight: 700; color: var(--c-ink); }
.c-spec-ok { color: var(--c-positive); }
.c-spec-bad { color: var(--c-alert-text); }

/* ---- pills (customer: touch target >= 44px) ---- */

.c-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 14px 16px;
    border-radius: var(--r-full);
    border: 1px solid var(--c-border);
    background: var(--c-card);
    color: var(--c-ink);
    font-size: 0.875rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.c-pill-primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }

/* ---- sticky contact bar (FR-10: plain links only) ---- */

/* Natural content-flow footer: sits directly after the page content, so short
   pages (no fault/filter/guide/video cards) show no mid-page gap. It only pins
   to the viewport bottom once the content is tall enough to overflow (sticky). */
.c-sticky-bar {
    position: sticky;
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: 100%;
    display: flex;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
}

.c-sticky-inner {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--c-card);
    border-radius: var(--r-xxl);
    padding: 12px;
    box-shadow: var(--shadow-sticky);
    width: calc(100% - 28px);
    max-width: 452px; /* 480 minus shell padding */
}

.c-whatsapp-pill {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 14px 16px;
    border-radius: var(--r-full);
    background: var(--c-positive);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
}

.c-call-button {
    inline-size: 48px;
    block-size: 48px;
    flex: 0 0 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-full);
    background: var(--c-black);
    color: #fff;
    text-decoration: none;
    font-size: 1.25rem;
}

/* ---- error (invalid payload) ---- */

.c-error-glyph { font-size: 3rem; text-align: center; }
.c-error-title { font-size: 1.25rem; font-weight: 700; text-align: center; margin: 8px 0 4px; }
.c-error-body { color: var(--c-muted); text-align: center; }

/* ---- focus ring (mandatory; never outline:none) ---- */

.customer-shell a:focus-visible,
.customer-shell button:focus-visible {
    outline: 2px solid var(--c-primary);
    outline-offset: 2px;
}

/* ---- Filter card (story 1.5; refreshed 2026-07-17: ring gauge, option C) ---- */
.c-filter-top { display: flex; align-items: center; gap: 18px; }
.c-ring { position: relative; flex: none; inline-size: 92px; block-size: 92px; }
.c-ring svg { display: block; transform: rotate(-90deg); } /* start the arc at 12 o'clock */
.c-ring-track { fill: none; stroke: var(--c-surface-muted); stroke-width: 12; }
.c-ring-prog { fill: none; stroke: var(--c-primary); stroke-width: 12; stroke-linecap: round; }
.c-ring-alert .c-ring-prog { stroke: var(--c-alert); }
.c-ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.c-ring-big { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; color: var(--c-ink); }
.c-ring-alert .c-ring-big { color: var(--c-alert-text); }
.c-ring-unit { font-size: var(--fs-label); color: var(--c-muted); font-weight: 600; margin-block-start: 3px; }
.c-filter-kicker { font-size: var(--fs-label); color: var(--c-muted); font-weight: 600; margin-block-end: 2px; }
.c-filter-head { font-size: 1.2rem; font-weight: 800; line-height: 1.2; color: var(--c-ink); margin: 0; }
.c-filter-head.c-alert-text { color: var(--c-alert-text); }
.c-filter-ends { display: flex; justify-content: space-between; margin-block-start: 16px; padding-block-start: 14px; border-block-start: 1px solid var(--c-surface-muted); }
.c-filter-ends b { display: block; font-size: 1rem; font-weight: 700; color: var(--c-ink); }
.c-filter-ends span { font-size: var(--fs-label); color: var(--c-muted); font-weight: 600; }
.c-filter-ends-e2 { text-align: left; }
.c-filter-order {
    display: inline-flex; align-items: center; justify-content: center;
    width: 100%; min-height: 44px; padding: 0 24px; margin-block-start: 16px;
    border-radius: 999px; background: var(--c-primary); color: #fff; font-weight: 700; text-decoration: none;
}
.c-filter-approaching .c-filter-order, .c-filter-overdue .c-filter-order { background: var(--c-alert); }
.c-filter-order:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 3px; }

/* ---- Fault card (story 1.6): orange bar, circle icon, numbered steps ---- */
.c-fault { border-block-start: 4px solid var(--c-alert); }
.c-fault-head { display: flex; align-items: flex-start; gap: 12px; }
.c-fault-icon {
    flex: 0 0 auto; inline-size: 32px; block-size: 32px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--c-alert); color: #fff; font-weight: 800; font-size: 1.125rem;
}
.c-fault-headings { min-inline-size: 0; }
.c-fault-title { font-size: 1.125rem; font-weight: 700; margin: 0; color: var(--c-ink); }
.c-fault-time { font-size: 0.8125rem; color: var(--c-muted); margin: 4px 0 0; }
.c-fault-explain { margin: 12px 0 0; font-size: 0.95rem; color: var(--c-ink); line-height: 1.5; } /* managed explanation (3.5) */
.c-fault-steps { margin: 14px 0 0; padding-inline-start: 1.25rem; display: flex; flex-direction: column; gap: 8px; }
.c-fault-steps li { font-size: 0.95rem; color: var(--c-ink); line-height: 1.45; }
.c-fault-cta {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 0 24px; margin-block-start: 16px;
    border-radius: 999px; background: var(--c-alert); color: #fff; font-weight: 700; text-decoration: none;
}
.c-fault-cta:focus-visible { outline: 2px solid var(--c-alert); outline-offset: 3px; }

/* Fault card - "all good" state (no fresh fault): mirrors the fault card in green (2026-07-21) */
.c-fault-ok { border-block-start: 4px solid var(--c-positive); }
.c-fault-ok-icon {
    flex: 0 0 auto; inline-size: 32px; block-size: 32px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--c-positive); color: #fff; font-weight: 800; font-size: 1.125rem;
}
.c-fault-ok-body { margin: 4px 0 0; font-size: 0.95rem; color: var(--c-muted); line-height: 1.5; }

/* Filter card - "not set up yet" state (no filter data): guides the customer to set up tracking */
.c-filter-setup { border-block-start: 4px solid var(--c-primary); }
.c-filter-setup-body { margin: 10px 0 0; font-size: 0.95rem; color: var(--c-muted); line-height: 1.5; }

/* ---- Guide card (story 1.7): PDF icon, view/download pills ---- */
.c-guide-head { display: flex; align-items: center; gap: 12px; }
.c-guide-icon {
    flex: 0 0 auto; inline-size: 44px; block-size: 44px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--c-primary-tint); color: var(--c-primary); font-weight: 800; font-size: 0.75rem; letter-spacing: 0.02em;
}
.c-guide-meta { min-inline-size: 0; }
.c-guide-title { font-size: 1.0625rem; font-weight: 700; margin: 0; color: var(--c-ink); }
.c-guide-sub { font-size: 0.8125rem; color: var(--c-muted); margin: 3px 0 0; }
.c-guide-actions { display: flex; gap: 10px; margin-block-start: 16px; }
.c-guide-pill {
    flex: 1; display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 0 16px; border-radius: 999px;
    border: 1px solid var(--c-border); background: var(--c-card); color: var(--c-ink);
    font-weight: 700; text-decoration: none;
}
.c-guide-pill-download { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.c-guide-pill:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }

/* ---- Tutorial videos card (refresh 2026-07-17): YouTube thumbnail list ---- */
.c-videos-head { display: flex; align-items: center; gap: 12px; margin-block-end: 6px; }
.c-videos-ico { flex: 0 0 auto; inline-size: 44px; block-size: 44px; border-radius: 50%; background: var(--c-primary-tint); display: inline-flex; align-items: center; justify-content: center; }
.c-videos-play { width: 0; height: 0; border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent var(--c-primary); margin-inline-start: 2px; }
.c-videos-meta { min-inline-size: 0; }
.c-videos-title { font-size: 1.0625rem; font-weight: 700; margin: 0; color: var(--c-ink); }
.c-videos-sub { font-size: var(--fs-label); color: var(--c-muted); font-weight: 600; margin: 2px 0 0; }
.c-videos-list { display: flex; flex-direction: column; }
.c-video-row { display: flex; align-items: center; gap: 12px; padding-block: 12px; border-block-end: 1px solid var(--c-surface-muted); text-decoration: none; color: inherit; min-height: 44px; }
.c-video-row:first-of-type { margin-block-start: 4px; }
.c-video-row:last-child { border-block-end: 0; padding-block-end: 2px; }
.c-video-thumb { position: relative; inline-size: 84px; block-size: 48px; border-radius: var(--r-md); flex: none; overflow: hidden; background: var(--c-surface-muted); }
.c-video-thumb img { inline-size: 100%; block-size: 100%; object-fit: cover; display: block; }
.c-video-play { position: absolute; inset: 0; margin: auto; inline-size: 26px; block-size: 26px; border-radius: 50%; background: rgba(20, 22, 26, .72); display: flex; align-items: center; justify-content: center; }
.c-video-play::after { content: ""; width: 0; height: 0; border-style: solid; border-width: 5px 0 5px 8px; border-color: transparent transparent transparent #fff; margin-inline-start: 2px; }
.c-video-dur { position: absolute; inset-block-end: 4px; inset-inline-start: 4px; background: rgba(20, 22, 26, .82); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 5px; }
.c-video-body { flex: 1; min-inline-size: 0; }
.c-video-title { display: block; font-size: 1rem; font-weight: 700; color: var(--c-ink); line-height: 1.3; }
.c-video-note { display: block; font-size: var(--fs-label); color: var(--c-muted); font-weight: 600; margin-block-start: 2px; }
.c-video-chevron { flex: none; color: var(--c-muted); opacity: .7; }
.c-video-chevron::before { content: ""; display: block; width: 8px; height: 8px; border-inline-start: 2px solid currentColor; border-block-end: 2px solid currentColor; transform: rotate(45deg); }
.c-video-row:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; border-radius: var(--r-md); }

/* ---- Landing page (story 1.9): centered brand card ---- */
.c-landing { min-block-size: 70vh; display: flex; align-items: center; justify-content: center; }
.c-landing-card { text-align: center; padding: 32px 24px; width: 100%; }
.c-landing-logo { font-size: 3.25rem; line-height: 1; margin-block-end: 8px; }
.c-landing-title { font-size: var(--fs-title); font-weight: 800; letter-spacing: -0.02em; margin: 0 0 10px; color: var(--c-ink); }
.c-landing-prompt { font-size: 1rem; color: var(--c-muted); margin: 0 0 22px; line-height: 1.5; }
.c-landing-cta { display: inline-flex; width: auto; min-width: 220px; margin-inline: auto; }
.c-landing-site { display: inline-block; margin-block-start: 16px; color: var(--c-primary); font-weight: 600; text-decoration: none; }
.c-landing-site:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
