/* ==========================================================================
   VichSI design tokens
   Dark is the default face: true black (#000, OLED pixels off) and white.
   Signal cyan is only a spark: status lights, focus, progress, selection.
   Light/dark follow the device, or the visitor's own pick (html[data-theme]).
   Signal never sits on white.
   ========================================================================== */
:root {
    color-scheme: dark;
    --bg: #000000;
    --surface: #000000;
    --raised: #121212;
    --field: #000000;
    --text: #FFFFFF;
    --text-soft: #C8C8C8;
    --muted: #9A9A9A;
    --line: #262626;
    --line-strong: #3A3A3A;
    --accent: #FFFFFF;
    --on-accent: #000000;
    --accent-hover: #D9D9D9;
    --accent-soft: rgba(255, 255, 255, 0.07);
    --accent-line: rgba(255, 255, 255, 0.32);
    --signal: #23D5D5;
    --hover: #23D5D5;
    --hover-fill: #23D5D5;
    --selection-bg: #23D5D5;
    --selection-text: #000000;
    --danger: #FF5C5C;
    --danger-soft: rgba(255, 92, 92, 0.10);
    --danger-line: rgba(255, 92, 92, 0.45);
    --warning: #FFB020;
    --warning-soft: rgba(255, 176, 32, 0.08);
    --warning-line: rgba(255, 176, 32, 0.40);
    --overlay: rgba(0, 0, 0, 0.88);
    --particle: #FFFFFF;
    --particle-opacity: 0.26;
    --particle-line-opacity: 0.08;
    --select-arrow: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='2.5' stroke-linecap='square'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    --radius: 2px;
    --font-sans: 'Archivo', 'IBM Plex Sans Arabic', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'JetBrains Mono', Menlo, Consolas, monospace;

    /* Names the templates and scripts already use */
    --primary: var(--accent);
    --primary-hover: var(--accent-hover);
    --glass-bg: var(--surface);
    --glass-border: var(--line);
    --text-main: var(--text);
    --text-muted: var(--muted);
    --bg-color: var(--bg);
}

/* Light: follows the device unless the visitor picked a mode */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        color-scheme: light;
        --bg: #FFFFFF;
        --surface: #FFFFFF;
        --raised: #F2F2F2;
        --field: #FFFFFF;
        --text: #000000;
        --text-soft: #2B2B2B;
        --muted: #5C5C5C;
        --line: #E0E0E0;
        --line-strong: #C8C8C8;
        --accent: #000000;
        --on-accent: #FFFFFF;
        --accent-hover: #2B2B2B;
        --accent-soft: rgba(0, 0, 0, 0.05);
        --accent-line: rgba(0, 0, 0, 0.40);
        --signal: #000000;
        --hover: #000000;
        --hover-fill: #2B2B2B;
        --selection-bg: #000000;
        --selection-text: #FFFFFF;
        --danger: #C62828;
        --danger-soft: rgba(198, 40, 40, 0.07);
        --danger-line: rgba(198, 40, 40, 0.45);
        --warning: #8A5A00;
        --warning-soft: rgba(176, 112, 0, 0.08);
        --warning-line: rgba(176, 112, 0, 0.40);
        --overlay: rgba(255, 255, 255, 0.92);
        --particle: #000000;
        --particle-opacity: 0.20;
        --particle-line-opacity: 0.07;
        --select-arrow: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2.5' stroke-linecap='square'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    }
}
:root[data-theme="light"] {
        color-scheme: light;
        --bg: #FFFFFF;
        --surface: #FFFFFF;
        --raised: #F2F2F2;
        --field: #FFFFFF;
        --text: #000000;
        --text-soft: #2B2B2B;
        --muted: #5C5C5C;
        --line: #E0E0E0;
        --line-strong: #C8C8C8;
        --accent: #000000;
        --on-accent: #FFFFFF;
        --accent-hover: #2B2B2B;
        --accent-soft: rgba(0, 0, 0, 0.05);
        --accent-line: rgba(0, 0, 0, 0.40);
        --signal: #000000;
        --hover: #000000;
        --hover-fill: #2B2B2B;
        --selection-bg: #000000;
        --selection-text: #FFFFFF;
        --danger: #C62828;
        --danger-soft: rgba(198, 40, 40, 0.07);
        --danger-line: rgba(198, 40, 40, 0.45);
        --warning: #8A5A00;
        --warning-soft: rgba(176, 112, 0, 0.08);
        --warning-line: rgba(176, 112, 0, 0.40);
        --overlay: rgba(255, 255, 255, 0.92);
        --particle: #000000;
        --particle-opacity: 0.20;
        --particle-line-opacity: 0.07;
        --select-arrow: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2.5' stroke-linecap='square'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-sans);
    font-weight: 400;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-sans); font-weight: 600; letter-spacing: -0.01em; }
strong, b { font-weight: 600; }
/* Selected text: always the opposite of the page so it stays readable in both modes */
::selection { background: var(--selection-bg); color: var(--selection-text); }
::-moz-selection { background: var(--selection-bg); color: var(--selection-text); }

/* Background elements */
#particles-js { position: fixed; width: 100%; min-height: 100vh; height: 100%; top: 0; left: 0; z-index: -2; pointer-events: none; }
.ambient-glow { display: none; }

.container { max-width: 900px; margin: 0 auto; padding: 50px 20px; position: relative; z-index: 10; }

/* Motion: sections rise into view, nothing slides in from the side */
.fade-up { opacity: 0; transform: translateY(24px); animation: fadeUpAnim 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.delay-1 { animation-delay: 0.15s; }
.delay-2 { animation-delay: 0.3s; }
@keyframes fadeUpAnim { to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
    .fade-up { animation: none; opacity: 1; transform: none; }
}

/* Brand marks (inline SVG, colour follows the text colour) */
.vichsi-logo, .vichsi-mark { display: block; height: auto; color: var(--text); }

/* Hero Header */
.hero-header { text-align: center; margin-bottom: 10px; padding: 40px 0 10px 0; }
.top-brand-logo { display: inline-block; color: var(--text); transition: opacity 0.2s ease; }
.top-brand-logo .vichsi-mark { width: 34px; margin: 0 auto 18px auto; }
.top-brand-logo:hover { opacity: 0.75; }
.logo-title {
    font-family: var(--font-sans);
    font-size: 104px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1;
    color: var(--text);
    margin: 0 auto;
    padding-left: 0.08em;
}
.hero-subtitle {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 14px;
    color: var(--muted);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin: 18px 0 22px 0;
}
.creator-badge {
    font-size: 17px;
    color: var(--muted);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 12px auto 0 auto;
    width: fit-content;
}
.author-link {
    font-weight: 600;
    font-size: 17px;
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 6px;
    position: relative;
    padding-bottom: 2px;
}
/* Signal appears on hover only */
.author-link:hover { color: var(--signal); }
.author-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 1px;
    background-color: currentColor;
    transition: width 0.25s ease;
}
.author-link:hover::after { width: 100%; }

/* Description Card */
.description-card { text-align: center; padding: 35px; margin-bottom: 60px; }
.desc-headline { font-size: 22px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.desc-headline span { color: var(--text); font-weight: 600; }
.desc-subline { font-size: 16px; color: var(--muted); max-width: 700px; margin: 0 auto; line-height: 1.6; }
.desc-subline span { color: var(--text); font-weight: 600; }

/* Panels */
.glass-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 40px;
    margin-bottom: 30px;
}
.glass-panel h2 {
    font-size: 1.2rem; font-weight: 600; color: var(--text);
    margin-bottom: 25px; display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid var(--line); padding-bottom: 15px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }
.input-group { margin-bottom: 24px; }

label { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 0.95rem; font-weight: 400; color: var(--text); }
.help-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--accent);
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--accent-line);
    padding: 4px 10px;
    border-radius: var(--radius);
    transition: background 0.2s ease, color 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}
.help-toggle svg { margin-bottom: 1px; }
.help-toggle:hover { background: var(--accent); color: var(--on-accent); }

.helper-text { display: block; margin-top: 12px; font-size: 0.9rem; color: var(--muted); background: var(--bg); padding: 20px; border-radius: var(--radius); border: 1px solid var(--line); border-left: 2px solid var(--line-strong); line-height: 1.7; animation: slideDown 0.25s ease forwards; }
.helper-text.hidden { display: none; }
.helper-text strong { color: var(--text); }
.helper-text a { color: var(--accent); text-decoration: none; font-weight: 600; }
.helper-text a:hover { text-decoration: underline; }
.helper-text code { background: var(--accent-soft); color: var(--accent); padding: 1px 6px; border-radius: var(--radius); font-size: 0.82rem; border: 1px solid var(--line); font-family: var(--font-mono); }
.helper-intro { font-size: 0.95rem; color: var(--muted); margin-bottom: 25px; padding-bottom: 15px; border-bottom: 1px dashed var(--line); }
.helper-intro strong { color: var(--text); }

input, textarea, select {
    width: 100%; padding: 14px 16px; background: var(--field); border: 1px solid var(--line-strong); border-radius: var(--radius);
    color: var(--text); font-family: inherit; font-size: 1rem; transition: border-color 0.2s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
textarea { resize: none; overflow: hidden; }
select {
    appearance: none;
    -webkit-appearance: none;
    background-image: var(--select-arrow);
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 40px;
    cursor: pointer;
}
select option { background: var(--bg); color: var(--text); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--signal); }

/* Upload Zone */
.upload-zone {
    border: 1px dashed var(--accent-line); border-radius: var(--radius); padding: 50px 20px; text-align: center; transition: border-color 0.2s ease, background 0.2s ease; background: var(--bg); cursor: pointer; position: relative; overflow: hidden;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.upload-icon { font-size: 2.6rem; margin-bottom: 15px; }
.upload-zone p { font-weight: 600; font-size: 1.05rem; margin-bottom: 5px; color: var(--text); }
.upload-zone .sub-text { font-size: 0.9rem; color: var(--muted); margin-bottom: 20px; font-weight: 400; }
.file-list { margin-top: 20px; text-align: left; display: flex; flex-wrap: wrap; gap: 10px; position: relative; z-index: 2; }
.file-chip {
    background: var(--raised); border: 1px solid var(--line); padding: 8px 14px; border-radius: var(--radius); font-size: 0.85rem; display: flex; align-items: center; gap: 10px; color: var(--text);
}
.repeat-btn {
    width: 22px; height: 22px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--accent-line); border-radius: var(--radius);
    background: transparent; color: var(--accent);
    font-size: 0.85rem; line-height: 1;
}
.repeat-btn:hover { background: var(--accent); color: var(--on-accent); }
.repeat-label { min-width: 28px; text-align: center; color: var(--accent); font-family: var(--font-mono); font-weight: 500; }

.lead-form-picker-row {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
}
.lead-form-picker-row p { margin: 0; font-size: 0.92rem; color: var(--muted); }
.lead-form-picker-row strong { color: var(--text); }
.lead-form-picker-btn { padding: 8px 15px; font-size: 0.82rem; white-space: nowrap; }

.lead-form-modal-content { max-width: 640px; }
.lead-form-modal-copy { color: var(--muted); margin-bottom: 18px; }
.lead-form-list { display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow-y: auto; padding-right: 4px; }
.lead-form-option {
    width: 100%;
    text-align: left;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.lead-form-option:hover { border-color: var(--accent); background: var(--accent-soft); }
.lead-form-option:disabled { cursor: not-allowed; opacity: 0.48; }
.lead-form-option:disabled:hover { border-color: var(--line); background: var(--bg); }
.lead-form-option-name { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; }
.lead-form-option-meta { margin-top: 5px; color: var(--muted); font-family: var(--font-mono); font-size: 0.74rem; word-break: break-word; }
.lead-form-default-badge {
    display: inline-flex;
    width: fit-content;
    margin-bottom: 8px;
    padding: 3px 8px;
    border-radius: var(--radius);
    border: 1px solid var(--accent-line);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.lead-form-status-pill { color: var(--accent); font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; }
.lead-form-error { margin-top: 14px; color: var(--danger); font-size: 0.9rem; }
.lead-form-error.hidden { display: none; }
/* Page dropdown status (loading / errors) under the Campaign Assets "Page" control */
.field-status { margin-top: 8px; color: var(--muted); font-size: 0.85rem; }
.field-status.is-error { color: var(--danger); }
.field-status.hidden { display: none; }
/* "Enter Page ID" fallback under the Page dropdown */
.page-id-entry { display: flex; gap: 10px; margin-top: 10px; }
.page-id-entry.hidden { display: none; }
.page-id-entry input { flex: 1; }
.page-id-entry .secondary-btn { white-space: nowrap; }
/* Controls that only apply to one conversion location (instant form vs WhatsApp) */
.when-whatsapp.hidden, .when-instant.hidden { display: none; }
.lead-form-option-preview { margin-top: 6px; color: var(--text-soft); font-size: 0.82rem; line-height: 1.45; }
.lead-form-modal-actions { display: flex; gap: 12px; margin-top: 22px; }

/* Alerts */
.billing-warning {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--warning-soft);
    border: 1px solid var(--warning-line);
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.5;
}
.billing-warning svg { color: var(--warning); flex-shrink: 0; margin-top: 1px; }
.billing-warning strong { color: var(--warning); }

/* Upload Progress Bar */
.upload-progress-container {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    height: 38px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
}
.upload-progress-container.hidden { display: none; }
.upload-progress-bar { height: 100%; width: 0%; background: var(--signal); transition: width 0.3s ease; }
.upload-progress-text {
    position: absolute;
    width: 100%;
    text-align: center;
    color: var(--text);
    mix-blend-mode: difference;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    pointer-events: none;
}
@keyframes progressPulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }
.pulse { animation: progressPulse 1.5s infinite; }

/* Buttons */
button { font-family: var(--font-sans); cursor: pointer; border: none; border-radius: var(--radius); font-weight: 600; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease; }
.primary-btn {
    width: 100%; padding: 18px; background: var(--accent); color: var(--on-accent); font-size: 1.05rem;
    display: flex; justify-content: center; align-items: center; gap: 12px; text-decoration: none;
}
.primary-btn:hover { background: var(--accent-hover); }
.primary-btn:disabled { background: var(--raised); color: var(--muted); cursor: not-allowed; border: 1px solid var(--line); }
.secondary-btn { padding: 12px 24px; background: transparent; color: var(--text); border: 1px solid var(--line); position: relative; z-index: 2; text-decoration: none; display: inline-block; }
.secondary-btn:hover { border-color: var(--accent); color: var(--accent); }
.secondary-btn.accent-outline { border-color: var(--accent-line); color: var(--accent); }
.danger-btn { background: transparent; color: var(--danger); border: 1px solid var(--danger-line); }
.danger-btn:hover { background: var(--danger); color: #FFFFFF; border-color: var(--danger); }
.save-msg { margin-left: 10px; font-size: 0.85rem; color: var(--accent); opacity: 0; transition: opacity 0.3s; font-weight: 600; }

/* Modal & Loader */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--overlay); display: flex; justify-content: center; align-items: center; z-index: 100; padding: 20px; }
.modal.hidden { display: none; }
.modal-content { width: 90%; max-width: 550px; background: var(--bg); border-color: var(--line-strong); }
.modal-content h2 { border-bottom: none; padding-bottom: 0; margin-bottom: 14px; }
.modal-content p { color: var(--muted); }
.modal-content p strong { color: var(--text); }
.modal-danger { border-top: 2px solid var(--danger); }
.modal-danger h2 { color: var(--danger); }
.modal-icon { display: flex; justify-content: center; margin-bottom: 20px; }
.modal-icon span { display: flex; padding: 15px; border-radius: var(--radius); border: 1px solid var(--accent-line); color: var(--accent); }
.modal-danger .modal-icon span { border-color: var(--danger-line); color: var(--danger); }
.modal-actions { display: flex; gap: 15px; margin-top: 30px; }
.modal-actions > * { flex: 1; }
.modal-field { margin-top: 15px; }
.code-block { background: var(--raised); padding: 20px; border-radius: var(--radius); font-family: var(--font-mono); font-size: 0.85rem; margin: 25px 0; white-space: pre-wrap; word-break: break-all; color: var(--text); border: 1px solid var(--line); }
.loader { width: 22px; height: 22px; border: 2px solid var(--accent-soft); border-radius: 50%; border-top-color: var(--on-accent); animation: spin 1s linear infinite; }
.loader.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Profile node (dashboard, top right) */
.profile-node { position: fixed; top: 25px; right: 25px; z-index: 1001; }
.icon-bubble {
    width: 48px; height: 48px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--line);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent); cursor: pointer; transition: border-color 0.2s ease;
}
.icon-bubble:hover { border-color: var(--accent-line); }
.admin-bubble { position: fixed; top: 90px; right: 25px; z-index: 1000; border-color: var(--accent-line); }
.profile-dropdown {
    position: absolute; top: 60px; right: 0; width: 280px;
    background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px; flex-direction: column; gap: 12px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}
.dropdown-label { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.profiles-list { max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.profile-row { display: flex; gap: 5px; align-items: stretch; }
.profile-item {
    flex: 1; text-align: left; background: transparent; color: var(--muted);
    border: 1px solid transparent; padding: 12px 14px; font-size: 0.95rem; font-weight: 400;
    display: flex; justify-content: space-between; align-items: center;
}
.profile-item:hover { background: var(--raised); color: var(--text); }
.profile-item.active { background: var(--accent-soft); color: var(--text); border-color: var(--accent-line); font-weight: 600; }
.active-dot { width: 8px; height: 8px; background: var(--signal); border-radius: 50%; display: inline-block; }
.profile-more { background: transparent; border: none; color: var(--muted); padding: 8px; display: flex; align-items: center; justify-content: center; height: 100%; }
.profile-more:hover { background: var(--raised); color: var(--text); }
/* Business / profile switcher and the Meta-style picker (META-CONNECTIONS-DESIGN.md §0).
   Business = one Meta business portfolio; profile = one ad account in it. */
.account-email { margin: 2px 0 10px; color: var(--muted); font-size: 0.82rem; word-break: break-all; }
.account-link { display: block; width: 100%; margin: 0 0 14px; padding: 10px 12px; background: transparent; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); font-size: 0.88rem; font-weight: 600; text-align: left; cursor: pointer; }
.password-modal-content { max-width: 420px; }
.password-modal-content .picker-error { color: var(--danger); }
.workspace-switcher { margin-bottom: 24px; }
.switcher-btn { display: inline-flex; align-items: center; gap: 10px; max-width: 100%; padding: 12px 16px; background: var(--bg); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--radius); font: 600 1rem/1.3 var(--font-sans); text-align: left; cursor: pointer; transition: border-color 0.2s ease; }
.switcher-business { min-width: 0; overflow: hidden; color: var(--muted); font-weight: 400; white-space: nowrap; text-overflow: ellipsis; }
.switcher-sep { color: var(--muted); }
.switcher-profile { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.switcher-chevron { flex-shrink: 0; color: var(--muted); }
.switcher-problem { margin: 10px 0 0; color: var(--danger); font-size: 0.88rem; }
.switcher-problem.hidden { display: none; }
.switcher-problem.is-warning { color: var(--warning); }
.switcher-fix { padding: 0; background: none; border: none; color: var(--text); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.modal.picker-modal, .modal.account-modal { z-index: 3000; } /* above the fixed account and admin bubbles */
.picker { display: flex; flex-direction: column; width: min(920px, calc(100vw - 32px)); height: min(620px, calc(100vh - 48px)); overflow: hidden; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35); }
.picker-top { display: flex; align-items: center; gap: 10px; padding: 12px; border-bottom: 1px solid var(--line); }
.picker-search { display: flex; flex: 1; align-items: center; gap: 8px; margin: 0; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--muted); }
.picker-search input { width: 100%; padding: 10px 0; background: transparent; border: none; color: var(--text); font-size: 0.95rem; }
.picker-search input:focus { outline: none; }
.picker-search:focus-within { border-color: var(--signal); }
.picker-icon-btn { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; background: transparent; border: 1px solid transparent; border-radius: var(--radius); color: var(--muted); cursor: pointer; }
.picker-back { display: none; }
.picker-body { display: grid; flex: 1; grid-template-columns: 300px 1fr; min-height: 0; }
.picker-left { overflow-y: auto; padding: 10px 0; border-right: 1px solid var(--line); }
.picker-col-label { padding: 6px 16px 8px; color: var(--muted); font: 400 0.7rem/1.4 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; }
.picker-business { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; background: transparent; border: none; border-left: 2px solid transparent; color: var(--text); text-align: left; cursor: pointer; }
.picker-business.is-selected { background: var(--raised); border-left-color: var(--text); }
.picker-tile { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid var(--line-strong); border-radius: var(--radius); font: 600 0.9rem/1 var(--font-sans); }
.picker-business-text { flex: 1; min-width: 0; }
.picker-business-name { display: block; overflow: hidden; font-size: 0.92rem; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.picker-business-sub { display: block; color: var(--muted); font-size: 0.78rem; }
.picker-dot { flex-shrink: 0; width: 8px; height: 8px; background: var(--line-strong); border-radius: 50%; }
.picker-dot.is-problem { background: var(--danger); }
.picker-dot.is-warning { background: var(--warning); }
.picker-chevron { flex-shrink: 0; color: var(--muted); }
.picker-right { overflow-y: auto; padding: 18px 20px; }
.picker-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.picker-head-name { margin: 0; font-size: 1.1rem; font-weight: 600; }
.picker-head-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; color: var(--muted); font-size: 0.82rem; }
.picker-badge { padding: 2px 7px; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text); font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; }
.picker-badge.is-problem { color: var(--danger); border-color: var(--danger-line); }
.picker-badge.is-warning { color: var(--warning); border-color: var(--warning-line); }
.picker-badge.is-unknown { color: var(--muted); }
.picker-subhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 8px; color: var(--muted); font-size: 0.82rem; }
.picker-add { position: relative; }
.picker-add > .secondary-btn, .picker-actions .secondary-btn, .picker-bottom .secondary-btn { padding: 8px 14px; font-size: 0.85rem; }
.picker-add-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 5; width: 340px; max-height: 300px; overflow-y: auto; padding: 6px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35); }
.picker-add-menu.hidden { display: none; }
.picker-add-item { display: block; width: 100%; padding: 9px 10px; background: transparent; border: none; border-radius: var(--radius); color: var(--text); font-size: 0.9rem; text-align: left; cursor: pointer; }
.picker-add-item small { display: block; color: var(--muted); font-family: var(--font-mono); font-size: 0.72rem; }
.picker-add-id { display: flex; gap: 8px; padding: 8px 4px 4px; }
.picker-add-id input { padding: 8px 10px; font-size: 0.85rem; }
.picker-profile { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: var(--radius); cursor: pointer; }
.picker-radio { position: relative; flex-shrink: 0; width: 18px; height: 18px; border: 1px solid var(--line-strong); border-radius: 50%; }
.picker-profile.is-active .picker-radio { border-color: var(--text); }
.picker-profile.is-active .picker-radio::after { content: ''; position: absolute; inset: 4px; background: var(--text); border-radius: 50%; }
.picker-profile-text { flex: 1; min-width: 0; }
.picker-profile-name { display: block; overflow: hidden; font-size: 0.92rem; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.picker-profile-meta { display: block; color: var(--muted); font-family: var(--font-mono); font-size: 0.74rem; }
.picker-empty { padding: 12px 8px; color: var(--muted); font-size: 0.88rem; }
.picker-bottom { padding: 12px; border-top: 1px solid var(--line); }
.picker-title { margin: 0 0 4px; font-size: 1.05rem; font-weight: 600; }
.picker-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.picker-note { margin: 8px 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.5; }
.picker-error { margin: 8px 0 0; color: var(--danger); font-size: 0.85rem; }
.picker-warning { margin: 8px 0 0; color: var(--warning); font-size: 0.85rem; line-height: 1.6; }
.picker-warning code { padding: 1px 5px; border: 1px solid var(--warning-line); border-radius: var(--radius); font-family: var(--font-mono); font-size: 0.76rem; }
.picker-error.hidden, .picker-note.hidden, .picker-form.hidden { display: none; }
.wizard-steps { display: flex; gap: 14px; margin-bottom: 14px; color: var(--muted); font: 400 0.72rem/1.4 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; }
.wizard-steps .is-current { color: var(--text); }
/* Settings v4 (META-CONNECTIONS-DESIGN.md §0 H + the owner's add-ons): calm, one thing per screen */
.picker[data-mode="list"] .picker-page { display: none; }
.picker[data-mode="page"] .picker-top, .picker[data-mode="page"] .picker-body, .picker[data-mode="page"] .picker-bottom { display: none; }
.picker-page { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.page-body .hidden { display: none; }
.page-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line); }
.page-back { flex-shrink: 0; min-height: 40px; padding: 0 14px; background: transparent; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text); font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.page-crumbs { flex: 1; min-width: 0; }
.page-crumbs:empty { display: none; }
.page-body { flex: 1; overflow-y: auto; padding: 30px max(32px, calc((100% - 580px) / 2)) 40px; }
.link-btn { padding: 0; background: none; border: none; color: var(--text); font: inherit; font-size: 0.92rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.picker-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.picker-rule { margin: 0; color: var(--muted); font-size: 0.82rem; }
.picker-rule .link-btn { font-size: 0.82rem; }
.picker-subhead-label { color: var(--muted); font: 400 0.7rem/1.4 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; }
/* Screens */
.v4-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.v4-tile { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 52px; height: 52px; border: 1px solid var(--line-strong); border-radius: var(--radius); font-size: 1.3rem; font-weight: 600; }
.v4-head-text { flex: 1; min-width: 0; }
.v4-name { margin: 0; font-size: 1.6rem; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.v4-head .v4-sub { margin-top: 4px; }
.v4-icon-btn { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; background: transparent; border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); cursor: pointer; }
.v4-rename { display: flex; flex: 1; gap: 8px; }
.v4-rename input { flex: 1; min-width: 0; min-height: 48px; font-size: 1.05rem; }
.v4-rename button { flex-shrink: 0; white-space: nowrap; }
.v4-title { margin: 0 0 8px; font-size: 1.55rem; font-weight: 600; line-height: 1.25; }
.v4-sub { margin: 0; color: var(--muted); font-size: 0.98rem; line-height: 1.55; }
.v4-flash { margin-bottom: 22px; padding: 12px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); font-size: 0.95rem; }
.v4-status { display: flex; align-items: center; gap: 18px; padding: 26px 0 22px; }
.v4-status-mark { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 60px; height: 60px; border: 2px solid currentColor; border-radius: 50%; font-size: 1.6rem; font-weight: 600; }
.v4-status-title { margin: 0; font-size: 1.4rem; font-weight: 600; }
.v4-status-line { margin: 4px 0 0; color: var(--text-soft); font-size: 1rem; }
.is-ok .v4-status-mark, .wz-big-state.is-ok { color: var(--text); }
.is-warning .v4-status-mark, .wz-big-state.is-warning, .v4-status.is-warning .v4-status-title { color: var(--warning); }
.is-problem .v4-status-mark, .wz-big-state.is-problem, .v4-status.is-problem .v4-status-title { color: var(--danger); }
.is-unknown .v4-status-mark { color: var(--muted); }
.v4-fix { margin-bottom: 10px; }
.v4-big-btn { min-height: 54px; padding: 0 30px; background: var(--accent); border: 1px solid var(--accent); border-radius: var(--radius); color: var(--on-accent); font-size: 1.02rem; font-weight: 600; cursor: pointer; }
.v4-big-btn:disabled { background: var(--raised); border-color: var(--line); color: var(--muted); cursor: not-allowed; }
.v4-rows { margin: 22px 0; border-top: 1px solid var(--line); }
.v4-row { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 62px; margin: 0; padding: 0 4px; background: transparent; border: none; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--text); font-size: 1.05rem; font-weight: 400; text-align: left; cursor: pointer; }
.v4-row-icon { display: inline-flex; flex-shrink: 0; color: var(--muted); }
.v4-row-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.v4-row-value { flex-shrink: 0; color: var(--muted); font-size: 0.98rem; }
.v4-row-chevron { flex-shrink: 0; color: var(--muted); font-size: 1.4rem; line-height: 1; }
.v4-row.is-attention .v4-row-value { color: var(--warning); }
.v4-row.is-add .v4-row-label, .v4-row-add { color: var(--muted); }
.v4-row.is-static { cursor: default; }
.v4-row.is-static .v4-danger-btn { flex-shrink: 0; font-size: 0.9rem; }
.move-ask { margin: 6px 0; padding: 14px; border: 1px solid var(--warning-line); border-radius: var(--radius); }
.move-ask p { margin: 0 0 12px; color: var(--text); font-size: 0.95rem; line-height: 1.5; }
.move-ask-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.v4-rows-quiet { margin-top: 8px; border-top: none; }
.v4-rows-quiet .v4-row { min-height: 52px; color: var(--muted); font-size: 0.98rem; }
.v4-more { margin-top: 30px; }
.v4-more summary, .v4-experts summary { color: var(--muted); font-size: 0.92rem; cursor: pointer; }
.v4-more-body { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; padding-top: 16px; }
.v4-danger-btn { padding: 0; background: none; border: none; color: var(--danger); font: inherit; font-size: 0.95rem; cursor: pointer; }
.v4-danger-btn:disabled { color: var(--muted); cursor: not-allowed; }
.v4-experts { margin-top: 36px; padding-top: 14px; border-top: 1px solid var(--line); }
.v4-experts dl { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; margin: 14px 0; font-size: 0.9rem; }
.v4-experts dt { color: var(--muted); }
.v4-experts dd { margin: 0; overflow-wrap: anywhere; }
.v4-perms { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 16px; margin: 0 0 10px; padding: 0; font-size: 0.82rem; list-style: none; }
.v4-perms .is-no { color: var(--warning); }
.v4-perms code { font-family: var(--font-mono); font-size: 0.76rem; }
.v4-token-state { margin: 20px 0 6px; font-size: 1.3rem; font-weight: 600; }
.v4-token-state.is-warning { color: var(--warning); }
.v4-token-state.is-problem { color: var(--danger); }
.v4-token-state.is-unknown { color: var(--muted); }
.v4-pages { margin: 18px 0; border-top: 1px solid var(--line); }
.v4-page { padding: 18px 2px; border-bottom: 1px solid var(--line); }
.v4-page-name { margin: 0 0 6px; font-size: 1.08rem; font-weight: 600; }
.v4-ready { margin: 4px 0 0; color: var(--muted); font-size: 0.96rem; }
.v4-ready.is-yes { color: var(--text); }
.v4-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 20px; }
.v4-inline { display: flex; gap: 8px; margin-top: 12px; }
.v4-inline input { flex: 1; min-width: 0; }
.v4-choices { margin: 18px 0; border-top: 1px solid var(--line); }
.v4-choice { display: flex; align-items: center; justify-content: flex-start; gap: 14px; min-height: 60px; margin: 0; padding: 0 4px; border-bottom: 1px solid var(--line); font-size: 1.05rem; cursor: pointer; }
.v4-choice .v4-row-value { margin-left: auto; }
.v4-saved { margin: 8px 0 0; color: var(--text); font-size: 0.95rem; }
/* Setup: 3 stages, checklists, "Show me where" */
.wz-title { margin: 0 0 10px; font-size: 1.6rem; font-weight: 600; line-height: 1.25; }
.wz-lead { margin: 0 0 20px; color: var(--text-soft); font-size: 1.05rem; line-height: 1.55; }
.wz-calm { margin: 10px 0; color: var(--muted); font-size: 0.98rem; line-height: 1.55; }
.wz-hint { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
.wz-hint a, .wz-where a { color: var(--text); }
.wz-big-state .v4-status-mark { width: 68px; height: 68px; margin-bottom: 18px; font-size: 1.8rem; }
.wz-stages { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 26px; padding: 0; color: var(--muted); font-size: 0.85rem; list-style: none; }
.wz-stages li { display: flex; align-items: center; gap: 8px; }
.wz-stages .is-current { color: var(--text); font-weight: 600; }
.wz-stage-num { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 24px; height: 24px; border: 1px solid currentColor; border-radius: 50%; font-size: 0.78rem; }
.wz-stages .is-done .wz-stage-num { background: var(--muted); border-color: var(--muted); color: var(--bg); }
.wz-intro-stages { margin: 6px 0 22px; padding: 0; border-top: 1px solid var(--line); list-style: none; }
.wz-intro-stages li { display: flex; align-items: center; gap: 16px; min-height: 64px; border-bottom: 1px solid var(--line); font-size: 1.15rem; }
.wz-intro-stages .wz-stage-num { width: 36px; height: 36px; border-color: var(--line-strong); font-size: 1rem; }
.wz-lines { margin: 4px 0 8px; padding: 0; border-top: 1px solid var(--line); list-style: none; }
.wz-line { padding: 18px 0; border-bottom: 1px solid var(--line); }
.wz-check { display: flex; align-items: flex-start; justify-content: flex-start; gap: 14px; margin: 0; font-size: 1.08rem; line-height: 1.45; cursor: pointer; }
.wz-check > span { flex: 1; min-width: 0; }
.wz-box, .v4-choice input { flex-shrink: 0; width: 22px; height: 22px; min-height: 0; margin: 1px 0 0; padding: 0; background: none; border: none; accent-color: var(--text); }
.wz-check:has(.wz-box:checked) > span { color: var(--muted); }
.smw { margin: 10px 0 0 36px; }
.smw summary { color: var(--text); font-size: 0.92rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; list-style: none; }
.smw summary::-webkit-details-marker { display: none; }
.smw-body { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin-top: 14px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); }
.wz-open { display: inline-flex; align-items: center; gap: 6px; min-height: 46px; padding: 0 18px; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text); font-size: 0.98rem; font-weight: 600; text-decoration: none; }
.page-body > .wz-open { display: flex; width: fit-content; margin-bottom: 16px; }
/* Look-alikes of Meta's own buttons and fields (Meta's colours, on purpose) */
.ml-wrap { width: 100%; margin: 2px 0 12px; }
.ml-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ml { display: inline-flex; align-items: center; gap: 8px; font-family: Helvetica, Arial, sans-serif; font-size: 0.86rem; line-height: 1.2; }
.ml-button { padding: 8px 14px; background: #E4E6EB; border-radius: 6px; color: #050505; font-weight: 600; }
.ml-button.is-primary { background: #0866FF; color: #FFFFFF; }
.ml-field { padding: 7px 11px; background: #FFFFFF; border: 1px solid #CED0D4; border-radius: 6px; color: #050505; }
.ml-value { color: #65676B; }
.ml-toggle { position: relative; display: inline-block; width: 32px; height: 18px; background: #0866FF; border-radius: 9px; }
.ml-toggle::after { content: ''; position: absolute; top: 2px; right: 2px; width: 14px; height: 14px; background: #FFFFFF; border-radius: 50%; }
.ml-then { color: var(--muted); font-size: 1.1rem; }
.ml-arrow { margin: 8px 0 0; color: var(--muted); font-size: 0.82rem; }
/* Copy boxes */
.cb { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.page-body > .cb { margin-bottom: 12px; }
.cb-label { margin: 0 0 6px; color: var(--muted); font-size: 0.85rem; }
.cb-row { display: flex; align-items: center; gap: 10px; }
.cb-value { flex: 1; min-width: 0; color: var(--text); font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.5; overflow-wrap: anywhere; }
.cb-btn { flex-shrink: 0; min-height: 36px; padding: 0 14px; background: transparent; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text); font-size: 0.86rem; font-weight: 600; cursor: pointer; }
/* "?" help dots */
.hd-term { display: inline; }
.hd { display: inline-flex; align-items: center; justify-content: center; width: 19px; height: 19px; margin: 0 2px 0 5px; padding: 0; vertical-align: 2px; background: transparent; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--muted); font-size: 0.7rem; font-weight: 700; line-height: 1; cursor: pointer; }
.hd-bubble { display: block; margin: 8px 0; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text-soft); font-size: 0.9rem; font-weight: 400; line-height: 1.5; }
/* The 3 boxes */
.wz-field { margin: 0 0 20px; }
.wz-field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.wz-field-head label { margin: 0; font-size: 1.02rem; font-weight: 600; }
.wz-field input { width: 100%; min-height: 52px; font-size: 1.02rem; }
.wz-where { margin: 0 0 10px; color: var(--muted); font-size: 0.9rem; }
.wz-result { margin: 12px 0 0; font-size: 0.95rem; line-height: 1.5; }
.wz-result.is-error { color: var(--danger); }
.wz-result .secondary-btn { margin-top: 12px; }
.wz-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 30px; }
.wz-actions:has(> :only-child) { justify-content: flex-end; }
.wz-back { min-height: 54px; padding: 0 24px; background: transparent; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text); font-size: 1rem; font-weight: 600; cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
    .page-back:hover, .wz-back:hover, .wz-open:hover, .cb-btn:hover, .v4-icon-btn:hover { border-color: var(--hover); color: var(--hover); }
    .v4-big-btn:not(:disabled):hover { background: var(--hover-fill); border-color: var(--hover-fill); color: #000000; }
    button.v4-row:hover .v4-row-label, button.v4-row:hover .v4-row-chevron, .v4-choice:hover span { color: var(--hover); }
    .link-btn:hover, .smw summary:hover, .v4-more summary:hover, .v4-experts summary:hover, .hd:hover { color: var(--hover); border-color: var(--hover); }
    .v4-danger-btn:not(:disabled):hover { text-decoration: underline; text-underline-offset: 3px; }
}
@media (max-width: 640px) {
    .page-top { padding: 10px 12px; }
    .page-body { padding: 22px 18px 32px; }
    .v4-name, .v4-title, .wz-title { font-size: 1.35rem; }
    .v4-status { gap: 14px; }
    .v4-status-mark { width: 52px; height: 52px; font-size: 1.4rem; }
    .v4-fix .v4-big-btn, .wz-actions > button, .v4-actions > .secondary-btn { width: 100%; }
    .wz-actions { flex-direction: column-reverse; align-items: stretch; }
    .smw { margin-left: 0; }
    .v4-row.is-static { flex-wrap: wrap; padding: 12px 4px; }
    .v4-experts dl { grid-template-columns: 1fr; gap: 2px; }
    .v4-experts dd { margin-bottom: 8px; }
    .picker-bottom { align-items: stretch; flex-direction: column; }
}
@media (hover: hover) and (pointer: fine) {
    .switcher-btn:hover { border-color: var(--hover); }
    .switcher-fix:hover { color: var(--hover); }
    .picker-business:hover, .picker-profile:hover, .picker-add-item:hover { background: var(--raised); }
    .picker-icon-btn:hover { color: var(--hover); border-color: var(--line-strong); }
    .account-link:hover { border-color: var(--line-strong); color: var(--hover); }
}
/* Phone: a full-screen, two-step sheet (businesses, then the chosen business's profiles) */
@media (max-width: 640px) {
    .modal.picker-modal { align-items: stretch; padding: 0; }
    .picker { width: 100vw; height: 100vh; height: 100dvh; border: none; border-radius: 0; }
    .picker-body { grid-template-columns: 1fr; }
    .picker-left { border-right: none; }
    .picker[data-step="businesses"] .picker-right { display: none; }
    .picker[data-step="detail"] .picker-left { display: none; }
    .picker[data-step="detail"] .picker-back { display: inline-flex; }
    .picker-add-menu { width: calc(100vw - 48px); }
}
.new-profile-row { display: flex; gap: 8px; margin-top: 8px; position: relative; }
.new-profile-row input { flex: 1; padding: 10px 12px; font-size: 0.85rem; }
.new-profile-row button { background: transparent; color: var(--accent); border: 1px solid var(--accent-line); padding: 0 14px; font-size: 1.1rem; }
.new-profile-row button:hover { background: var(--accent); color: var(--on-accent); }
.logout-link {
    margin-top: 15px; display: flex; justify-content: center; align-items: center; gap: 8px;
    color: var(--danger); text-decoration: none; font-weight: 600; font-size: 0.9rem;
    border: 1px solid var(--danger-line); padding: 12px; border-radius: var(--radius); transition: background 0.2s ease, color 0.2s ease;
}
.logout-link:hover { background: var(--danger); color: #FFFFFF; }

/* Profile action menu */
.ctx-menu {
    position: fixed; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 6px; flex-direction: column; gap: 4px; box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35); z-index: 9999; min-width: 140px;
}
.ctx-item { background: transparent; border: none; color: var(--text); display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-size: 0.85rem; font-weight: 400; width: 100%; text-align: left; }
.ctx-item:hover { background: var(--raised); }
.ctx-item.accent { color: var(--accent); }
.ctx-item.warning { color: var(--warning); }
.ctx-item.danger { color: var(--danger); }

/* Footer: the product's address, lowercase (recc.vichsi.com) */
.vichsi-footer { width: 100%; border-top: 1px solid var(--line); background: var(--bg); }
.vichsi-footer .container {
    padding: 14px 20px; display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.12em; color: var(--muted); line-height: 1.5;
}
.vichsi-footer a { color: inherit; text-decoration: none; }

/* Small pages (reset password, admin) */
.status-used { color: var(--danger); font-size: 0.85rem; font-family: var(--font-mono); }
.status-active { color: var(--signal); font-size: 0.85rem; font-family: var(--font-mono); }
.notice { padding: 12px; border-radius: var(--radius); margin-bottom: 20px; font-weight: 600; font-size: 0.9rem; }
.notice.error, .error-msg { background: var(--danger-soft); border: 1px solid var(--danger-line); color: var(--danger); }
.notice.success, .success-msg { background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent); }

@media (max-width: 768px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .logo-title { font-size: 60px; }
    .glass-panel { padding: 28px 20px; }
    .lead-form-picker-row, .lead-form-modal-actions { flex-direction: column; align-items: stretch; }
    .profile-node { top: 16px; right: 16px; }
    .admin-bubble { top: 76px; right: 16px; }
}

/* Hide Native Number Spinners */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

/* ==========================================================================
   Appearance switch (System / Light / Dark)
   ========================================================================== */
.theme-toggle { position: relative; display: inline-flex; }
.theme-toggle-btn {
    width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
    background: transparent; color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.theme-toggle-btn svg, .theme-option svg { width: 16px; height: 16px; flex-shrink: 0; }
.theme-menu {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 2000; min-width: 168px;
    background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius);
    padding: 6px; display: flex; flex-direction: column; gap: 2px; box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}
.theme-menu[hidden] { display: none; }
.theme-option {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px;
    background: transparent; color: var(--muted); border: none; border-radius: var(--radius);
    font-size: 0.88rem; font-weight: 400; text-align: left;
}
.theme-option[aria-checked="true"] { color: var(--text); background: var(--raised); font-weight: 600; }
.theme-option .check { margin-left: auto; opacity: 0; }
.theme-option[aria-checked="true"] .check { opacity: 1; }
.theme-segment { display: flex; gap: 4px; border: 1px solid var(--line); border-radius: var(--radius); padding: 3px; }
.theme-segment .theme-option { justify-content: center; padding: 7px 6px; font-size: 0.78rem; gap: 6px; }
.theme-segment .theme-option .check { display: none; }

@media (hover: hover) and (pointer: fine) {
    .theme-toggle-btn:hover { color: var(--hover); border-color: var(--hover); }
    .theme-option:hover { color: var(--hover); }
}

/* Work screen hierarchy: the form leads, the title steps back */
.logo-title { font-size: 72px; }
.hero-header { padding: 24px 0 8px 0; }
.hero-subtitle { font-size: 12px; margin: 14px 0 8px 0; }
.description-card { padding: 28px 32px; margin-bottom: 40px; }
.desc-headline { font-size: 21px; line-height: 1.35; }
.glass-panel h2 { font-size: 1.1rem; letter-spacing: 0; }
label { font-size: 0.9rem; }
.helper-intro { font-size: 0.9rem; }
@media (max-width: 768px) { .logo-title { font-size: 48px; } .desc-headline { font-size: 19px; } }
