/* GenesisBot — slate + indigo SaaS theme */
:root {
    /* Surfaces */
    --bg: #f8fafc;            /* app body — slate-50 */
    --bg-elev: #f1f5f9;       /* inset fields, table heads — slate-100 */
    --bg-card: #ffffff;       /* content cards */
    --border: #e2e8f0;        /* slate-200 */
    --border-soft: #eef2f6;

    /* Text */
    --text: #0f172a;          /* slate-900 */
    --text-dim: #64748b;      /* slate-500 */
    --text-faint: #94a3b8;    /* slate-400 */

    /* Brand — indigo */
    --accent: #4f46e5;        /* indigo-600 */
    --accent-strong: #4338ca; /* indigo-700 */
    --accent-soft: #eef2ff;   /* indigo-50 */
    --accent-ring: rgba(79, 70, 229, 0.18);

    /* Semantic */
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --success: #16a34a;
    --success-soft: #f0fdf4;
    --warning: #d97706;
    --warning-soft: #fffbeb;

    /* Shape + depth */
    --radius: 14px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.10), 0 2px 8px rgba(15, 23, 42, 0.05);
    --shadow: var(--shadow-lg);

    --sidebar-w: 252px;
    --sidebar-w-collapsed: 76px;
    --appbar-h: 64px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    min-height: 100vh;
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }

/* Public (logged-out) header */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 32px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #15233a;
    font-weight: 600;
    justify-self: start;
}

.brand-logo {
    height: 48px;
    width: auto;
    max-height: 48px;
    max-width: 220px;
    display: block;
    object-fit: contain;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-size: 20px; font-weight: 700; color: #0b1220; letter-spacing: -0.01em; }
.brand-tag { font-size: 12px; color: #5d6c7c; font-weight: 500; }
.brand-sub { font-size: 11px; color: #8a96a3; font-weight: 500; }

.topbar nav {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    background: #ffffff;
    border: 1px solid #e6e8eb;
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(15, 23, 32, 0.04);
    justify-self: center;
}

.topbar nav .nav-link {
    display: inline-flex;
    align-items: center;
    padding: 10px 18px;
    border-radius: 999px;
    color: #45525f;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}
.topbar nav .nav-link:hover { color: #0b1220; background: #f3f5f7; }
.topbar nav .nav-link.is-active {
    background: #0b1220;
    color: #ffffff;
}

.topbar .nav-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    justify-self: end;
}

.user-pill {
    color: #5d6c7c;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #e6e8eb;
}

.btn-cta {
    background: #0b1220;
    color: #ffffff;
    border-color: #0b1220;
    padding: 12px 22px;
    font-weight: 600;
    gap: 8px;
}
.btn-cta:hover { background: #1a2740; color: #ffffff; }
.btn-cta .arrow { display: inline-block; transition: transform 0.15s ease; }
.btn-cta:hover .arrow { transform: translateX(3px); }

@media (max-width: 900px) {
    .topbar { grid-template-columns: 1fr auto; }
    .topbar nav { grid-column: 1 / -1; order: 3; overflow-x: auto; max-width: 100%; }
}

.inline-form { display: inline; margin: 0; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 999px;
    font-weight: 500;
    font-size: 14px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.06s ease, background 0.15s ease, color 0.15s ease;
    font-family: inherit;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-strong); color: #ffffff; }

.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-block { width: 100%; }

.main {
    max-width: 1180px;
    margin: 0 auto;
    width: 100%;
    padding: 32px clamp(16px, 3vw, 40px) 72px;
}

.main-public {
    max-width: 980px;
    padding-top: 48px;
}

.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.message {
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(18, 133, 92, 0.08);
    border: 1px solid rgba(18, 133, 92, 0.2);
    margin-bottom: 8px;
}

/* Auth pages */
.auth-shell {
    display: flex;
    justify-content: center;
    padding: 32px 0;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 36px 32px 28px;
}

.auth-title {
    margin: 0 0 6px;
    font-size: 26px;
    letter-spacing: -0.2px;
}

.auth-sub {
    margin: 0 0 26px;
    color: var(--text-dim);
}

.field {
    display: block;
    margin-bottom: 16px;
}

.field-label {
    display: block;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.input,
input[type="email"],
input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus,
input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(18, 133, 92, 0.15);
}

.field-error {
    display: block;
    margin-top: 6px;
    color: var(--danger);
    font-size: 12px;
}

.field-help {
    display: block;
    margin-top: 6px;
    color: var(--text-dim);
    font-size: 12px;
    line-height: 1.45;
}

.form-error {
    background: rgba(214, 69, 69, 0.08);
    border: 1px solid rgba(214, 69, 69, 0.3);
    color: var(--danger);
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 13px;
}

.auth-foot {
    margin-top: 18px;
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
}

/* Authenticated home */
.hero {
    text-align: center;
    padding: 64px 16px 24px;
}
.eyebrow {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(18, 133, 92, 0.1);
    color: var(--accent);
    font-size: 12px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    margin-bottom: 14px;
}
.hero h1 {
    margin: 0 0 8px;
    font-size: 32px;
    letter-spacing: -0.4px;
}
.hero-sub {
    color: var(--text-dim);
    margin: 0 auto;
    max-width: 480px;
}

.hero-actions {
    margin-top: 22px;
}

/* Topbar nav link */
.nav-link {
    color: #2c3a52;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}
.nav-link:hover { color: var(--accent-strong); background: rgba(13, 103, 70, 0.08); }

/* Topbar buttons override (sit on white) */
.topbar .btn-ghost {
    color: #2c3a52;
    border-color: #d8dde2;
    background: transparent;
}
.topbar .btn-ghost:hover {
    border-color: var(--accent-strong);
    color: var(--accent-strong);
}

/* Page head */
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.page-head > div:first-child { min-width: 0; }

.page-title {
    margin: 0 0 6px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.4px;
}

.page-sub {
    margin: 0;
    color: var(--text-dim);
    font-size: 14px;
}

.page-head .btn { flex-shrink: 0; }

.back-link {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--text-dim);
    font-size: 13px;
}
.back-link:hover { color: var(--accent); }

/* Bot list */
.bot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.bot-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #ffffff 0%, #f7f9fa 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 22px 22px 18px;
    color: var(--text);
    box-shadow: 0 1px 2px rgba(11, 18, 32, 0.04), 0 8px 24px rgba(11, 18, 32, 0.06);
    transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    min-height: 200px;
}
.bot-card:hover {
    border-color: var(--accent);
    color: var(--text);
    transform: translateY(-2px);
    box-shadow: 0 1px 2px rgba(11, 18, 32, 0.06), 0 14px 32px rgba(11, 18, 32, 0.10), 0 0 0 1px rgba(18, 133, 92, 0.20);
}

.bot-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}
.bot-card-head h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.2px;
    line-height: 1.3;
}

.status-pill {
    font-size: 10px;
    padding: 4px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.status-on {
    color: var(--accent);
    background: rgba(18, 133, 92, 0.1);
    border-color: rgba(18, 133, 92, 0.3);
}
.status-off {
    color: var(--text-dim);
    background: rgba(11, 18, 32, 0.04);
}

.bot-desc {
    margin: 4px 0 16px;
    color: var(--text-dim);
    font-size: 13px;
    line-height: 1.55;
    flex: 1;
}

.bot-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--text-dim);
    font-size: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.bot-meta .dot { opacity: 0.4; }

.empty {
    text-align: center;
    padding: 64px 16px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: #fafbfc;
}
.empty h2 { margin: 0 0 6px; font-size: 20px; }
.empty p { margin: 0 0 18px; color: var(--text-dim); }

/* Bot form */
.bot-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px 18px;
}

.section-title {
    margin: 0 0 16px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-dim);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 640px) {
    .grid-2 { grid-template-columns: 1fr; }
}

textarea.input,
textarea {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 64px;
}
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(18, 133, 92, 0.15);
}

select.input,
select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
                      linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

input[type="number"].input,
input[type="number"] {
    -moz-appearance: textfield;
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
}
.checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}
.muted { color: var(--text-dim); font-size: 13px; }

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.btn-danger {
    background: rgba(214, 69, 69, 0.12);
    color: var(--danger);
    border: 1px solid rgba(214, 69, 69, 0.4);
}
.btn-danger:hover {
    background: rgba(214, 69, 69, 0.2);
    color: #ffb0b0;
}

.danger-zone {
    margin-top: 32px;
    padding: 18px 22px;
    border: 1px solid rgba(214, 69, 69, 0.25);
    border-radius: var(--radius);
    background: rgba(214, 69, 69, 0.04);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.danger-zone h3 {
    margin: 0 0 4px;
    font-size: 15px;
    color: #ffc7c7;
}
.danger-zone p { margin: 0; }

/* Bot tabs */
.bot-tabs {
    display: inline-flex;
    gap: 4px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px;
}
.tab {
    padding: 7px 14px;
    border-radius: 999px;
    color: var(--text-dim);
    font-size: 13px;
    transition: background 0.15s ease, color 0.15s ease;
}
.tab:hover { color: var(--text); background: #eef1f4; }
.tab-active {
    background: var(--accent);
    color: #ffffff;
}
.tab-active:hover { background: var(--accent); color: #ffffff; }

/* Upload card */
.upload-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px;
    margin-bottom: 24px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
}
.upload-card h3 { margin: 0 0 4px; font-size: 15px; }
.upload-row {
    display: inline-flex;
    gap: 10px;
    align-items: center;
}
.upload-row input[type="file"] {
    color: var(--text-dim);
    font-size: 13px;
}

/* Data table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.data-table th, .data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.data-table th {
    background: var(--bg-elev);
    color: var(--text-dim);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table a { color: var(--text); }
.data-table a:hover { color: var(--accent); }

.btn-sm { padding: 6px 12px; font-size: 12px; }

.status-fail {
    color: var(--danger);
    background: rgba(214, 69, 69, 0.1);
    border-color: rgba(214, 69, 69, 0.3);
}

.row-error {
    margin-top: 4px;
    color: var(--danger);
    font-size: 12px;
}

/* Chat */
.chat-shell {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    height: 65vh;
    min-height: 460px;
    overflow: hidden;
}

.chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.chat-log.static { height: auto; min-height: auto; padding: 0; background: transparent; border: none; }

.bubble {
    max-width: 75%;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.55;
    border: 1px solid var(--border);
}
.bubble-role {
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.voice-tag {
    text-transform: none;
    letter-spacing: 0;
    color: var(--accent, #6fe6a3);
    margin-left: 6px;
}
.bubble-text { color: var(--text); white-space: pre-wrap; word-wrap: break-word; }
.bubble-meta {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-dim);
}

.bubble-user {
    align-self: flex-end;
    background: rgba(18, 133, 92, 0.1);
    border-color: rgba(18, 133, 92, 0.3);
}
.bubble-bot {
    align-self: flex-start;
    background: var(--bg-elev);
}
.bubble-error .bubble-text { color: var(--danger); }

.chat-log.static .bubble { max-width: 100%; }

.chat-input {
    display: flex;
    gap: 10px;
    padding: 14px;
    border-top: 1px solid var(--border);
    background: var(--bg-elev);
}
.chat-input textarea {
    flex: 1;
    min-height: 44px;
    max-height: 160px;
    resize: none;
}

/* API key reveal */
.key-reveal {
    background: rgba(18, 133, 92, 0.06);
    border: 1px solid rgba(18, 133, 92, 0.3);
    border-radius: var(--radius);
    padding: 18px 22px;
    margin-bottom: 24px;
}
.key-reveal h3 { margin: 0 0 4px; font-size: 15px; color: var(--accent); }
.key-reveal p { margin: 0 0 12px; }

.key-code {
    display: block;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    word-break: break-all;
    user-select: all;
    flex: 1;
    margin: 0;
}

.key-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.key-copy-btn {
    flex-shrink: 0;
    min-width: 86px;
    padding: 0 16px;
}

.code-block {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    color: var(--text);
    font-size: 13px;
    overflow-x: auto;
    white-space: pre;
    margin: 0 0 12px;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

/* Billing */
.info-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(255, 200, 100, 0.08);
    border: 1px solid rgba(255, 200, 100, 0.25);
    color: #f0d9b1;
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 24px;
}
.info-card code { font-size: 13px; }

.usage-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.usage-row:last-child { border-bottom: none; }

.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.plan-card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px 18px;
    display: flex;
    flex-direction: column;
}
.plan-card .muted { flex-shrink: 0; }
.plan-card form { margin-top: auto; }

.plan-current {
    border-color: var(--accent);
    background: rgba(18, 133, 92, 0.04);
}

.plan-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}
.plan-head h3 { margin: 0; font-size: 18px; }
.plan-price {
    color: var(--accent);
    font-weight: 600;
    font-size: 14px;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 14px 0;
    flex-grow: 1;
}
.plan-features li {
    padding: 5px 0;
    font-size: 13px;
    color: var(--text-dim);
    border-bottom: 1px dashed var(--border);
}
.plan-features li:last-child { border-bottom: none; }

/* =====================================================================
   Cloud-style Chatbots dashboard (light, scoped under .cloud-app)
   Full-bleed: breaks out of the centered .main container.
   ===================================================================== */
.cloud-app {
    --cl-bg: #e8eaef;
    --cl-surface: #ffffff;
    --cl-text: #1d2330;
    --cl-muted: #8990a3;
    --cl-border: #eceef3;
    --cl-border-strong: #e0e3ea;
    --cl-accent: #2f6bff;
    --cl-accent-soft: #eef3ff;
    --cl-on: #16a34a;
    --cl-off: #94a3b8;

    width: 100vw;
    margin-left: calc(50% - 50vw);
    min-height: calc(100vh - 96px);
    box-sizing: border-box;
    padding: 28px clamp(16px, 4vw, 48px);
    background: var(--cl-bg);
    color: var(--cl-text);
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) 320px;
    gap: 20px;
    align-items: start;
    font-size: 14px;
    line-height: 1.5;
    border-radius: 18px 18px 0 0;
}
.cloud-app *, .cloud-app *::before, .cloud-app *::after { box-sizing: border-box; }
.cloud-app a { color: inherit; text-decoration: none; }

/* ---------- Sidebar ---------- */
.cl-sidebar {
    background: var(--cl-surface);
    border-radius: 16px;
    padding: 14px;
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.cl-nav { display: flex; flex-direction: column; gap: 2px; }
.cl-nav-secondary { border-top: 1px solid var(--cl-border); padding-top: 12px; }
.cl-nav-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%; text-align: left;
    padding: 10px 12px; border-radius: 10px;
    background: none; border: 0; cursor: pointer;
    font: inherit; color: var(--cl-text);
}
.cl-nav-item:hover { background: #f4f6fa; }
.cl-nav-item.is-active { background: var(--cl-accent-soft); color: var(--cl-accent); font-weight: 600; }
.cl-ic { width: 18px; text-align: center; opacity: .85; font-size: 13px; }

.cl-storage {
    margin-top: auto;
    border: 1px solid var(--cl-border-strong);
    border-radius: 12px;
    padding: 12px;
}
.cl-storage-head { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 10px; }
.cl-storage-bar { height: 6px; border-radius: 99px; background: #edeff4; overflow: hidden; }
.cl-storage-bar span { display: block; height: 100%; background: var(--cl-accent); border-radius: 99px; }
.cl-storage-text { margin: 8px 0 4px; color: var(--cl-muted); font-size: 12px; }
.cl-storage-link { color: var(--cl-accent); font-size: 12px; font-weight: 600; }

/* ---------- Main column ---------- */
.cl-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.cl-section-head h2 { margin: 0 0 12px; font-size: 16px; font-weight: 700; }

.cl-quick { background: var(--cl-surface); border-radius: 16px; padding: 18px; }
.cl-quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.cl-quick-card {
    border: 1px solid var(--cl-border-strong);
    border-radius: 12px; padding: 14px;
    display: flex; flex-direction: column; gap: 6px;
    transition: border-color .15s, box-shadow .15s;
}
.cl-quick-card:hover { border-color: var(--cl-accent); box-shadow: 0 6px 18px rgba(47,107,255,.10); }
.cl-quick-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: grid; place-items: center; font-size: 18px;
    background: #f1f4fb;
}
.cl-quick-icon.is-on { background: #e7f7ee; }
.cl-quick-name { font-weight: 600; }
.cl-quick-meta { color: var(--cl-muted); font-size: 12px; }
.cl-quick-empty { align-items: flex-start; }

/* ---------- File-table panel ---------- */
.cl-panel { background: var(--cl-surface); border-radius: 16px; padding: 18px; }
.cl-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cl-crumbs { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.cl-crumbs a { color: var(--cl-muted); }
.cl-crumbs a:hover { color: var(--cl-text); }
.cl-crumb-sep { color: var(--cl-muted); }
.cl-crumb-current { color: var(--cl-text); }
.cl-add {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--cl-accent); color: #fff;
    padding: 9px 16px; border-radius: 10px; font-weight: 600;
}
.cl-add:hover { background: #2257e0; }

.cl-table { width: 100%; border-collapse: collapse; }
.cl-table th {
    text-align: left; font-size: 12px; font-weight: 600; color: var(--cl-muted);
    padding: 10px 12px; border-bottom: 1px solid var(--cl-border);
}
.cl-table td { padding: 12px; border-bottom: 1px solid var(--cl-border); vertical-align: middle; }
.cl-row { cursor: pointer; transition: background .12s; }
.cl-row:hover { background: #f7f9fd; }
.cl-row.is-selected { background: var(--cl-accent-soft); box-shadow: inset 3px 0 0 var(--cl-accent); }
.cl-row:last-child td { border-bottom: 0; }
.cl-cell-name { font-weight: 600; }
.cl-row-icon {
    display: inline-grid; place-items: center;
    width: 28px; height: 28px; border-radius: 8px; margin-right: 10px;
    background: #f1f4fb; font-size: 14px; vertical-align: middle;
}
.cl-row-icon.is-on { background: #e7f7ee; }
.cl-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: #46506a; }
.cl-muted { color: var(--cl-muted); }
.cl-status { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; }
.cl-status-on { background: #e7f7ee; color: var(--cl-on); }
.cl-status-off { background: #eef0f4; color: var(--cl-off); }
.cl-th-menu { width: 36px; text-align: center; }
.cl-menu-btn { color: var(--cl-muted); font-size: 18px; padding: 0 6px; border-radius: 6px; }
.cl-menu-btn:hover { background: #eef0f4; color: var(--cl-text); }
.cl-empty-filter { color: var(--cl-muted); text-align: center; padding: 28px 0; }

.cl-empty { text-align: center; padding: 48px 16px; }
.cl-empty-icon { font-size: 32px; }
.cl-empty h3 { margin: 12px 0 4px; }
.cl-empty p { color: var(--cl-muted); margin: 0 0 18px; }

/* ---------- Right detail panel ---------- */
.cl-detail {
    background: var(--cl-surface);
    border-radius: 16px;
    padding: 18px;
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 480px;
}
.cl-detail-head { display: flex; align-items: flex-start; justify-content: space-between; }
.cl-detail-avatar {
    width: 56px; height: 56px; border-radius: 14px;
    display: grid; place-items: center; font-size: 24px; background: #eef3ff;
}
.cl-detail-close { background: none; border: 0; cursor: pointer; color: var(--cl-muted); font-size: 14px; padding: 4px; }
.cl-detail-close:hover { color: var(--cl-text); }
.cl-detail-name { margin: 0; font-size: 18px; font-weight: 700; }
.cl-detail-sub { margin: -8px 0 0; color: var(--cl-muted); font-size: 12.5px; }
.cl-detail-section { border-top: 1px solid var(--cl-border); padding-top: 14px; }
.cl-detail-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-weight: 600; }
.cl-detail-link { color: var(--cl-accent); font-size: 12.5px; font-weight: 600; }
.cl-detail-line { margin: 0; }
.cl-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cl-tag { background: var(--cl-accent-soft); color: var(--cl-accent); font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 7px; }
.cl-detail-grow { flex: 1; }
.cl-detail-tabs { display: flex; gap: 16px; margin-bottom: 12px; }
.cl-detail-tab { font-weight: 600; color: var(--cl-muted); padding-bottom: 8px; }
.cl-detail-tab.is-active { color: var(--cl-text); box-shadow: inset 0 -2px 0 var(--cl-accent); }
.cl-activity { list-style: none; margin: 0; padding: 0 0 0 16px; position: relative; }
.cl-activity::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 2px; background: var(--cl-border); }
.cl-activity li { position: relative; padding: 0 0 16px; }
.cl-activity li::before { content: ""; position: absolute; left: -16px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--cl-accent); box-shadow: 0 0 0 3px #fff; }
.cl-activity-date { color: var(--cl-muted); font-size: 11.5px; }
.cl-activity p { margin: 2px 0 0; }
.cl-detail-open { margin-top: auto; color: var(--cl-accent); font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
    .cloud-app { grid-template-columns: 200px minmax(0, 1fr); }
    .cl-detail { grid-column: 1 / -1; position: static; min-height: 0; }
}
@media (max-width: 720px) {
    .cloud-app { grid-template-columns: 1fr; }
    .cl-sidebar { position: static; flex-direction: row; flex-wrap: wrap; }
    .cl-storage { width: 100%; }
    .cl-table thead { display: none; }
    .cl-table, .cl-table tbody, .cl-table tr, .cl-table td { display: block; width: 100%; }
    .cl-table tr { border: 1px solid var(--cl-border); border-radius: 12px; margin-bottom: 10px; padding: 6px; }
    .cl-table td { border: 0; padding: 6px 10px; }
}

/* ---------- Staff panel ---------- */
.staff-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.staff-sidebar { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; position: sticky; top: 20px; }
.staff-sidebar-title { font-weight: 700; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 14px; }
.staff-nav { display: flex; flex-direction: column; gap: 4px; }
.staff-nav-link { padding: 9px 12px; border-radius: 10px; color: var(--text); font-weight: 500; }
.staff-nav-link:hover { background: var(--bg-elev); color: var(--accent); }
.staff-nav-link.is-active { background: var(--bg-elev); color: var(--accent); }
.staff-main { min-width: 0; }
.staff-h1 { font-size: 26px; margin: 0 0 18px; }
.staff-h2 { font-size: 16px; margin: 0 0 14px; }
.staff-header-row { display: flex; align-items: center; justify-content: space-between; }
.staff-count { font-size: 14px; color: var(--text-dim); font-weight: 500; }
.staff-back { display: inline-block; color: var(--text-dim); margin-bottom: 8px; }

.staff-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.staff-stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.staff-stat-num { font-size: 30px; font-weight: 700; color: var(--accent); }
.staff-stat-label { color: var(--text-dim); font-size: 13px; margin-top: 4px; }

.staff-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-bottom: 20px; }
.staff-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }

.staff-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.staff-table th { text-align: left; color: var(--text-dim); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.staff-table td { padding: 10px; border-bottom: 1px solid var(--border); }
.staff-table tr:last-child td { border-bottom: 0; }
.staff-table .num { text-align: right; }
.muted { color: var(--text-dim); }

.staff-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.staff-input { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; color: var(--text); padding: 9px 12px; font-size: 14px; }
.staff-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.staff-form .btn { align-self: flex-start; margin-top: 6px; }
.staff-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }

.staff-dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 13px; margin: 0; }
.staff-dl dt { color: var(--text-dim); }
.staff-dl dd { margin: 0; word-break: break-all; }

.staff-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg-elev); border: 1px solid var(--border); }
.staff-badge-active, .staff-badge-trialing { color: var(--accent); border-color: var(--accent-strong); }
.staff-badge-canceled, .staff-badge-past_due, .staff-badge-incomplete { color: var(--danger); border-color: var(--danger); }

.staff-pagination { display: flex; align-items: center; gap: 14px; margin-top: 18px; }

@media (max-width: 820px) {
    .staff-shell { grid-template-columns: 1fr; }
    .staff-sidebar { position: static; }
    .staff-nav { flex-direction: row; flex-wrap: wrap; }
}
.staff-logout { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.staff-logout-btn { width: 100%; text-align: left; background: none; border: 0; cursor: pointer; font: inherit; }

/* =====================================================================
   SaaS dashboard shell — sidebar, appbar, toasts, and component polish.
   Appended last so these rules win over the older green-theme blocks.
   ===================================================================== */

/* ---------- Shell layout ---------- */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
    transition: grid-template-columns 0.22s ease;
}
.app-shell.is-collapsed { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }

.app-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ---------- Sidebar ---------- */
.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 14px 18px;
    background: #ffffff;
    border-right: 1px solid var(--border);
    z-index: 40;
}

.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 40px;
    margin-bottom: 12px;
}

.sidebar-brand { display: flex; align-items: center; min-width: 0; }
.sidebar-logo { height: 34px; width: auto; max-width: 150px; object-fit: contain; display: block; }
.sidebar-mark {
    display: none;
    width: 36px; height: 36px;
    border-radius: 11px;
    background: linear-gradient(140deg, var(--accent) 0%, #7c3aed 100%);
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.sidebar-collapse {
    flex-shrink: 0;
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text-dim);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.sidebar-collapse svg { width: 15px; height: 15px; transition: transform 0.22s ease; }
.sidebar-collapse:hover { background: var(--bg-elev); color: var(--text); border-color: #cbd5e1; }
.sidebar-collapse:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }

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

.sidebar-section-label {
    padding: 14px 12px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-faint);
    white-space: nowrap;
}

.side-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 11px;
    color: #475569;
    font-size: 14.5px;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}
.side-link:hover { background: var(--bg-elev); color: var(--text); }
.side-link.is-active {
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-weight: 600;
}
.side-link.is-active::before {
    content: "";
    position: absolute;
    left: -14px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 22px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}
.side-link:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }

.side-icon { width: 20px; height: 20px; flex-shrink: 0; }
.side-label { overflow: hidden; text-overflow: ellipsis; }

.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border-soft); }

.side-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 11px 14px;
    border-radius: 11px;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}
.side-cta:hover { background: var(--accent-strong); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.side-cta:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.side-cta .side-icon { width: 17px; height: 17px; }

/* Collapsed state — icons only, with hover tooltips. */
.is-collapsed .sidebar { padding-left: 12px; padding-right: 12px; }
.is-collapsed .side-label,
.is-collapsed .sidebar-section-label,
.is-collapsed .sidebar-logo { display: none; }
.is-collapsed .sidebar-mark { display: flex; }
.is-collapsed .sidebar-head { justify-content: center; flex-direction: column; height: auto; gap: 10px; }
.is-collapsed .side-link,
.is-collapsed .side-cta { justify-content: center; padding-left: 0; padding-right: 0; }
.is-collapsed .sidebar-collapse svg { transform: rotate(180deg); }

.is-collapsed .side-link::after,
.is-collapsed .side-cta::after {
    content: attr(data-tip);
    position: absolute;
    left: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%);
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--text);
    color: #fff;
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.14s ease;
    z-index: 60;
}
.is-collapsed .side-cta { position: relative; }
.is-collapsed .side-link:hover::after,
.is-collapsed .side-cta:hover::after { opacity: 1; }

.sidebar-scrim {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 35;
}

/* ---------- App bar ---------- */
.appbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 14px;
    height: var(--appbar-h);
    padding: 0 clamp(16px, 3vw, 40px);
    background: rgba(248, 250, 252, 0.86);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}

.appbar-menu {
    display: none;
    width: 38px; height: 38px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--text-dim);
    cursor: pointer;
}
.appbar-menu svg { width: 18px; height: 18px; }

.appbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.appbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-btn {
    position: relative;
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fff;
    color: var(--text-dim);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--bg-elev); color: var(--text); border-color: #cbd5e1; }
.icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.icon-btn-dot {
    position: absolute;
    top: 8px; right: 9px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #fff;
}

/* ---------- User menu ---------- */
.user-menu { position: relative; }

.user-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px 5px 5px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    font: inherit;
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.user-trigger:hover { border-color: #cbd5e1; box-shadow: var(--shadow-sm); }
.user-trigger:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }

.avatar {
    width: 30px; height: 30px;
    flex-shrink: 0;
    display: grid; place-items: center;
    border-radius: 50%;
    background: linear-gradient(140deg, var(--accent) 0%, #7c3aed 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.user-trigger-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; min-width: 0; }
.user-trigger-name { font-size: 13px; font-weight: 600; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-trigger-mail { font-size: 11.5px; color: var(--text-dim); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-trigger-caret { width: 14px; height: 14px; color: var(--text-faint); flex-shrink: 0; }

.menu-pop {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    min-width: 232px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 50;
}
.menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--border-soft); margin-bottom: 6px; }
.menu-head-name { font-size: 14px; font-weight: 600; }
.menu-head-mail { font-size: 12.5px; color: var(--text-dim); word-break: break-all; }

.menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 9px 12px;
    border: 0;
    border-radius: 9px;
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}
.menu-item:hover { background: var(--bg-elev); color: var(--text); }
.menu-form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--border-soft); }
.menu-item-danger { color: var(--danger); }
.menu-item-danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- Toasts ---------- */
.toast-stack {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(380px, calc(100vw - 40px));
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 13px 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-left: 3px solid var(--text-faint);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(10px) scale(0.98);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.is-in { opacity: 1; transform: none; }
.toast.is-leaving { opacity: 0; transform: translateX(12px); }

.toast-icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.toast-text { flex: 1; line-height: 1.45; color: var(--text); }
.toast-close {
    flex-shrink: 0;
    border: 0; background: none; cursor: pointer;
    color: var(--text-faint); font-size: 18px; line-height: 1;
    padding: 0 2px;
}
.toast-close:hover { color: var(--text); }

.toast-success { border-left-color: var(--success); }
.toast-success .toast-icon { color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info { border-left-color: var(--accent); }
.toast-info .toast-icon { color: var(--accent); }

/* ---------- Component polish (overrides the legacy green theme) ---------- */
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }

.btn { border-radius: 10px; font-weight: 600; font-size: 14px; padding: 10px 16px; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.btn-primary { background: var(--accent); border-color: var(--accent); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); box-shadow: var(--shadow-md); }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--bg-elev); border-color: #cbd5e1; color: var(--text); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; color: var(--danger); }

.btn:disabled,
.btn[disabled],
.btn.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    pointer-events: none;
}

.input,
input[type="email"], input[type="text"], input[type="password"],
input[type="number"], textarea, select {
    background: #fff;
    border-color: #cbd5e1;
    border-radius: 10px;
    font-size: 14.5px;
    padding: 11px 13px;
}
.input:hover, textarea:hover, select:hover { border-color: #94a3b8; }
.input:focus, input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}
.input::placeholder, textarea::placeholder { color: var(--text-faint); }
.checkbox { accent-color: var(--accent); }

.eyebrow { background: var(--accent-soft); color: var(--accent-strong); }
.message {
    background: var(--accent-soft);
    border-color: #c7d2fe;
    color: var(--accent-strong);
    border-radius: 12px;
}

.form-section,
.auth-card,
.data-table,
.upload-card,
.plan-card,
.chat-shell,
.staff-card,
.staff-stat {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    background: var(--bg-card);
}
.auth-card { box-shadow: var(--shadow-lg); }

.bot-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.bot-card:hover {
    border-color: #c7d2fe;
    box-shadow: var(--shadow-lg);
}

.status-on { color: var(--success); background: var(--success-soft); border-color: #bbf7d0; }
.status-off { color: var(--text-dim); background: var(--bg-elev); border-color: var(--border); }
.status-fail { color: var(--danger); background: var(--danger-soft); border-color: #fecaca; }

.tab-active, .tab-active:hover { background: var(--accent); color: #fff; }
.tab:hover { background: #e2e8f0; }
.bot-tabs { background: #fff; box-shadow: var(--shadow-sm); }

.data-table th { background: var(--bg-elev); color: var(--text-dim); }
.data-table tbody tr { transition: background 0.12s ease; }
.data-table tbody tr:hover { background: #f8fafc; }

.key-reveal { background: var(--accent-soft); border-color: #c7d2fe; border-radius: var(--radius-lg); }
.key-reveal h3 { color: var(--accent-strong); }
.key-code, .code-block { background: #f8fafc; border-color: var(--border); }

.info-card {
    background: var(--warning-soft);
    border-color: #fde68a;
    color: #92400e;
    border-radius: var(--radius-lg);
}

.plan-card { border-radius: var(--radius-xl); padding: 24px; }
.plan-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-md); }
.plan-price { color: var(--text); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.plan-features li { border-bottom-color: var(--border-soft); }

.danger-zone { background: var(--danger-soft); border-color: #fecaca; border-radius: var(--radius-lg); }
.danger-zone h3 { color: #991b1b; }

.bubble-user { background: var(--accent-soft); border-color: #c7d2fe; }
.bubble-bot { background: var(--bg-elev); border-color: var(--border); }

.empty { background: #fff; border-radius: var(--radius-lg); border-color: #cbd5e1; }

/* Copy-to-clipboard affordance (API keys, widget snippet). */
.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text-dim);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.copy-btn svg { width: 15px; height: 15px; }
.copy-btn:hover { background: var(--accent-soft); color: var(--accent-strong); border-color: #c7d2fe; }
.copy-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.copy-btn.is-copied { background: var(--success-soft); color: var(--success); border-color: #bbf7d0; }

/* ---------- Shell responsive ---------- */
@media (max-width: 960px) {
    .app-shell { grid-template-columns: minmax(0, 1fr); }
    .app-shell.is-collapsed { grid-template-columns: minmax(0, 1fr); }
    .sidebar {
        position: fixed;
        left: 0; top: 0;
        width: var(--sidebar-w);
        transform: translateX(-100%);
        transition: transform 0.24s ease;
        box-shadow: var(--shadow-lg);
    }
    .app-shell.is-drawer-open .sidebar { transform: none; }
    .app-shell:not(.is-drawer-open) .sidebar-scrim { display: none; }
    .sidebar-collapse { display: none; }
    .appbar-menu { display: grid; }
    /* The drawer is always full-width on mobile, never the icon rail. */
    .is-collapsed .side-label,
    .is-collapsed .sidebar-section-label,
    .is-collapsed .sidebar-logo { display: revert; }
    .is-collapsed .sidebar-mark { display: none; }
    .is-collapsed .sidebar-head { flex-direction: row; height: 40px; }
    .is-collapsed .side-link,
    .is-collapsed .side-cta { justify-content: flex-start; padding-left: 12px; padding-right: 12px; }
    .is-collapsed .side-cta { justify-content: center; }
    .is-collapsed .side-link::after, .is-collapsed .side-cta::after { content: none; }
}

@media (max-width: 640px) {
    .user-trigger-text { display: none; }
    .user-trigger { padding: 4px; }
    .user-trigger-caret { display: none; }
    .toast-stack { right: 12px; left: 12px; bottom: 12px; max-width: none; }
}

/* =====================================================================
   Chatbot builder — split screen: editor on the left, live preview right.
   ===================================================================== */
.builder {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 24px;
    align-items: start;
}

.builder-editor { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.builder-preview {
    position: sticky;
    top: calc(var(--appbar-h) + 24px);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ---------- Editor cards ---------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    padding: 24px 26px;
}

.card-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
}
.card-head-icon {
    flex-shrink: 0;
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: 11px;
    background: var(--accent-soft);
    color: var(--accent);
}
.card-head-icon svg { width: 19px; height: 19px; }
.card-head-text { min-width: 0; }
.card-title { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.card-sub { margin: 3px 0 0; color: var(--text-dim); font-size: 13.5px; line-height: 1.5; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 720px) { .field-row { grid-template-columns: 1fr; } }

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field-label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 7px;
}
.field-label .req { color: var(--accent); margin-left: 2px; }

/* A switch-style toggle row for booleans. */
.toggle-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fcfdfe;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.toggle-row:hover { border-color: #cbd5e1; background: #fff; }
.toggle-row .checkbox { margin-top: 2px; width: 18px; height: 18px; flex-shrink: 0; }
.toggle-copy { min-width: 0; }
.toggle-title { display: block; font-size: 14px; font-weight: 600; }
.toggle-help { display: block; margin-top: 3px; color: var(--text-dim); font-size: 13px; line-height: 1.5; }
.toggle-help code {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 1px 5px;
    font-size: 12px;
}

/* Character counter under the big instruction textareas. */
.field-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 6px;
}
.char-count { font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.field-foot .field-help { margin-top: 0; }

textarea.input { min-height: 96px; line-height: 1.6; }
textarea.is-tall { min-height: 132px; }

/* ---------- Sticky save bar ---------- */
.save-bar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 4px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}
.save-bar-status { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-dim); }
.save-bar-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
.save-bar.is-dirty .save-bar-dot { background: var(--warning); }
.save-bar-actions { margin-left: auto; display: flex; gap: 10px; }

/* ---------- Live preview panel ---------- */
.preview {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    height: calc(100vh - var(--appbar-h) - 72px);
    min-height: 520px;
    max-height: 780px;
}

.preview-head {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
}
.preview-avatar {
    width: 36px; height: 36px;
    flex-shrink: 0;
    display: grid; place-items: center;
    border-radius: 11px;
    background: linear-gradient(140deg, var(--accent) 0%, #7c3aed 100%);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
}
.preview-id { min-width: 0; flex: 1; }
.preview-name {
    margin: 0;
    font-size: 14.5px;
    font-weight: 650;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.preview-state { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.preview-state .pulse {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px var(--success-soft);
}
.preview-state.is-idle .pulse { background: var(--text-faint); box-shadow: 0 0 0 3px var(--bg-elev); }

.preview-reset {
    flex-shrink: 0;
    width: 32px; height: 32px;
    display: grid; place-items: center;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text-dim);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.preview-reset svg { width: 15px; height: 15px; }
.preview-reset:hover { background: var(--bg-elev); color: var(--text); }
.preview-reset:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }

.preview-log {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg);
}

.preview-log .bubble { max-width: 88%; box-shadow: var(--shadow-sm); }
.preview-log .bubble-bot { background: #fff; }

.preview-hint {
    margin: auto;
    text-align: center;
    color: var(--text-dim);
    font-size: 13.5px;
    max-width: 260px;
    line-height: 1.6;
}
.preview-hint-icon {
    width: 44px; height: 44px;
    margin: 0 auto 12px;
    display: grid; place-items: center;
    border-radius: 13px;
    background: var(--accent-soft);
    color: var(--accent);
}
.preview-hint-icon svg { width: 22px; height: 22px; }

.preview-input {
    display: flex;
    gap: 9px;
    padding: 12px;
    border-top: 1px solid var(--border);
    background: #fff;
}
.preview-input textarea {
    flex: 1;
    min-height: 42px;
    max-height: 130px;
    resize: none;
    padding: 10px 12px;
    font-size: 14px;
}
.preview-send {
    flex-shrink: 0;
    width: 42px; height: 42px;
    align-self: flex-end;
    display: grid; place-items: center;
    border: 0;
    border-radius: 11px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
}
.preview-send svg { width: 18px; height: 18px; }
.preview-send:hover { background: var(--accent-strong); }
.preview-send:disabled { opacity: 0.45; cursor: not-allowed; }
.preview-send:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }

/* Locked state — a bot must exist before it can answer. */
.preview-locked {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 32px 28px;
    text-align: center;
    background: var(--bg);
}
.preview-locked h4 { margin: 0; font-size: 15px; font-weight: 650; }
.preview-locked p { margin: 0; color: var(--text-dim); font-size: 13.5px; line-height: 1.6; max-width: 280px; }

/* Typing indicator. */
.typing { display: inline-flex; gap: 4px; align-items: center; padding: 2px 0; }
.typing span {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--text-faint);
    animation: typing-bounce 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
    30% { transform: translateY(-4px); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .typing span { animation: none; }
    .toast, .app-shell, .sidebar { transition: none; }
}

/* ---------- Builder page head ---------- */
.page-head { border-bottom: 0; padding-bottom: 0; margin-bottom: 24px; align-items: flex-start; }
.page-title { font-size: 26px; letter-spacing: -0.02em; }
.back-link { color: var(--text-dim); font-weight: 500; }
.back-link:hover { color: var(--accent); }

@media (max-width: 1180px) {
    .builder { grid-template-columns: minmax(0, 1fr); }
    .builder-preview { position: static; }
    .preview { height: 560px; max-height: none; }
}

/* =====================================================================
   Home dashboard — KPI row, usage chart, subscription widget.
   Chart palette validated with the dataviz validator against the white
   card surface: #4f46e5 / #eb6834 — CVD ΔE 31.4, both ≥ 3:1 contrast.
   ===================================================================== */

.dash-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}
.dash-head .btn { flex-shrink: 0; }

/* ---------- KPI stat tiles ---------- */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(212px, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.kpi {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    padding: 20px 22px;
    transition: box-shadow 0.18s ease, transform 0.14s ease;
}
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.kpi-label {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
}

.kpi-value {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.1;
    /* Proportional figures — tabular-nums makes a big standalone number loose. */
}

.kpi-foot { display: flex; flex-direction: column; gap: 3px; margin-top: 10px; }

.delta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    font-weight: 600;
}
.delta-glyph { font-size: 13px; line-height: 1; }
.delta-success { color: #15803d; }
.delta-danger { color: #b91c1c; }
.delta-neutral { color: var(--text-faint); }

.kpi-hint { font-size: 12px; color: var(--text-faint); }

/* ---------- Dashboard grid ---------- */
.dash-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 344px;
    gap: 20px;
    align-items: start;
}

.dash-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ---------- Chart card ---------- */
.chart-card { padding: 22px 24px 18px; }

.chart-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.chart-legend { display: flex; gap: 18px; flex-wrap: wrap; }

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);   /* text tokens — never the series color */
}
.legend-key {
    width: 10px; height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
    display: inline-block;
}
.legend-total {
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.chart-wrap { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }

.grid-line { stroke: #eef2f6; stroke-width: 1; }        /* solid hairline, never dashed */
.axis-text { fill: #94a3b8; font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-crosshair { stroke: #cbd5e1; stroke-width: 1; }

.chart-tooltip {
    position: absolute;
    top: 4px;
    transform: translateX(-50%);
    min-width: 148px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 11px;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
    z-index: 5;
}
.tip-day { margin: 0 0 7px; font-size: 12px; font-weight: 700; color: var(--text); }
.tip-row {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 3px;
    font-size: 12.5px;
    color: var(--text-dim);
}
.tip-row:last-child { margin-bottom: 0; }
.tip-val {
    margin-left: auto;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.chart-table { margin-top: 14px; border-top: 1px solid var(--border-soft); padding-top: 12px; }
.chart-table summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
    list-style: none;
}
.chart-table summary::-webkit-details-marker { display: none; }
.chart-table summary::before { content: "▸ "; color: var(--text-faint); }
.chart-table[open] summary::before { content: "▾ "; }
.chart-table summary:hover { color: var(--accent); }
.chart-table-scroll { max-height: 280px; overflow-y: auto; margin-top: 12px; }
.chart-table .data-table { border-radius: 10px; }
.chart-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.chart-empty { text-align: center; padding: 44px 16px 40px; }
.chart-empty-icon {
    width: 48px; height: 48px;
    margin: 0 auto 14px;
    display: grid; place-items: center;
    border-radius: 14px;
    background: var(--accent-soft);
    color: var(--accent);
}
.chart-empty-icon svg { width: 24px; height: 24px; }
.chart-empty h3 { margin: 0 0 6px; font-size: 16px; }
.chart-empty p { margin: 0 auto 18px; color: var(--text-dim); max-width: 340px; font-size: 14px; }

/* ---------- Subscription widget ---------- */
.plan-widget { padding: 22px 24px; }

.plan-widget-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.plan-widget-eyebrow {
    margin: 0 0 2px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.plan-widget-name { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }

.plan-widget-price {
    margin: 0 0 20px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.plan-widget-desc {
    display: block;
    margin-top: 3px;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-dim);
    line-height: 1.5;
}

.quota-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 18px; }

.quota-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 7px;
}
.quota-label { font-size: 13px; font-weight: 500; color: var(--text-dim); }
.quota-count { font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.quota-count strong { color: var(--text); font-weight: 700; }

/* Meter: unfilled track is a lighter step of the fill's own ramp. */
.meter {
    height: 7px;
    border-radius: 999px;
    background: var(--accent-soft);
    overflow: hidden;
}
.meter-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--accent);
    transition: width 0.4s ease;
}
.meter-warning { background: #d97706; }
.meter-danger { background: #dc2626; }
/* Track follows the fill's ramp so state reads across the whole bar. */
.meter:has(.meter-warning) { background: #fef3c7; }
.meter:has(.meter-danger) { background: #fee2e2; }

.quota-warn {
    margin: 6px 0 0;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}
.quota-warn-warning { color: #b45309; }
.quota-warn-danger { color: #b91c1c; }

.plan-widget-renew {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fbfcfe;
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
}
.plan-widget-renew svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; color: var(--text-faint); }
.plan-widget-renew strong { color: var(--text); font-weight: 650; }

/* ---------- Recent activity ---------- */
.activity-card { padding: 20px 22px; }
.activity-card .card-title { margin-bottom: 14px; }

.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }

.activity-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 10px;
    margin: 0 -10px;
    border-radius: 10px;
    color: var(--text);
    transition: background 0.14s ease;
}
.activity-item:hover { background: var(--bg-elev); color: var(--text); }

.activity-avatar {
    width: 32px; height: 32px;
    flex-shrink: 0;
    display: grid; place-items: center;
    border-radius: 9px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 700;
}
.activity-copy { display: flex; flex-direction: column; min-width: 0; }
.activity-title {
    font-size: 13.5px;
    font-weight: 550;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.activity-meta { font-size: 12px; color: var(--text-dim); }
.activity-empty { margin: 0; font-size: 13.5px; line-height: 1.55; }

@media (max-width: 1100px) {
    .dash-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
    .dash-head { flex-direction: column; }
    .kpi-value { font-size: 28px; }
}

/* =====================================================================
   Profile & account settings
   ===================================================================== */

/* ---------- Clickable identity block in the user menu ---------- */
.menu-head-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border-soft);
    border-radius: 9px 9px 0 0;
    color: var(--text);
    transition: background 0.15s ease;
}
.menu-head-link:hover { background: var(--bg-elev); color: var(--text); }
.menu-head-link:focus-visible {
    outline: none;
    background: var(--bg-elev);
    box-shadow: 0 0 0 2px var(--accent-ring);
}
.menu-head-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.menu-head-link .menu-head-name,
.menu-head-link .menu-head-mail {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.menu-head-caret {
    width: 15px; height: 15px;
    flex-shrink: 0;
    color: var(--text-faint);
    transition: transform 0.15s ease;
}
.menu-head-link:hover .menu-head-caret { transform: translateX(2px); color: var(--accent); }

.avatar-sm { width: 34px; height: 34px; font-size: 14px; flex-shrink: 0; }

/* ---------- Identity banner on the profile page ---------- */
.profile-identity {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 22px;
    margin-bottom: 22px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}
.profile-avatar {
    width: 56px; height: 56px;
    flex-shrink: 0;
    display: grid; place-items: center;
    border-radius: 16px;
    background: linear-gradient(140deg, var(--accent) 0%, #7c3aed 100%);
    color: #fff;
    font-size: 22px;
    font-weight: 700;
}
.profile-name { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.profile-mail { margin: 2px 0 0; font-size: 14px; color: var(--text-dim); word-break: break-all; }
.profile-since { margin: 4px 0 0; font-size: 12.5px; }

/* ---------- Settings sections ---------- */
.settings-stack { display: flex; flex-direction: column; gap: 20px; max-width: 720px; }
.settings-stack .form-section { padding: 22px 24px; }
.section-note { margin: -8px 0 18px; font-size: 13.5px; line-height: 1.55; }

.settings-stack .form-actions { margin-top: 18px; }

/* A disabled input should read as "for reference", not "broken". */
.input:disabled,
input:disabled {
    background: var(--bg-elev);
    color: var(--text-dim);
    cursor: not-allowed;
    -webkit-text-fill-color: var(--text-dim);   /* Safari honours this, not `color` */
    opacity: 1;
}

/* Password validator help text arrives as a <ul> from Django. */
.field-help ul { margin: 4px 0 0; padding-left: 18px; }
.field-help li { margin-bottom: 2px; }

.settings-link-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.settings-link-title { margin: 0 0 3px; font-size: 14.5px; font-weight: 600; }
.settings-link-sub { margin: 0; font-size: 13px; line-height: 1.55; max-width: 46ch; }
.settings-link-sub .status-pill { margin-left: 4px; }
.settings-link-row .btn { flex-shrink: 0; }

@media (max-width: 560px) {
    .profile-identity { flex-direction: column; align-items: flex-start; text-align: left; }
    .settings-link-row .btn { width: 100%; }
}
