/* Quidget Demos: style-guide tokens and components. Tailwind (CDN) supplies layout utilities. */

:root {
    --q-lavender: #DABFFF;
    --q-purple: #907AD6;
    --q-slate: #4F518C;
    --q-navy: #2C2A4A;
    --q-tint: #EEE8FF;
    --q-bg: #F6F5FB;
    --q-border: #E6E3F2;
    --q-text: #2C2A4A;
    --q-muted: #6B6A85;
    --q-purple-hover: #7B63CB;
    --q-purple-active: #4F518C;
    --q-purple-disabled: #CFC6EC;
    --q-success-bg: #E3F6EA;
    --q-success: #1F9D55;
    --q-error-bg: #FDE7E7;
    --q-error: #D64545;
    --q-warn-bg: #FFF4E0;
    --q-warn: #B7791F;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
    margin: 0;
    font-family: 'Gilroy', 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--q-text);
    background: var(--q-bg);
}
[x-cloak] { display: none !important; }

/* Sidebar */
.sidebar {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #2F2D50 0%, #2C2A4A 55%, #252342 100%);
    min-height: 100vh;
}
.sidebar::before {
    content: "";
    position: absolute;
    left: -80px;
    bottom: -100px;
    width: 320px;
    height: 320px;
    border-radius: 38% 62% 55% 45% / 45% 40% 60% 55%;
    background: radial-gradient(circle at 35% 35%, rgba(144, 122, 214, 0.6), rgba(144, 122, 214, 0.14) 60%, rgba(144, 122, 214, 0) 75%);
    pointer-events: none;
}
.sidebar::after {
    content: "";
    position: absolute;
    left: 24px;
    bottom: 56px;
    width: 150px;
    height: 150px;
    transform: rotate(35deg);
    border-radius: 28px;
    background: linear-gradient(135deg, rgba(218, 191, 255, 0.2), rgba(218, 191, 255, 0));
    pointer-events: none;
}
.brand-wordmark {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
    line-height: 1;
}
.nav-section {
    padding: 20px 14px 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(218, 191, 255, 0.55);
}
.nav-link {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 14px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-link-active, .nav-link-active:hover {
    background: var(--q-purple);
    color: #fff;
    box-shadow: 0 6px 16px rgba(144, 122, 214, 0.35);
}
.nav-link svg { width: 20px; height: 20px; flex: none; }

/* Top bar and user menu */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 9999px;
    background: var(--q-purple);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex: none;
}
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 264px;
    background: #fff;
    border: 1px solid var(--q-border);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(44, 42, 74, 0.12);
    overflow: hidden;
    z-index: 40;
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--q-text);
    text-align: left;
    cursor: pointer;
}
.dropdown-item:hover { background: var(--q-bg); }
.dropdown-compact { width: 200px; top: calc(100% + 6px); border-radius: 12px; }
.dropdown-compact .dropdown-item { padding: 10px 14px; font-size: 13.5px; }

/* Typography */
.eyebrow {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--q-purple);
}
.page-title {
    margin: 6px 0 0;
    font-size: 36px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--q-navy);
}
.page-desc {
    margin: 10px 0 0;
    font-size: 14px;
    line-height: 1.65;
    color: var(--q-muted);
}
.page-desc a { color: var(--q-purple); text-decoration: underline; }
.section-title { margin: 0; font-size: 24px; font-weight: 600; color: var(--q-navy); }
.card-title { margin: 0; font-size: 18px; font-weight: 600; color: var(--q-navy); }

/* Cards */
.card {
    background: #fff;
    border: 1px solid var(--q-border);
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(44, 42, 74, 0.04);
    padding: 24px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}
.card-flush { padding: 0; overflow: hidden; }
/* Cards whose table rows open menus: let the menu overflow, and round the header cells instead of clipping them. */
.card-flush.card-overflow-visible { overflow: visible; }
.card-overflow-visible .table thead th:first-child { border-top-left-radius: 15px; }
.card-overflow-visible .table thead th:last-child { border-top-right-radius: 15px; }
.card-flush .card-header { padding: 20px 24px 0; margin-bottom: 14px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 8px; }
.btn-primary { background: var(--q-purple); color: #fff; box-shadow: 0 4px 14px rgba(144, 122, 214, 0.3); }
.btn-primary:hover { background: var(--q-purple-hover); }
.btn-primary:active { background: var(--q-purple-active); }
.btn-secondary { background: var(--q-tint); color: var(--q-purple); }
.btn-secondary:hover { background: #E4DBFF; }
.btn-ghost { background: #fff; color: var(--q-navy); border-color: var(--q-border); }
.btn-ghost:hover { border-color: #CFC9E6; background: var(--q-bg); }
.btn-danger { background: var(--q-error); color: #fff; }
.btn-danger:hover { background: #B93A3A; }
.btn-danger-ghost { color: var(--q-error); }
.btn-link { background: transparent; border-color: transparent; box-shadow: none; color: var(--q-purple); }
.btn-link:hover { color: var(--q-purple-hover); text-decoration: underline; text-underline-offset: 3px; }
.btn-danger-ghost:hover { background: var(--q-error-bg); border-color: #F3C5C5; }
.btn:disabled, .btn[aria-disabled="true"] {
    background: var(--q-purple-disabled);
    color: #fff;
    border-color: transparent;
    box-shadow: none;
    cursor: not-allowed;
}
.btn-ghost:disabled, .btn-ghost[aria-disabled="true"] {
    background: #fff;
    color: var(--q-muted);
    border-color: var(--q-border);
    opacity: 0.6;
}
.logo-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 96px;
    min-height: 64px;
    padding: 10px 14px;
    border-radius: 10px;
    background: conic-gradient(#EEECF6 25%, #FFFFFF 0 50%, #EEECF6 0 75%, #FFFFFF 0) 0 0 / 14px 14px;
}
.logo-preview-missing::after { content: 'Preview unavailable'; font-size: 12px; color: var(--q-muted); }
.google-btn { background: #fff; color: var(--q-navy); border-color: var(--q-border); padding: 12px 20px; }
.google-btn:hover { background: var(--q-bg); border-color: #CFC9E6; }

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    vertical-align: middle;
}
.badge-pending { background: var(--q-tint); color: var(--q-purple); }
.badge-success { background: var(--q-success-bg); color: var(--q-success); }
.badge-neutral { background: #EEEEF4; color: #55546E; }
.badge-error { background: var(--q-error-bg); color: var(--q-error); }
.badge-warning { background: var(--q-warn-bg); color: var(--q-warn); }

/* Forms */
.label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--q-navy); }
.input, .select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--q-border);
    border-radius: 10px;
    background: #fff;
    font-family: inherit;
    font-size: 14px;
    color: var(--q-text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: #9C9BB3; }
.input:focus, .select:focus { border-color: var(--q-purple); box-shadow: 0 0 0 3px rgba(144, 122, 214, 0.18); }
.select {
    appearance: none;
    padding-right: 38px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B6A85' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
.help { margin-top: 6px; font-size: 12px; color: var(--q-muted); }
code.kv {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    background: var(--q-bg);
    border: 1px solid var(--q-border);
    border-radius: 6px;
    padding: 2px 6px;
}

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
    padding: 14px 24px;
    border-bottom: 1px solid var(--q-border);
    background: #FAFAFD;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #7A7994;
    text-align: left;
}
.table td { padding: 16px 24px; border-bottom: 1px solid var(--q-border); vertical-align: middle; color: var(--q-text); }
.table-compact th, .table-compact td { padding-left: 16px; padding-right: 16px; }
.wrap-anywhere { overflow-wrap: anywhere; }
.table-compact th:first-child, .table-compact td:first-child { padding-left: 24px; }
.table-compact th:last-child, .table-compact td:last-child { padding-right: 24px; }
.table tbody:last-child tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FBFAFE; }
.table .text-right { text-align: right; }
.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    border-top: 1px solid var(--q-border);
    font-size: 13px;
    color: var(--q-muted);
}
.pager { display: inline-flex; align-items: center; gap: 6px; }
.pager a, .pager span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--q-border);
    border-radius: 8px;
    background: #fff;
    color: var(--q-navy);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}
.pager a:hover { border-color: #CFC9E6; }
.pager .is-active { background: var(--q-purple); border-color: var(--q-purple); color: #fff; }
.pager .is-disabled { opacity: 0.45; pointer-events: none; }

/* Stat tiles */
.stat { background: #fff; border: 1px solid var(--q-border); border-radius: 16px; padding: 20px 22px; }
.stat-label { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--q-muted); }
.stat-value { margin: 6px 0 0; font-size: 30px; font-weight: 700; line-height: 1.1; color: var(--q-navy); }

/* Flash messages */
.flash {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 14px;
}
.flash > svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.flash-success { background: var(--q-success-bg); color: #166534; border-color: #C9EBD6; }
.flash-error { background: var(--q-error-bg); color: #9B2C2C; border-color: #F3C5C5; }
.flash-info { background: var(--q-tint); color: var(--q-slate); border-color: #DCD2F7; }
.flash-warning { background: var(--q-warn-bg); color: #92400E; border-color: #F5DEB3; }

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(44, 42, 74, 0.45);
}
.modal {
    width: 100%;
    max-width: 440px;
    padding: 28px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 64px rgba(44, 42, 74, 0.25);
}

/* Empty state */
.empty { padding: 56px 24px; text-align: center; color: var(--q-muted); }
.empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border-radius: 16px;
    background: var(--q-tint);
    color: var(--q-purple);
}

/* Signed-out pages */
.guest-bg {
    background:
        radial-gradient(1100px 600px at 8% 110%, rgba(144, 122, 214, 0.5), transparent 60%),
        radial-gradient(800px 500px at 100% -10%, rgba(218, 191, 255, 0.28), transparent 60%),
        linear-gradient(180deg, #2F2D50, #252342);
}

/* Selectable option cards (site mode, active backend) */
.mode-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    border: 2px solid var(--q-border);
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.mode-card:hover { border-color: #CFC9E6; }
.mode-card.is-selected { border-color: var(--q-purple); background: var(--q-tint); }

/* Job logs */
.pre-log {
    margin: 0;
    padding: 14px 16px;
    max-height: 420px;
    overflow: auto;
    border-radius: 10px;
    background: #1F1D33;
    color: #E6E3F2;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}
.log-row td { background: #FAFAFD; padding: 8px 16px 16px; }
.table tbody tr.log-row:hover td { background: #FAFAFD; }
fieldset { min-width: 0; }
textarea.input { resize: vertical; }

/* Branding colour pickers: a swatch that opens a popover of the colours found on the website */
.color-swatch-btn {
    width: 44px;
    height: 44px;
    flex: none;
    border: 1px solid var(--q-border);
    border-radius: 10px;
    box-shadow: inset 0 0 0 3px #fff;
    cursor: pointer;
}
.color-swatch-btn:focus { outline: none; }
.color-swatch-btn:focus-visible { outline: 2px solid var(--q-purple); outline-offset: 2px; }
.color-popover {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 30;
    margin-top: 6px;
    width: 252px;
    max-width: calc(100vw - 48px);
    padding: 12px;
    border: 1px solid var(--q-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(44, 42, 74, 0.16);
}
.color-popover > div + div, .color-popover > div + label, .color-popover > template + div { margin-top: 10px; }
.color-popover-title { margin: 0 0 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--q-muted); }
.color-popover-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.color-popover-custom {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--q-navy);
    cursor: pointer;
}
.color-popover-custom:hover { background: var(--q-bg); }
.color-popover-custom-chip {
    position: relative;
    width: 22px;
    height: 22px;
    flex: none;
    overflow: hidden;
    border: 1px solid var(--q-border);
    border-radius: 6px;
    background: conic-gradient(#f87171, #fbbf24, #4ade80, #38bdf8, #a78bfa, #f472b6, #f87171);
}
.color-popover-custom-chip input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.palette-swatch {
    width: 28px;
    height: 28px;
    border: 1px solid var(--q-border);
    border-radius: 8px;
    box-shadow: inset 0 0 0 2px #fff;
    cursor: pointer;
    transition: transform 0.1s;
}
.palette-swatch:hover { transform: scale(1.1); }
.palette-swatch:focus { outline: none; }
.palette-swatch:focus-visible, .palette-swatch.is-current { outline: 2px solid var(--q-purple); outline-offset: 1px; }
