/* ============================================================
   VANTORA DESIGN SYSTEM
   Loaded AFTER each page's own stylesheet, so it only has to
   redefine the tokens and restyle the parts that carry the brand.

   Brand idea: the logo is a star in orbit. The product is black
   and white; the one bold move is the black brand rail with the
   white mark. Everything else stays quiet. Colour appears only
   where it carries meaning (status, focus, links).
   ============================================================ */

/* ---------- Tokens: light (default) ---------- */
:root {
    color-scheme: light;

    --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Sora", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

    /* surfaces */
    --bg: #f4f5f7;
    --bg-blue: #f4f5f7;
    --surface: #ffffff;
    --surface-soft: #f8f9fb;
    --surface-sunken: #eef0f3;
    --surface-glass: #ffffff;
    --overlay: rgba(10, 12, 16, 0.5);

    /* lines */
    --border: #e5e8ed;
    --border-dark: #d6dbe3;
    --border-hover: #c3cad5;

    /* text */
    --text: #0a0c10;
    --text-soft: #394150;
    --muted: #5c6577;
    --faint: #98a1b2;

    /* the primary action is ink on paper (white on black in dark mode) */
    --ink: #0a0c10;
    --on-ink: #ffffff;

    /* accent: focus, links, selection. Never a button fill. */
    --accent: #2748e0;
    --accent-strong: #1b36b8;
    --accent-soft: #eef1fd;
    --accent-border: #d3dbfa;
    --accent-focus: #6f86f0;
    --focus-ring: 0 0 0 3px rgba(39, 72, 224, 0.18);

    /* names the older stylesheets already use */
    --primary: var(--accent);
    --primary-dark: var(--accent-strong);
    --primary-soft: var(--accent-soft);
    --primary-border: var(--accent-border);

    /* status */
    --green: #137a52;
    --green-strong: #0e6b45;
    --green-soft: #e8f6ef;
    --green-border: #bfe6d3;
    --amber: #b25e00;
    --amber-strong: #8f4b00;
    --amber-soft: #fff4e0;
    --amber-border: #f6d9a8;
    --red: #c2332d;
    --red-strong: #a5261f;
    --red-soft: #fdeceb;
    --red-border: #f5c1be;

    /* depth */
    --shadow-xs: 0 1px 2px rgba(10, 12, 16, 0.05);
    --shadow-sm: 0 1px 2px rgba(10, 12, 16, 0.04), 0 8px 24px -14px rgba(10, 12, 16, 0.14);
    --shadow-md: 0 2px 4px rgba(10, 12, 16, 0.04), 0 24px 56px -20px rgba(10, 12, 16, 0.22);
    --shadow: var(--shadow-sm);
    --shadow-large: var(--shadow-md);

    --scroll: #d0d5dd;
    --scroll-hover: #b9c0cc;

    /* shape: three clear steps, not one radius everywhere */
    --radius: 14px;
    --radius-small: 10px;
    --radius-chip: 999px;

    /* the brand rail (black in both themes) */
    --rail-bg: #000000;
    --rail-text: #f3f4f6;
    --rail-muted: #8b93a1;
    --rail-border: rgba(255, 255, 255, 0.09);
    --rail-hover: rgba(255, 255, 255, 0.06);
    --rail-active: rgba(255, 255, 255, 0.11);
    --rail-indicator: #9db0ff;
}

/* ---------- Tokens: dark ---------- */
html[data-theme="dark"] {
    color-scheme: dark;

    --bg: #0b0d10;
    --bg-blue: #0b0d10;
    --surface: #12151a;
    --surface-soft: #171b21;
    --surface-sunken: #0e1115;
    --surface-glass: #12151a;
    --overlay: rgba(0, 0, 0, 0.68);

    --border: rgba(255, 255, 255, 0.08);
    --border-dark: rgba(255, 255, 255, 0.14);
    --border-hover: rgba(255, 255, 255, 0.26);

    --text: #f2f4f7;
    --text-soft: #c8ced9;
    --muted: #98a1b2;
    --faint: #6b7487;

    --ink: #f5f6f8;
    --on-ink: #0a0c10;

    --accent: #8da2ff;
    --accent-strong: #afbdff;
    --accent-soft: rgba(141, 162, 255, 0.12);
    --accent-border: rgba(141, 162, 255, 0.3);
    --accent-focus: #8da2ff;
    --focus-ring: 0 0 0 3px rgba(141, 162, 255, 0.28);

    --green: #3dd68c;
    --green-strong: #5ee6a6;
    --green-soft: rgba(61, 214, 140, 0.12);
    --green-border: rgba(61, 214, 140, 0.3);
    --amber: #f2b544;
    --amber-strong: #f6c770;
    --amber-soft: rgba(242, 181, 68, 0.12);
    --amber-border: rgba(242, 181, 68, 0.3);
    --red: #ff6b63;
    --red-strong: #ff8e88;
    --red-soft: rgba(255, 107, 99, 0.12);
    --red-border: rgba(255, 107, 99, 0.32);

    --shadow-xs: none;
    --shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
    --shadow-md: 0 28px 64px -24px rgba(0, 0, 0, 0.85);

    --scroll: #2a303a;
    --scroll-hover: #3a4250;
}

/* ---------- Base ---------- */
html {
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

h1,
h2,
h3 {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
    color: var(--text);
}

::selection {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

:focus-visible {
    outline: 2px solid var(--accent-focus);
    outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
}

.eyebrow {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* ---------- The mark and the wordmark ---------- */
.vt-mark {
    display: inline-block;
    flex: none;
    width: 34px;
    height: 34px;
    background: currentColor;
    -webkit-mask: url("/brand/vantora-mark.svg") center / contain no-repeat;
    mask: url("/brand/vantora-mark.svg") center / contain no-repeat;
}

.vt-wordmark {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.26em;
    line-height: 1;
}

.vt-tagline {
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.12em;
    line-height: 1.55;
    text-transform: uppercase;
}

/* ---------- Brand rail (sidebar) ---------- */
.sidebar {
    background: var(--rail-bg);
    border-right: 1px solid var(--rail-border);
    color: var(--rail-text);
    padding: 22px 14px 16px;
}

.vt-brand {
    display: grid;
    gap: 12px;
    margin: 0 0 14px;
    padding: 4px 8px 20px;
    border-bottom: 1px solid var(--rail-border);
    color: #fff;
}

.vt-brand-row {
    display: flex;
    align-items: center;
    gap: 13px;
}

.vt-brand .vt-wordmark {
    color: #fff;
}

.vt-brand .vt-tagline {
    color: var(--rail-muted);
    max-width: 190px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    position: relative;
    padding: 11px 12px;
    border-radius: var(--radius-small);
    color: var(--rail-muted);
    font-size: 13px;
    font-weight: 500;
    gap: 12px;
}

.nav-item:hover {
    background: var(--rail-hover);
    color: var(--rail-text);
}

.nav-item.active {
    background: var(--rail-active);
    color: #fff;
    font-weight: 600;
}

/* the active marker sits on the rail's edge: it says "you are here" */
.nav-item.active::before {
    content: "";
    position: absolute;
    left: -14px;
    top: 50%;
    width: 3px;
    height: 18px;
    transform: translateY(-50%);
    border-radius: 0 3px 3px 0;
    background: var(--rail-indicator);
}

.nav-item .vt-ico {
    width: 18px;
    height: 18px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.system-status {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--rail-border);
    border-radius: var(--radius-small);
    color: var(--rail-muted);
    font-size: 11px;
}

.status-dot {
    background: #3dd68c;
    box-shadow: 0 0 0 3px rgba(61, 214, 140, 0.14);
}

.sidebar-bottom {
    border-top-color: var(--rail-border);
}

.user-card {
    border-top: 1px solid var(--rail-border);
}

.user-card strong {
    color: var(--rail-text);
    font-weight: 600;
}

.user-card span,
.user-card div span {
    color: var(--rail-muted);
}

.avatar {
    background: var(--rail-active);
    color: #fff;
    border-radius: var(--radius-small);
    font-family: var(--font-display);
}

.sidebar-logout {
    background: transparent;
    border: 1px solid var(--rail-border);
    border-radius: var(--radius-small);
    color: var(--rail-muted);
}

.sidebar-logout:hover {
    background: var(--rail-hover);
    border-color: rgba(255, 255, 255, 0.22);
    color: #fff;
}

/* theme switch in the rail: sun / moon / auto */
.vt-theme-switch {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    margin: 12px 6px 0;
    padding: 3px;
    border: 1px solid var(--rail-border);
    border-radius: var(--radius-small);
}

.vt-theme-switch button {
    display: grid;
    place-items: center;
    height: 28px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--rail-muted);
    cursor: pointer;
}

.vt-theme-switch button:hover {
    color: #fff;
}

.vt-theme-switch button[aria-pressed="true"] {
    background: var(--rail-active);
    color: #fff;
}

.vt-theme-switch svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Page header ---------- */
.main {
    background: var(--bg);
}

.topbar h1 {
    font-size: 28px;
    letter-spacing: -0.035em;
    font-weight: 600;
}

.vt-subtitle {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-small);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    box-shadow: none;
}

.refresh-btn svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Surfaces ---------- */
.panel,
.stat-card,
.pipeline-step,
.schedule-item,
.team-member,
.assistant-card,
.assistant-create,
.assistant-empty,
.settings-card,
.reason-box,
.invite-result {
    border-color: var(--border);
    color: var(--text);
}

.panel,
.stat-card {
    box-shadow: var(--shadow);
}

.stat-card:hover {
    transform: none;
}

.stat-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.stat-card strong {
    font-family: var(--font-display);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
}

.panel-header h2,
.panel h2 {
    font-size: 17px;
    font-weight: 600;
}

.panel p,
.panel-header p {
    color: var(--muted);
}

/* ---------- Buttons: ink on paper ---------- */
.primary-btn,
.assistant-button.primary,
.assistant-editor-modal .primary-btn,
.onboarding-action.primary {
    background: var(--ink);
    border: 1px solid var(--ink);
    border-radius: var(--radius-small);
    color: var(--on-ink);
    box-shadow: none;
    font-weight: 600;
}

.primary-btn:hover,
.assistant-button.primary:hover,
.assistant-editor-modal .primary-btn:hover,
.onboarding-action.primary:hover {
    background: var(--ink);
    box-shadow: none;
    transform: none;
    opacity: 0.88;
}

.secondary-btn,
.assistant-button.secondary,
.assistant-editor-modal .secondary-btn,
.close-btn,
.assistant-editor-modal .modal-close {
    background: var(--surface);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-small);
    color: var(--text);
    box-shadow: none;
}

.secondary-btn:hover,
.assistant-button.secondary:hover,
.refresh-btn:hover {
    background: var(--surface-soft);
    border-color: var(--border-hover);
}

.danger-btn {
    background: transparent;
    border: 1px solid var(--red-border);
    border-radius: var(--radius-small);
    color: var(--red-strong);
}

.danger-btn:hover {
    background: var(--red-soft);
}

button:disabled {
    opacity: 0.55;
}

/* ---------- Fields ---------- */
.filters input,
.filters select,
.modal-body input,
.modal-body select,
.modal-body textarea,
.assistant-link-input,
.assistant-create input,
.assistant-create select,
.settings-field input {
    background: var(--surface);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-small);
    color: var(--text);
}

.filters input::placeholder,
.settings-field input::placeholder {
    color: var(--faint);
}

.filters input:focus,
.filters select:focus,
.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus,
.assistant-link-input:focus,
.assistant-create input:focus,
.assistant-create select:focus,
.settings-field input:focus {
    border-color: var(--accent-focus);
    box-shadow: var(--focus-ring);
    outline: none;
}

/* ---------- Pills and badges ---------- */
.status-pill {
    background: var(--accent-soft);
    border-color: var(--accent-border);
    color: var(--accent-strong);
}

.priority-high {
    background: var(--red-soft);
    color: var(--red-strong);
}

.priority-medium {
    background: var(--amber-soft);
    color: var(--amber-strong);
}

.priority-low {
    background: var(--surface-sunken);
    color: var(--text-soft);
}

.booked-badge,
.assistant-status {
    background: var(--green-soft);
    border-color: var(--green-border);
    color: var(--green-strong);
}

/* ---------- Modals ---------- */
.modal,
.qr-modal-overlay,
#assistantEditorModal {
    background: var(--overlay);
}

.modal-card,
.qr-modal {
    background: var(--surface);
    border: 1px solid var(--border-dark);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    color: var(--text);
}

.tabs {
    background: var(--surface-soft);
    border-color: var(--border);
}

.tab {
    color: var(--muted);
}

.tab.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-xs);
}

/* QR codes must stay black on white to scan, in both themes */
.assistant-qr-code {
    background: #ffffff;
    padding: 10px;
    border-radius: var(--radius-small);
}

/* ---------- Onboarding ---------- */
.onboarding-step.current {
    background: var(--surface-soft);
    border-color: var(--border-dark);
}

.onboarding-step.current .onboarding-check {
    border-color: var(--ink);
    color: var(--text);
}

.onboarding-step.done .onboarding-check {
    background: var(--green);
    border-color: var(--green);
    color: var(--on-ink);
}

.onboarding-bar i {
    background: var(--ink);
}

/* ---------- Settings ---------- */
.settings-card {
    background: var(--surface);
    border-radius: var(--radius);
}

.settings-card h3 {
    font-size: 15px;
    font-weight: 600;
}

.settings-card-lead {
    margin: -6px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

/* appearance: three tiles that show what you get */
.vt-theme-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.vt-theme-option {
    display: grid;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-small);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.vt-theme-option:hover {
    border-color: var(--border-hover);
}

.vt-theme-option[aria-pressed="true"] {
    border-color: var(--ink);
    box-shadow: 0 0 0 1px var(--ink);
}

.vt-theme-preview {
    display: grid;
    grid-template-columns: 22% 1fr;
    height: 54px;
    overflow: hidden;
    border: 1px solid rgba(128, 136, 150, 0.35);
    border-radius: 7px;
}

.vt-theme-preview i {
    background: #000;
}

.vt-theme-preview b {
    display: block;
    background: #f4f5f7;
}

.vt-theme-option[data-theme-choice="dark"] .vt-theme-preview b {
    background: #12151a;
}

.vt-theme-option[data-theme-choice="system"] .vt-theme-preview b {
    background: linear-gradient(105deg, #f4f5f7 50%, #12151a 50%);
}

/* danger zone: quiet until you look for it */
.settings-danger {
    grid-column: 1 / -1;
    border-color: var(--red-border);
}

.settings-danger h3 {
    color: var(--red-strong);
}

.settings-danger .danger-btn {
    align-self: flex-start;
}

/* delete-account dialog */
.vt-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10002;
    display: grid;
    place-items: center;
    padding: 18px;
    background: var(--overlay);
}

.vt-dialog {
    width: min(520px, 100%);
    max-height: 92vh;
    overflow: auto;
    padding: 26px;
    border: 1px solid var(--border-dark);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-md);
}

.vt-dialog h2 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 600;
}

.vt-dialog p {
    margin: 0 0 14px;
    color: var(--text-soft);
    font-size: 13.5px;
    line-height: 1.6;
}

.vt-dialog ul {
    margin: 0 0 16px;
    padding: 12px 14px 12px 30px;
    border: 1px solid var(--red-border);
    border-radius: var(--radius-small);
    background: var(--red-soft);
    color: var(--text);
    font-size: 13px;
    line-height: 1.6;
}

.vt-dialog .settings-field {
    margin-bottom: 14px;
}

.vt-dialog-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 14px;
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.5;
}

.vt-dialog-check input {
    width: auto;
    min-height: 0;
    margin-top: 3px;
}

.vt-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 6px;
}

.vt-dialog-actions button {
    padding: 11px 16px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.vt-btn-danger {
    border: 1px solid var(--red);
    border-radius: var(--radius-small);
    background: var(--red);
    color: #fff;
}

html[data-theme="dark"] .vt-btn-danger {
    color: #0a0c10;
}

.vt-btn-danger:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* the active tab needs to stand out from its track in dark mode too */
html[data-theme="dark"] .auth-tab.active {
    background: var(--surface-soft);
    box-shadow: 0 0 0 1px var(--border-dark);
}

/* ---------- Phone: the rail becomes a compact top bar ---------- */
@media (max-width: 850px) {
    .sidebar {
        padding: 14px 14px 12px;
    }

    .vt-brand {
        gap: 6px;
        margin-bottom: 10px;
        padding: 0 4px 12px;
    }

    .vt-brand .vt-tagline {
        max-width: none;
    }

    /* four tabs in one row: icon over label, nothing hidden off-screen */
    .sidebar nav {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
        overflow: visible;
    }

    .nav-item {
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        padding: 10px 4px;
        font-size: 11.5px;
        text-align: center;
        white-space: normal;
        line-height: 1.2;
    }

    .nav-item.active::before {
        left: 22%;
        right: 22%;
        top: auto;
        bottom: 2px;
        width: auto;
        height: 2px;
        transform: none;
        border-radius: 2px;
    }

    /* the user and Log out share one line; the theme switch lives in Settings on a phone */
    .sidebar-bottom {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-top: 8px;
        padding-top: 10px;
        border-top: 1px solid var(--rail-border);
    }

    .sidebar-bottom .user-card {
        flex: 1;
        min-width: 0;
        padding: 0;
        border-top: 0;
    }

    .sidebar-bottom .sidebar-logout {
        flex: none;
        width: auto;
        margin: 0;
        padding: 0 16px;
        min-height: 36px;
    }

    .vt-theme-switch {
        display: none;
    }
}

@media (max-width: 600px) {
    .vt-theme-options {
        grid-template-columns: 1fr;
    }
}
