:root {
    --bg: #0a0a0d;
    --bg-radial: radial-gradient(120% 90% at 50% -10%, #14141c 0%, #0a0a0d 55%);
    --glass-bg: rgba(16, 16, 21, 0.74);
    --glass-border: rgba(255, 255, 255, 0.07);
    --glass-hover: rgba(255, 255, 255, 0.10);
    /* Matched to the KINJU Android app's ThemePalette.kt default "Blue"
       accent gradient (gradientStart #38C6F4 -> gradientEnd #6F59FF,
       TL_BR orientation == 135deg here) so the web/desktop frontend and
       the Android app read as the same product. The 7-swatch theme
       picker in Settings > Appearance overrides --accent/--accent-2 at
       runtime with the other ThemePalette.kt entries (Purple, Pink, Red,
       Orange, Yellow, Green) - see the THEME SWATCHES block below. */
    --accent: #38c6f4;
    --accent-2: #6f59ff;
    --accent-glow: rgba(111, 89, 255, 0.28);
    --accent-secondary: #38c6f4;
    --text: rgba(247, 247, 250, 0.96);
    --text-dim: rgba(247, 247, 250, 0.54);
    --text-muted: rgba(247, 247, 250, 0.58);
    --danger: #f0665e;
    --success: #4fc98a;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --header-h: 64px;
    --input-bar-h: calc(88px + env(safe-area-inset-bottom, 0px));
    --content-gap: 16px;
    --panel-gap: 14px;
    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Space Grotesk', var(--font);
    --drawer-w: 280px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; overflow-x: hidden; }

body {
    font-family: var(--font);
    background: var(--bg);
    background-image: var(--bg-radial);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    letter-spacing: -0.006em;
}

button { font-family: var(--font); cursor: pointer; border: none; background: none; color: inherit; }
textarea { font-family: var(--font); color: var(--text); }

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(28px) saturate(1.3);
    -webkit-backdrop-filter: blur(28px) saturate(1.3);
    border: 1px solid var(--glass-border);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 32px rgba(0, 0, 0, 0.28);
}

.app {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.login-gate {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background);
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.login-gate.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.login-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 44px 40px;
    max-width: 340px;
    width: 90%;
    border-radius: 20px;
}

.login-logo {
    width: 90px;
    height: 90px;
    object-fit: contain;
    filter: drop-shadow(0 0 28px rgba(110, 107, 240, 0.45));
    margin-bottom: 8px;
}

.login-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 1px;
}

.login-sub {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-top: 4px;
    margin-bottom: 28px;
}

.google-signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 20px;
    border-radius: 24px;
    background: #fff;
    color: #1f1f1f;
    font-size: 0.88rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    border: none;
    transition: all var(--transition);
}

.google-signin-btn:hover {
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.google-signin-btn:disabled {
    opacity: 0.6;
    cursor: default;
    transform: none;
}

.login-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 20px;
}

.user-avatar-img {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.header {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    height: var(--header-h);
    padding: 0 24px;
    margin-bottom: var(--content-gap);
    border-radius: 0 0 var(--radius) var(--radius);
    border-top: none;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-mark {
    width: 52px;
    height: 52px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(110, 107, 240, 0.35));
}

.logo {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text);
}

.tagline {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.4px;
    padding-left: 10px;
    border-left: 1px solid var(--glass-border);
}

.mode-switch {
    position: relative;
    display: flex;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 3px;
    gap: 2px;
}

.mode-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(50% - 4px);
    height: calc(100% - 6px);
    background: var(--accent);
    border-radius: 10px;
    transition: transform var(--transition);
    opacity: 0.18;
}

.mode-slider.right {
    transform: translateX(calc(100% + 2px));
}

.mode-switch-single {
    min-width: 0;
}

.mode-switch-single .mode-btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
    padding: 7px 16px;
}

.mode-switch-single .mode-slider {
    width: calc(100% - 6px);
}

.mode-switch-three {
    min-width: 0;
}

.mode-switch-three .mode-btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
    padding: 7px 10px;
}

.mode-switch-three .mode-slider {
    width: calc(33.333% - 4px);
}

.mode-switch-three .mode-slider.center {
    transform: translateX(calc(100% + 2px));
}

.mode-switch-three .mode-slider.right {
    transform: translateX(calc(200% + 4px));
}

.mode-btn {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    font-size: 0.76rem;
    font-weight: 500;
    border-radius: 10px;
    color: var(--text-dim);
    transition: color var(--transition);
    white-space: nowrap;
}

.mode-btn.active { color: var(--text); }
.mode-btn svg {
    opacity: 0.7;
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    flex-shrink: 0;
}

.mode-btn.active svg { opacity: 1; }
.header-left { display: flex; align-items: baseline; gap: 10px; flex-shrink: 0; min-width: 0; }
.header-center { flex: 1; min-width: 0; display: flex; justify-content: center; align-items: center; }
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

/* ------------------------------------------------------------------
   FILE CARDS - dark rounded cards for files Kinju shares in chat
   (code files, archives, documents), matching the download-card look:
   colored icon tile on the left, filename + type label, circular
   download button on the right. Call renderFileCards() in script.js
   with a list of {name, ext, url} to drop these into a message.
------------------------------------------------------------------ */
.file-card-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.file-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--glass-border);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

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

.file-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.14);
}

.file-card-icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
}

/* Warm accent for code/text files - a distinct "file type" color,
   separate from the site's cyan/purple brand accent, same way Claude's
   own file cards use their own tone for this. */
.file-card-icon.code { background: rgba(212, 133, 79, 0.16); color: #e0996a; }
.file-card-icon.archive { background: rgba(255, 255, 255, 0.08); color: var(--text-dim); }
.file-card-icon.doc { background: rgba(110, 107, 240, 0.16); color: var(--accent); }
.file-card-icon.image { background: rgba(76, 194, 233, 0.16); color: var(--accent-secondary); }

.file-card-info { flex: 1; min-width: 0; }

.file-card-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-card-type {
    font-size: 0.72rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-top: 1px;
}

.file-card-download {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    display: grid;
    place-items: center;
    color: var(--text-dim);
    transition: var(--transition);
    /* Now a real <button> (was a decorative <div>) so a plain click on
       the icon itself can still download without opening the card's
       code-preview panel - needs its own reset since <button> ships
       with a border/padding/font that <div> never had. */
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
}

.file-card:hover .file-card-download {
    background: var(--accent);
    color: white;
}

.file-card-download-all {
    display: flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    margin-top: 2px;
    padding: 9px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.file-card-download-all:hover {
    background: rgba(255, 255, 255, 0.09);
    color: var(--text);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-dim);
}

.upgrade-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    flex-shrink: 0;
}

.upgrade-btn:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
    animation: pulse-dot 2s ease-in-out infinite;
}

.status-dot.offline {
    background: var(--danger);
    box-shadow: 0 0 6px var(--danger);
    animation: none;
}

.btn-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    transition: background var(--transition), border-color var(--transition);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-icon:hover {
    background: var(--glass-hover);
    border-color: rgba(255, 255, 255, 0.14);
}

.chat-area {
    position: relative;
    z-index: 5;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    gap: 16px;
    padding: 48px 24px;
    animation: fadeIn 0.6s ease;
}

.welcome-icon {
    margin-bottom: 4px;
}

.welcome-logo {
    width: 116px;
    height: 116px;
    object-fit: contain;
    filter: drop-shadow(0 0 32px rgba(110, 107, 240, 0.5));
    animation: welcomeLogoFloat 4s ease-in-out infinite;
}

@keyframes welcomeLogoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.welcome-title {
    font-size: 1.8rem;
    font-weight: 600;
    font-family: var(--font-display);
    background: linear-gradient(135deg, var(--text), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-sub {
    font-size: 0.9rem;
    color: var(--text-dim);
    font-weight: 300;
}

.welcome-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    font-size: 0.78rem;
    font-weight: 400;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    transition: all var(--transition);
}

.chip svg {
    flex-shrink: 0;
    opacity: 0.85;
}

.chip:hover {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(110, 107, 240, 0.3);
}

.message {
    display: flex;
    gap: 12px;
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    animation: msgIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.message.user { flex-direction: row-reverse; }
.msg-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 4px;
}

.msg-avatar .msg-avatar-icon {
    width: 18px;
    height: 18px;
}

.msg-avatar img.msg-avatar-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.message.assistant .msg-avatar {
    background: #fff;
    padding: 4px;
}

.message.user .msg-avatar {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-dim);
}

.msg-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.msg-content {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 0.87rem;
    line-height: 1.65;
    font-weight: 400;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message.assistant .msg-content {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-top-left-radius: var(--radius-xs);
}

.message.user .msg-content {
    background: rgba(124, 106, 239, 0.13);
    border: 1px solid rgba(124, 106, 239, 0.16);
    border-top-right-radius: var(--radius-xs);
}

.msg-label {
    font-size: 0.66rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 0 4px;
}
.message.user .msg-label { text-align: right; }

.stream-cursor {
    animation: blink 0.8s step-end infinite;
    color: var(--accent);
    margin-left: 1px;
}

.msg-actions-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.msg-action-image {
    max-width: 100%;
    max-height: 320px;
    border-radius: var(--radius);
    object-fit: contain;
}

.msg-actions-contents {
    margin-top: 12px;
}

.msg-action-content {
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius);
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre-wrap;
    margin-bottom: 8px;
}
.msg-action-content:last-child { margin-bottom: 0; }

.bg-task-card {
    margin-top: 12px;
    padding: 14px 18px;
    background: rgba(124, 106, 239, 0.06);
    border: 1px solid rgba(124, 106, 239, 0.12);
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.bg-task-card.bg-task-done {
    background: rgba(78, 205, 196, 0.06);
    border-color: rgba(78, 205, 196, 0.15);
}

.bg-task-card.bg-task-failed {
    background: rgba(255, 107, 107, 0.06);
    border-color: rgba(255, 107, 107, 0.12);
}

.bg-task-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bg-task-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(124, 106, 239, 0.15);
    border-top: 2px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }
.bg-task-done-icon {
    width: 16px; height: 16px; flex-shrink: 0;
    background: var(--success);
    border-radius: 50%;
    position: relative;
}

.bg-task-done-icon::after {
    content: '';
    position: absolute;
    top: 3px; left: 5px;
    width: 5px; height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.bg-task-fail-icon {
    width: 16px; height: 16px; flex-shrink: 0;
    background: var(--danger);
    border-radius: 50%;
    position: relative;
}

.bg-task-fail-icon::after {
    content: '!';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
}

.bg-task-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
}

.bg-task-status {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-left: auto;
}

.bg-task-prompt {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 6px;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bg-task-view-btn {
    margin-top: 10px;
    padding: 8px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.bg-task-view-btn:hover { background: #6b5ce7; }
.cam-btn.cam-active {
    color: var(--accent);
    background: rgba(124, 106, 239, 0.18);
    border-color: rgba(124, 106, 239, 0.3);
}

.cam-panel {
    --cam-w: 420px;
    --cam-h: 315px;
    position: fixed;
    bottom: calc(var(--input-bar-h) + var(--panel-gap) + 16px);
    right: 24px;
    width: var(--cam-w);
    height: var(--cam-h);
    min-width: 200px;
    min-height: 150px;
    max-width: 90vw;
    max-height: 70vh;
    z-index: 100;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(124, 106, 239, 0.25);
    background: rgba(10, 10, 28, 0.88);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9) translateY(12px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, width 0.25s ease, height 0.25s ease;
}

.cam-panel.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
}

.cam-panel.minimized {
    width: 72px !important;
    height: 72px !important;
    min-width: 72px;
    min-height: 72px;
    border-radius: 50%;
}

.cam-panel.minimized .cam-panel-header,
.cam-panel.minimized .cam-panel-overlay,
.cam-panel.minimized .cam-panel-resize { display: none; }

.cam-panel.minimized .cam-panel-body {
    border-radius: 50%;
    cursor: pointer;
}

.cam-panel.minimized .cam-panel-body video { border-radius: 50%; }

.cam-panel {
    display: flex;
    flex-direction: column;
}

.cam-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.35);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    cursor: move;
    user-select: none;
    flex-shrink: 0;
    border-radius: 20px 20px 0 0;
}

.cam-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}

.cam-panel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse-dot 1.5s ease-in-out infinite;
}

.cam-panel-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cam-panel-vision-mode {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-right: 8px;
}

.cam-panel-vision-mode input { display: none; }
.cam-panel-vision-label {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-dim);
    padding: 4px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    transition: all var(--transition);
}

.cam-panel-vision-mode input:checked + .cam-panel-vision-label {
    color: var(--accent);
    background: rgba(124, 106, 239, 0.2);
}

.cam-panel-btn {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-dim);
    border-radius: 10px;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: all var(--transition);
}

.cam-panel-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
}

.cam-panel-btn.cam-close:hover { background: rgba(255, 107, 107, 0.25); color: var(--danger); }

.cam-panel-body {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.cam-panel #cam-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cam-panel-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.85);
}

.cam-panel-resize {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 24px;
    height: 24px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 45%, rgba(255,255,255,0.2) 45%, rgba(255,255,255,0.2) 55%, transparent 55%);
    border-bottom-right-radius: inherit;
}

.cam-panel-resize:hover { background: linear-gradient(135deg, transparent 45%, rgba(124,106,239,0.4) 45%, rgba(124,106,239,0.4) 55%, transparent 55%); }
.cam-panel.minimized .cam-panel-resize { pointer-events: none; }

@media (max-width: 768px) {
    .cam-panel { --cam-w: 280px; --cam-h: 210px; right: 16px; bottom: calc(var(--input-bar-h) + var(--panel-gap) + 12px); }
}

@media (max-width: 480px) {
    .cam-panel { --cam-w: 240px; --cam-h: 180px; right: 12px; bottom: calc(var(--input-bar-h) + var(--panel-gap) + 8px); }
}

.input-bar {
    position: relative;
    z-index: 10;
    padding: 14px 24px 14px;
    padding-bottom: max(14px, env(safe-area-inset-bottom, 14px));
    margin-top: var(--content-gap);
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: none;
    flex-shrink: 0;
    box-shadow: none;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 8px 8px 8px 18px;
    transition: border-color var(--transition);
    box-shadow: none;
}

.input-wrapper:focus-within {
    border-color: rgba(255, 255, 255, 0.14);
}

.input-wrapper textarea {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    resize: none;
    font-size: 0.87rem;
    line-height: 1.5;
    padding: 8px 0;
    max-height: 120px;
    color: var(--text);
}
.input-wrapper textarea::placeholder { color: var(--text-muted); }
.input-wrapper textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.input-actions {
    display: flex;
    gap: 6px;
    padding-bottom: 2px;
    flex-shrink: 0;
}

.action-btn {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all var(--transition);
    color: var(--text-dim);
    flex-shrink: 0;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.16);
    color: var(--text);
    transform: translateY(-1px);
}

.action-btn:active {
    transform: translateY(0);
}

.send-btn {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(124, 106, 239, 0.25);
}

.send-btn:hover {
    background: #6a58e0 !important;
    border-color: #6a58e0 !important;
    box-shadow: 0 4px 14px rgba(124, 106, 239, 0.35);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: default;
    box-shadow: none;
    transform: none;
    animation: sendBtnPulse 1.2s ease-in-out infinite;
}

@keyframes sendBtnPulse {
    0%, 100% { opacity: 0.5; }
    50%      { opacity: 0.7; }
}

.mic-btn .mic-icon-active { display: none; }
.mic-btn.listening .mic-icon { display: none; }
.mic-btn.listening .mic-icon-active { display: block; }

.mic-btn.listening {
    background: rgba(255, 107, 107, 0.18);
    border-color: rgba(255, 107, 107, 0.3);
    color: var(--danger);
    animation: micPulse 1.5s ease-in-out infinite;
}

.mic-btn.auto-listen:not(.listening) {
    border-color: rgba(78, 205, 196, 0.4);
    box-shadow: 0 0 0 1px rgba(78, 205, 196, 0.2);
}

.tts-btn .tts-icon-on { display: none; }
.tts-btn.tts-active .tts-icon-off { display: none; }
.tts-btn.tts-active .tts-icon-on { display: block; }

.tts-btn.tts-active {
    background: rgba(124, 106, 239, 0.18);
    border-color: rgba(124, 106, 239, 0.3);
    color: var(--accent);
}

.tts-btn.tts-speaking {
    animation: ttsPulse 1.5s ease-in-out infinite;
}

.input-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 6px 12px 0;
    min-height: 0;
    font-size: 0.66rem;
    color: var(--text-muted);
}

.panel-overlay {
    position: fixed;
    inset: 0;
    z-index: 19;
    background: transparent;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.panel-overlay.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: none;
}

.speech-widget {
    position: fixed;
    bottom: calc(var(--input-bar-h) + var(--panel-gap));
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    z-index: 15;
    min-width: min(320px, 90vw);
    max-width: min(560px, 95vw);
    padding: 14px 20px;
    border-radius: 16px;
    background: rgba(10, 10, 28, 0.65);
    backdrop-filter: blur(24px) saturate(1.3);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(124, 106, 239, 0.08);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

.speech-widget.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    animation: speechWidgetIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes speechWidgetIn {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.speech-widget-inner {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.speech-widget-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.speech-widget-label::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--danger);
    animation: pulse-dot 1.2s ease-in-out infinite;
}

.speech-widget-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text);
    min-height: 1.5em;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.speech-widget-text:empty::before {
    content: 'Speak now...';
    color: var(--text-muted);
    font-style: italic;
}

.toast-container {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 20px;
    background: rgba(20, 20, 35, 0.95);
    border: 1px solid rgba(255, 107, 107, 0.4);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    max-width: min(400px, 90vw);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
    cursor: pointer;
}

.toast.toast-visible {
    opacity: 1;
    transform: translateY(0);
}

.activity-panel {
    position: fixed;
    top: calc(var(--header-h) + var(--panel-gap));
    left: 0;
    bottom: calc(var(--input-bar-h) + var(--panel-gap));
    width: min(340px, 90vw);
    min-width: 0;
    height: auto;
    z-index: 6;
    display: flex;
    flex-direction: column;
    border-radius: 0 var(--radius) var(--radius) 0;
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.04);
    overflow: hidden;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.activity-panel.open {
    transform: translateX(0);
}

.activity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.activity-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.activity-title::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(124, 106, 239, 0.5);
}

.activity-close {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    cursor: pointer;
    transition: all var(--transition);
}

.activity-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
}

.activity-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.activity-list::-webkit-scrollbar { display: none; }
.activity-empty {
    padding: 24px 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
}

.activity-item {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    font-size: 0.78rem;
    line-height: 1.55;
    animation: activityIn 0.25s ease-out;
}

.activity-item .activity-event {
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.activity-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 6px;
    background: rgba(124, 106, 239, 0.2);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 700;
}

.activity-item .activity-detail {
    color: var(--text-dim);
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
}

.activity-item.route-general .activity-event,
.activity-item.route-general .activity-step { color: #7dd3fc; }
.activity-item.route-general .activity-step { background: rgba(125, 211, 252, 0.15); }
.activity-item.route-realtime .activity-event,
.activity-item.route-realtime .activity-step { color: var(--success); }
.activity-item.route-realtime .activity-step { background: rgba(81, 207, 102, 0.15); }
.activity-item.route-vision .activity-event,
.activity-item.route-vision .activity-step { color: #f59e0b; }
.activity-item.route-vision .activity-step { background: rgba(245, 158, 11, 0.15); }
.activity-item.route-task .activity-event,
.activity-item.route-task .activity-step { color: var(--accent-secondary); }
.activity-item.route-task .activity-step { background: rgba(78, 205, 196, 0.15); }
.activity-item.route-chat .activity-event,
.activity-item.route-chat .activity-step { color: var(--accent); }
.activity-item.route-chat .activity-step { background: rgba(124, 106, 239, 0.2); }

.activity-item.activity-sub {
    padding: 12px 14px;
    font-size: 0.75rem;
    border-left: 3px solid rgba(124, 106, 239, 0.4);
}

.activity-item.activity-sub .activity-event { font-size: 0.76rem; }

@keyframes activityIn {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

.search-results-widget {
    position: fixed;
    top: calc(var(--header-h) + var(--panel-gap));
    right: 0;
    bottom: calc(var(--input-bar-h) + var(--panel-gap));
    width: min(380px, 95vw);
    min-width: 0;
    height: auto;
    z-index: 6;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius) 0 0 var(--radius);
    border-right: none;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.04);
    overflow: hidden;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-results-widget.open {
    transform: translateX(0);
}

.search-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.search-results-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.search-results-title::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse-dot 2s ease-in-out infinite;
    flex-shrink: 0;
}

.search-results-close {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.search-results-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
}

/* ------------------------------------------------------------------
   CODE PANEL - slide-in viewer opened by clicking a .file-card (see
   renderFileCards() / openCodePanel() in script.js). Same slide-in
   pattern as .search-results-widget just to its left side timing-
   wise (reuses #panel-overlay), but wider and with a code-focused
   dark body instead of a text column.
------------------------------------------------------------------ */
.code-panel {
    position: fixed;
    top: calc(var(--header-h) + var(--panel-gap));
    right: 0;
    bottom: calc(var(--input-bar-h) + var(--panel-gap));
    width: min(640px, 95vw);
    min-width: 0;
    height: auto;
    z-index: 7;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius) 0 0 var(--radius);
    border-right: none;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.04);
    overflow: hidden;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s ease;
}

.code-panel.open { transform: translateX(0); }
.code-panel.expanded { width: min(1000px, 95vw); }

.code-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.code-panel-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
}

.code-panel-filename {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.code-panel-lang {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.code-panel-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.code-panel-action { width: 32px; height: 32px; }

.code-panel-body {
    flex: 1;
    overflow: auto;
    background: #0d1117;
}

.code-panel-pre {
    margin: 0;
    padding: 20px;
    min-height: 100%;
}

.code-panel-pre code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre;
    background: transparent !important;
}

@media (max-width: 900px) {
    .code-panel { width: min(100vw, 480px); }
    .code-panel.expanded { width: 100vw; }
}

@media (max-width: 480px) {
    .code-panel { width: 100vw; border-radius: 0; }
}

/* Prominent pill next to "Download all" when a message's files include
   an index.html (or any .html file) - opens the full website live in
   the modal below instead of just handing over code to read. Styled
   with the accent color (unlike the neutral download-all pill) since
   this is the primary "see it now" action for a generated site. */
.file-card-preview-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    margin-top: 2px;
    padding: 9px 16px;
    border-radius: 999px;
    background: var(--accent);
    border: 1px solid var(--accent);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.file-card-preview-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

/* ------------------------------------------------------------------
   SITE PREVIEW - full-screen modal that renders a generated website's
   HTML (with its linked CSS/JS inlined client-side, see
   buildPreviewDocument() in script.js) live in a sandboxed iframe, so
   the user can actually see the site Kinju built instead of only
   downloading its files. Opened from the "Preview" pill on a file-card
   list and from the eye icon in the code panel's header when the
   open file is HTML.
------------------------------------------------------------------ */
.site-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(8, 10, 16, 0.72);
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.site-preview-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.site-preview-modal {
    width: min(1500px, 100%);
    height: min(900px, 100%);
    display: flex;
    flex-direction: column;
    background: #0d1117;
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transform: scale(0.97) translateY(8px);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.site-preview-overlay.open .site-preview-modal {
    transform: scale(1) translateY(0);
}

.site-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.site-preview-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.site-preview-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #3ecf8e;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.15);
}

.site-preview-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-preview-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.site-preview-body {
    flex: 1;
    min-height: 0;
    background: #fff;
}

.site-preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

@media (max-width: 720px) {
    .site-preview-overlay { padding: 0; }
    .site-preview-modal { width: 100vw; height: 100vh; border-radius: 0; }
}

.search-results-query {
    padding: 12px 20px 14px;
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.search-results-answer {
    padding: 16px 20px 18px;
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--text);
    background: rgba(124, 106, 239, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    max-height: 200px;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.search-results-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.search-result-card {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    transition: background var(--transition), border-color var(--transition);
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-result-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.1);
}

.search-result-card .card-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.search-result-card .card-content {
    font-size: 0.76rem;
    color: var(--text-dim);
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result-card .card-url {
    font-size: 0.7rem;
    color: var(--accent);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.search-result-card .card-url:hover {
    text-decoration: underline;
}

.search-result-card .card-score {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.search-results-answer::-webkit-scrollbar,
.search-results-list::-webkit-scrollbar {
    width: 6px;
}

.search-results-answer::-webkit-scrollbar-track,
.search-results-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.search-results-answer::-webkit-scrollbar-thumb,
.search-results-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
}

.search-results-answer::-webkit-scrollbar-thumb:hover,
.search-results-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

@supports (scrollbar-color: rgba(255,255,255,0.12) rgba(255,255,255,0.03)) {
    .search-results-answer,
    .search-results-list {
        scrollbar-color: rgba(255, 255, 255, 0.12) rgba(255, 255, 255, 0.03);
        scrollbar-width: thin;
    }
}

.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: min(360px, 92vw);
    z-index: 21;
    border-radius: var(--radius);
    padding: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
}

.settings-panel.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--glass-border);
}

.settings-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.settings-body {
    padding: 24px 20px 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.settings-label {
    font-size: 0.88rem;
    color: var(--text);
    cursor: pointer;
    flex: 1;
}

.settings-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: 4px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    transition: background var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.14); }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes msgIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes dotBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%           { transform: translateY(-5px); opacity: 1; }
}
@keyframes blink {
    50% { opacity: 0; }
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}
@keyframes micPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.3); }
    50%      { box-shadow: 0 0 0 8px rgba(255, 107, 107, 0); }
}
@keyframes ttsPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(124, 106, 239, 0.3); }
    50%      { box-shadow: 0 0 0 8px rgba(124, 106, 239, 0); }
}
@media (max-width: 768px) {
    :root { --input-bar-h: calc(100px + env(safe-area-inset-bottom, 0px)); --content-gap: 12px; --panel-gap: 12px; }
    .header { padding: 0 16px; gap: 12px; margin-bottom: var(--content-gap); }
    .header-right { gap: 8px; }
    .btn-icon { width: 38px; height: 38px; min-width: 38px; min-height: 38px; }
    .tagline { display: none; }
    .logo { font-size: 1rem; }
    .mode-btn { padding: 6px 10px; font-size: 0.72rem; }
    .mode-btn .mode-btn-text { display: none; }
    .status-badge .status-text { display: none; }
    .chat-messages { padding: 18px 16px 22px; gap: 12px; }
    .input-bar { padding: 12px 16px 12px; padding-bottom: max(12px, env(safe-area-inset-bottom, 12px)); margin-top: var(--content-gap); }
    .input-wrapper { padding: 4px 4px 4px 12px; }
    .action-btn { width: 36px; height: 36px; min-width: 36px; border-radius: 9px; }
    .msg-content { font-size: 0.84rem; padding: 10px 13px; }
    .welcome-title { font-size: 1.3rem; }
    .message { gap: 8px; }
    .msg-avatar { width: 26px; height: 26px; font-size: 0.62rem; }
    .msg-avatar .msg-avatar-icon { width: 16px; height: 16px; }
    .search-results-widget { width: min(100vw, 360px); }
    .search-results-header { padding: 14px 16px; }
    .search-results-query,
    .search-results-answer { padding: 12px 16px; }
    .search-results-list { padding: 12px 16px 20px; gap: 12px; }
    .search-result-card { padding: 12px 14px; }
    .activity-panel { width: min(100vw, 320px); }
    .activity-header { padding: 14px 16px; }
    .activity-list { padding: 12px 16px 20px; gap: 12px; }
    .speech-widget { bottom: calc(var(--input-bar-h) + var(--panel-gap)); min-width: min(280px, 88vw); padding: 12px 16px; }
    .speech-widget-text { font-size: 0.85rem; }
}

@media (max-width: 480px) {
    :root { --input-bar-h: calc(95px + env(safe-area-inset-bottom, 0px)); --content-gap: 10px; --panel-gap: 10px; }
    .header { padding: 0 12px; margin-bottom: var(--content-gap); gap: 8px; }
    .header-left { flex-shrink: 0; }
    .header-center { flex: 1; justify-content: center; display: flex; min-width: 0; }
    .header-right { gap: 6px; }
    .btn-icon { width: 36px; height: 36px; min-width: 36px; min-height: 36px; }
    .logo { font-size: 0.9rem; letter-spacing: 2px; }
    .mode-switch { width: 100%; }
    .mode-btn { flex: 1; justify-content: center; }
    .new-chat-btn { display: none; }
    .chat-messages { padding: 14px 12px 18px; gap: 10px; }
    .message { max-width: 95%; }
    .msg-content { max-width: 100%; }
    .input-bar { padding: 10px 12px 10px; padding-bottom: max(10px, env(safe-area-inset-bottom, 10px)); margin-top: var(--content-gap); }
    .welcome-chips { gap: 8px; }
    .chip { font-size: 0.72rem; padding: 8px 16px; }
    .action-btn { width: 34px; height: 34px; min-width: 34px; border-radius: 8px; }
    .action-btn svg { width: 17px; height: 17px; }
    .input-actions { gap: 5px; }
    .input-wrapper { gap: 4px; }
    .search-results-widget { width: 100vw; max-width: 100%; }
    .search-results-header { padding: 12px 14px; }
    .search-results-query { font-size: 0.72rem; padding: 10px 14px 12px; }
    .search-results-answer { font-size: 0.82rem; padding: 12px 14px; max-height: 160px; }
    .search-results-list { padding: 12px 14px 18px; gap: 10px; }
    .search-result-card { padding: 12px 14px; }
    .search-result-card .card-title { font-size: 0.76rem; }
    .search-result-card .card-content { font-size: 0.72rem; -webkit-line-clamp: 3; }
    .activity-panel { width: 100vw; }
    .activity-header { padding: 12px 14px; }
    .activity-list { padding: 12px 14px 18px; gap: 10px; }
    .mode-switch-three .mode-btn { padding: 8px 10px; font-size: 0.68rem; }
    .mode-switch-three .mode-btn .mode-btn-text { display: none; }
    .speech-widget { bottom: calc(var(--input-bar-h) + var(--panel-gap)); min-width: min(260px, 92vw); padding: 10px 14px; }
    .speech-widget-label { font-size: 0.65rem; }
    .speech-widget-text { font-size: 0.82rem; }
}/* =============================================================================
   BRANDING POLISH — append to the end of style.css
   -----------------------------------------------------------------------------
   Purely additive: no existing rule is touched. These just add a gradient
   wordmark, a small monogram mark next to the logo, and fix icon alignment
   inside the welcome chips (which now include an svg + text).
   ============================================================================= */

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--text) 10%, var(--accent) 60%, var(--accent-secondary) 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: logoSheen 10s ease-in-out infinite;
}

.logo-mark {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    color: var(--accent);
    background: rgba(110, 107, 240, 0.12);
    border: 1px solid rgba(110, 107, 240, 0.25);
    flex-shrink: 0;
}

@keyframes logoSheen {
    0%, 100% { background-position: 0% center; }
    50%      { background-position: 100% center; }
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.chip svg { flex-shrink: 0; opacity: 0.75; transition: opacity var(--transition); }
.chip:hover svg { opacity: 1; }

.welcome-icon svg {
    filter: drop-shadow(0 0 18px var(--accent-glow));
}

@media (prefers-reduced-motion: reduce) {
    .logo { animation: none; }
}

/* =============================================================================
   ANDROID APP PARITY — drawer navigation, full-screen panels (History,
   Private Chats, Search, Agents, Tools, Files), expanded Settings sections,
   and the Appearance theme-swatch picker. Purely additive: nothing above
   this line is touched, every selector here is new.
   ============================================================================= */

/* --- Drawer toggle button reuses .btn-icon, just needs no extra CSS --- */

.drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 29;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.drawer-overlay.visible { opacity: 1; visibility: visible; }

.app-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--drawer-w);
    max-width: 86vw;
    z-index: 30;
    display: flex;
    flex-direction: column;
    background: var(--glass-bg);
    backdrop-filter: blur(28px) saturate(1.3);
    -webkit-backdrop-filter: blur(28px) saturate(1.3);
    border-right: 1px solid var(--glass-border);
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.35);
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 20px 14px;
}
.app-drawer.open { transform: translateX(0); }

.drawer-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 18px;
}
.drawer-logo { width: 28px; height: 28px; object-fit: contain; }
.drawer-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.5px;
    color: var(--text);
}

.drawer-new-chat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-size: 0.86rem;
    font-weight: 600;
    transition: var(--transition);
    margin-bottom: 14px;
}
.drawer-new-chat:hover { opacity: 0.9; transform: translateY(-1px); }

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

.drawer-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 0.86rem;
    font-weight: 500;
    text-align: left;
    transition: var(--transition);
}
.drawer-nav-item svg { flex-shrink: 0; opacity: 0.85; }
.drawer-nav-item:hover { background: var(--glass-hover); color: var(--text); }
.drawer-nav-item.active { background: rgba(111, 89, 255, 0.14); color: var(--text); }

.drawer-spacer { flex: 1; }

.drawer-footer {
    border-top: 1px solid var(--glass-border);
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.drawer-footer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 0.86rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}
.drawer-footer-item:hover { background: var(--glass-hover); color: var(--text); }
.drawer-footer-item.upgrade { color: #f5b942; }

.drawer-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-top: 6px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
}
.drawer-profile-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    flex-shrink: 0;
}
.drawer-profile-info { min-width: 0; }
.drawer-profile-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.drawer-profile-email {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Generic full-height screen panel, used by History / Private Chats /
   Search / Agents / Tools / Files. Slides in from the right, sits above
   the chat area but below the drawer. --- */

.app-screen {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(420px, 100vw);
    z-index: 25;
    display: flex;
    flex-direction: column;
    background: var(--glass-bg);
    backdrop-filter: blur(28px) saturate(1.3);
    -webkit-backdrop-filter: blur(28px) saturate(1.3);
    border-left: 1px solid var(--glass-border);
    box-shadow: -12px 0 32px rgba(0, 0, 0, 0.35);
    transform: translateX(100%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.28s ease, visibility 0.28s ease;
}
.app-screen.open {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.app-screen-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}
.app-screen-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}
.app-screen-header-actions { display: flex; gap: 8px; }

.app-screen-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.app-screen-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 40px 10px;
}

/* --- History / conversation-search list rows --- */

.hist-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    text-align: left;
    transition: var(--transition);
}
.hist-row:hover { background: var(--glass-hover); border-color: var(--glass-border); }
.hist-row-icon { color: var(--text-muted); flex-shrink: 0; margin-top: 2px; }
.hist-row-info { min-width: 0; flex: 1; }
.hist-row-title {
    font-size: 0.86rem;
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hist-row-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 3px;
}
.hist-row-delete {
    flex-shrink: 0;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity var(--transition), color var(--transition);
}
.hist-row:hover .hist-row-delete { opacity: 1; }
.hist-row-delete:hover { color: var(--danger); }

.app-search-input {
    width: 100%;
    padding: 11px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text);
    font-size: 0.86rem;
    font-family: var(--font);
    margin-bottom: 14px;
}
.app-search-input:focus { outline: none; border-color: var(--accent); }
.app-search-input::placeholder { color: var(--text-muted); }

/* --- Agents screen --- */

.agent-card {
    padding: 16px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
}
.agent-card-title { font-size: 0.92rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.agent-card-desc { font-size: 0.78rem; color: var(--text-dim); line-height: 1.5; margin-bottom: 14px; }
.agent-card-input {
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    color: var(--text);
    font-size: 0.84rem;
    font-family: var(--font);
    resize: vertical;
    min-height: 70px;
    margin-bottom: 12px;
}
.agent-card-input:focus { outline: none; border-color: var(--accent); }
.agent-run-btn {
    display: block;
    margin-left: auto;
    padding: 10px 26px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    transition: var(--transition);
}
.agent-run-btn:hover { opacity: 0.9; }
.agent-run-btn:disabled { opacity: 0.5; cursor: default; }
.agent-result {
    margin-top: 16px;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    font-size: 0.82rem;
    color: var(--text-dim);
    line-height: 1.6;
    white-space: pre-wrap;
    max-height: 340px;
    overflow-y: auto;
}
.agent-result.pending { color: var(--text-muted); font-style: italic; }

/* --- Tools screen (static capability list, each row prefills the
   composer with an example prompt and jumps back to chat) --- */

.tool-row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 13px 14px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    text-align: left;
    transition: var(--transition);
}
.tool-row:hover { background: var(--glass-hover); }
.tool-row-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(111, 89, 255, 0.14);
    color: var(--accent);
    flex-shrink: 0;
}
.tool-row-title { font-size: 0.85rem; font-weight: 500; color: var(--text); }
.tool-row-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

/* --- Files screen --- */

.ufile-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
}
.ufile-icon { color: var(--text-muted); flex-shrink: 0; }
.ufile-info { min-width: 0; flex: 1; }
.ufile-name { font-size: 0.84rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ufile-meta { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }
.ufile-actions { display: flex; gap: 4px; flex-shrink: 0; }
.ufile-actions button { width: 30px; height: 30px; display: grid; place-items: center; border-radius: var(--radius-xs); color: var(--text-muted); transition: var(--transition); }
.ufile-actions button:hover { background: var(--glass-hover); color: var(--text); }
.ufile-actions .ufile-delete:hover { color: var(--danger); }

/* --- Private Chats — multi-method lock gate ---
   The user picks one of Voice / PIN / Pattern / Face to lock Private Chats on
   this device. .pin-screen/.pin-lock-icon/.pin-title/.pin-sub/.pin-unlocked/
   .pin-start-btn/.pin-relock-btn/.pin-note are the shared generic-lock-screen
   layout pieces used by every method; each method then adds its own input
   widget (keypad, pattern grid, mic circle, or camera capture) below. */

.pin-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 20px;
    text-align: center;
}
.pin-lock-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(111, 89, 255, 0.14);
    color: var(--accent);
    margin-bottom: 10px;
}
.pin-title { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.pin-sub { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 24px; }
.pin-note {
    margin-top: 28px;
    max-width: 280px;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.pin-unlocked { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; gap: 14px; padding: 20px; text-align: center; }
.pin-start-btn {
    padding: 12px 28px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-size: 0.86rem;
    font-weight: 600;
}
.pin-relock-btn { font-size: 0.76rem; color: var(--text-muted); text-decoration: underline; }

/* Voice capture widget: big mic circle + live transcript + typed fallback */
.voice-mic-circle {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: 0 0 0 0 rgba(111, 89, 255, 0.45);
    margin-bottom: 18px;
    transition: var(--transition);
}
.voice-mic-circle:hover { transform: scale(1.04); }
.voice-mic-circle:active { transform: scale(0.96); }
.voice-mic-circle.listening {
    animation: voiceMicPulse 1.4s ease-out infinite;
}
.voice-mic-circle.unsupported { opacity: 0.35; pointer-events: none; }
@keyframes voiceMicPulse {
    0%   { box-shadow: 0 0 0 0 rgba(111, 89, 255, 0.45); }
    70%  { box-shadow: 0 0 0 18px rgba(111, 89, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(111, 89, 255, 0); }
}
.voice-transcript {
    min-height: 20px;
    max-width: 280px;
    font-size: 0.86rem;
    color: var(--text-dim);
    margin-bottom: 14px;
    line-height: 1.4;
}
.voice-transcript.heard { color: var(--text); font-weight: 500; }
.voice-transcript.err { color: var(--danger); }
.voice-fallback-link {
    font-size: 0.74rem;
    color: var(--accent-secondary);
    text-decoration: underline;
    margin-top: 4px;
}
.voice-fallback-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    width: 100%;
    max-width: 280px;
}
.voice-fallback-row input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text);
    font-size: 0.84rem;
}
.voice-fallback-row button {
    padding: 0 16px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Lock-method picker (Voice / PIN / Pattern / Face cards) */
.lock-method-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 280px;
}
.lock-method-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 10px;
    border-radius: var(--radius-md, 16px);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    font-size: 0.78rem;
    font-weight: 600;
    transition: var(--transition);
}
.lock-method-card:hover {
    color: var(--text);
    border-color: var(--accent);
    background: rgba(111, 89, 255, 0.08);
}

/* PIN keypad */
.pin-dots { display: flex; gap: 14px; margin-bottom: 22px; }
.pin-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--glass-border);
    transition: var(--transition);
}
.pin-dot.filled { background: var(--accent); border-color: var(--accent); }
.pin-dots.err .pin-dot { border-color: var(--danger); background: var(--danger); }
.pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    width: 100%;
    max-width: 240px;
}
.pin-key {
    aspect-ratio: 1;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 600;
    transition: var(--transition);
}
.pin-key:hover { background: var(--glass-hover); }
.pin-key:active { transform: scale(0.94); }
.pin-key-ghost { background: transparent; border: none; pointer-events: none; }

/* Pattern lock — 3x3 drag-to-connect grid */
.pattern-wrap {
    position: relative;
    width: min(240px, 72vw);
    aspect-ratio: 1;
    margin-bottom: 6px;
}
.pattern-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pattern-grid {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    place-items: center;
    touch-action: none;
}
.pattern-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid var(--glass-border);
    transition: var(--transition);
}
.pattern-dot.active { background: var(--accent); border-color: var(--accent); transform: scale(1.15); }
.pattern-dot.error { background: var(--danger); border-color: var(--danger); }

/* Face lock — camera capture */
.face-capture {
    position: relative;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 14px;
    background: rgba(255, 255, 255, 0.04);
}
.face-capture video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}
.face-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--accent);
    opacity: 0.6;
    pointer-events: none;
}

/* --- Settings: new grouped sections appended below the existing toggles --- */

.settings-body { max-height: min(72vh, 620px); overflow-y: auto; }
.settings-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 6px;
}
.settings-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.theme-swatch {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 2px solid transparent;
    transition: var(--transition);
}
.theme-swatch.active { border-color: var(--text); transform: scale(1.08); }

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.settings-row-label { font-size: 0.85rem; color: var(--text); }
.settings-row-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.settings-pill-btn {
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text);
    transition: var(--transition);
    white-space: nowrap;
}
.settings-pill-btn:hover { background: var(--glass-hover); }
.settings-pill-btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.settings-pill-btn.danger { color: var(--danger); border-color: rgba(240, 102, 94, 0.35); }
.settings-pill-btn.danger:hover { background: rgba(240, 102, 94, 0.1); }

.settings-about-links { display: flex; flex-direction: column; gap: 6px; }
.settings-about-links a { font-size: 0.82rem; color: var(--accent); text-decoration: none; }
.settings-about-links a:hover { text-decoration: underline; }
.settings-version { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }

@media (max-width: 480px) {
    .app-drawer { width: 86vw; }
    .app-screen { width: 100vw; }
}

/* ------------------------------------------------------------------
   CHAT POLISH - formatted replies, pasted-text chips, per-reply
   actions, stop button, jump-to-latest (see "CHAT POLISH" in script.js)
------------------------------------------------------------------ */

/* Rendered markdown inside a reply. .msg-content is white-space:
   pre-wrap (right for plain text), which would double every gap between
   the HTML blocks below, so the rendered container resets it. */
.msg-stream-text.md {
    display: block;
    white-space: normal;
}
.msg-stream-text.md > :first-child { margin-top: 0; }
.msg-stream-text.md > :last-child { margin-bottom: 0; }
.msg-stream-text.md p { margin: 0 0 0.75em; }
.msg-stream-text.md h1,
.msg-stream-text.md h2,
.msg-stream-text.md h3,
.msg-stream-text.md h4,
.msg-stream-text.md h5,
.msg-stream-text.md h6 {
    margin: 1.1em 0 0.45em;
    line-height: 1.3;
    font-weight: 600;
    color: var(--text);
}
.msg-stream-text.md h1 { font-size: 1.25rem; }
.msg-stream-text.md h2 { font-size: 1.12rem; }
.msg-stream-text.md h3 { font-size: 1.02rem; }
.msg-stream-text.md h4,
.msg-stream-text.md h5,
.msg-stream-text.md h6 { font-size: 0.92rem; }
.msg-stream-text.md ul,
.msg-stream-text.md ol { margin: 0 0 0.75em; padding-left: 1.4em; }
.msg-stream-text.md li { margin: 0.2em 0; }
.msg-stream-text.md li > ul,
.msg-stream-text.md li > ol { margin: 0.2em 0 0.2em; }
.msg-stream-text.md strong { font-weight: 600; color: var(--text); }
.msg-stream-text.md a { color: var(--accent-secondary, var(--accent)); text-decoration: underline; text-underline-offset: 2px; }
.msg-stream-text.md a:hover { filter: brightness(1.15); }
.msg-stream-text.md hr { border: none; border-top: 1px solid var(--glass-border); margin: 1em 0; }
.msg-stream-text.md blockquote {
    margin: 0 0 0.75em;
    padding: 2px 0 2px 14px;
    border-left: 3px solid rgba(255, 255, 255, 0.18);
    color: var(--text-dim);
}
.msg-stream-text.md code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.82em;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
}
.msg-stream-text.md pre.md-code {
    position: relative;
    margin: 0 0 0.85em;
    padding: 14px 16px;
    border-radius: 12px;
    background: #0d1117;
    border: 1px solid var(--glass-border);
    overflow-x: auto;
}
.msg-stream-text.md pre.md-code code {
    padding: 0;
    background: none;
    font-size: 0.8rem;
    line-height: 1.55;
    white-space: pre;
}
.msg-stream-text.md .md-code-lang {
    position: absolute;
    top: 6px;
    right: 10px;
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.md-table-wrap { overflow-x: auto; margin: 0.4em 0 1em; border: 1px solid var(--glass-border); border-radius: 12px; background: rgba(255, 255, 255, 0.02); -webkit-overflow-scrolling: touch; }
.msg-stream-text.md table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.84rem; line-height: 1.45; }
.msg-stream-text.md th,
.msg-stream-text.md td { padding: 9px 14px; border-bottom: 1px solid var(--glass-border); text-align: left; vertical-align: top; }
.msg-stream-text.md th { background: rgba(124, 140, 255, 0.14); font-weight: 600; white-space: nowrap; font-size: 0.78rem; letter-spacing: 0.02em; }
.msg-stream-text.md tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.03); }
.msg-stream-text.md tbody tr:hover td { background: rgba(124, 140, 255, 0.08); }
.msg-stream-text.md tbody tr:last-child td { border-bottom: 0; }
.msg-stream-text.md td:first-child { font-weight: 600; }

/* Typing cursor lives at the end of the last rendered block while a
   reply streams (the old standalone "|" element would otherwise sit on
   its own line under the formatted text). */
.msg-content .stream-cursor { display: none; }
.msg-stream-text.streaming > :last-child:not(ul):not(ol):not(pre):not(.md-table-wrap)::after,
.msg-stream-text.streaming > ul:last-child > li:last-child::after,
.msg-stream-text.streaming > ol:last-child > li:last-child::after {
    content: '\258D';
    margin-left: 2px;
    color: var(--accent);
    animation: blink 0.8s step-end infinite;
}

/* Copy / regenerate under each reply */
.msg-actions {
    display: flex;
    gap: 4px;
    padding: 2px 2px 0;
    opacity: 0.45;
    transition: opacity var(--transition);
}
.message:hover .msg-actions,
.msg-actions:focus-within { opacity: 1; }
.msg-action-btn {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 8px;
    background: none;
    color: var(--text-dim);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.msg-action-btn:hover { background: rgba(255, 255, 255, 0.09); color: var(--text); }
.msg-action-btn.done { color: #3ecf8e; }

/* Stop button: the send button while a reply is generating */
.send-btn.is-stop {
    animation: none;
    opacity: 1;
}

/* Jump to latest */
.scroll-bottom-btn {
    position: absolute;
    left: 50%;
    bottom: 14px;
    z-index: 6;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: rgba(28, 30, 40, 0.92);
    color: var(--text);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    opacity: 0;
    transform: translate(-50%, 8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.scroll-bottom-btn.visible {
    opacity: 1;
    transform: translate(-50%, 0);
    pointer-events: auto;
}
.scroll-bottom-btn:hover { background: rgba(48, 50, 64, 0.96); }

/* Pasted-text chips: above the input while composing, inside the sent
   message afterwards */
.paste-chips { padding: 0 2px 10px; }
.paste-chips:empty { display: none; }
.paste-chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.message.user .paste-chip-list { margin-top: 8px; }
.message.user .paste-chip-list:first-child { margin-top: 0; }
.paste-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 280px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}
.paste-chip:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.16); }
.paste-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.paste-chip-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: rgba(110, 107, 240, 0.16);
    color: var(--accent);
}
.paste-chip-info { min-width: 0; line-height: 1.3; }
.paste-chip-title { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.paste-chip-meta { font-size: 0.7rem; color: var(--text-dim); white-space: nowrap; }
.paste-chip-remove {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-dim);
    cursor: pointer;
}
.paste-chip-remove:hover { background: rgba(255, 255, 255, 0.18); color: var(--text); }

/* .msg-content is white-space: pre-wrap (so plain replies keep their line
   breaks), and everything appended inside it inherited that - the
   indentation/newlines in the file-card, paste-chip and action-bar
   templates then rendered as real blank lines, which is why file cards
   showed as tall boxes with the filename and type far apart. These
   blocks are laid out by flex/grid, not by text flow, so they go back to
   normal whitespace handling. */
.file-card-list,
.file-card,
.paste-chip-list,
.paste-chip,
.msg-actions {
    white-space: normal;
}


/* Code panel: rendered README / wrapped text instead of raw, clipped lines */
.code-panel-md {
    padding: 20px 22px;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.65;
    font-size: 0.92rem;
}
.code-panel-md h1, .code-panel-md h2, .code-panel-md h3 { margin: 1em 0 0.5em; line-height: 1.25; }
.code-panel-md h1:first-child { margin-top: 0; }
.code-panel-md p, .code-panel-md ul, .code-panel-md ol { margin: 0.5em 0; }
.code-panel-md code { background: rgba(255,255,255,0.08); padding: 1px 6px; border-radius: 5px; font-size: 0.85em; }
.code-panel-pre code.wrap-lines { white-space: pre-wrap; overflow-wrap: anywhere; }


/* ---- "+" menu (files / skills / plugins) ---- */
.plus-btn {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
    color: var(--text-dim);
    background: transparent;
    border: none;
    cursor: pointer;
    align-self: flex-end;
    margin: 0 4px 0 -10px;
    transition: background var(--transition), color var(--transition);
}
.plus-btn:hover, .plus-btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.plus-menu {
    position: fixed;
    z-index: 60;
    width: min(300px, calc(100vw - 16px));
    max-height: min(70vh, 460px);
    overflow-y: auto;
    padding: 6px;
    border-radius: 14px;
    background: #17171d;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
    white-space: normal;
}
.plus-menu[hidden] { display: none; }
.plus-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.88rem;
    text-align: left;
    cursor: pointer;
}
button.plus-row:hover, label.plus-row:hover { background: rgba(255, 255, 255, 0.07); }
.plus-row > svg { flex-shrink: 0; color: var(--text-dim); }
.plus-row-title { flex: 1; min-width: 0; font-weight: 500; }
.plus-kbd { color: var(--text-muted); font-size: 0.74rem; }
.plus-sep { height: 1px; margin: 5px 6px; background: rgba(255, 255, 255, 0.08); }
.plus-back { font-weight: 600; }
.plus-list { display: flex; flex-direction: column; }
.plus-row-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.plus-row-desc { color: var(--text-dim); font-size: 0.74rem; line-height: 1.35; font-weight: 400; }
.plus-row-switch { cursor: pointer; }
.plus-switch { position: absolute; opacity: 0; pointer-events: none; }
.plus-switch-ui {
    position: relative;
    flex-shrink: 0;
    width: 34px;
    height: 20px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.16);
    transition: background 0.2s;
}
.plus-switch-ui::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}
.plus-switch:checked + .plus-switch-ui { background: var(--accent); }
.plus-switch:checked + .plus-switch-ui::after { transform: translateX(14px); }
.plus-switch:focus-visible + .plus-switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.plus-note { padding: 6px 10px 8px; color: var(--text-muted); font-size: 0.72rem; }
.plus-icon-btn { display: grid; place-items: center; width: 28px; height: 28px; border: none; border-radius: 7px; background: transparent; color: var(--text-dim); cursor: pointer; }
.plus-icon-btn:hover { background: rgba(240, 102, 94, 0.15); color: var(--danger); }

.add-plugin-overlay {
    position: fixed; inset: 0; z-index: 80;
    display: grid; place-items: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
}
.add-plugin-modal {
    width: min(460px, 100%);
    padding: 20px;
    border-radius: 16px;
    background: #17171d;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex; flex-direction: column; gap: 8px;
    white-space: normal;
}
.add-plugin-modal h3 { margin: 0 0 2px; font-size: 1.05rem; }
.add-plugin-help { margin: 0 0 6px; color: var(--text-dim); font-size: 0.8rem; line-height: 1.5; }
.add-plugin-label { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--text-dim); margin-top: 4px; }
.add-plugin-input {
    width: 100%; box-sizing: border-box;
    padding: 9px 11px; border-radius: 9px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text); font: inherit; font-size: 0.88rem; resize: vertical;
}
.add-plugin-input:focus { outline: none; border-color: var(--accent); }
.add-plugin-error { min-height: 1em; color: var(--danger); font-size: 0.78rem; }
.add-plugin-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.add-plugin-actions button { padding: 8px 16px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, 0.12); background: transparent; color: var(--text); font: inherit; font-size: 0.85rem; cursor: pointer; }
.add-plugin-actions .add-plugin-save { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; font-weight: 600; }
@media (max-width: 600px) { .plus-btn { margin-left: -6px; } }


/* ---- Save as skill pill ---- */
.file-card-skill-btn {
    display: inline-flex; align-items: center; gap: 6px;
    align-self: flex-start;
    margin: 2px 0 0; padding: 6px 12px;
    border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.14);
    background: transparent; color: var(--text-dim);
    font: inherit; font-size: 0.78rem; cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.file-card-skill-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.file-card-skill-btn:disabled { opacity: 0.6; cursor: progress; }

/* ---- Proof Mode (lite) bar ---- */
.proof-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin: 8px 0 0; white-space: normal;
    --proof: #8b8b96;
}
.proof-verified { --proof: #4fc98a; }
.proof-strong { --proof: #38c6f4; }
.proof-uncertain { --proof: #e6b34a; }
.proof-low { --proof: #f0665e; }
.proof-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px 4px 8px; border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--proof) 45%, transparent);
    background: color-mix(in srgb, var(--proof) 14%, transparent);
    color: var(--proof); font: inherit; font-size: 0.76rem; font-weight: 600; cursor: pointer;
}
.proof-chip:hover { background: color-mix(in srgb, var(--proof) 24%, transparent); }
.proof-score { opacity: 0.75; font-weight: 500; }
.proof-sources { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.proof-source {
    max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    padding: 3px 9px; border-radius: 999px; font-size: 0.72rem;
    background: rgba(255, 255, 255, 0.06); color: var(--text-dim); text-decoration: none;
}
a.proof-source:hover { background: rgba(255, 255, 255, 0.12); color: var(--text); }
.proof-details {
    flex-basis: 100%; padding: 10px 12px; border-radius: 10px;
    background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.78rem; line-height: 1.5; color: var(--text-dim);
}
.proof-details[hidden] { display: none; }
.proof-details-title { color: var(--text); font-weight: 600; margin-bottom: 4px; }
.proof-details ul { margin: 0 0 6px; padding-left: 18px; }
.proof-note { color: var(--text-muted); font-size: 0.72rem; margin-bottom: 6px; }
.proof-open-search { border: none; background: none; padding: 0; color: var(--accent); font: inherit; font-size: 0.76rem; cursor: pointer; }


/* ================= PROFESSIONAL LOGIN ================= */
.login-gate { background: var(--bg, #0a0a0d); background-image: var(--bg-radial); overflow-y: auto; }
.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    width: min(1040px, 100%);
    min-height: min(640px, 100%);
    margin: auto;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
    background: rgba(16, 16, 21, 0.6);
    transition: opacity 0.3s ease;
}
.login-gate.checking .login-shell { opacity: 0; pointer-events: none; }
.login-spinner {
    position: absolute; top: 50%; left: 50%;
    width: 34px; height: 34px; margin: -17px 0 0 -17px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-top-color: var(--accent);
    animation: login-spin 0.8s linear infinite;
    opacity: 0; transition: opacity 0.2s;
}
.login-gate.checking .login-spinner { opacity: 1; }
@keyframes login-spin { to { transform: rotate(360deg); } }

.login-brand {
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 40px;
    background:
        radial-gradient(90% 70% at 0% 0%, rgba(111, 89, 255, 0.35), transparent 60%),
        radial-gradient(80% 60% at 100% 100%, rgba(56, 198, 244, 0.25), transparent 60%),
        #0e0e14;
}
.login-brand-top { display: flex; align-items: center; gap: 12px; }
.login-brand-logo { width: 38px; height: 38px; object-fit: contain; }
.login-brand-name { font-family: var(--font-display); font-weight: 700; letter-spacing: 2px; font-size: 1rem; }
.login-brand-copy h1 { font-family: var(--font-display); font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.15; margin: 0 0 14px; letter-spacing: -0.5px; }
.login-brand-copy p { color: var(--text-dim); line-height: 1.6; margin: 0 0 22px; font-size: 0.95rem; max-width: 40ch; }
.login-brand-copy ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.login-brand-copy li { position: relative; padding-left: 26px; color: var(--text-dim); font-size: 0.88rem; }
.login-brand-copy li::before {
    content: ''; position: absolute; left: 0; top: 3px; width: 14px; height: 14px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.login-brand-copy li span { color: var(--text); font-weight: 600; }
.login-brand-foot { color: var(--text-muted); font-size: 0.78rem; }

.login-card {
    max-width: none; width: auto;
    padding: 40px 44px;
    border-radius: 0; border: none; box-shadow: none;
    justify-content: center; align-items: stretch; text-align: left;
    background: rgba(16, 16, 21, 0.9);
}
.login-card .login-logo { display: none; width: 56px; height: 56px; margin: 0 auto 6px; }
.login-card .login-title { font-size: 1.55rem; letter-spacing: -0.3px; }
.login-card .login-sub { margin-bottom: 22px; }
.login-card .google-signin-btn { border-radius: 12px; padding: 12px 16px; font-size: 0.92rem; font-weight: 600; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: rgba(255, 255, 255, 0.1); }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-field[hidden], .auth-hint[hidden] { display: none; }
.auth-field label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
.auth-label-row { display: flex; align-items: center; justify-content: space-between; }
.auth-label-row label { margin-bottom: 6px; }
.auth-field input {
    width: 100%; box-sizing: border-box;
    padding: 11px 13px; border-radius: 11px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text); font: inherit; font-size: 0.92rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-field input::placeholder { color: var(--text-muted); }
.auth-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56, 198, 244, 0.15); }
.auth-field input.invalid { border-color: var(--danger); }
.auth-password-wrap { position: relative; }
.auth-password-wrap input { padding-right: 44px; }
.auth-eye {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    width: 36px; height: 36px; display: grid; place-items: center;
    background: none; border: none; border-radius: 8px; color: var(--text-dim); cursor: pointer;
}
.auth-eye:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.auth-hint { margin-top: 6px; font-size: 0.74rem; color: var(--text-muted); }
.auth-link { background: none; border: none; padding: 0; font: inherit; font-size: 0.78rem; font-weight: 600; color: var(--accent); cursor: pointer; }
.auth-link:hover { text-decoration: underline; }
.auth-link[hidden] { display: none; }
.auth-message { min-height: 0; font-size: 0.8rem; line-height: 1.45; border-radius: 10px; }
.auth-message:not(:empty) { padding: 10px 12px; }
.auth-message.error { background: rgba(240, 102, 94, 0.12); border: 1px solid rgba(240, 102, 94, 0.35); color: #ff9d97; }
.auth-message.success { background: rgba(79, 201, 138, 0.12); border: 1px solid rgba(79, 201, 138, 0.35); color: #8fe3b6; }
.auth-submit {
    position: relative; display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 12px 16px; border: none; border-radius: 12px; cursor: pointer;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff; font: inherit; font-size: 0.92rem; font-weight: 700;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.auth-submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 24px var(--accent-glow); }
.auth-submit:disabled { opacity: 0.7; cursor: progress; }
.auth-submit-spinner { display: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #fff; animation: login-spin 0.7s linear infinite; }
.auth-submit.busy .auth-submit-spinner { display: inline-block; }
.login-switch { margin: 16px 0 0; text-align: center; font-size: 0.84rem; color: var(--text-dim); }
.login-switch .auth-link { font-size: 0.84rem; }
.login-legal { margin: 14px 0 0; text-align: center; font-size: 0.72rem; color: var(--text-muted); line-height: 1.5; }
.login-legal a { color: var(--text-dim); }

@media (max-width: 820px) {
    .login-gate { align-items: flex-start; padding: 0; }
    .login-shell { grid-template-columns: 1fr; min-height: 100%; border-radius: 0; border: none; box-shadow: none; }
    .login-brand { display: none; }
    .login-card { padding: 32px 22px 28px; background: transparent; }
    .login-card .login-logo { display: block; }
    .login-card .login-title, .login-card .login-sub { text-align: center; }
}

/* ---- account menu (replaces the old confirm() sign-out) ---- */
.user-initial {
    width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff; font-size: 0.78rem; font-weight: 700;
}
.account-menu {
    position: fixed; z-index: 70; width: min(290px, calc(100vw - 16px));
    padding: 8px; border-radius: 14px;
    background: #17171d; border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55); white-space: normal;
}
.account-menu[hidden] { display: none; }
.account-menu-head { display: flex; align-items: center; gap: 10px; padding: 8px; }
.account-menu-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.account-menu-avatar.initial { display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 700; }
.account-menu-name { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-email { color: var(--text-dim); font-size: 0.76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-info { min-width: 0; }
.account-menu-verify { margin: 4px 8px 8px; padding: 9px 10px; border-radius: 10px; background: rgba(230, 179, 74, 0.12); border: 1px solid rgba(230, 179, 74, 0.35); color: #f0c866; font-size: 0.76rem; line-height: 1.45; }
.account-menu-verify button { background: none; border: none; padding: 0; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.account-menu-sep { height: 1px; margin: 4px 6px; background: rgba(255, 255, 255, 0.08); }
.account-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: none; border-radius: 9px; background: transparent; color: var(--text); font: inherit; font-size: 0.88rem; cursor: pointer; text-align: left; }
.account-menu-item:hover { background: rgba(255, 255, 255, 0.07); }
.account-menu-item.danger:hover { background: rgba(240, 102, 94, 0.14); color: var(--danger); }


/* ---- Connectors screen ---- */
.app-screen-wide { width: min(560px, 100vw); }
.conn-tabs { display: inline-flex; padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, 0.06); }
.conn-tab { padding: 5px 14px; border: none; border-radius: 8px; background: transparent; color: var(--text-dim); font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; }
.conn-tab.active { background: rgba(255, 255, 255, 0.14); color: var(--text); }
.conn-search-row { padding: 12px 18px 0; flex-shrink: 0; }
.conn-search { width: 100%; box-sizing: border-box; padding: 10px 14px; border-radius: 11px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); color: var(--text); font: inherit; font-size: 0.88rem; }
.conn-search:focus { outline: none; border-color: var(--accent); }
.conn-heading { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 700; color: var(--text); margin: 4px 0 2px; }
.conn-heading span { font-weight: 500; font-size: 0.72rem; color: var(--text-dim); background: rgba(255, 255, 255, 0.08); padding: 1px 8px; border-radius: 999px; }
.conn-card { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); white-space: normal; }
.conn-card:hover { background: rgba(255, 255, 255, 0.06); }
.conn-tile.has-logo { background:#fff; border:1px solid rgba(0,0,0,.08); box-shadow:0 1px 3px rgba(0,0,0,.08); }
.conn-tile svg { width: 26px; height: 26px; display:block; }
.conn-tile { width: 46px; height: 46px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.2rem; }
.conn-info { flex: 1; min-width: 0; }
.conn-name { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.92rem; color: var(--text); }
.conn-badge { color: var(--accent); display: inline-flex; }
.conn-soon { font-size: 0.64rem; font-weight: 600; color: var(--text-dim); background: rgba(255, 255, 255, 0.08); padding: 1px 7px; border-radius: 999px; }
.conn-desc { margin-top: 2px; font-size: 0.78rem; line-height: 1.4; color: var(--text-dim); }
.conn-by { margin-top: 3px; font-size: 0.7rem; color: var(--text-muted); }
.conn-on { color: var(--success); font-weight: 600; }
.conn-action { flex-shrink: 0; }
.conn-btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 13px; border-radius: 9px; font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; border: 1px solid transparent; white-space: nowrap; }
.conn-btn:disabled { opacity: 0.65; cursor: default; }
.conn-btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.conn-btn-primary:hover:not(:disabled) { box-shadow: 0 4px 16px var(--accent-glow); }
.conn-btn-ghost { background: transparent; border-color: rgba(255, 255, 255, 0.16); color: var(--text); }
.conn-btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); }
.conn-btn-done { background: rgba(79, 201, 138, 0.12); color: var(--success); border-color: rgba(79, 201, 138, 0.3); }
.conn-empty-btn { margin-top: 12px; padding: 8px 16px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, 0.16); background: transparent; color: var(--text); font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; }
@media (max-width: 480px) { .conn-card { flex-wrap: wrap; } .conn-action { width: 100%; } .conn-btn { width: 100%; justify-content: center; } }

/* ===== Premium badge (replaces "Upgrade" once the plan is active) ===== */
.upgrade-btn.is-premium {
    background: linear-gradient(135deg, rgba(250, 204, 21, 0.16), rgba(245, 158, 11, 0.10));
    border: 1px solid rgba(250, 204, 21, 0.38);
    color: #fcd34d;
    box-shadow: none;
}
.upgrade-btn.is-premium svg { fill: #fcd34d; stroke: #fcd34d; }
.drawer-footer-item.upgrade.is-premium { color: #fcd34d; }

/* ===== SKILL STUDIO ===== */
.ss-overlay {
    position: fixed; inset: 0; z-index: 90;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    background: rgba(4, 4, 8, 0.66);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    opacity: 0; transition: opacity 0.18s ease;
}
.ss-overlay[hidden] { display: none; }
.ss-overlay.show { opacity: 1; }
.ss-panel {
    width: min(940px, 100%); max-height: min(88vh, 860px);
    display: flex; flex-direction: column;
    border-radius: 22px;
    background:
        radial-gradient(120% 70% at 0% 0%, rgba(111, 89, 255, 0.13), transparent 55%),
        radial-gradient(90% 60% at 100% 0%, rgba(56, 198, 244, 0.10), transparent 55%),
        #111118;
    border: 1px solid rgba(255, 255, 255, 0.09);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
    transform: translateY(10px) scale(0.985);
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow: hidden;
}
.ss-overlay.show .ss-panel { transform: none; }
.ss-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 24px 26px 6px; }
.ss-head h2 { font-family: var(--font-display); font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.ss-head p { margin-top: 4px; font-size: 0.9rem; color: var(--text-dim); }
.ss-close {
    width: 34px; height: 34px; flex: none; border-radius: 10px; border: 1px solid rgba(255,255,255,.09);
    background: rgba(255,255,255,.04); color: var(--text-dim); font-size: 1.4rem; line-height: 1; cursor: pointer;
    transition: background .15s, color .15s;
}
.ss-close:hover { background: rgba(255,255,255,.1); color: var(--text); }
.ss-tools { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 14px 26px 4px; }
.ss-search {
    flex: 1 1 220px; display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 42px;
    border-radius: 12px; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.08); color: var(--text-dim);
    transition: border-color .15s, background .15s;
}
.ss-search:focus-within { border-color: rgba(111, 89, 255, .6); background: rgba(255,255,255,.06); }
.ss-search input { flex: 1; background: none; border: 0; outline: 0; color: var(--text); font: inherit; font-size: .92rem; min-width: 0; }
.ss-auto { display: flex; align-items: center; gap: 10px; font-size: .86rem; color: var(--text-dim); cursor: pointer; user-select: none; }
.ss-tabs { display: flex; gap: 6px; padding: 14px 26px 4px; overflow-x: auto; scrollbar-width: none; }
.ss-tabs::-webkit-scrollbar { display: none; }
.ss-tab {
    flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 999px;
    border: 1px solid transparent; background: transparent; color: var(--text-dim); font: inherit; font-size: .88rem; cursor: pointer;
    transition: background .15s, color .15s;
}
.ss-tab:hover { background: rgba(255,255,255,.06); color: var(--text); }
.ss-tab.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 600; }
.ss-count:not(:empty) { font-size: .72rem; padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,.2); }
.ss-grid {
    flex: 1; overflow-y: auto; padding: 14px 26px 26px;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; align-content: start;
}
.ss-card {
    position: relative; display: flex; flex-direction: column; text-align: left; padding: 18px; border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.025));
    border: 1px solid rgba(255,255,255,.08); color: var(--text);
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, opacity .18s;
}
.ss-card::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .2s;
    background: radial-gradient(90% 70% at 0% 0%, color-mix(in srgb, var(--g1) 22%, transparent), transparent 70%);
}
.ss-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--g1) 55%, transparent); box-shadow: 0 14px 34px rgba(0,0,0,.4); }
.ss-card:hover::before { opacity: 1; }
.ss-card.is-off { opacity: .5; }
.ss-overlay.auto-off .ss-card:not(.ss-create):not(.ss-custom) { opacity: .38; }
.ss-card-top { position: relative; display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.ss-icon {
    width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff;
    background: linear-gradient(135deg, var(--g1), var(--g2));
    box-shadow: 0 8px 22px color-mix(in srgb, var(--g1) 42%, transparent), inset 0 1px 0 rgba(255,255,255,.3);
}
.ss-cat { position: relative; font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: color-mix(in srgb, var(--g1) 75%, #fff); margin-bottom: 4px; }
.ss-card h3 { position: relative; font-family: var(--font-display); font-size: 1.08rem; font-weight: 650; letter-spacing: -0.01em; margin-bottom: 6px; }
.ss-card p { position: relative; font-size: .86rem; line-height: 1.5; color: var(--text-dim); }
.ss-try { position: relative; display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.ss-chip {
    display: flex; align-items: baseline; gap: 8px; width: 100%; text-align: left; padding: 8px 11px; border-radius: 11px;
    background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.07); color: var(--text-dim);
    font: inherit; font-size: .78rem; line-height: 1.4; cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.ss-chip span { flex: none; font-size: .66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: color-mix(in srgb, var(--g1) 80%, #fff); }
.ss-chip:hover { color: var(--text); border-color: color-mix(in srgb, var(--g1) 60%, transparent); background: rgba(0,0,0,.4); }
.ss-when { position: relative; margin-top: 12px; font-size: .76rem; color: var(--text-muted); }
.ss-del { width: 28px; height: 28px; border-radius: 8px; border: 0; background: rgba(255,255,255,.06); color: var(--text-dim); font-size: 1.15rem; cursor: pointer; }
.ss-del:hover { background: rgba(240,102,94,.2); color: var(--danger); }
.ss-create {
    align-items: center; justify-content: center; text-align: center; min-height: 220px; cursor: pointer; font: inherit;
    background: transparent; border: 1.5px dashed rgba(255,255,255,.16);
}
.ss-create:hover { border-color: var(--accent); background: rgba(111, 89, 255, .06); }
.ss-create-plus {
    width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 12px; font-size: 1.7rem; color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.ss-empty { grid-column: 1 / -1; text-align: center; padding: 40px 0; color: var(--text-dim); }
.ss-switch { position: relative; display: inline-block; width: 40px; height: 23px; flex: none; }
.ss-switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 2; margin: 0; }
.ss-switch-ui { position: absolute; inset: 0; border-radius: 999px; background: rgba(255,255,255,.16); transition: background .18s; }
.ss-switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.ss-switch input:checked + .ss-switch-ui { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.ss-switch input:checked + .ss-switch-ui::after { transform: translateX(17px); }
.ss-switch input:focus-visible + .ss-switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 600px) {
    .ss-overlay { padding: 0; align-items: flex-end; }
    .ss-panel { max-height: 94vh; border-radius: 22px 22px 0 0; }
    .ss-head, .ss-tools, .ss-tabs, .ss-grid { padding-left: 16px; padding-right: 16px; }
    .ss-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    .ss-overlay, .ss-panel, .ss-card, .ss-switch-ui, .ss-switch-ui::after { transition: none; }
}
.ss-head, .ss-tools, .ss-tabs { flex: none; }

/* ---------- Build Studio v2 (waiting animation) ---------- */
.bs-card { --sk: rgba(128,134,150,.24); --bs-acc: #7c8cff; }
.bs-studio { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(0,1fr); gap: 12px; margin-top: 12px; }
@media (max-width: 620px) { .bs-studio { grid-template-columns: 1fr; } }

/* live preview (a tiny browser that builds the site as it goes) */
.bp { position: relative; height: 244px; border-radius: 12px; overflow: hidden; background: #fff; color: #12151c; font: 10px/1.35 system-ui, -apple-system, 'Segoe UI', sans-serif;
      box-shadow: 0 0 0 1px rgba(128,134,150,.3), 0 18px 38px -18px rgba(0,0,0,.55); isolation: isolate; }
.bp * { box-sizing: border-box; }
.bp-chrome { height: 20px; display: flex; align-items: center; gap: 4px; padding: 0 9px; background: #e8eaef; position: relative; z-index: 3; }
.bp-chrome span { width: 6px; height: 6px; border-radius: 50%; background: #c3c7d1; }
.bp-chrome span:nth-child(1) { background: #ff6058; } .bp-chrome span:nth-child(2) { background: #ffbd2e; } .bp-chrome span:nth-child(3) { background: #28c93f; }
.bp-chrome em { font-style: normal; margin-left: 8px; flex: 1; height: 12px; border-radius: 6px; background: #fff; color: #7a8090; font-size: 8px; line-height: 12px; padding: 0 8px; overflow: hidden; white-space: nowrap; }
.bp-viewport { position: absolute; top: 20px; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; background: #cfd3dc; }
.bp-site { width: 100%; height: 100%; overflow: hidden; position: relative; background: #f1f2f6; color: #12151c; transition: width .9s cubic-bezier(.6,.05,.2,1), background-color 1s, color 1s; font-family: var(--ff, system-ui, sans-serif); }
.bp.phone .bp-site { width: 46%; box-shadow: 0 0 0 1px rgba(0,0,0,.2); }
.bp.phone .bp-nav nav { display: none; }
.bp.phone .bp-grid, .bp.phone .bp-masonry { grid-template-columns: 1fr 1fr; }
.bp.phone .bp-grid .bp-card:nth-child(3) { display: none; }
.bp.phone .bp-copy { max-width: 90%; }
.bp.phone .bp-kpis { grid-template-columns: 1fr 1fr; } .bp.phone .bp-kpis div:nth-child(3) { display: none; }

.bp-nav { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line, rgba(0,0,0,.07)); }
.bp-nav b { font-size: 11px; letter-spacing: .03em; font-family: var(--ffh, inherit); }
.bp-nav nav { display: flex; gap: 8px; margin-left: 8px; opacity: .75; }
.bp-cart { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.bp-cart i { font-style: normal; min-width: 13px; height: 13px; padding: 0 3px; border-radius: 7px; background: var(--acc, #9aa1b5); color: #fff; display: grid; place-items: center; font-size: 8px; font-weight: 700; }
.bp-cart i.pop { animation: bpPop .45s cubic-bezier(.3,1.6,.5,1); }
.bp-ncta { margin-left: auto; }
.bp-hero { position: relative; margin: 8px 12px; height: 76px; border-radius: 8px; overflow: hidden; display: flex; align-items: flex-end; }
.bp-hero > .bp-ph { position: absolute; inset: 0; }
.bp-copy { position: relative; z-index: 3; padding: 9px 12px; max-width: 64%; }
.bp-hero h4 { margin: 0; font-size: 13px; line-height: 1.12; font-family: var(--ffh, inherit); font-weight: 700; }
.bp-hero p { margin: 3px 0 5px; opacity: .88; font-size: 9px; }
.bp-btn { display: inline-block; padding: 3px 10px; border-radius: 99px; background: var(--acc, #9aa1b5); color: #fff; font-weight: 600; font-size: 9px; }
.bp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; padding: 0 12px; }
.bp-card h5 { margin: 5px 0 0; font-size: 9.5px; font-weight: 600; } .bp-card p { margin: 1px 0 4px; opacity: .7; }
.bp-card .bp-ph { height: 54px; border-radius: 6px; }
.bp-add { display: inline-block; padding: 2px 8px; border-radius: 99px; border: 1px solid currentColor; font-size: 8.5px; font-weight: 600; }
.bp-tabs { display: flex; gap: 6px; padding: 2px 12px 6px; }
.bp-tabs span { padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line, rgba(0,0,0,.15)); font-weight: 600; font-size: 9px; transition: background .3s, color .3s; }
.bp-tabs span.on { background: var(--acc, #9aa1b5); color: #fff; border-color: transparent; }
.bp-menu { padding: 0 12px; display: grid; gap: 6px; transition: opacity .3s; }
.bp-mrow { display: flex; align-items: baseline; gap: 6px; font-size: 10px; } .bp-mrow em { flex: 1; border-bottom: 1px dotted currentColor; opacity: .35; transform: translateY(-2px); } .bp-mrow b { font-weight: 700; }
.bp-menu.alt .bp-mrow:nth-child(odd) { opacity: .45; }
.bp-masonry { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 26px; gap: 5px; padding: 0 12px; }
.bp-masonry .bp-ph { border-radius: 3px; } .bp-masonry .p0 { grid-row: span 2; } .bp-masonry .p3 { grid-row: span 2; } .bp-masonry .p4 { grid-row: span 1; }
.bp-light { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; background: rgba(0,0,0,.82); opacity: 0; pointer-events: none; transition: opacity .35s; }
.bp-light .bp-ph { width: 62%; height: 74%; border-radius: 4px; } .bp.lit .bp-light { opacity: 1; }
.bp-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px 12px 6px; }
.bp-kpis div { padding: 6px 8px; border-radius: 6px; background: var(--card, rgba(0,0,0,.05)); } .bp-kpis small { display: block; opacity: .65; font-size: 8px; } .bp-kpis b { font-size: 13px; font-variant-numeric: tabular-nums; }
.bp-chart { margin: 0 12px; height: 62px; border-radius: 6px; background: var(--card, rgba(0,0,0,.05)); padding: 6px; }
.bp-chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.bp-line { fill: none; stroke: var(--acc, #9aa1b5); stroke-width: 1.5; stroke-linejoin: round; stroke-dasharray: 220; stroke-dashoffset: 220; transition: stroke-dashoffset 2.2s ease; vector-effect: non-scaling-stroke; }
.bp-area { fill: var(--acc, #9aa1b5); opacity: 0; transition: opacity 1.2s 1.2s; }
.bp.s2 .bp-line { stroke-dashoffset: 0; } .bp.s3 .bp-area { opacity: .16; }
.bp.alt .bp-chart svg { transform: scaleY(-.6) translateY(-52%); transform-origin: center; transition: transform .6s; }
.bp-rows { margin: 6px 12px; display: grid; gap: 4px; } .bp-rows span { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 6px; } .bp-rows i { height: 7px; border-radius: 3px; background: var(--card, rgba(0,0,0,.08)); }
.bp-toast { position: absolute; right: 10px; bottom: 9px; z-index: 5; padding: 5px 10px; border-radius: 7px; background: #111; color: #fff; font-weight: 600; font-size: 9px; box-shadow: 0 8px 20px -6px rgba(0,0,0,.5); transform: translateY(12px); opacity: 0; transition: all .35s; }
.bp-toast.show { transform: none; opacity: 1; }
.bp-tag { position: absolute; right: 6px; top: 3px; font-style: normal; font-size: 7.5px; letter-spacing: .08em; text-transform: uppercase; color: #5b6cff; opacity: 0; transition: opacity .4s; font-family: ui-monospace, monospace; }
.bp-hero .bp-tag, .bp-grid .bp-tag { display: none; }

/* photo placeholders: studio light + film grain (no cartoons) */
.bp-ph { position: relative; overflow: hidden; background: var(--sk); }
.bp-ph::after { content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity 1.2s; background: var(--noise), var(--photo); background-blend-mode: overlay, normal; }
.bp-ph::before { content: ''; position: absolute; z-index: 2; opacity: 0; transition: opacity 1.2s .2s; }
.bp.s3 .bp-ph::after, .bp.s3 .bp-ph::before { opacity: 1; }
.bp { --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/><feColorMatrix values='0 0 0 0 .5  0 0 0 0 .5  0 0 0 0 .5  0 0 0 .55 0'/></filter><rect width='140' height='140' filter='url(%23n)'/></svg>"); }

/* skeleton -> real text */
.bp:not(.s2) :is(.bp-nav b, .bp-nav nav a, .bp-hero h4, .bp-hero p, .bp-btn, .bp-add, .bp-cart span, .bp-card h5, .bp-card p, .bp-tabs span, .bp-mrow span, .bp-mrow b, .bp-kpis small, .bp-kpis b) {
    color: transparent !important; background: var(--sk) !important; border-color: transparent !important; border-radius: 3px; text-shadow: none; position: relative; overflow: hidden; }
.bp:not(.s2) :is(.bp-nav b, .bp-nav nav a, .bp-hero h4, .bp-hero p, .bp-btn, .bp-add, .bp-card h5, .bp-card p, .bp-tabs span, .bp-mrow span, .bp-kpis b)::after,
.bp:not(.s1) .bp-ph::after { }
.bp:not(.s2) :is(.bp-nav b, .bp-hero h4, .bp-card h5)::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); animation: bpShimmer 1.6s infinite; }
.bp:not(.s2) .bp-hero .bp-ph, .bp:not(.s2) .bp-ph { animation: bpPulse 1.8s ease-in-out infinite; }
.bp.s2 .bp-site * { transition: color .6s, background-color .6s; }

/* stage 1: planning -> dashed wireframe with section labels */
.bp[data-stage="1"] .bp-nav, .bp[data-stage="1"] .bp-hero, .bp[data-stage="1"] .bp-card, .bp[data-stage="1"] .bp-masonry .bp-ph, .bp[data-stage="1"] .bp-kpis div, .bp[data-stage="1"] .bp-chart { outline: 1px dashed rgba(91,108,255,.75); outline-offset: -1px; }
.bp[data-stage="1"] .bp-tag { opacity: 1; }
.bp[data-stage="0"] .bp-site > *:not(.bp-nav), .bp[data-stage="0"] .bp-nav > * { opacity: .55; }

/* stage 3+: theme palettes */
.bp[data-kind="shop"].s3 { --ff: Inter, system-ui, sans-serif; }
.bp[data-kind="shop"].s3 .bp-site { --bg: #f4f1ec; --ink: #151515; --acc: #e4572e; --line: rgba(0,0,0,.09); background: #f4f1ec; color: #151515; }
.bp[data-kind="shop"] { --photo: radial-gradient(90% 70% at 22% 14%, rgba(255,255,255,.75), transparent 60%), radial-gradient(70% 34% at 50% 88%, rgba(0,0,0,.32), transparent 72%), linear-gradient(165deg, #e9e3d9, #b0a697); }
.bp[data-kind="shop"] .bp-card .bp-ph::before { left: 22%; top: 34%; width: 56%; height: 34%; border-radius: 62% 38% 46% 54% / 66% 58% 42% 34%; background: linear-gradient(120deg, #faf8f4, #bdb4a6 55%, #8a8274); box-shadow: 0 9px 10px -4px rgba(0,0,0,.5), inset 0 2px 3px rgba(255,255,255,.7); }
.bp[data-kind="shop"] .bp-card:nth-child(2) .bp-ph::before { background: linear-gradient(120deg, #2b2f3a, #12141b); transform: rotate(-6deg); }
.bp[data-kind="shop"] .bp-card:nth-child(3) .bp-ph::before { background: linear-gradient(120deg, #e4572e, #a53318); transform: rotate(4deg); }
.bp[data-kind="shop"] .bp-hero .bp-ph::after { background: var(--noise), linear-gradient(100deg, rgba(10,10,12,.78), rgba(10,10,12,.1) 72%), radial-gradient(80% 90% at 82% 30%, #ffb08a, transparent 60%), linear-gradient(160deg, #433a35, #15110f); }
.bp[data-kind="shop"].s3 .bp-hero { color: #fff; }

.bp[data-kind="food"].s3 { --ff: Georgia, 'Times New Roman', serif; --ffh: Georgia, serif; }
.bp[data-kind="food"].s3 .bp-site { --acc: #3f6b3a; --line: rgba(60,40,20,.18); background: #f6efe4; color: #2a1f14; }
.bp[data-kind="food"] .bp-hero .bp-ph::after { background: var(--noise), linear-gradient(100deg, rgba(14,28,16,.82), rgba(14,28,16,.1) 75%), radial-gradient(60% 90% at 84% 35%, rgba(255,214,150,.75), transparent 60%), linear-gradient(160deg, #3c5a35, #12251a); }
.bp[data-kind="food"] .bp-hero::before { content: ''; position: absolute; z-index: 2; right: 12%; top: 18%; width: 46px; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 46%, #b9772e 0 38%, #f3ede0 41% 100%); box-shadow: 0 9px 12px -4px rgba(0,0,0,.6); opacity: 0; transition: opacity 1.2s .3s; }
.bp[data-kind="food"].s3 .bp-hero::before { opacity: 1; animation: bpSteam 4s ease-in-out infinite; }
.bp[data-kind="food"].s3 .bp-hero { color: #fff; }

.bp[data-kind="gallery"].s3 { --ff: 'Cormorant Garamond', Georgia, serif; --ffh: 'Cormorant Garamond', Georgia, serif; }
.bp[data-kind="gallery"].s3 .bp-site { --acc: #c8a35e; --line: rgba(255,255,255,.12); background: #0e0e10; color: #f2f2f2; }
.bp[data-kind="gallery"] .bp-hero .bp-ph::after { background: var(--noise), linear-gradient(100deg, rgba(0,0,0,.7), transparent 70%), radial-gradient(70% 90% at 80% 20%, #6b7fa8, transparent 60%), linear-gradient(160deg, #1d2433, #07080c); }
.bp[data-kind="gallery"] .bp-masonry .p0 { --photo: radial-gradient(70% 50% at 50% 30%, rgba(255,205,150,.8), transparent 65%), linear-gradient(170deg, #5c4a3a, #1a1410); }
.bp[data-kind="gallery"] .bp-masonry .p1 { --photo: radial-gradient(60% 60% at 30% 40%, rgba(160,190,230,.7), transparent 65%), linear-gradient(160deg, #2c3a55, #0b0e18); }
.bp[data-kind="gallery"] .bp-masonry .p2 { --photo: radial-gradient(80% 60% at 70% 30%, rgba(255,240,215,.75), transparent 60%), linear-gradient(170deg, #8a7a66, #2a241d); }
.bp[data-kind="gallery"] .bp-masonry .p3 { --photo: radial-gradient(60% 40% at 50% 20%, rgba(255,160,110,.8), transparent 65%), linear-gradient(180deg, #3d2a2a, #0c0808); }
.bp[data-kind="gallery"] .bp-masonry .p4 { --photo: radial-gradient(70% 70% at 60% 50%, rgba(140,200,180,.6), transparent 65%), linear-gradient(160deg, #20382f, #080e0c); }
.bp[data-kind="gallery"] .bp-masonry .p5 { --photo: radial-gradient(70% 60% at 40% 30%, rgba(255,225,190,.7), transparent 65%), linear-gradient(170deg, #4a3d52, #100c14); }
.bp[data-kind="gallery"] .bp-light .bp-ph { --photo: radial-gradient(70% 50% at 50% 30%, rgba(160,190,230,.8), transparent 65%), linear-gradient(160deg, #2c3a55, #0b0e18); }
.bp[data-kind="gallery"].s3 .bp-hero { color: #fff; }

.bp[data-kind="dash"].s3 { --ff: Inter, system-ui, sans-serif; }
.bp[data-kind="dash"].s3 .bp-site { --acc: #5b8cff; --line: rgba(255,255,255,.1); --card: rgba(255,255,255,.07); background: #0f1420; color: #e8ecf5; }

.bp[data-kind="generic"].s3 .bp-site { --acc: #5b6cff; --line: rgba(0,0,0,.08); background: #f7f8fb; color: #12151c; }
.bp[data-kind="generic"] .bp-hero .bp-ph::after { background: var(--noise), radial-gradient(70% 100% at 85% 20%, #ff9d7a, transparent 60%), radial-gradient(70% 100% at 10% 90%, #6bd0ff, transparent 60%), linear-gradient(135deg, #5b6cff, #2a2f6b); }
.bp[data-kind="generic"] { --photo: radial-gradient(70% 70% at 25% 20%, rgba(255,255,255,.7), transparent 60%), linear-gradient(150deg, #c9d2ff, #8a96e8); }
.bp[data-kind="generic"].s3 .bp-hero { color: #fff; }
.bp.s3 .bp-hero .bp-copy { text-shadow: 0 1px 8px rgba(0,0,0,.35); }
.bp.s3 .bp-hero .bp-btn { text-shadow: none; }
.bp.s3 .bp-card, .bp.s3 .bp-kpis div { transition: transform .4s; }
.bp.s3 .bp-card .bp-add { color: var(--ink); }

/* cursor + scan */
.bp-cursor { position: absolute; left: 0; top: 0; z-index: 8; opacity: 0; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.45)); }
.bp-cursor::after { content: ''; position: absolute; left: -9px; top: -9px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(91,108,255,.9); opacity: 0; transform: scale(.3); }
.bp-cursor.click::after { animation: bpRipple .7s ease-out; }
.bp-scan { position: absolute; left: 0; right: 0; top: 20px; height: 40px; z-index: 4; pointer-events: none; background: linear-gradient(180deg, transparent, rgba(124,140,255,.18), transparent); animation: bpScan 3.2s linear infinite; }
.bs-card.ge4 .bp-scan { opacity: .0; }
.bs-card.bs-done .bp-scan { display: none; }
.bs-card.bs-done .bp { box-shadow: 0 0 0 2px #34c27a, 0 14px 38px -14px rgba(52,194,122,.5); }

/* code pane */
.bs-code { border-radius: 12px; background: #0d1117; color: #c9d1d9; overflow: hidden; display: flex; flex-direction: column; height: 244px; box-shadow: 0 0 0 1px rgba(128,134,150,.25); }
@media (max-width: 620px) { .bs-code { height: 150px; } }
.bs-tabs { display: flex; background: #161b22; font: 600 10px ui-monospace, 'SF Mono', Menlo, Consolas, monospace; overflow: hidden; flex: none; }
.bs-tabs span { padding: 7px 10px; color: #7d8590; border-right: 1px solid #0d1117; white-space: nowrap; }
.bs-tabs span.on { color: #e6edf3; background: #0d1117; box-shadow: inset 0 -2px 0 var(--bs-acc); }
.bs-pre { margin: 0; padding: 8px 10px 10px 0; flex: 1; overflow: hidden; font: 10.5px/1.55 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; white-space: pre; position: relative; }
.bs-pre code { display: block; font: inherit; }
.bs-ln { display: inline-block; width: 26px; margin-right: 10px; text-align: right; color: #484f58; user-select: none; }
.bs-caret { display: inline-block; width: 6px; height: 12px; background: #58a6ff; vertical-align: -2px; margin-left: 1px; animation: bsBlink 1s steps(2) infinite; }
.c-tag { color: #7ee787; } .c-attr { color: #79c0ff; } .c-str { color: #a5d6ff; } .c-cmt { color: #6e7681; font-style: italic; }
.c-sel { color: #d2a8ff; } .c-prop { color: #79c0ff; } .c-num { color: #ffa657; } .c-kw { color: #ff7b72; } .c-fn { color: #d2a8ff; }
.c-ok { color: #3fb950; } .c-cmd { color: #e6edf3; font-weight: 700; } .c-arrow { color: #58a6ff; }

/* progress + stages */
.bs-prog { margin-top: 12px; height: 4px; border-radius: 4px; background: var(--sk); overflow: hidden; }
.bs-bar { height: 100%; } .bs-bar i { display: block; height: 100%; width: 8%; border-radius: 4px; background: linear-gradient(90deg, #5b6cff, #b06bff, #ff8a6b); background-size: 200% 100%; animation: bsFlow 2.4s linear infinite; transition: width .6s ease; }
.bs-card.bs-done .bs-bar i { animation: none; background: #34c27a; }
.bs-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: .8rem; }
.bs-now { font-weight: 600; min-width: 0; } .bs-time { opacity: .6; font-size: .74rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bs-steps { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.bs-step { display: flex; gap: 6px; align-items: center; padding: 3px 9px 3px 7px; border-radius: 99px; border: 1px solid var(--sk); font-size: .72rem; opacity: .5; transition: all .4s; }
.bs-step.on { opacity: 1; border-color: var(--bs-acc); box-shadow: 0 0 0 3px rgba(124,140,255,.14); }
.bs-step.done { opacity: .85; }
.bs-dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid currentColor; opacity: .6; position: relative; flex: none; }
.bs-step.on .bs-dot { border-color: var(--bs-acc); opacity: 1; animation: bsPulse 1.6s infinite; }
.bs-step.done .bs-dot { background: #34c27a; border-color: #34c27a; opacity: 1; }
.bs-step.done .bs-dot::after { content: ''; position: absolute; left: 2px; top: 0; width: 2.5px; height: 5px; border: solid #fff; border-width: 0 1.4px 1.4px 0; transform: rotate(45deg); }

@keyframes bpShimmer { to { transform: translateX(100%); } }
@keyframes bpPulse { 50% { filter: brightness(1.12); } }
@keyframes bpScan { from { transform: translateY(-50px); } to { transform: translateY(240px); } }
@keyframes bpPop { 0% { transform: scale(1); } 40% { transform: scale(1.6); } 100% { transform: scale(1); } }
@keyframes bpRipple { 0% { opacity: .9; transform: scale(.3); } 100% { opacity: 0; transform: scale(1.6); } }
@keyframes bpSteam { 50% { transform: translateY(-2px) scale(1.03); } }
@keyframes bsBlink { 50% { opacity: 0; } }
@keyframes bsFlow { to { background-position: -200% 0; } }
@keyframes bsPulse { 0% { box-shadow: 0 0 0 0 rgba(124,140,255,.55); } 70% { box-shadow: 0 0 0 6px rgba(124,140,255,0); } 100% { box-shadow: 0 0 0 0 rgba(124,140,255,0); } }
@media (prefers-reduced-motion: reduce) { .bp *, .bp-scan, .bs-bar i, .bs-caret, .bs-step.on .bs-dot { animation: none !important; } }


/* image generation: a photo slowly "developing" out of blur */
.bi-frame { position: relative; margin-top: 12px; height: 170px; border-radius: 10px; overflow: hidden; background: #1c1f27; }
.bi-blur { position: absolute; inset: -30px; background: radial-gradient(circle at 30% 35%, #ffb36b, transparent 45%), radial-gradient(circle at 70% 60%, #6b8cff, transparent 50%), radial-gradient(circle at 50% 90%, #b06bff, transparent 45%); filter: blur(28px); animation: biDevelop 9s ease-in-out infinite alternate; }
.bi-grain { position: absolute; inset: 0; opacity: .22; mix-blend-mode: overlay; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/></filter><rect width='120' height='120' filter='url(%23n)'/></svg>"); animation: biGrain .8s steps(4) infinite; }
@keyframes biDevelop { 0% { filter: blur(34px); transform: scale(1.1); } 100% { filter: blur(10px); transform: scale(1); } }
@keyframes biGrain { 0% { transform: translate(0,0); } 25% { transform: translate(-6px,4px); } 50% { transform: translate(5px,-5px); } 75% { transform: translate(-4px,-3px); } 100% { transform: translate(0,0); } }
@media (prefers-reduced-motion: reduce) { .bi-blur, .bi-grain, .bs-step.on .bs-dot { animation: none !important; } }

/* ---------- Thinking indicator ---------- */
.kt-think { display: flex; gap: 12px; align-items: flex-start; padding: 2px 0 4px; }
.kt-body { display: grid; gap: 3px; min-width: 0; flex: 1; max-width: 420px; }
.kt-head { display: flex; align-items: baseline; gap: 8px; }
.kt-shim { position: relative; font-weight: 600; font-size: .92rem; opacity: .95; }
.kt-shim::after { content: attr(data-t); position: absolute; left: 0; top: 0; white-space: nowrap; color: #7c8cff; -webkit-mask-image: linear-gradient(100deg, transparent 38%, #000 50%, transparent 62%); mask-image: linear-gradient(100deg, transparent 38%, #000 50%, transparent 62%); -webkit-mask-size: 260% 100%; mask-size: 260% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; animation: ktShim 2.2s linear infinite; }
.kt-clock { font-style: normal; font-size: .72rem; opacity: .5; font-variant-numeric: tabular-nums; }
.kt-sub { font-size: .8rem; opacity: .62; min-height: 1em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kt-sub:empty { display: none; }
.kt-lines { display: grid; gap: 7px; margin-top: 8px; }
.kt-lines u { display: block; height: 9px; border-radius: 6px; text-decoration: none; position: relative; overflow: hidden; background: rgba(128,134,150,.2); }
.kt-lines u:nth-child(1) { width: 94%; } .kt-lines u:nth-child(2) { width: 78%; } .kt-lines u:nth-child(3) { width: 52%; }
.kt-lines u::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent); animation: ktSweep 1.7s infinite; }
.kt-lines u:nth-child(2)::after { animation-delay: .18s; } .kt-lines u:nth-child(3)::after { animation-delay: .36s; }

/* soft glowing orb with a changing icon in the middle */
.kt-orb { position: relative; width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; color: #fff; margin-top: 1px; isolation: isolate; }
.kt-orb i { position: absolute; inset: 0; border-radius: 50%; filter: blur(5px); opacity: .85; z-index: -1; }
.kt-orb i:nth-child(1) { background: radial-gradient(circle at 30% 30%, #7c8cff, transparent 70%); animation: ktOrbit 3.2s linear infinite; }
.kt-orb i:nth-child(2) { background: radial-gradient(circle at 70% 40%, #ff8a6b, transparent 70%); animation: ktOrbit 4.1s linear infinite reverse; }
.kt-orb i:nth-child(3) { background: radial-gradient(circle at 50% 80%, #b06bff, transparent 70%); animation: ktOrbit 5s linear infinite; }
.kt-orb::before { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: rgba(20,22,30,.55); backdrop-filter: blur(4px); box-shadow: inset 0 1px 1px rgba(255,255,255,.35), 0 0 0 1px rgba(255,255,255,.12); z-index: -1; animation: ktBreathe 2.4s ease-in-out infinite; }
.kt-ico { width: 14px; height: 14px; animation: ktIco 2.4s ease-in-out infinite; }
.kt-orb::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid rgba(124,140,255,.45); opacity: 0; animation: ktRing 2.4s ease-out infinite; }
@keyframes ktShim { from { -webkit-mask-position: 130% 0; mask-position: 130% 0; } to { -webkit-mask-position: -30% 0; mask-position: -30% 0; } }
@keyframes ktSweep { to { transform: translateX(100%); } }
@keyframes ktOrbit { to { transform: rotate(360deg); } }
@keyframes ktBreathe { 50% { transform: scale(.9); } }
@keyframes ktIco { 50% { transform: scale(1.12); opacity: .85; } }
@keyframes ktRing { 0% { opacity: .7; transform: scale(.85); } 100% { opacity: 0; transform: scale(1.45); } }
@media (prefers-reduced-motion: reduce) { .kt-shim, .kt-lines u::after, .kt-orb i, .kt-orb::before, .kt-orb::after, .kt-ico { animation: none !important; } }

/* ---------- History: tabs, row menu, rename ---------- */
.hist-tabs { display: flex; gap: 6px; padding: 3px; border-radius: 12px; background: rgba(255,255,255,.05); margin-bottom: 4px; position: sticky; top: 0; z-index: 2; backdrop-filter: blur(8px); }
.hist-tab { flex: 1; padding: 7px 10px; border-radius: 9px; font-size: .82rem; font-weight: 600; color: var(--text-muted); transition: background .2s, color .2s; }
.hist-tab.on { background: var(--glass-hover, rgba(255,255,255,.1)); color: var(--text); box-shadow: 0 1px 6px rgba(0,0,0,.25); }
.hist-rows { display: flex; flex-direction: column; gap: 10px; }
.hist-row { cursor: pointer; align-items: center; }
.hist-row:focus-visible { outline: 2px solid var(--accent, #7c8cff); outline-offset: 1px; }
.hist-row-menu { flex-shrink: 0; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: var(--text-muted); transition: background .2s, color .2s; }
.hist-row-menu:hover, .hist-row-menu:focus-visible { background: rgba(255,255,255,.1); color: var(--text); }
.hist-rename { width: 100%; font: inherit; font-size: .86rem; font-weight: 500; color: var(--text); background: rgba(255,255,255,.07); border: 1px solid var(--accent, #7c8cff); border-radius: 8px; padding: 4px 8px; outline: none; }
.hist-menu { position: fixed; z-index: 10000; min-width: 190px; padding: 6px; border-radius: 14px; background: #1c1f2a; border: 1px solid rgba(255,255,255,.12); box-shadow: 0 18px 44px rgba(0,0,0,.55); animation: histMenuIn .14s ease-out; }
.hist-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border-radius: 9px; font-size: .84rem; color: #e8e8ee; text-align: left; }
.hist-menu-item:hover, .hist-menu-item:focus-visible { background: rgba(255,255,255,.09); outline: none; }
.hist-menu-item.danger { color: #ff6b6b; } .hist-menu-item.danger:hover { background: rgba(255,107,107,.14); }
@keyframes histMenuIn { from { opacity: 0; transform: translateY(-4px) scale(.97); } to { opacity: 1; transform: none; } }
.private-list-head { margin-top: 22px; font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); align-self: stretch; text-align: left; }
.private-list { display: flex; flex-direction: column; gap: 10px; align-self: stretch; margin-top: 8px; text-align: left; }
.pin-unlocked { width: 100%; max-width: 560px; margin: 0 auto; padding: 28px 18px 24px; justify-content: flex-start; }
.private-pill { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; font-size: .74rem; font-weight: 600; color: #fff; background: linear-gradient(135deg, #5b6cff, #b06bff); box-shadow: 0 6px 18px rgba(91,108,255,.4); pointer-events: none; }


/* ---------- History archive toggle, Retry button, Private badge ---------- */
.hist-archive-toggle { font-size: .78rem; font-weight: 500; color: var(--accent, #7c8cff); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--glass-border); background: rgba(255,255,255,.04); transition: background .2s; cursor: pointer; }
.hist-archive-toggle:hover { background: rgba(255,255,255,.09); }
.msg-retry-btn { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 7px 14px; border-radius: 999px; font-size: .8rem; font-weight: 500; color: var(--text); background: rgba(255,255,255,.07); border: 1px solid var(--glass-border); cursor: pointer; transition: background .2s, transform .15s; }
.msg-retry-btn:hover { background: rgba(255,255,255,.13); }
.msg-retry-btn:active { transform: scale(.97); }
.msg-retry-btn:disabled { opacity: .5; cursor: default; }
.private-badge { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 9000; padding: 6px 14px; border-radius: 999px; font-size: .75rem; color: #e8e8ee; background: rgba(28,31,42,.92); border: 1px solid rgba(124,140,255,.45); backdrop-filter: blur(8px); pointer-events: none; }


/* Signup consent + cookie notice */
.auth-consent { display:flex; gap:10px; align-items:flex-start; font-size:13px; line-height:1.4; color:var(--text-secondary, rgba(247,247,250,.75)); margin:4px 0 8px; cursor:pointer; }
.auth-consent[hidden] { display:none; }
.auth-consent input { margin-top:2px; width:16px; height:16px; accent-color:#6c8cff; flex:none; }
.auth-consent a { color:inherit; text-decoration:underline; }
.cookie-notice { position:fixed; left:16px; right:16px; bottom:96px; z-index:9999; max-width:560px; margin:0 auto; display:flex; gap:12px; align-items:center; justify-content:space-between; padding:12px 16px; border-radius:12px; background:rgba(20,20,34,.96); border:1px solid rgba(255,255,255,.12); color:#f1f1f6; font-size:13px; line-height:1.4; box-shadow:0 8px 30px rgba(0,0,0,.4); }
.cookie-notice[hidden] { display:none; }
.cookie-notice a { color:#9db4ff; }
.cookie-notice button { flex:none; padding:8px 14px; border-radius:8px; border:0; background:#6c8cff; color:#fff; font:inherit; font-weight:600; cursor:pointer; }


/* ---------- Thinking visuals per phase: spinning globe (searching), scanning page (reading), motion per icon ---------- */
.kt-globe, .kt-scan { display: none; }
.kt-think[data-ic="search"] .kt-orb { width: 38px; height: 38px; }
.kt-think[data-ic="search"] .kt-ico { display: none; }
.kt-think[data-ic="search"] .kt-globe { display: block; width: 26px; height: 26px; overflow: visible; color: #cfd6ff; }
.kt-globe .gm { transform-box: fill-box; transform-origin: center; animation: ktGlobe 3s linear infinite; }
.kt-globe .gm2 { animation-delay: -1s; } .kt-globe .gm3 { animation-delay: -2s; }
.kt-globe .gsat { transform-origin: 12px 12px; animation: ktOrbit 2.2s linear infinite; color: #ffb38a; }
.kt-think[data-ic="search"] .kt-orb::before { animation: ktBreathe 2.4s ease-in-out infinite, ktGlow 2.4s ease-in-out infinite; }
.kt-think[data-ic="read"] .kt-ico { width: 15px; height: 15px; }
.kt-think[data-ic="read"] .kt-scan { display: block; position: absolute; left: 8px; right: 8px; top: 6px; bottom: 6px; overflow: hidden; border-radius: 3px; }
.kt-scan b { position: absolute; left: 0; right: 0; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, #9db4ff, transparent); box-shadow: 0 0 8px #7c8cff; animation: ktScan 1.4s ease-in-out infinite; }
.kt-think[data-ic="work"] .kt-ico { animation: ktBolt 1.1s ease-in-out infinite; }
.kt-think[data-ic="write"] .kt-ico { animation: ktPen 1.2s ease-in-out infinite; transform-origin: 20% 80%; }
.kt-think[data-ic="image"] .kt-ico { animation: ktLook 2.6s ease-in-out infinite; }
@keyframes ktGlobe { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(.06); } }
@keyframes ktScan { 0% { top: 0; opacity: 0; } 15%, 85% { opacity: 1; } 100% { top: calc(100% - 2px); opacity: 0; } }
@keyframes ktGlow { 50% { box-shadow: inset 0 1px 1px rgba(255,255,255,.35), 0 0 14px rgba(124,140,255,.55); } }
@keyframes ktBolt { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.18) rotate(-6deg); } 70% { transform: scale(.95); } }
@keyframes ktPen { 0%, 100% { transform: translate(0, 0) rotate(0); } 50% { transform: translate(2px, -2px) rotate(8deg); } }
@keyframes ktLook { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(-2px); } 70% { transform: translateX(2px); } }
@media (prefers-reduced-motion: reduce) { .kt-globe .gm, .kt-globe .gsat, .kt-scan b, .kt-think .kt-ico { animation: none !important; } .kt-globe .gm2, .kt-globe .gm3 { display: none; } }


/* Copy / Edit under the user's own messages */
.message.user .msg-actions.user-actions { justify-content: flex-end; opacity: 0; transition: opacity .15s; }
.message.user:hover .msg-actions.user-actions, .message.user:focus-within .msg-actions.user-actions { opacity: 1; }
@media (hover: none) { .message.user .msg-actions.user-actions { opacity: .75; } }
.msg-edit-box { width: min(560px, 100%); margin-left: auto; display: grid; gap: 8px; }
.msg-edit-box textarea { width: 100%; resize: vertical; font: inherit; font-size: .92rem; color: var(--text); background: rgba(255,255,255,.07); border: 1px solid var(--accent, #7c8cff); border-radius: 12px; padding: 10px 12px; outline: none; }
.msg-edit-row { display: flex; justify-content: flex-end; gap: 8px; }
.msg-edit-cancel, .msg-edit-save { padding: 7px 16px; border-radius: 999px; font-size: .82rem; font-weight: 600; cursor: pointer; border: 1px solid var(--glass-border); color: var(--text); background: rgba(255,255,255,.06); }
.msg-edit-save { background: var(--accent, #6c8cff); border-color: transparent; color: #fff; }


/* Kinju Memory + Daily Brief */
.prem-tag { display:inline-block; margin-left:8px; padding:1px 8px; border-radius:99px; font-size:.64rem; font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:#1b1400; background:linear-gradient(135deg,#ffd76a,#ffb347); vertical-align:middle; }
.memory-list { display:grid; gap:6px; margin:6px 0 10px; }
.memory-item { display:flex; align-items:flex-start; justify-content:space-between; gap:8px; padding:8px 10px; border-radius:10px; background:rgba(255,255,255,.05); font-size:.84rem; line-height:1.4; }
.memory-del { flex:none; width:24px; height:24px; border-radius:50%; font-size:1.1rem; line-height:1; color:var(--text-muted); }
.memory-del:hover, .memory-del:focus-visible { background:rgba(255,107,107,.18); color:#ff6b6b; outline:none; }
.memory-empty { font-size:.82rem; color:var(--text-muted); margin:4px 0; }
.memory-add { display:flex; gap:8px; margin-bottom:10px; }
.memory-add[hidden], #memory-clear-row[hidden] { display:none; }
.memory-add input { flex:1; min-width:0; font:inherit; font-size:.84rem; color:var(--text); background:rgba(255,255,255,.07); border:1px solid var(--glass-border); border-radius:10px; padding:8px 10px; outline:none; }
.memory-add input:focus { border-color:var(--accent,#7c8cff); }
.brief-card { width:min(560px,100%); margin:0 auto 16px; text-align:left; padding:14px 16px; border-radius:16px; background:rgba(255,255,255,.05); border:1px solid var(--glass-border); }
.brief-card[hidden] { display:none; }
.brief-head { display:flex; align-items:center; gap:4px; margin-bottom:8px; font-size:.9rem; }
.brief-refresh { margin-left:auto; width:28px; height:28px; border-radius:8px; color:var(--text-muted); font-size:1rem; }
.brief-refresh:hover, .brief-refresh:focus-visible { background:rgba(255,255,255,.1); color:var(--text); outline:none; }
.brief-body { font-size:.86rem; line-height:1.55; }
.brief-body p { margin:0 0 6px; }
.brief-src { margin-top:6px; font-size:.72rem; color:var(--text-muted); }


/* Empty-state suggestions + template gallery */
.try-asking { margin-top: 18px; display: grid; gap: 8px; justify-items: center; }
.try-label { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.try-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 620px; }
.try-chip { padding: 8px 14px; border-radius: 999px; font-size: .82rem; color: var(--text); background: rgba(255,255,255,.05); border: 1px solid var(--glass-border); cursor: pointer; transition: background .2s, transform .15s; }
.try-chip:hover, .try-chip:focus-visible { background: rgba(255,255,255,.12); outline: none; transform: translateY(-1px); }
.try-more { color: var(--accent, #9db4ff); border-style: dashed; }
.tpl-overlay { position: fixed; inset: 0; z-index: 10001; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
.tpl-box { width: min(760px, 100%); max-height: 86vh; overflow: auto; padding: 18px 18px 22px; border-radius: 18px; background: #151823; border: 1px solid rgba(255,255,255,.12); box-shadow: 0 24px 60px rgba(0,0,0,.6); color: #eceef6; }
.tpl-head { display: flex; align-items: center; justify-content: space-between; }
.tpl-head h3 { margin: 0; font-size: 1.05rem; }
.tpl-close { width: 32px; height: 32px; border-radius: 50%; font-size: 1.4rem; line-height: 1; color: #aab; cursor: pointer; }
.tpl-close:hover, .tpl-close:focus-visible { background: rgba(255,255,255,.1); outline: none; }
.tpl-hint { margin: 4px 0 6px; font-size: .82rem; color: #9aa0b4; }
.tpl-group { margin: 16px 0 8px; font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: #8f96ad; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.tpl-card { display: grid; gap: 4px; text-align: left; padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); color: inherit; cursor: pointer; transition: background .2s, transform .15s, border-color .2s; }
.tpl-card:hover, .tpl-card:focus-visible { background: rgba(255,255,255,.1); border-color: #7c8cff; transform: translateY(-2px); outline: none; }
.tpl-card b { font-size: .9rem; }
.tpl-card span { font-size: .76rem; line-height: 1.4; color: #9aa0b4; }


/* Usage card + command palette */
.usage-card { padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.05); font-size: .84rem; margin-bottom: 8px; }
.usage-bar { height: 6px; border-radius: 99px; background: rgba(255,255,255,.1); margin-top: 8px; overflow: hidden; }
.usage-bar[hidden] { display: none; }
.usage-bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #6c8cff, #b06bff); transition: width .4s; }
.usage-bar.low i { background: linear-gradient(90deg, #ffb347, #ff6b6b); }
.cmdk-overlay { position: fixed; inset: 0; z-index: 10002; display: flex; justify-content: center; align-items: flex-start; padding: 14vh 16px 16px; background: rgba(0,0,0,.55); backdrop-filter: blur(3px); }
.cmdk-box { width: min(520px, 100%); border-radius: 16px; background: #171a26; border: 1px solid rgba(255,255,255,.12); box-shadow: 0 24px 60px rgba(0,0,0,.6); overflow: hidden; }
.cmdk-input { width: 100%; box-sizing: border-box; padding: 14px 16px; font: inherit; font-size: .95rem; color: #eceef6; background: transparent; border: 0; border-bottom: 1px solid rgba(255,255,255,.1); outline: none; }
.cmdk-list { max-height: 50vh; overflow: auto; padding: 6px; }
.cmdk-item { display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px; font-size: .88rem; color: #eceef6; cursor: pointer; }
.cmdk-item.on { background: rgba(124,140,255,.22); }
.cmdk-empty { padding: 14px; font-size: .85rem; color: #9aa0b4; }


/* Feedback form + tour */
.fb-box { width: min(480px, 100%); }
.fb-cats { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.fb-cats .try-chip.on { background: rgba(124,140,255,.28); border-color: #7c8cff; }
.fb-text { width: 100%; box-sizing: border-box; resize: vertical; font: inherit; font-size: .9rem; color: #eceef6; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); border-radius: 12px; padding: 10px 12px; outline: none; margin-bottom: 10px; }
.fb-text:focus { border-color: #7c8cff; }
.tour-veil { position: fixed; inset: 0; z-index: 10003; background: rgba(0,0,0,.55); }
.tour-hl { position: relative; z-index: 10004 !important; box-shadow: 0 0 0 4px rgba(124,140,255,.9), 0 0 0 9999px rgba(0,0,0,.0); border-radius: 12px; }
.tour-pop { position: fixed; z-index: 10005; padding: 14px 16px; border-radius: 14px; background: #1b1f2e; border: 1px solid rgba(124,140,255,.5); color: #eceef6; box-shadow: 0 16px 40px rgba(0,0,0,.6); }
.tour-pop b { display: block; font-size: .98rem; margin-bottom: 4px; }
.tour-pop p { margin: 0 0 12px; font-size: .84rem; line-height: 1.5; color: #b9bfd2; }
.tour-step { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: #8f96ad; margin-bottom: 4px; }
.tour-row { display: flex; justify-content: space-between; align-items: center; }
.tour-skip { font-size: .8rem; color: #9aa0b4; padding: 6px 4px; cursor: pointer; }
.tour-next { padding: 7px 18px; border-radius: 999px; font-size: .84rem; font-weight: 600; background: #6c8cff; color: #fff; cursor: pointer; }


/* Invite friends */
.invite-box { display: flex; gap: 8px; margin: 6px 0; }
.invite-box input { flex: 1; min-width: 0; font: inherit; font-size: .8rem; color: var(--text); background: rgba(255,255,255,.07); border: 1px solid var(--glass-border); border-radius: 10px; padding: 8px 10px; }

/* Settings: voice language dropdown */
.settings-select {
    max-width: 210px;
    padding: 7px 10px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: inherit;
    font: inherit;
    font-size: 0.84rem;
    cursor: pointer;
}
.settings-select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.settings-select option { background: #14141c; color: #eee; }

/* ===== Brief Step 1: shared content width, spacing, header ===== */
:root { --content-w: 880px; --gutter: 20px; }
.chat-messages { padding: 20px var(--gutter) 24px; }
.message { max-width: var(--content-w); }
.input-bar { padding: 12px var(--gutter); padding-bottom: max(12px, env(safe-area-inset-bottom, 12px)); }
.input-bar .input-wrapper { max-width: var(--content-w); width: 100%; margin: 0 auto; }
.input-wrapper textarea { max-height: 160px; overflow-y: auto; }
.welcome-screen { width: 100%; max-width: var(--content-w); margin: 0 auto; gap: 12px; padding: 32px 0 24px; }
.welcome-chips { margin-top: 12px; }
.brief-card { width: 100%; max-width: var(--content-w); }
.try-asking { width: 100%; max-width: var(--content-w); }
/* header: settings lives in the menu drawer; keep header to nav, status, new chat */
.header { padding: 0 var(--gutter); gap: 12px; }
#settings-btn { display: none; }
.header-right { gap: 8px; min-width: 0; }
@media (max-width: 900px) { .tagline { display: none; } }
@media (max-width: 640px) {
  :root { --gutter: 14px; }
  .header-center { display: none; }
  .header-left { gap: 8px; }
  .status-badge .status-text { display: none; }
  .upgrade-btn span { display: none; }
  .activity-toggle { display: none; }
  .welcome-screen { padding: 20px 0 16px; }
}
/* Brief states */
.brief-head { display:flex; align-items:center; gap:8px; }
.brief-head .brief-refresh { margin-left:0; }
.brief-toggle { margin-left:auto; background:none; border:0; color:var(--text-muted); font:inherit; font-size:12px; cursor:pointer; padding:4px 8px; border-radius:8px; }
.brief-toggle:hover, .brief-toggle:focus-visible { color:var(--text-primary, #fff); outline:2px solid rgba(255,255,255,.25); }
.brief-card.collapsed .brief-body, .brief-card.collapsed .brief-src { display:none; }
.brief-msg { margin:0 0 10px; color:var(--text-muted); font-size:14px; }
.brief-cta { background:rgba(255,255,255,.08); border:1px solid var(--glass-border); color:inherit; font:inherit; font-size:13px; padding:8px 14px; border-radius:10px; cursor:pointer; }
.brief-cta:hover, .brief-cta:focus-visible { background:rgba(255,255,255,.14); }

/* ---- Composer extras: "/" and "@" menu + drag & drop overlay ---- */
.cx-menu {
    position: fixed; z-index: 70; max-height: min(50vh, 340px); overflow-y: auto; padding: 6px;
    border-radius: 14px; background: #17171d; border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 16px 48px rgba(0,0,0,0.55);
}
.cx-menu[hidden] { display: none; }
.cx-title { padding: 6px 10px 4px; font-size: 0.68rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.cx-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.cx-row:hover, .cx-row.active { background: rgba(255,255,255,0.08); }
.cx-ico { width: 24px; text-align: center; flex-shrink: 0; }
.cx-text { display: flex; flex-direction: column; min-width: 0; }
.cx-label { font-size: 0.85rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-desc { font-size: 0.72rem; color: var(--text-dim); }
.cx-empty { padding: 10px; font-size: 0.78rem; color: var(--text-dim); line-height: 1.4; }
.cx-drop {
    position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
    background: rgba(8,10,16,0.72); backdrop-filter: blur(4px); pointer-events: none;
}
.cx-drop[hidden] { display: none; }
.cx-drop-box {
    text-align: center; padding: 44px 56px; border-radius: 22px;
    border: 2px dashed var(--accent); background: rgba(255,255,255,0.04);
}
.cx-drop-ico { font-size: 2.2rem; margin-bottom: 8px; }
.cx-drop-title { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.cx-drop-sub { margin-top: 4px; font-size: 0.8rem; color: var(--text-dim); }

/* ---- UX audit pass: readability, focus, reduced motion (no colour/palette change) ---- */
/* Existing muted/dim text already measures >=5.5:1 on the dark canvas; the real issue was size. */
.login-legal { font-size: 0.8rem; line-height: 1.55; }
.login-legal a, .auth-consent a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.auth-hint { font-size: 0.8rem; }
.status-badge { font-size: 0.76rem; }
.msg-label, .input-meta, .search-result-card .card-score { font-size: 0.74rem; }
.settings-version, .settings-row-sub, .ufile-meta, .tool-row-sub { font-size: 0.78rem; }
.try-label { font-size: 0.76rem; }
.login-brand-copy li { font-size: 0.95rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.input-wrapper textarea:focus-visible { outline: none; }
.input-wrapper:focus-within { border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Connector tiles: neutral monogram instead of third-party brand logos */
.conn-tile { background: linear-gradient(135deg, rgba(56,198,244,.18), rgba(111,89,255,.18)) !important; color: #dff6ff !important; border: 1px solid rgba(255,255,255,.12); }
.conn-tile svg { display: none; }
.cx-ico svg { display: block; margin: 0 auto; color: var(--text-dim); }

/* =============================================================================
   CALM-DOWN PASS (additive; nothing above is edited)
   - No continuous logo animation or heavy glow in the working app
   - Decorative motion stops for people who ask for reduced motion
   - Full-screen preview uses dynamic viewport height (mobile browser bars)
   - Visible keyboard focus on the message composer
   ============================================================================= */
.welcome-logo { animation: none; filter: drop-shadow(0 0 16px rgba(110, 107, 240, 0.25)); }
.logo { animation: none; background-size: 100% auto; }
@media (max-width: 720px) {
    .site-preview-modal { height: 100dvh; }
}
.input-wrapper:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56, 198, 244, 0.14); }
.input-wrapper textarea:focus-visible { outline: none; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .welcome-logo, .logo { animation: none; }
    .send-btn:disabled { animation: none; }
    .toast, .toast-container > * { animation-duration: 0.01ms; }
}

/* ---- Drawer navigation groups (labels only; buttons and JS hooks unchanged) ---- */
.drawer-group {
    padding: 14px 12px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim, #8c93a3);
    user-select: none;
}
.drawer-nav > .drawer-group:first-child { padding-top: 8px; }
.drawer-footer > .drawer-group { padding-top: 8px; }
/* short screens: let the drawer scroll instead of cutting off Settings / profile */
.app-drawer { overflow-y: auto; overscroll-behavior: contain; }
.drawer-header, .drawer-new-chat, .drawer-footer { flex-shrink: 0; }
.drawer-spacer { min-height: 12px; }

/* ---- My Orders screen ---- */
.ord-add-btn { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--glass-border); background: rgba(255,255,255,0.05); color: var(--text); font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; transition: background .15s, transform .12s; }
.ord-add-btn:hover { background: var(--glass-hover); }
.ord-add-btn:active { transform: scale(0.97); }
.ord-note { font-size: 0.8rem; line-height: 1.55; color: var(--text-dim); padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(56,198,244,0.07); border: 1px solid rgba(56,198,244,0.2); }
.ord-form { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--radius-sm); background: rgba(255,255,255,0.03); border: 1px solid var(--glass-border); }
.ord-form[hidden] { display: none; }
.ord-form label { display: flex; flex-direction: column; gap: 5px; font-size: 0.78rem; color: var(--text-dim); }
.ord-form input, .ord-form select { padding: 9px 10px; border-radius: 10px; border: 1px solid var(--glass-border); background: rgba(0,0,0,0.25); color: var(--text); font: inherit; font-size: 0.9rem; min-width: 0; }
.ord-form input:focus-visible, .ord-form select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ord-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.7fr); gap: 8px; }
.ord-row label { min-width: 0; }
.ord-form input { width: 100%; box-sizing: border-box; }
.ord-form-actions { display: flex; gap: 8px; margin-top: 4px; }
.ord-primary { padding: 10px 16px; border: 0; border-radius: 999px; background: var(--accent); color: #04121a; font: inherit; font-weight: 700; font-size: 0.88rem; cursor: pointer; }
.ord-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.ord-secondary { padding: 10px 16px; border-radius: 999px; border: 1px solid var(--glass-border); background: none; color: var(--text); font: inherit; font-size: 0.88rem; cursor: pointer; }
.ord-error { color: var(--danger); font-size: 0.82rem; }
.ord-card { padding: 14px; border-radius: var(--radius-sm); background: rgba(255,255,255,0.03); border: 1px solid var(--glass-border); display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ord-card.done { opacity: 0.7; }
.ord-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ord-title { font-weight: 600; font-size: 0.95rem; color: var(--text); overflow-wrap: anywhere; }
.ord-sub { font-size: 0.78rem; color: var(--text-dim); }
.ord-chip { flex: none; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; background: rgba(255,255,255,0.08); color: var(--text); white-space: nowrap; }
.ord-chip.st-shipped, .ord-chip.st-out_for_delivery { background: rgba(56,198,244,0.16); color: #9fe3fb; }
.ord-chip.st-delivered { background: rgba(79,201,138,0.16); color: #9ae5bf; }
.ord-chip.st-cancelled, .ord-chip.st-returned { background: rgba(240,102,94,0.16); color: #f6a6a1; }
.ord-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 0.8rem; color: var(--text-dim); }
.ord-meta b { color: var(--text); font-weight: 600; }
.ord-meta .late { color: #ffb86b; font-weight: 600; }
.ord-meta .soon { color: var(--accent); font-weight: 600; }
.ord-meta a { color: var(--accent); }
.ord-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ord-actions button { padding: 6px 11px; border-radius: 999px; border: 1px solid var(--glass-border); background: rgba(255,255,255,0.04); color: var(--text); font: inherit; font-size: 0.76rem; cursor: pointer; transition: background .15s, transform .12s; }
.ord-actions button:hover { background: var(--glass-hover); }
.ord-actions button:active { transform: scale(0.97); }
.ord-actions button.danger { color: #f6a6a1; }
@media (prefers-reduced-motion: reduce) { .ord-add-btn, .ord-actions button { transition: none; } }

/* ---- My Orders: Gmail suggestions ---- */
.ord-gmail { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.ord-hint { font-size: 0.76rem; color: var(--text-dim); }
.ord-cand { padding: 12px 14px; border-radius: var(--radius-sm); border: 1px dashed rgba(56,198,244,0.45); background: rgba(56,198,244,0.05); display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.ord-cand .ord-src { font-size: 0.74rem; color: var(--text-dim); overflow-wrap: anywhere; }
.ord-cand-head { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); }
