/*
 * Ozoned Connect theme on Bootstrap 5.3 (RI-style shell: 127px rail, top bar, light/dark).
 * Workspace themes (developer guide §19): Insurer teal, Distributor purple, Ozoned provider
 * slate. Every colour comes from the --cx-* tokens; red is used only for errors/refusals.
 */

@font-face { font-family: "Futura PT"; src: url("../fonts/FuturaPTBook.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Futura PT"; src: url("../fonts/FuturaPTMedium.otf") format("opentype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Futura PT"; src: url("../fonts/FuturaPTDemi.otf") format("opentype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Futura PT"; src: url("../fonts/FuturaPTHeavy.otf") format("opentype"); font-weight: 800; font-display: swap; }

:root {
    --cx-brand: #14655e;
    --cx-brand-hover: #0f4f4a;
    --cx-brand-fill: #14655e;
    --cx-brand-fill-hover: #0f4f4a;
    --cx-rail-from: #14655e;
    --cx-rail-to: #0e4a45;
    --cx-tint: #e8f2f1;
    --cx-canvas: #f6f8f8;
    --cx-surface: #fff;
    --cx-surface-hover: #f9fbfb;
    --cx-readonly: #f3f5f6;
    --cx-heading: #2f3542;
    --cx-text: #3d424c;
    --cx-muted: #6b7280;
    --cx-border: #dfe7e6;
    --cx-focus: rgba(20, 101, 94, .22);
    --cx-success: #1d7a52;
    --cx-success-bg: #e7f4ec;
    --cx-warning: #8f5c14;
    --cx-warning-bg: #fdf3e1;
    --cx-danger: #b42318;
    --cx-danger-bg: #fdecea;
    --cx-info: #3a6ea5;
    --cx-info-bg: #e9f0f8;
    --cx-rail-width: 127px;
}

/* Distributor workspace: purple-led. */
.cx-distributor {
    --cx-brand: #5b3f8c;
    --cx-brand-hover: #47306f;
    --cx-brand-fill: #5b3f8c;
    --cx-brand-fill-hover: #47306f;
    --cx-rail-from: #5b3f8c;
    --cx-rail-to: #3a2a5c;
    --cx-tint: #f0ebf7;
    --cx-focus: rgba(91, 63, 140, .22);
}

/* Ozoned provider console: neutral slate. */
.cx-platform {
    --cx-brand: #334a66;
    --cx-brand-hover: #263a52;
    --cx-brand-fill: #334a66;
    --cx-brand-fill-hover: #263a52;
    --cx-rail-from: #334a66;
    --cx-rail-to: #1e2c3d;
    --cx-tint: #ebf0f5;
    --cx-focus: rgba(51, 74, 102, .22);
}

:root[data-bs-theme="dark"] {
    --cx-canvas: #0f141a;
    --cx-surface: #171d24;
    --cx-surface-hover: #1d252e;
    --cx-readonly: #1e252d;
    --cx-heading: #e8edf2;
    --cx-text: #c9d1d9;
    --cx-muted: #93a0ad;
    --cx-border: #2b3540;
    --cx-success: #4cc38a;
    --cx-success-bg: rgba(76, 195, 138, .14);
    --cx-warning: #e3a83f;
    --cx-warning-bg: rgba(227, 168, 63, .14);
    --cx-danger: #f2786d;
    --cx-danger-bg: rgba(242, 120, 109, .14);
    --cx-info: #79b0e6;
    --cx-info-bg: rgba(121, 176, 230, .14);
    --bs-body-bg: var(--cx-surface);
    --bs-body-color: var(--cx-text);
    --bs-border-color: var(--cx-border);
    --bs-secondary-color: var(--cx-muted);
    --bs-tertiary-bg: var(--cx-readonly);
}
:root[data-bs-theme="dark"] .cx-insurer { --cx-brand: #5ec2b5; --cx-brand-hover: #86d4ca; --cx-brand-fill: #1d7d72; --cx-rail-from: #0f4d48; --cx-rail-to: #0b3532; --cx-tint: #1a2a29; }
:root[data-bs-theme="dark"] .cx-distributor { --cx-brand: #b9a2e6; --cx-brand-hover: #cdbdf0; --cx-brand-fill: #6b4ea3; --cx-rail-from: #3a2a5c; --cx-rail-to: #281d40; --cx-tint: #231d30; }
:root[data-bs-theme="dark"] .cx-platform { --cx-brand: #9db7d6; --cx-brand-hover: #bccfe5; --cx-brand-fill: #3e5878; --cx-rail-from: #23324a; --cx-rail-to: #172232; --cx-tint: #1b2330; }

html, body { height: 100%; }
body.cx {
    margin: 0;
    background: var(--cx-canvas);
    color: var(--cx-text);
    font-family: "Futura PT", "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    overflow-wrap: break-word; /* long refs / JSON values break instead of running off the card */
}
.cx h1, .cx h2, .cx h3, .cx h4 { color: var(--cx-heading); font-weight: 600; }
.cx h1 { font-size: 1.6rem; margin: 0; }
.cx h2 { font-size: 1.2rem; }
.cx h3 { font-size: 1.05rem; }
:where(.cx) a { color: var(--cx-brand); }
:where(.cx) a:hover { color: var(--cx-brand-hover); }
.cx :focus-visible { outline: 2px solid var(--cx-brand); outline-offset: 2px; }
.cx .form-control:focus, .cx .form-select:focus, .cx .form-check-input:focus { border-color: var(--cx-brand); box-shadow: 0 0 0 .2rem var(--cx-focus); }
.cx .form-check-input:checked { background-color: var(--cx-brand); border-color: var(--cx-brand); }
.cx .form-label { font-weight: 500; color: var(--cx-heading); margin-bottom: .25rem; }
.cx .form-text { color: var(--cx-muted); }
/* Required-field mark, added by connect-forms.js next to the label of every required control. */
.cx-req { color: var(--cx-danger); font-weight: 600; margin: 0 .25em 0 .15em; }
/* Bootstrap floats <legend> at 100% width and clears only its next sibling; when that sibling is a
   hidden input the options sat in a zero-width strip beside the float and ran off the card. */
.cx fieldset > legend ~ * { clear: left; }
/* Auto-width controls (long option text) never grow past their container on narrow screens. */
.cx .form-select.w-auto, .cx .form-control.w-auto { max-width: 100%; }

/* ---------- Shell ---------- */
.cx-shell { display: flex; min-height: 100vh; }

.cx-sidebar {
    width: var(--cx-rail-width);
    flex: 0 0 var(--cx-rail-width);
    align-self: flex-start;
    min-height: 60vh;
    background: linear-gradient(180deg, var(--cx-rail-from), var(--cx-rail-to));
    color: #fff;
    position: relative;
    z-index: 1030;
    border-bottom-right-radius: 65px;
    box-shadow: 0 0 10px rgba(0, 0, 0, .1);
    padding-bottom: 40px;
}
.cx-brand { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 8px 14px; text-align: center; }
.cx-brand-mark { width: 44px; height: 44px; border-radius: 12px; background: rgba(255, 255, 255, .16); display: grid; place-items: center; font-weight: 800; font-size: 1.05rem; letter-spacing: .02em; }
.cx-brand-name { font-weight: 600; font-size: .9rem; line-height: 1.15; }
.cx-brand-kind { font-size: .72rem; opacity: .8; text-transform: uppercase; letter-spacing: .06em; }
.cx-menu-toggle { display: none; }

.cx-rail ul { list-style: none; margin: 0; padding: 0; }
.cx-rail > ul > li { position: relative; }
.cx-tile {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 12px 6px; color: #fff; text-decoration: none; text-align: center;
    font-size: .8rem; line-height: 1.15; cursor: pointer; border-left: 3px solid transparent;
    list-style: none;
}
.cx-tile::-webkit-details-marker { display: none; }
.cx-tile:hover, .cx-rail details[open] > .cx-tile { background: rgba(255, 255, 255, .12); color: #fff; }
.cx-tile.active { background: rgba(255, 255, 255, .2); border-left-color: #fff; }
.cx-tile svg { width: 24px; height: 24px; }
.cx-tile { position: relative; }
/* Pending approvals count on the rail tile. */
.cx-tile-count { position: absolute; top: 6px; right: 22px; min-width: 20px; padding: 0 6px; border-radius: 999px; background: #fff; color: var(--cx-brand-fill); font-size: .72rem; font-weight: 700; line-height: 18px; text-align: center; }
/* An item opened from a link (Pending approvals → #REF) is outlined and clear of the sticky top bar. */
.cx [id]:target { scroll-margin-top: 90px; outline: 2px solid var(--cx-brand); outline-offset: 3px; border-radius: 10px; }
.cx-flyout {
    position: absolute; left: 100%; top: 0; min-width: 230px;
    background: var(--cx-surface); color: var(--cx-text);
    border: 1px solid var(--cx-border); border-radius: 0 10px 10px 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12); padding: 8px 0;
}
.cx-flyout-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--cx-muted); padding: 4px 16px 6px; }
.cx-flyout a { display: block; padding: 7px 16px; color: var(--cx-text); text-decoration: none; }
.cx-flyout a:hover, .cx-flyout a.active { background: var(--cx-tint); color: var(--cx-brand); }

.cx-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.cx-topbar {
    position: sticky; top: 0; z-index: 1020;
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    background: var(--cx-surface); border-bottom: 1px solid var(--cx-border); padding: 10px 24px;
}
.cx-topbar-left, .cx-topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cx-back { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--cx-tint); color: var(--cx-brand); text-decoration: none; font-weight: 500; }
.cx-entity { display: flex; flex-direction: column; line-height: 1.1; }
.cx-entity small { color: var(--cx-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.cx-entity strong { color: var(--cx-heading); }
.cx-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--cx-brand-fill); color: #fff; font-size: .78rem; font-weight: 500; }
.cx-linkbtn { background: none; border: 0; padding: 0; color: var(--cx-brand); cursor: pointer; }
.cx-linkbtn:hover { text-decoration: underline; }
.cx-theme { border: 1px solid var(--cx-border); background: var(--cx-surface); color: var(--cx-text); border-radius: 999px; padding: 3px 10px; font-size: .8rem; }

.cx-switch { position: relative; }
.cx-switch > summary { list-style: none; cursor: pointer; }
.cx-switch > summary::-webkit-details-marker { display: none; }
.cx-switch-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 280px; background: var(--cx-surface); border: 1px solid var(--cx-border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); padding: 8px; z-index: 1040; }
.cx-switch-menu button, .cx-switch-menu .is-current { display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; border-radius: 6px; background: none; color: var(--cx-text); }
.cx-switch-menu button:hover { background: var(--cx-tint); }
.cx-switch-menu .is-current { color: var(--cx-brand); font-weight: 600; }
.cx-switch-menu p { margin: 6px 10px 4px; font-size: .75rem; color: var(--cx-muted); }

.cx-titlebar { padding: 20px 24px 4px; }
.cx-eyebrow { color: var(--cx-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.cx-content { padding: 16px 24px 48px; }

/* ---------- Content ---------- */
.cx-card { background: var(--cx-surface); border: 1px solid var(--cx-border); border-radius: 12px; padding: 18px 20px; margin-bottom: 18px; }
.cx-card > h2:first-child, .cx-card > h3:first-child { margin-top: 0; }
.cx-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cx-card-head h2, .cx-card-head h3 { margin: 0; }
.cx-muted { color: var(--cx-muted); }
.cx-key { color: var(--cx-muted); font-size: .85rem; }
.cx-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.cx-metric { background: var(--cx-surface); border: 1px solid var(--cx-border); border-radius: 12px; padding: 16px 18px; }
.cx-metric b { display: block; font-size: 1.8rem; color: var(--cx-heading); line-height: 1.1; }
.cx-metric span { color: var(--cx-muted); }
.cx-empty { border: 1px dashed var(--cx-border); border-radius: 10px; padding: 18px; color: var(--cx-muted); text-align: center; background: var(--cx-surface); }
.cx-notice { border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; border: 1px solid transparent; }
.cx-notice.info { background: var(--cx-info-bg); color: var(--cx-info); }
.cx-notice.warn { background: var(--cx-warning-bg); color: var(--cx-warning); }
.cx-notice.good { background: var(--cx-success-bg); color: var(--cx-success); }
.cx-notice.bad { background: var(--cx-danger-bg); color: var(--cx-danger); }
.cx-notice.sim { background: var(--cx-warning-bg); color: var(--cx-warning); border-color: var(--cx-warning); font-weight: 500; }

.cx-badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .78rem; font-weight: 500; white-space: nowrap; background: var(--cx-readonly); color: var(--cx-muted); border: 1px solid var(--cx-border); }
.cx-badge.good { background: var(--cx-success-bg); color: var(--cx-success); border-color: transparent; }
.cx-badge.bad { background: var(--cx-danger-bg); color: var(--cx-danger); border-color: transparent; }
.cx-badge.wait { background: var(--cx-warning-bg); color: var(--cx-warning); border-color: transparent; }

.cx-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.cx-table th { text-align: left; font-weight: 600; color: var(--cx-heading); border-bottom: 2px solid var(--cx-border); padding: 8px 10px; white-space: nowrap; }
.cx-table td { border-bottom: 1px solid var(--cx-border); padding: 8px 10px; vertical-align: top; }
.cx-table tr:last-child td { border-bottom: 0; }
.cx-table-wrap { overflow-x: auto; }
.cx-table td form { display: inline; }

/* Section tabs (server-side ?tab=; inactive sections are `hidden`) */
.cx-tabs { display: flex; flex-wrap: wrap; gap: 2px 4px; border-bottom: 1px solid var(--cx-border); margin-bottom: 18px; }
.cx-tabs a { padding: 8px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--cx-muted); font-weight: 500; text-decoration: none; }
.cx-tabs a:hover { color: var(--cx-text); }
.cx-tabs a[aria-current="page"] { color: var(--cx-brand); border-bottom-color: var(--cx-brand); }
.cx-count { display: inline-block; min-width: 22px; padding: 0 7px; margin-left: 4px; border-radius: 999px; background: var(--cx-readonly); color: var(--cx-muted); font-size: .76rem; text-align: center; }
.cx-tabs a[aria-current="page"] .cx-count { background: var(--cx-tint); color: var(--cx-brand); }

.cx-form-grid { display: grid; gap: 12px 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.cx-form-grid .cx-span { grid-column: 1 / -1; }
.cx-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.cx .btn-primary { --bs-btn-bg: var(--cx-brand-fill); --bs-btn-border-color: var(--cx-brand-fill); --bs-btn-hover-bg: var(--cx-brand-fill-hover); --bs-btn-hover-border-color: var(--cx-brand-fill-hover); --bs-btn-active-bg: var(--cx-brand-fill-hover); --bs-btn-disabled-bg: var(--cx-brand-fill); }
.cx .btn-outline-primary { --bs-btn-color: var(--cx-brand); --bs-btn-border-color: var(--cx-brand); --bs-btn-hover-bg: var(--cx-brand-fill); --bs-btn-hover-border-color: var(--cx-brand-fill); }
.cx details.cx-detail > summary { cursor: pointer; color: var(--cx-brand); }
.cx dl.cx-dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.cx dl.cx-dl dt { color: var(--cx-muted); font-weight: 400; }
.cx dl.cx-dl dd { margin: 0; }
.cx-timeline { list-style: none; padding: 0; margin: 0; }
.cx-timeline li { padding: 6px 0 6px 14px; border-left: 2px solid var(--cx-border); }
.cx-flow { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; counter-reset: cx-flow; }
.cx-flow li { counter-increment: cx-flow; padding: 4px 12px; border-radius: 999px; font-size: .82rem; border: 1px solid var(--cx-border); color: var(--cx-muted); background: var(--cx-surface); }
.cx-flow li::before { content: counter(cx-flow) ". "; }
.cx-flow li.done { background: var(--cx-success-bg); color: var(--cx-success); border-color: transparent; }
.cx-flow li.current { background: var(--cx-brand-fill); color: #fff; border-color: transparent; font-weight: 600; }
/* ---------- Customer web journey (plan U7) ---------- */
.cx-customer { min-height: 100vh; padding: 24px 16px; background: linear-gradient(160deg, var(--cx-rail-from), var(--cx-rail-to)); }
.cx-phone { max-width: 420px; margin: 0 auto; background: var(--cx-surface); border: 1px solid var(--cx-border); border-radius: 24px; padding: 18px 18px 22px; box-shadow: 0 16px 40px rgba(0, 0, 0, .18); }
.cx-phone-brand { display: flex; justify-content: space-between; align-items: center; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid var(--cx-border); color: var(--cx-heading); }
.cx-offer, .cx-policy { border: 1px solid var(--cx-border); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.cx-policy { background: var(--cx-success-bg); border-color: transparent; }

/* ---------- Sign-in pages ---------- */
.cx-auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, var(--cx-rail-from), var(--cx-rail-to)); }
.cx-auth-card { width: 100%; max-width: 460px; background: var(--cx-surface); border-radius: 16px; padding: 28px 30px; box-shadow: 0 16px 40px rgba(0, 0, 0, .2); }
.cx-auth-card.wide { max-width: 820px; }
.cx-auth-card .cx-brand-mark { background: var(--cx-brand-fill); color: #fff; margin-bottom: 10px; }
.cx-landing { max-width: 1080px; margin: 0 auto; padding: 40px 24px; }
.cx-entry { border-top: 6px solid var(--cx-brand); }

@media (max-width: 900px) {
    .cx-shell { flex-direction: column; }
    .cx-sidebar { width: 100%; flex-basis: auto; min-height: 0; border-bottom-right-radius: 0; padding-bottom: 0; }
    .cx-brand { flex-direction: row; justify-content: space-between; padding: 10px 16px; }
    .cx-menu-toggle { display: inline-block; background: rgba(255, 255, 255, .16); border: 0; color: #fff; border-radius: 8px; padding: 4px 12px; }
    .cx-rail { display: none; }
    .cx-rail.is-open { display: block; }
    .cx-tile { flex-direction: row; justify-content: flex-start; padding: 10px 16px; font-size: .9rem; }
    .cx-tile-count { position: static; margin-left: auto; }
    .cx-flyout { position: static; border-radius: 0; box-shadow: none; border: 0; background: rgba(255, 255, 255, .08); }
    .cx-flyout a { color: #fff; }
    .cx-flyout-title { display: none; }
    .cx-topbar, .cx-titlebar, .cx-content { padding-left: 16px; padding-right: 16px; }
}

/* ---------- Controller stages, guided walkthrough, guides ---------- */
.cx-stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; list-style: none; padding: 0; margin: 0; counter-reset: cx-stage; }
.cx-stages li { counter-increment: cx-stage; border: 1px solid var(--cx-border); border-radius: 10px; padding: 8px 10px; background: var(--cx-surface); }
.cx-stages li::before { content: counter(cx-stage) " · "; color: var(--cx-muted); }
.cx-stages li.done { background: var(--cx-success-bg); border-color: transparent; }
.cx-coach > summary { cursor: pointer; }
.cx-tour { padding-left: 1.2rem; margin: 0; }
.cx-tour li { padding: 6px 0; border-bottom: 1px solid var(--cx-border); }
.cx-tour li.done { color: var(--cx-muted); }
.cx-tour li.current { font-weight: 500; }
.cx-guide { overflow-x: auto; }
.cx-guide table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: .9rem; }
.cx-guide th, .cx-guide td { border: 1px solid var(--cx-border); padding: 6px 8px; vertical-align: top; }
.cx-guide pre { background: var(--cx-readonly); padding: 10px; border-radius: 8px; overflow-x: auto; }

/* ---------- Visual journey planner ---------- */
.cx-planner { display: flex; flex-wrap: wrap; gap: 6px; align-items: stretch; list-style: none; padding: 0; margin: 8px 0; }
.cx-planner li { position: relative; min-width: 128px; flex: 1 1 128px; border: 1px solid var(--cx-border); border-radius: 10px; padding: 6px 8px 6px; background: var(--cx-surface); font-size: .82rem; }
.cx-planner li .cat { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--cx-muted); }
.cx-planner li.review { border-style: dashed; border-color: var(--cx-brand); }
.cx-planner li.mandatory .lock { color: var(--cx-muted); font-size: .7rem; }

