/* =====================================================================
   Caelum Cloud Services — design system
   Inspired by huawei.com: generous white space, full-bleed cinematic heroes,
   left-aligned headlines, one red accent, pill buttons, quiet card grids.
   Font: Saira. Images are optional: every image slot has a gradient fallback,
   so pages look finished before the generated images are added.
   ===================================================================== */

:root {
    --font: 'Saira', system-ui, -apple-system, 'Segoe UI', sans-serif;

    /* Ink & surfaces */
    --ink: #111111;
    --ink-2: #4a4a4a;
    --ink-3: #8a8a8a;
    --line: #e5e5e5;
    --surface: #ffffff;
    --surface-2: #f5f5f5;
    --surface-3: #ececec;
    --dark: #0d0f12;

    /* Brand accent — interface only (buttons, links, focus). Never used for data. */
    --brand: #c7000b;
    --brand-dark: #9e0009;
    --brand-tint: #fbeaea;

    /* Data & status (see the dataviz guidance): one hue for magnitude, reserved status colors */
    --chart: #2a78d6;
    --chart-grid: #ececec;
    --good: #0ca30c;
    --warning: #fab219;
    --serious: #ec835a;
    --critical: #d03b3b;

    --radius: 4px;
    --pill: 999px;
    --header-h: 64px;
    --max: 1280px;
    --shadow: 0 8px 28px rgba(0, 0, 0, .08);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-weight: 600; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* Blazor's FocusOnNavigate moves focus to the page's h1 for screen readers — no visible ring for that. */
h1:focus, h1:focus-visible { outline: none; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--ink-3); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Buttons & links ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 44px; padding: 0 26px; border-radius: var(--pill);
    font: 500 15px var(--font); letter-spacing: .01em;
    border: 1px solid transparent; cursor: pointer; transition: background .2s, color .2s, border-color .2s;
    white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: #fff; }
.btn-light { background: transparent; border-color: #fff; color: #fff; }
.btn-light:hover { background: #fff; color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-2); padding: 0 12px; }
.btn-ghost:hover { color: var(--brand); }
.btn-danger { background: transparent; border-color: var(--critical); color: var(--critical); }
.btn-danger:hover { background: var(--critical); color: #fff; }
.btn-sm { height: 34px; padding: 0 16px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.link-arrow { color: var(--brand); font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.link-arrow::after { content: '›'; font-size: 1.3em; line-height: 1; transition: transform .2s; }
.link-arrow:hover::after { transform: translateX(4px); }
.text-link { color: var(--brand); }
.text-link:hover { text-decoration: underline; }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50; height: var(--header-h);
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.site-header .container { height: 100%; display: flex; align-items: center; gap: 40px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.25rem; letter-spacing: .12em; }
.brand-mark { width: 28px; height: 28px; }
.brand small { font-weight: 400; letter-spacing: .06em; color: var(--ink-3); font-size: .7rem; display: block; margin-top: -4px; }
.main-nav { display: flex; gap: 32px; }
.main-nav a { font-size: 15px; color: var(--ink-2); position: relative; padding: 20px 0; }
.main-nav a:hover, .main-nav a.active { color: var(--ink); }
.main-nav a.active::after, .main-nav a:hover::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: 12px; height: 2px; background: var(--brand);
}
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
}
img.avatar { object-fit: cover; background: var(--surface-3); }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }

/* Image upload (profile picture, logos) */
.image-upload { display: flex; align-items: center; gap: 20px; }
.image-upload-preview {
    width: 132px; height: 72px; flex: none; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2);
    display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--ink-3); font-size: 13px;
}
.image-upload-preview.round { width: 72px; border-radius: 50%; font-size: 22px; font-weight: 600; background: var(--ink); color: #fff; }
.image-upload-preview img { width: 100%; height: 100%; object-fit: contain; }
.image-upload-preview.round img { object-fit: cover; }
.image-upload-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.image-upload-actions .hint { flex-basis: 100%; font-size: 13px; color: var(--ink-3); }
.image-upload-actions label.btn { cursor: pointer; }
.image-upload-actions label.btn.disabled { opacity: .5; pointer-events: none; }
@media (max-width: 480px) { .image-upload { flex-direction: column; align-items: flex-start; } }
.menu-toggle { display: none; background: none; border: 0; font-size: 26px; cursor: pointer; }

/* ---------- Hero ---------- */
.hero {
    --img: none;
    position: relative; min-height: 600px; display: flex; align-items: center; color: #fff;
    background-color: var(--dark);
    background-image:
        linear-gradient(90deg, rgba(8, 10, 14, .78) 0%, rgba(8, 10, 14, .35) 55%, rgba(8, 10, 14, .05) 100%),
        var(--img),
        radial-gradient(1200px 600px at 80% 20%, #2b3d57 0%, transparent 60%),
        linear-gradient(135deg, #111722 0%, #06080b 100%);
    background-size: cover; background-position: center;
}
.hero.compact { min-height: 360px; }
/* The container keeps the page width (text aligns with the logo, Huawei-style); only the copy is narrow. */
.hero-content > * { max-width: 620px; }
.hero .eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: 13px; opacity: .85; margin-bottom: 16px; }
.hero h1 { color: #fff; }
.hero p { font-size: 1.15rem; opacity: .9; max-width: 540px; }
.hero .row { margin-top: 32px; }
.hero p.hero-offer {
    margin-top: 20px; padding-left: 14px; border-left: 3px solid var(--brand);
    font-size: 1.05rem; opacity: 1;
}
.hero-offer strong { font-size: 1.6rem; font-weight: 700; color: #fff; margin: 0 2px; }
.hero-offer-note { font-size: .8rem; letter-spacing: .08em; opacity: .7; }

/* ---------- Sections ---------- */
.section { padding: 96px 0; }
.section.tight { padding: 64px 0; }
.section.alt { background: var(--surface-2); }
.section.dark { background: var(--dark); color: #fff; }
.section-head { text-align: center; max-width: 720px; margin: 0 auto 56px; }
.section-head p { color: var(--ink-2); font-size: 1.1rem; }
.section.dark .section-head p { color: #c9c9c9; }

.grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-2 { display: grid; gap: 24px; grid-template-columns: repeat(2, 1fr); }
.grid-3 { display: grid; gap: 24px; grid-template-columns: repeat(3, 1fr); }
.grid-4 { display: grid; gap: 24px; grid-template-columns: repeat(4, 1fr); }

/* Image card: picture on top, text below (Huawei "news"/"solutions" cards) */
.card { background: var(--surface); display: flex; flex-direction: column; transition: box-shadow .25s, transform .25s; }
.card:hover { box-shadow: var(--shadow); transform: translateY(-4px); }
.card-media {
    --img: none;
    aspect-ratio: 16 / 9; background-color: #1a2230;
    background-image: var(--img), linear-gradient(135deg, #25354d, #0d131c);
    background-size: cover; background-position: center;
}
.card-body { padding: 24px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body p { color: var(--ink-2); margin: 0; flex: 1; }
.section.alt .card { background: var(--surface); }

/* Split: image + text side by side */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; }
.split-media {
    --img: none; aspect-ratio: 4 / 3;
    background-image: var(--img), linear-gradient(135deg, #25354d, #0d131c);
    background-size: cover; background-position: center;
}

/* Big numbers strip */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; text-align: center; }
.stat-value { font-size: clamp(2rem, 4vw, 3rem); font-weight: 600; }
.stat-label { color: var(--ink-3); }
.section.dark .stat-label { color: #a5a5a5; }

/* Icon feature list */
.feature { display: flex; gap: 16px; }
.feature-icon {
    flex: none; width: 48px; height: 48px; border-radius: 50%; background: var(--brand-tint); color: var(--brand);
    display: flex; align-items: center; justify-content: center; font-size: 22px;
}

/* Line icons (Shared/Icon.razor) */
.icon { display: inline-block; vertical-align: middle; flex: none; }
.tile-icon { color: var(--brand); line-height: 0; }
.ico-muted { color: var(--ink-2); line-height: 0; }
.side-nav .ico { display: inline-flex; align-items: center; justify-content: center; }
.side-nav a.active .ico { opacity: 1; color: var(--brand); }
.stat-value .icon { color: #fff; }
a.panel { transition: border-color .2s, box-shadow .2s; }
a.panel:hover { border-color: var(--ink); box-shadow: var(--shadow); }
.tile-cta { background: var(--ink); color: #fff; border-color: var(--ink); }
.tile-cta .tile-icon { color: #fff; }
.tile-cta p { color: #c9c9c9; }
.tile-cta:hover { background: var(--brand); border-color: var(--brand); }

/* Call to action band */
.cta-band {
    --img: none; color: #fff; padding: 88px 0; text-align: center;
    background-image: linear-gradient(rgba(8, 10, 14, .7), rgba(8, 10, 14, .7)), var(--img), linear-gradient(135deg, #1f2a3a, #07090c);
    background-size: cover; background-position: center;
}
.cta-band p { color: #d5d5d5; max-width: 600px; margin: 0 auto 28px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface-2); border-top: 1px solid var(--line); font-size: 14px; }
.footer-cols { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 40px; padding: 64px 0 40px; }
.footer-cols h4 { font-size: 15px; margin-bottom: 16px; }
.footer-cols a { display: block; color: var(--ink-2); margin-bottom: 10px; }
.footer-cols a:hover { color: var(--brand); }
.footer-bottom { border-top: 1px solid var(--line); padding: 20px 0; color: var(--ink-3); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* Newsletter band at the top of the footer */
.newsletter {
    display: grid; grid-template-columns: 1fr minmax(0, 460px); gap: 12px 48px; align-items: center;
    padding: 48px 0 40px; border-bottom: 1px solid var(--line);
}
.newsletter h4 { font-size: 1.25rem; margin: 0 0 6px; }
.newsletter-copy p { margin: 0; max-width: 460px; }
.newsletter-form { display: flex; gap: 10px; }
.newsletter-form .input { flex: 1; min-width: 0; height: 44px; border-radius: var(--pill); padding: 0 18px; background: #fff; }
.newsletter-form .btn { height: 44px; padding: 0 24px; }
.newsletter-fine { grid-column: 2; margin: 8px 0 0; font-size: 12px; color: var(--ink-3); }
.newsletter-done { display: flex; align-items: center; gap: 8px; margin: 0; color: #0a7a0a; font-weight: 500; }
.newsletter .validation-message { grid-column: 2; }
@media (max-width: 760px) {
    .newsletter { grid-template-columns: 1fr; }
    .newsletter-fine, .newsletter .validation-message { grid-column: 1; }
}

/* ---------- FAQ ---------- */
.faq-group { max-width: 880px; margin: 0 auto 48px; }
.faq-group h3 { margin-bottom: 8px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
    cursor: pointer; list-style: none; padding: 22px 40px 22px 0; font-weight: 500; font-size: 1.05rem; position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: 8px; top: 16px; font-size: 26px; font-weight: 300; color: var(--brand); }
.faq details[open] summary::after { content: '−'; }
.faq details p { color: var(--ink-2); padding-bottom: 20px; margin: 0; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 20px; }
.form-grid { display: grid; gap: 20px; grid-template-columns: repeat(2, 1fr); }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.field .hint { font-size: 13px; color: var(--ink-3); }
.input, .field input, .field select, .field textarea {
    font: 15px var(--font); color: var(--ink); background: var(--surface);
    border: 1px solid #cfcfcf; border-radius: var(--radius); padding: 11px 14px; width: 100%;
    transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 120px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(17, 17, 17, .08);
}
.field .validation-message, .validation-message { color: var(--critical); font-size: 13px; }
.checkbox { display: flex; gap: 10px; align-items: center; font-size: 15px; cursor: pointer; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--brand); }
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.pw-rules { list-style: none; padding: 0; margin: 4px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; font-size: 13px; }
.pw-rules li::before { content: '○ '; color: var(--ink-3); }
.pw-rules li.ok { color: var(--good); }
.pw-rules li.ok::before { content: '✓ '; }

/* ---------- Alerts ---------- */
.alert { padding: 14px 18px; border-radius: var(--radius); border-left: 4px solid; font-size: 15px; display: flex; gap: 10px; }
.alert-error { background: #fdf0f0; border-color: var(--critical); color: #7a1f1f; }
.alert-success { background: #eef9ee; border-color: var(--good); color: #145214; }
.alert-info { background: #eef4fc; border-color: var(--chart); color: #173d6b; }

/* ---------- Auth pages ---------- */
.auth-wrap { min-height: calc(100vh - var(--header-h)); display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-media {
    --img: none; color: #fff; display: flex; align-items: flex-end; padding: 56px;
    background-image: linear-gradient(0deg, rgba(8, 10, 14, .8), rgba(8, 10, 14, .1)), var(--img), linear-gradient(135deg, #1f2a3a, #07090c);
    background-size: cover; background-position: center;
}
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-box { width: 100%; max-width: 420px; }
.auth-box h1 { font-size: 2rem; }
/* New-device approval (sign-in page and the emailed link's page) */
.device-check-icon {
    width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: var(--surface-2); color: var(--ink); margin-bottom: 20px;
}
.device-check-icon.good { background: #e7f6e7; color: #0a7a0a; }
.device-check-icon.bad { background: #fbe9e9; color: #a52828; }
.device-check p { color: var(--ink-2); }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; margin: 0; }

/* ---------- App shell (portal & admin) ---------- */
.app-shell { display: grid; grid-template-columns: 248px 1fr; min-height: calc(100vh - var(--header-h)); }
.side-nav { background: var(--surface); border-right: 1px solid var(--line); padding: 24px 12px; position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto; }
.side-nav .group { text-transform: uppercase; font-size: 11px; letter-spacing: .14em; color: var(--ink-3); margin: 20px 12px 8px; }
.side-nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius);
    color: var(--ink-2); font-size: 15px; border-left: 3px solid transparent;
}
.side-nav a:hover { background: var(--surface-2); color: var(--ink); }
.side-nav a.active { background: var(--surface-2); color: var(--ink); border-left-color: var(--brand); font-weight: 500; }
.side-nav .ico { width: 20px; text-align: center; opacity: .75; }
.app-main { background: var(--surface-2); padding: 32px 40px 64px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.9rem; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); }
.breadcrumb { font-size: 13px; color: var(--ink-3); margin-bottom: 6px; }
.breadcrumb a:hover { color: var(--brand); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel + .panel, .panel + .grid-2, .grid-2 + .panel, .kpis + .panel, .panel + .kpis { margin-top: 24px; }
/* …but never inside a grid, where the gap does the spacing and cells must line up. */
.grid > *, .grid-2 > *, .grid-3 > *, .grid-4 > * { margin-top: 0 !important; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 1.1rem; margin: 0; }
.panel-body { padding: 24px; }
.panel-body.flush { padding: 0; }
.dl { display: grid; grid-template-columns: 180px 1fr; gap: 10px 20px; margin: 0; }
.dl dt { color: var(--ink-3); font-size: 14px; }
.dl dd { margin: 0; }

/* KPI tiles — the "hero number" form */
.kpis { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.kpi-label { font-size: 13px; color: var(--ink-3); }
.kpi-value { font-size: clamp(1.45rem, 1.9vw, 2rem); font-weight: 600; line-height: 1.25; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-sub { font-size: 13px; color: var(--ink-2); }
.kpi a.kpi-sub:hover { color: var(--brand); }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: #fafafa; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table a.row-link { font-weight: 500; }
.table a.row-link:hover { color: var(--brand); }

/* Badges — status always carries a label (and a dot), never color alone */
.badge {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--pill);
    font-size: 12px; font-weight: 500; letter-spacing: .02em; background: var(--surface-3); color: var(--ink-2); white-space: nowrap;
}
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.plain::before { display: none; }
.badge.good { background: #e7f6e7; color: #0a7a0a; }
.badge.warning { background: #fff5dd; color: #8a5a00; }
.badge.serious { background: #fdeee7; color: #9a4520; }
.badge.critical { background: #fbe9e9; color: #a52828; }
.badge.info { background: #e8f1fc; color: #1c5cab; }
.badge.neutral { background: var(--surface-3); color: var(--ink-2); }

/* Contract kinds — one color each, always with its name: Build (blue), Care plan (green), Add-on (violet) */
:root { --kind-build: #1f5fbf; --kind-build-bg: #e8f0fc; --kind-care: #0e8a4f; --kind-care-bg: #e4f5ec; --kind-addon: #7a3fc8; --kind-addon-bg: #f1eafb; }
.kind-build { --kind: var(--kind-build); --kind-bg: var(--kind-build-bg); }
.kind-care { --kind: var(--kind-care); --kind-bg: var(--kind-care-bg); }
.kind-addon { --kind: var(--kind-addon); --kind-bg: var(--kind-addon-bg); }
.badge.kind { background: var(--kind-bg); color: var(--kind); font-weight: 600; }
.badge.kind::before { border-radius: 2px; } /* a square, so it never reads as a status dot */
.table tr.kind-row > td:first-child { box-shadow: inset 4px 0 0 var(--kind); }
.kind-header { border-left: 6px solid var(--kind); background: linear-gradient(90deg, var(--kind-bg), transparent 70%); padding: 12px 16px; border-radius: 8px; }
.kind-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 4px 0 16px; }
.kind-legend > div { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--ink-2); max-width: 360px; }
.kind-group-title { display: flex; align-items: center; gap: 10px; margin: 24px 0 8px; font-size: 15px; font-weight: 600; color: var(--kind); }
.kind-group-title::before { content: ''; width: 12px; height: 12px; border-radius: 3px; background: var(--kind); }
.kind-group-title .muted { font-weight: 400; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tabs button {
    background: none; border: 0; border-bottom: 2px solid transparent; padding: 12px 18px; margin-bottom: -1px;
    font: 500 15px var(--font); color: var(--ink-3); cursor: pointer; white-space: nowrap;
}
.tabs button.active { color: var(--ink); border-bottom-color: var(--brand); }
.tabs button:hover { color: var(--ink); }

/* Conversation (tickets) & timeline (incidents) */
.thread { display: flex; flex-direction: column; gap: 16px; }
.msg { max-width: 78%; padding: 14px 18px; border-radius: 10px; background: var(--surface-2); }
.msg.mine { align-self: flex-end; background: #eef4fc; }
.msg.internal { background: #fff7e0; border: 1px dashed #e5b73b; }
.msg-meta { font-size: 12.5px; color: var(--ink-3); margin-bottom: 4px; }
.msg-body { white-space: pre-wrap; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 24px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 24px 8px; }
.timeline li::before { content: ''; position: absolute; left: -32px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink-3); }
.timeline li.resolved::before { border-color: var(--good); background: var(--good); }

.empty { text-align: center; padding: 48px 24px; color: var(--ink-3); }
.empty .ico { font-size: 34px; margin-bottom: 8px; }

.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Charts (inline SVG) */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font: 12.5px var(--font); fill: var(--ink-3); }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .bar { fill: var(--chart); }
.chart .bar-hit { fill: transparent; cursor: default; }
.chart .bar-hit:hover + .bar, .chart g:hover .bar { fill: #1c5cab; }
.chart .value-label { fill: var(--ink-2); font-weight: 500; transition: opacity .15s; }
.chart g:hover .value-label { opacity: 1 !important; }
.chart-tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 13px; padding: 6px 10px; border-radius: 4px; white-space: nowrap; transform: translate(-50%, -110%); }
.chart-box { position: relative; }
details.table-view { margin-top: 12px; font-size: 14px; }
details.table-view summary { cursor: pointer; color: var(--ink-3); }

/* Health rows */
.health { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.health:last-child { border-bottom: 0; }
.health-name { font-weight: 500; }
.health-msg { color: var(--ink-3); font-size: 13px; }

/* Blazor error UI */
#blazor-error-ui {
    background: #fff4d6; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2); display: none; left: 0;
    padding: .8rem 1.25rem; position: fixed; width: 100%; z-index: 1000; font-size: 14px;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .6rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .split { grid-template-columns: 1fr; gap: 32px; }
    .footer-cols { grid-template-columns: 1fr 1fr; }
    .app-main { padding: 24px; }
}
@media (max-width: 860px) {
    .menu-toggle { display: block; margin-left: auto; }
    .main-nav, .header-actions { display: none; }
    .site-header.open .main-nav, .site-header.open .header-actions {
        display: flex; flex-direction: column; align-items: flex-start; gap: 4px; position: absolute;
        left: 0; right: 0; background: #fff; padding: 12px 24px; border-bottom: 1px solid var(--line);
    }
    .site-header.open .main-nav { top: var(--header-h); }
    .site-header.open .main-nav a { padding: 10px 0; }
    .site-header.open .main-nav a::after { display: none; }
    .site-header.open .header-actions { top: calc(var(--header-h) + 230px); margin: 0; }
    .app-shell { grid-template-columns: 1fr; }
    .side-nav { position: static; height: auto; display: flex; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
    .side-nav .group { display: none; }
    .side-nav a { white-space: nowrap; border-left: 0; }
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-media { display: none; }
    .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
    .hero { min-height: 480px; }
    .section { padding: 64px 0; }
    .dl { grid-template-columns: 1fr; gap: 2px; }
    .dl dd { margin-bottom: 10px; }
    .msg { max-width: 100%; }
}

/* Activity history: field changes, old → new */
.changes { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.changes li { overflow-wrap: anywhere; }
.changes .field-name { color: var(--ink-3); margin-right: 6px; }
.changes .field-name::after { content: ":"; }
.changes .old { color: var(--ink-3); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--critical) 55%, transparent); }
.changes .new { color: var(--ink); font-weight: 500; }

/* Card on file */
.saved-card { display: flex; align-items: center; gap: 12px; }
.saved-card .badge { margin-left: 6px; }
.card-mandate { margin: 0; padding: 10px 12px; background: #f5f5f5; border-radius: 8px; }

/* Public status page */
.status-page { max-width: 820px; }
.status-banner { display: flex; align-items: center; gap: 18px; padding: 24px 28px; border: 1px solid var(--line); border-left: 6px solid var(--ink-3); border-radius: var(--radius); margin: 12px 0 28px; background: var(--surface); }
.status-banner h1 { font-size: 1.6rem; margin: 0; }
.status-banner p { margin: 4px 0 0; color: var(--ink-3); }
.status-banner.good { border-left-color: var(--good); }
.status-banner.serious { border-left-color: var(--serious); }
.status-banner.critical { border-left-color: var(--critical); }
.status-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--ink-3); flex: none; }
.status-banner.good .status-dot { background: var(--good); }
.status-banner.serious .status-dot { background: var(--serious); }
.status-banner.critical .status-dot { background: var(--critical); }
.status-incident { border: 1px solid var(--line); border-top: 4px solid var(--serious); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 20px; }
.status-incident.critical { border-top-color: var(--critical); }
.status-incident h2 { font-size: 1.15rem; margin: 0; }
.status-timeline { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; font-size: 14px; }
.status-components { border: 1px solid var(--line); border-radius: var(--radius); }
.status-component { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 20px; }
.status-component + .status-component { border-top: 1px solid var(--line); }
.status-history-title { font-size: 1.2rem; margin: 40px 0 12px; }
.status-past { padding: 12px 0; border-bottom: 1px solid var(--line); }

/* Legal pages */
.legal { max-width: 820px; }
.legal h1 { margin-bottom: 4px; }
.legal h2 { font-size: 1.25rem; margin: 36px 0 10px; }
.legal p, .legal li { color: var(--ink-2); line-height: 1.65; }
.legal ul { padding-left: 20px; }
.legal-table td { vertical-align: top; font-size: 14px; }
.legal-table td:first-child { width: 38%; }
.footer-legal a { color: inherit; margin-left: 16px; }

/* Editable content (FAQ answers, privacy policy), rendered from Markdown */
.faq .faq-answer { color: var(--ink-2); padding-bottom: 20px; }
.faq .faq-answer p { padding-bottom: 0; margin: 0 0 8px; }
.faq .faq-answer a, .legal-body a { color: var(--brand); text-decoration: underline; }
.legal-body table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0 16px; }
.legal-body th, .legal-body td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.legal-body th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); border-bottom-color: var(--ink); }
.legal-body td:first-child { width: 38%; }
.content-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.content-editor textarea { font-family: ui-monospace, Consolas, monospace; font-size: 13px; min-height: 560px; }
.content-preview { max-height: 640px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; }
@media (max-width: 900px) { .content-editor { grid-template-columns: 1fr; } }

/* Small numbers above a chart (e.g. failed sign-ins: today / this month / daily average) */
.mini-stats { display: flex; gap: 32px; margin-bottom: 16px; }
.mini-stats > div { display: flex; flex-direction: column; }
.mini-value { font-size: 1.5rem; font-weight: 600; line-height: 1.2; }
.mini-label { font-size: 12px; color: var(--ink-3); }

/* Service insights: share of requests by country */
.share-bar { height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden; }
.share-bar span { display: block; height: 100%; background: var(--ink-2); border-radius: 4px; }

/* Copy buttons and code samples (reporting key guide) */
.copy-button.copied { border-color: var(--good); color: var(--good); }
.key-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; background: #fff; border: 1px dashed var(--good); border-radius: var(--radius); }
.key-box .mono { flex: 1; min-width: 240px; word-break: break-all; user-select: all; font-size: 14px; }
.code-sample { position: relative; margin: 8px 0 16px; }
.code-sample pre { margin: 0; padding: 14px 16px; padding-right: 110px; background: #0d0f12; color: #e8e8e8; border-radius: var(--radius); overflow-x: auto; font-size: 12.5px; line-height: 1.5; }
.code-sample .copy-button { position: absolute; top: 8px; right: 8px; background: #fff; }
.api-guide h3 { font-size: 1rem; margin: 24px 0 6px; }
.api-guide h3:first-child { margin-top: 0; }
.api-guide p, .api-guide li { color: var(--ink-2); font-size: 14px; }
.api-guide .table td, .api-guide .table th { font-size: 13px; }

/* Two-factor setup */
.setup-steps { margin: 0 0 16px; padding-left: 20px; display: grid; gap: 22px; }
.setup-steps li { color: var(--ink-2); }
.qr-box { width: 200px; height: 200px; margin: 12px 0; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.qr-box svg { width: 100%; height: 100%; display: block; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, max-content); gap: 8px 32px; padding: 16px 20px; background: #f5f5f5; border-radius: var(--radius); font-size: 15px; }

/* A button that looks like a text link (actions that are not navigation) */
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); text-decoration: underline; cursor: pointer; }
.link-button:hover { color: var(--ink); }

/* Expiry dates on Service health: amber under 30 days, red under 7 or when there's a problem. */
.text-warning { color: color-mix(in srgb, var(--warning) 55%, #000); }
.text-critical { color: var(--critical); font-weight: 600; }

/* Admin > site/app features: category panels side by side, one checkbox per line. */
.feature-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.feature-check { display: flex; padding: 4px 0; }

/* Password box with a show/hide button inside it. */
.pw-field { position: relative; }
.pw-field input { width: 100%; padding-right: 44px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: 6px;
             color: var(--ink-3); cursor: pointer; border-radius: 6px; line-height: 0; }
.pw-toggle:hover, .pw-toggle[aria-pressed="true"] { color: var(--ink); }
.pw-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.pw-match { font-size: 13px; margin-top: 4px; color: var(--ink-3); }
.pw-match.ok { color: var(--good); }

/* Asks before a consequential change (e.g. a business's status): nothing happens until "Yes". */
.confirm-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
               padding: 14px 18px; margin-bottom: 20px; border: 1px solid var(--line, #e3e3e3); border-left: 4px solid var(--brand);
               border-radius: 10px; background: #fafafa; }
.confirm-bar.danger { border-left-color: var(--critical); background: #fdf3f3; }
.confirm-bar .small { color: var(--ink-2, #555); margin-top: 2px; }

/* Business card preview (Account page): a checkerboard stands for the clear plastic — only the ink prints. */
.card-preview { display: flex; gap: 16px; flex-wrap: wrap; }
.card-preview img { width: 100%; max-width: 360px; height: auto; border-radius: 8px; border: 1px solid var(--line);
    background: repeating-conic-gradient(#e9e9e9 0% 25%, #ffffff 0% 50%) 50% / 16px 16px; }

/* Newsletter editor (Shared/RichTextEditor.razor) and its email preview. */
.rte { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border-bottom: 1px solid var(--line); background: #fafafa; border-radius: 10px 10px 0 0; }
.rte-toolbar button, .rte-button { font: inherit; font-size: 13px; padding: 4px 9px; border: 1px solid transparent; border-radius: 6px; background: none; cursor: pointer; color: var(--ink); }
.rte-toolbar button:hover, .rte-button:hover { background: #fff; border-color: var(--line); }
.rte-sep { width: 1px; background: var(--line); margin: 2px 4px; }
.rte-area { min-height: 320px; max-height: 60vh; overflow-y: auto; padding: 14px 16px; outline: none; line-height: 1.6; }
.rte-area:focus { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--brand) 30%, transparent); border-radius: 0 0 10px 10px; }
.rte-area img { max-width: 100%; height: auto; }
.rte-area blockquote { margin: 0 0 14px; padding: 4px 0 4px 14px; border-left: 3px solid var(--brand); color: var(--ink-2); }
.email-preview { width: 100%; height: 640px; border: 0; border-radius: 0 0 10px 10px; background: #f2f2f2; display: block; }

/* ---------- Where am I: business area (dark) vs client portal (light) ---------- */
.area-tag { display: flex; align-items: center; gap: 10px; margin: 0 4px 8px; padding: 12px; border-radius: var(--radius); }
.area-tag .ico { display: inline-flex; width: 32px; height: 32px; border-radius: 8px; align-items: center; justify-content: center; flex: none; }
.area-tag strong { display: block; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.area-tag span { display: block; font-size: 12px; }
.area-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: -32px -40px 28px; padding: 9px 40px; font-size: 13px; }
.area-bar a { font-weight: 600; text-decoration: underline; }

.area-admin .side-nav { background: var(--dark); border-right-color: #000; }
.area-admin .side-nav .group { color: #8b9098; }
.area-admin .side-nav a { color: #c9ccd1; }
.area-admin .side-nav a:hover { background: #1c2026; color: #fff; }
.area-admin .side-nav a.active { background: #1c2026; color: #fff; }
.area-admin .area-tag { background: #1c2026; color: #fff; }
.area-admin .area-tag .ico { background: var(--brand); color: #fff; }
.area-admin .area-tag span { color: #8b9098; }
.area-admin .area-bar { background: var(--dark); color: #fff; }
.area-admin .area-bar a { color: #fff; }

.area-portal .area-tag { background: #fdf0f0; color: var(--ink); border: 1px solid #f5d5d6; }
.area-portal .area-tag .ico { background: #fff; color: var(--brand); border: 1px solid #f5d5d6; }
.area-portal .area-tag span { color: var(--ink-3); }
.area-portal .area-bar { background: #fff5dd; color: #6b4600; border-bottom: 1px solid #f0dca8; }
.area-portal .area-bar a { color: #6b4600; }

@media (max-width: 860px) {
    .area-tag { display: none; } /* the bar says it on small screens */
}
@media (max-width: 1024px) {
    .area-bar { margin: -24px -24px 24px; padding: 9px 24px; }
}
