/*
 * AI Notes client styles — every rule is scoped under .ain-root so
 * WordPress theme styling is untouched. Ported from the web client theme.
 */

.ain-root {
    position: relative;
    isolation: isolate;
    z-index: 1;
}

.ain-root {
    --primary: #5a50f0;
    --primary-strong: #4f46e0;
    --primary-soft: #736aff;
    --secondary: #06776d;
    --accent: #c93a5e;
    --bg: #f4f5fa;
    --surface: #ffffff;
    --card: #ffffff;
    --border: #e5e7f0;
    --text: #171930;
    --text-2: #565b78;
    --text-3: #6b7290;
}

.ain-root {
    min-height: 100%;
}

.ain-root {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Poppins', 'Instrument Sans', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.ain-root a {
    color: inherit;
    text-decoration: none;
}

.ain-root /* ---------- App shell ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 20px;
    height: 60px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

/* Logged-in WordPress admin bar sits above the page; keep the sticky
   topbar visible below it. */
body.admin-bar .ain-root .topbar {
    top: 32px;
}

.ain-root .brand {
    font-weight: 700;
    font-size: 18px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    white-space: nowrap;
}

.ain-root .topnav {
    display: flex;
    gap: 4px;
    flex: 1;
    overflow-x: auto;
}

.ain-root .topnav a {
    padding: 7px 14px;
    border-radius: 999px;
    color: var(--text-2);
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
}

.ain-root .topnav a:hover {
    color: var(--text);
    background: rgba(108, 99, 255, 0.12);
}

.ain-root .topnav a.active {
    color: var(--primary-strong);
    font-weight: 600;
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.14), rgba(0, 217, 192, 0.12));
}

.ain-root .topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.ain-root .quota-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
}

.ain-root .quota-chip .spark {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--secondary);
    box-shadow: 0 0 8px rgba(0, 217, 192, 0.7);
}

.ain-root .avatar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
}

.ain-root .app-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 20px 80px;
}

.ain-root .page-title {
    font-size: 22px;
    font-weight: 700;
    margin: 4px 0 4px;
}

.ain-root .page-subtitle {
    color: var(--text-2);
    font-size: 13.5px;
    margin: 0 0 20px;
}

.ain-root /* ---------- Cards,
.ain-root buttons,
.ain-root inputs ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(20, 24, 60, 0.05);
}

.ain-root .card-tight {
    padding: 14px 16px;
}

.ain-root .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-soft));
    box-shadow: 0 6px 18px rgba(108, 99, 255, 0.35);
    transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s;
}

.ain-root .btn:hover {
    transform: translateY(-1px);
}

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

.ain-root .btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.ain-root .btn-secondary {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text-2);
    box-shadow: none;
}

.ain-root .btn-secondary:hover {
    color: var(--text);
    border-color: var(--primary);
}

.ain-root .btn-teal {
    background: linear-gradient(135deg, var(--secondary), #33e6d4);
    color: #06251f;
    box-shadow: 0 6px 18px rgba(0, 217, 192, 0.3);
}

.ain-root .btn-danger {
    background: transparent;
    border: 1px solid rgba(255, 101, 132, 0.5);
    color: var(--accent);
    box-shadow: none;
}

.ain-root .btn-danger:hover {
    background: rgba(255, 101, 132, 0.12);
}

.ain-root .btn-sm {
    padding: 7px 13px;
    font-size: 12.5px;
    border-radius: 10px;
}

.ain-root .input,
.ain-root .textarea,
.ain-root .select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 13px;
    background: var(--card);
    border: 1px solid #c8cde4;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ain-root .input:focus,
.ain-root .textarea:focus,
.ain-root .select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.2);
}

.ain-root .input::placeholder,
.ain-root .textarea::placeholder {
    color: var(--text-3);
}

.ain-root .textarea {
    resize: vertical;
    min-height: 120px;
}

.ain-root label.field-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    margin: 0 0 6px;
}

.ain-root .field-gap {
    margin-bottom: 16px;
}

.ain-root /* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.ain-root .badge-premium {
    background: linear-gradient(135deg, rgba(255, 197, 66, 0.2), rgba(255, 101, 132, 0.2));
    color: #8a6a1f;
    border: 1px solid rgba(255, 197, 66, 0.4);
}

.ain-root .badge-freemium {
    background: rgba(108, 99, 255, 0.15);
    color: var(--primary-strong);
    border: 1px solid rgba(108, 99, 255, 0.4);
}

.ain-root .badge-ready {
    background: rgba(0, 217, 192, 0.14);
    color: var(--secondary);
    border: 1px solid rgba(0, 217, 192, 0.4);
}

.ain-root .badge-processing {
    background: rgba(108, 99, 255, 0.14);
    color: var(--primary-strong);
    border: 1px solid rgba(108, 99, 255, 0.4);
}

.ain-root .badge-failed {
    background: rgba(255, 101, 132, 0.14);
    color: var(--accent);
    border: 1px solid rgba(255, 101, 132, 0.4);
}

/* ---------- Auth ---------- */

.ain-root .auth-wrap {
    min-height: max(560px, 78vh);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: radial-gradient(ellipse at top, rgba(108, 99, 255, 0.18), var(--bg) 65%);
}

.ain-root .auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 32px 28px;
}

.ain-root .auth-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 14px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 10px 30px rgba(108, 99, 255, 0.4);
}

.ain-root .auth-title {
    text-align: center;
    font-size: 21px;
    font-weight: 700;
    margin: 0 0 4px;
}

.ain-root .auth-sub {
    text-align: center;
    color: var(--text-2);
    font-size: 13px;
    margin: 0 0 24px;
}

.ain-root .auth-alt {
    text-align: center;
    color: var(--text-2);
    font-size: 13px;
    margin-top: 18px;
}

.ain-root .auth-alt a {
    color: var(--secondary);
    font-weight: 600;
}

.ain-root .field-error {
    color: var(--accent);
    font-size: 12.5px;
    margin-top: 5px;
}

.ain-root /* ---------- Home ---------- */
.hero {
    border-radius: 22px;
    padding: 36px 28px;
    background: radial-gradient(ellipse at top left, rgba(108, 99, 255, 0.25), transparent 55%),
        radial-gradient(ellipse at bottom right, rgba(0, 217, 192, 0.16), transparent 50%), var(--surface);
    border: 1px solid var(--border);
    margin-bottom: 22px;
}

.ain-root .hero-greeting {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 6px;
}

.ain-root .hero-sub {
    color: var(--text-2);
    font-size: 14px;
    margin: 0 0 20px;
}

.ain-root .quota-meter {
    height: 9px;
    border-radius: 999px;
    background: var(--card);
    overflow: hidden;
    margin: 10px 0 8px;
}

.ain-root .quota-meter > div {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.4s ease;
}

.ain-root .quota-meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-3);
    font-size: 12px;
}

.ain-root .action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.ain-root .action-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px;
    transition: transform 0.15s, border-color 0.15s;
}

.ain-root .action-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.ain-root .action-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.ain-root .action-title {
    font-weight: 600;
    font-size: 15px;
}

.ain-root .action-desc {
    color: var(--text-2);
    font-size: 12.5px;
}

.ain-root .session-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 13px;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
    cursor: pointer;
}

.ain-root .session-row svg {
    flex-shrink: 0;
    color: var(--text-2);
}

.ain-root .session-row:hover {
    background: var(--card);
    border-color: var(--border);
}

.ain-root .session-label {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ain-root .session-meta {
    color: var(--text-3);
    font-size: 12px;
    white-space: nowrap;
}

.ain-root /* ---------- Chat ---------- */
.chat-shell {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 18px;
    height: calc(100vh - 60px - 48px);
    min-height: 480px;
}

.ain-root .chat-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px;
    overflow: hidden;
}

.ain-root .chat-side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ain-root .chat-side-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.ain-root .session-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ain-root .chat-main {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
}

.ain-root .chat-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.ain-root .chat-title {
    font-weight: 600;
    font-size: 15px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ain-root .icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 15px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.ain-root .icon-btn:hover {
    color: var(--text);
    border-color: var(--primary);
}

.ain-root .icon-btn-labeled {
    width: auto;
    padding: 0 13px;
    gap: 7px;
}

.ain-root .icon-btn-labeled .btn-label {
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

.ain-root .icon-btn svg {
    flex-shrink: 0;
}

.ain-root .icon-btn.on {
    color: var(--secondary);
    border-color: var(--secondary);
    background: rgba(0, 217, 192, 0.1);
}

.ain-root .icon-btn.recording {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(255, 101, 132, 0.12);
    animation: ain-pulse 1.2s infinite;
}

@keyframes ain-pulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 101, 132, 0.5);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(255, 101, 132, 0);
    }
}

.ain-root .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ain-root .msg-row {
    display: flex;
    gap: 10px;
    max-width: 88%;
}

.ain-root .msg-row.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ain-root .msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.ain-root .msg-row.assistant .msg-avatar {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
}

.ain-root .msg-row.user .msg-avatar {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text-2);
}

.ain-root .msg-bubble {
    padding: 11px 14px;
    border-radius: 16px;
    font-size: 14px;
    overflow-wrap: break-word;
    min-width: 0;
}

.ain-root .msg-row.assistant .msg-bubble {
    background: var(--card);
    border: 1px solid var(--border);
    border-top-left-radius: 4px;
}

.ain-root .msg-row.user .msg-bubble {
    background: linear-gradient(135deg, var(--primary), var(--primary-soft));
    color: #fff;
    border-top-right-radius: 4px;
}

.ain-root .typing-dots {
    display: inline-flex;
    gap: 4px;
    padding: 4px 0;
}

.ain-root .typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-3);
    animation: ain-blink 1.2s infinite;
}

.ain-root .typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.ain-root .typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes ain-blink {
    0%,
    80%,
    100% {
        opacity: 0.25;
    }
    40% {
        opacity: 1;
    }
}

.ain-root .chat-composer {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    align-items: flex-end;
}

.ain-root .chat-composer .icon-btn {
    flex-shrink: 0;
    margin-bottom: 5px;
}

.ain-root .chat-composer .textarea {
    min-height: 46px;
    max-height: 160px;
    flex: 1;
    padding: 12px 14px;
    border-radius: 14px;
}

.ain-root /* ---------- Markdown ---------- */
.md p {
    margin: 0 0 10px;
}

.ain-root .md p:last-child {
    margin-bottom: 0;
}

.ain-root .md h1,
.ain-root .md h2,
.ain-root .md h3 {
    margin: 14px 0 8px;
    font-size: 15.5px;
    font-weight: 700;
    color: var(--text);
}

.ain-root .md h1 {
    font-size: 17px;
}

.ain-root .md ul,
.ain-root .md ol {
    margin: 0 0 10px;
    padding-left: 20px;
}

.ain-root .md li {
    margin-bottom: 4px;
}

.ain-root .md code {
    background: rgba(108, 99, 255, 0.12);
    color: var(--primary-strong);
    padding: 1.5px 6px;
    border-radius: 6px;
    font-size: 12.5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.ain-root .md .code-block {
    position: relative;
    margin: 10px 0;
}

.ain-root .md .code-block pre {
    margin: 0;
    padding: 12px 14px;
    background: #0d1126;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow-x: auto;
}

.ain-root .md .code-block code {
    background: none;
    color: #d6dcff;
    padding: 0;
    font-size: 12.5px;
    line-height: 1.55;
}

.ain-root .copy-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 3px 9px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-2);
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
}

.ain-root .copy-btn:hover {
    color: var(--text);
    border-color: var(--primary);
}

.ain-root .md blockquote {
    margin: 0 0 10px;
    padding: 6px 12px;
    border-left: 3px solid var(--primary);
    color: var(--text-2);
    background: rgba(108, 99, 255, 0.07);
    border-radius: 0 8px 8px 0;
}

.ain-root .md a {
    color: var(--primary);
    text-decoration: underline;
}

.ain-root .md strong {
    color: var(--text);
}

.ain-root /* ---------- Drawer / modal ---------- */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 16, 0.66);
    z-index: 50;
    display: flex;
    justify-content: flex-end;
}

.ain-root .drawer {
    width: min(420px, 92vw);
    height: 100%;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 18px;
    gap: 14px;
    overflow-y: auto;
}

.ain-root .drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ain-root .drawer-title {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 16px;
    font-weight: 700;
}

.ain-root .drawer-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 8px 0 4px;
}

.ain-root .doc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid transparent;
}

.ain-root .doc-row:hover {
    background: var(--card);
    border-color: var(--border);
}

.ain-root .doc-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    background: rgba(108, 99, 255, 0.14);
}

.ain-root /* ---------- Toast ---------- */
.toast {
    position: fixed;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 80;
    padding: 11px 20px;
    border-radius: 13px;
    font-size: 13.5px;
    font-weight: 500;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: 0 10px 30px rgba(20, 24, 60, 0.18);
    animation: ain-toast-in 0.2s ease;
}

.ain-root .toast.error {
    border-color: rgba(255, 101, 132, 0.55);
    color: var(--accent);
}

.ain-root .toast.success {
    border-color: rgba(0, 217, 192, 0.55);
    color: var(--secondary);
}

@keyframes ain-toast-in {
    from {
        opacity: 0;
        transform: translate(-50%, 8px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.ain-root /* ---------- Vault ---------- */
.vault-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 18px;
    align-items: start;
}

.ain-root .doc-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ain-root .dropzone {
    border: 1.5px dashed var(--border);
    border-radius: 16px;
    padding: 26px 16px;
    text-align: center;
    color: var(--text-2);
    font-size: 13.5px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.ain-root .dropzone:hover,
.ain-root .dropzone.dragover {
    border-color: var(--primary);
    background: rgba(108, 99, 255, 0.07);
}

.ain-root /* ---------- Tool page (meeting/research) ---------- */
.tool-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    align-items: start;
}

@media (max-width: 900px) {
.ain-root .tool-grid {
        grid-template-columns: 1fr;
    }

.ain-root .vault-grid {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 640px) {
    .ain-root .icon-btn-labeled .btn-label {
        display: none;
    }

    .ain-root .icon-btn-labeled {
        padding: 0;
        width: 36px;
        gap: 0;
    }
}

.ain-root .report-view {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    min-height: 220px;
    max-height: calc(100vh - 320px);
    overflow-y: auto;
    font-size: 13.5px;
}

.ain-root /* ---------- Voice overlay ---------- */
.voice-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: radial-gradient(ellipse at center, rgba(108, 99, 255, 0.18), rgba(244, 245, 250, 0.97) 70%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 24px;
    text-align: center;
}

.voice-typing {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
}

.ain-root .voice-input {
    flex: 1;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
}

.ain-root .voice-input::placeholder {
    color: var(--text-3);
}

.ain-root .voice-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.25);
}

.ain-root .voice-orb {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 0 60px rgba(108, 99, 255, 0.55);
    animation: ain-pulse 2s infinite;
}

.ain-root .voice-status {
    font-size: 15px;
    color: var(--text);
    max-width: 560px;
}

@media (max-width: 860px) {
.ain-root .chat-shell {
        grid-template-columns: 1fr;
        height: auto;
    }

.ain-root .ws-side {
        position: fixed;
        top: 60px;
        left: 0;
        bottom: 0;
        width: min(300px, 86vw);
        z-index: 45;
        margin: 0;
        border-radius: 0 18px 18px 0;
        border-left: none;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        box-shadow: 0 18px 50px rgba(20, 24, 60, 0.25);
        max-height: none;
    }

body.admin-bar .ain-root .ws-side {
        top: 92px;
    }

.ain-root .chat-shell.ws-open .ws-side {
        transform: translateX(0);
    }

.ain-root .ws-backdrop {
        position: fixed;
        inset: 0;
        z-index: 44;
        background: rgba(4, 6, 16, 0.45);
    }

.ain-root .chat-shell .ws-toggle {
        display: inline-flex;
    }

.ain-root .chat-messages {
        min-height: 320px;
        max-height: 60vh;
    }

.ain-root .ws-view {
        overflow-y: visible;
    }

}

.ain-root /* ---------- Workspace (vault rail + views) ---------- */
.ws-side {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px 12px;
    overflow: hidden;
    min-height: 0;
}

.ain-root .ws-side-head {
    display: flex;
    align-items: center;
    padding: 2px 6px 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.ain-root .ws-side-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.ain-root .ws-section {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ain-root .ws-section[data-ws-section="chat"] {
    flex: 0 1 auto;
    min-height: 0;
}

.ain-root .ws-section-head {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 10px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    font: inherit;
    color: var(--text-2);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.ain-root .ws-section-head:hover {
    background: rgba(90, 80, 240, 0.06);
    color: var(--text);
}

.ain-root .ws-section.active .ws-section-head {
    background: rgba(90, 80, 240, 0.09);
    border-color: rgba(90, 80, 240, 0.25);
    color: var(--primary-strong);
}

.ain-root .ws-dot {
    width: 10px;
    height: 10px;
    border-radius: 4px;
    flex-shrink: 0;
}

.ain-root .ws-dot-chat {
    background: #5a50f0;
}

.ain-root .ws-dot-vault {
    background: #06776d;
}

.ain-root .ws-dot-meeting {
    background: #c93a5e;
}

.ain-root .ws-dot-research {
    background: #a16207;
}

.ain-root .ws-section-label {
    flex: 1;
    text-align: left;
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ain-root .ws-count {
    font-size: 11.5px;
    color: var(--text-2);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 1px 8px;
    min-width: 14px;
    text-align: center;
}

.ain-root .ws-count:empty {
    display: none;
}

.ain-root .ws-chevron {
    flex-shrink: 0;
    color: var(--text-3);
    transition: transform 0.18s ease;
}

.ain-root .ws-section.collapsed .ws-chevron {
    transform: rotate(-90deg);
}

.ain-root .ws-section-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 6px 4px 6px 18px;
    min-height: 0;
    flex: 0 1 auto;
}

.ain-root .ws-section.collapsed .ws-section-body {
    display: none;
}

.ain-root .ws-section .session-list {
    flex: 0 1 auto;
    min-height: 0;
    max-height: 280px;
    overflow-y: auto;
}

.ain-root .ws-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.ain-root .ws-main .chat-main {
    flex: 1;
    min-height: 0;
}

.ain-root .ws-view {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-right: 4px;
}

/* The author display rules above would otherwise beat the hidden attribute. */
.ain-root .ws-main [data-ws-view][hidden] {
    display: none;
}

.ain-root .ws-view-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 14px;
    background: var(--card);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.ain-root .ws-view-title {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}

.ain-root .ws-view-sub {
    flex: 1;
    color: var(--text-3);
    font-size: 12.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ain-root .ws-account-store {
    display: none;
}

.ain-root .ws-toggle {
    display: none;
}

.ain-root .chat-suggest {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px 0;
}

.ain-root .chat-suggest-title {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.ain-root .chat-suggest-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ain-root .chip {
    padding: 7px 13px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-2);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.ain-root .chip:hover {
    border-color: var(--primary);
    color: var(--primary-strong);
}

.ain-root .quota-chip.quota-flash {
    animation: ain-quota-flash 0.9s ease;
}

@keyframes ain-quota-flash {
    0% {
        background: rgba(0, 217, 192, 0.25);
        border-color: var(--secondary);
    }

    100% {
        background: var(--card);
        border-color: var(--border);
    }
}

.ain-root .drawer .tool-grid {
    grid-template-columns: 1fr;
}

.ain-root /* ---------- Utility ---------- */
.muted {
    color: var(--text-2);
}

.ain-root .hint {
    color: var(--text-3);
    font-size: 12.5px;
}

.ain-root .row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ain-root .row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.ain-root .stack-8 > * + * {
    margin-top: 8px;
}

.ain-root .stack-14 > * + * {
    margin-top: 14px;
}

.ain-root .empty-state {
    text-align: center;
    color: var(--text-3);
    font-size: 13.5px;
    padding: 26px 10px;
}

