/* ============================================================================
   ARISTOS ATLAS — APPLICATION UI
   Extends atlas.css brand tokens for the productivity surface.
   Sidebar shell · Topbar · Page headers · Cards · Lists · Chat · Drawer · Forms
   ============================================================================ */

/* ============================================================================
   1. APP-SPECIFIC TOKENS & BASE OVERRIDES
   ============================================================================ */
:root {
    --app-sidebar-w:    268px;
    --app-topbar-h:     68px;
    --app-drawer-w:     520px;
    --app-max:          1440px;

    --surface:          #FFFFFF;
    --surface-2:        #FAFAFC;
    --surface-3:        #F4F3F9;
    --surface-4:        #EDECF4;
    --border:           #E5E4EE;
    --border-2:         #DCDAE8;
    --border-dark:      rgba(152, 137, 192, 0.20);

    /* Semantic colors (stay within the brand palette) */
    --ok:               #6A8A6B;
    --ok-soft:          rgba(106, 138, 107, 0.14);
    --warn:             #C59358;
    --warn-soft:        rgba(197, 147, 88, 0.14);
    --danger:           #B64B5B;
    --danger-soft:      rgba(182, 75, 91, 0.14);
    --info:             #6A7BA6;
    --info-soft:        rgba(106, 123, 166, 0.14);
}

body.app {
    background: var(--surface-2);
    color: var(--ink);
    min-height: 100vh;
    font-size: 0.95rem;
    line-height: 1.55;
    overflow: hidden; /* main area scrolls */
}

body.app * { box-sizing: border-box; }

body.app p { max-width: none; }

/* Hide the rail/corner from atlas.css if somehow present */
body.app .rail,
body.app .corner-tr,
body.app .scroll-progress,
body.app .grain { display: none !important; }

/* ============================================================================
   2. APP SHELL
   ============================================================================ */
.app-shell {
    display: grid;
    grid-template-columns: var(--app-sidebar-w) 1fr;
    grid-template-rows: 100vh;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.app-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: var(--surface-2);
}

.app-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2rem clamp(1.5rem, 3vw, 2.5rem) 4rem;
    scroll-padding-top: 2rem;
    position: relative;
}

.app-content {
    scrollbar-width: thin;
    scrollbar-color: var(--border-2) transparent;
}
.app-content::-webkit-scrollbar { width: 10px; }
.app-content::-webkit-scrollbar-track { background: transparent; }
.app-content::-webkit-scrollbar-thumb {
    background: var(--border-2);
    border-radius: var(--r-pill);
    border: 2px solid transparent;
    background-clip: padding-box;
}
.app-content::-webkit-scrollbar-thumb:hover { background: var(--lavender-d); background-clip: padding-box; }

/* ============================================================================
   3. SIDEBAR
   ============================================================================ */
.sidebar {
    background: var(--mesh-dark);
    color: var(--lavender-ll);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--jacarta-dd);
    position: relative;
    overflow: hidden;
}

.sidebar::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(600px circle at 50% 0%, rgba(152, 137, 192, 0.12), transparent 60%),
        radial-gradient(500px circle at 50% 100%, rgba(196, 156, 224, 0.08), transparent 60%);
    pointer-events: none;
}

.sidebar > * { position: relative; z-index: 1; }

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-bottom: 1px solid rgba(152, 137, 192, 0.14);
    text-decoration: none;
}

.sidebar-brand-mark {
    width: 36px;
    height: 36px;
    background-image: url('../img/favicon.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    filter: drop-shadow(0 2px 8px rgba(196, 156, 224, 0.35));
    transition: transform var(--t) var(--ease-spring);
}

.sidebar-brand:hover .sidebar-brand-mark { transform: rotate(-8deg) scale(1.05); }

.sidebar-brand-lockup {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1;
}

.sidebar-brand-name {
    font-family: var(--ff-display);
    font-size: 1.3rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--white);
}

.sidebar-brand-sys {
    font-family: var(--ff-heading);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--lavender-d);
}

/* User card */
.sidebar-user {
    padding: 1rem 1.25rem;
    margin: 1rem 0.75rem 0;
    border: 1px solid rgba(152, 137, 192, 0.16);
    border-radius: var(--r);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(152, 137, 192, 0.06);
    transition: border-color var(--t) var(--ease);
    cursor: pointer;
}

.sidebar-user:hover { border-color: rgba(196, 156, 224, 0.4); }

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--iris), var(--lavender));
    display: grid;
    place-items: center;
    font-family: var(--ff-heading);
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--jacarta-dd);
    letter-spacing: -0.01em;
    flex-shrink: 0;
}

.sidebar-user-meta {
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}

.sidebar-user-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-workspace {
    font-size: 0.7rem;
    color: var(--lavender-d);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.sidebar-user-chev {
    width: 14px;
    height: 14px;
    color: var(--lavender-d);
    flex-shrink: 0;
}

/* Nav sections */
.sidebar-nav {
    padding: 1.5rem 0.75rem 0;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    /* Ghost scrollbar — invisible by default, reveals on sidebar hover */
    scrollbar-width: none;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.3s ease;
}

.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 3px;
    transition: background 0.3s ease;
}

/* Reveal on sidebar hover */
.sidebar:hover .sidebar-nav { scrollbar-width: thin; scrollbar-color: rgba(152, 137, 192, 0.35) transparent; }
.sidebar:hover .sidebar-nav::-webkit-scrollbar-thumb { background: rgba(152, 137, 192, 0.35); }
.sidebar:hover .sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(152, 137, 192, 0.6); }

.sidebar-section-label {
    font-family: var(--ff-heading);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.34em;
    text-transform: uppercase;
    color: var(--lavender-d);
    padding: 1rem 0.75rem 0.5rem;
    display: block;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    border-radius: var(--r-sm);
    color: var(--lavender-ll);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
    position: relative;
    cursor: pointer;
}

.sidebar-item:hover {
    background: rgba(152, 137, 192, 0.08);
    color: var(--white);
}

.sidebar-item.active {
    background: linear-gradient(90deg, rgba(196, 156, 224, 0.16), rgba(152, 137, 192, 0.04));
    color: var(--white);
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: -0.75rem;
    top: 20%;
    bottom: 20%;
    width: 3px;
    border-radius: 3px;
    background: var(--grad-accent);
    box-shadow: 0 0 14px var(--iris-soft);
}

.sidebar-item-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: currentColor;
    opacity: 0.78;
}

.sidebar-item.active .sidebar-item-icon { opacity: 1; color: var(--iris); }

.sidebar-item-label { flex: 1; }

.sidebar-item-badge {
    background: var(--iris);
    color: var(--jacarta-dd);
    font-family: var(--ff-heading);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.45rem;
    border-radius: var(--r-pill);
    min-width: 20px;
    text-align: center;
}

.sidebar-item-kbd {
    font-family: var(--ff-mono);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--lavender-d);
    background: rgba(10, 8, 32, 0.4);
    padding: 0.12rem 0.4rem;
    border-radius: 4px;
    border: 1px solid rgba(152, 137, 192, 0.2);
}

.sidebar-footer {
    padding: 1rem 1rem 1.25rem;
    border-top: 1px solid rgba(152, 137, 192, 0.14);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-status {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.5rem;
    font-size: 0.72rem;
    color: var(--lavender-d);
    border-radius: var(--r-sm);
}

.sidebar-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 8px rgba(106, 138, 107, 0.5);
    animation: pulse-dot 2.5s ease-in-out infinite;
    flex-shrink: 0;
}

.sidebar-status-dot.ok { background: #7BD38E; box-shadow: 0 0 8px rgba(123, 211, 142, 0.5); }
.sidebar-status-dot.iris { background: var(--iris); box-shadow: 0 0 10px var(--iris-soft); }

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

.sidebar-status-text {
    color: var(--lavender-ll);
    font-weight: 600;
}

.sidebar-status-meta {
    color: var(--lavender-d);
    margin-left: auto;
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
}

/* Sidebar mobile toggle */
.sidebar-backdrop { display: none; }

@media (max-width: 960px) {
    .app-shell {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: var(--app-sidebar-w);
        max-width: 85vw;
        transform: translateX(-100%);
        transition: transform var(--t) var(--ease-out);
        z-index: 80;
        box-shadow: 0 10px 60px rgba(10, 8, 32, 0.4);
    }
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }
    body.sidebar-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(10, 8, 32, 0.55);
        backdrop-filter: blur(4px);
        z-index: 70;
    }
}

/* ============================================================================
   4. TOP BAR
   ============================================================================ */
.topbar {
    height: var(--app-topbar-h);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 clamp(1.25rem, 3vw, 2.5rem);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: saturate(160%) blur(18px);
    -webkit-backdrop-filter: saturate(160%) blur(18px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-menu {
    display: none;
    width: 38px;
    height: 38px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--ink-2);
}

@media (max-width: 960px) {
    .topbar-menu { display: flex; }
}

.topbar-crumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--ff-heading);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ink-3);
    letter-spacing: 0.02em;
}

.topbar-crumbs .sep {
    color: var(--ink-4);
    font-weight: 400;
}

.topbar-crumbs .current {
    color: var(--jacarta);
    font-weight: 800;
}

.topbar-search {
    margin-left: auto;
    flex: 1;
    max-width: 460px;
    position: relative;
}

.topbar-search input {
    width: 100%;
    height: 40px;
    padding: 0 2.75rem 0 2.75rem;
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    background: var(--surface-3);
    font-size: 0.87rem;
    color: var(--ink);
    font-family: inherit;
    transition: all var(--t) var(--ease);
}

.topbar-search input::placeholder { color: var(--ink-3); }

.topbar-search input:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--lavender);
    box-shadow: 0 0 0 4px var(--lavender-10);
}

.topbar-search-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--ink-3);
    pointer-events: none;
}

.topbar-search-kbd {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--ff-mono);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--ink-3);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.15rem 0.45rem;
    border-radius: 5px;
    pointer-events: none;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

@media (max-width: 960px) {
    .topbar-search { display: none; }
}

/* ============================================================================
   5. BUTTONS
   ============================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 1rem;
    height: 40px;
    border-radius: var(--r-sm);
    font-family: var(--ff-heading);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--t-fast) var(--ease);
    white-space: nowrap;
    text-decoration: none;
    font-family: inherit;
}

.btn:focus-visible {
    outline: 2px solid var(--iris);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--jacarta);
    color: var(--white);
    border-color: var(--jacarta);
}
.btn-primary:hover {
    background: var(--jacarta-d);
    border-color: var(--jacarta-d);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(45, 39, 105, 0.22);
    color: var(--white);
}

.btn-accent {
    background: var(--grad-accent);
    color: var(--white);
    border: none;
    position: relative;
}
.btn-accent:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--iris-soft);
    color: var(--white);
}

.btn-secondary {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--border);
}
.btn-secondary:hover {
    border-color: var(--lavender);
    color: var(--jacarta);
    background: var(--surface);
}

.btn-ghost {
    background: transparent;
    color: var(--ink-2);
    border-color: transparent;
}
.btn-ghost:hover {
    background: var(--surface-3);
    color: var(--jacarta);
}

.btn-danger {
    background: var(--surface);
    color: var(--danger);
    border-color: var(--border);
}
.btn-danger:hover {
    background: var(--danger-soft);
    border-color: var(--danger);
}

.btn-sm {
    height: 32px;
    padding: 0 0.75rem;
    font-size: 0.76rem;
    border-radius: 6px;
}

.btn-lg {
    height: 48px;
    padding: 0 1.5rem;
    font-size: 0.9rem;
}

.btn-icon {
    width: 40px;
    padding: 0;
    flex-shrink: 0;
}

.btn-icon.btn-sm { width: 32px; }

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-lg svg { width: 18px; height: 18px; }

/* ============================================================================
   6. PAGE HEADER
   ============================================================================ */
.page {
    max-width: var(--app-max);
    margin: 0 auto;
    animation: page-in 400ms var(--ease-out);
}

@keyframes page-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

.page-head {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.page-head-main { flex: 1; min-width: 0; }

.page-eyebrow {
    font-family: var(--ff-heading);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--lavender-d);
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.page-eyebrow-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--iris);
    box-shadow: 0 0 8px var(--iris-soft);
}

.page-title {
    font-family: var(--ff-heading);
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 800;
    color: var(--jacarta);
    line-height: 1.05;
    letter-spacing: -0.025em;
    margin: 0 0 0.5rem;
}

.page-deck {
    font-size: 1rem;
    color: var(--ink-2);
    max-width: 62ch;
    line-height: 1.55;
    margin: 0;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ============================================================================
   7. CARDS (generic)
   ============================================================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease),
                transform var(--t) var(--ease-out);
    overflow: hidden;
}

.card-hover:hover {
    border-color: var(--lavender);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.card-body {
    padding: 1.5rem;
}

.card-head {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-head-title {
    font-family: var(--ff-heading);
    font-size: 1rem;
    font-weight: 800;
    color: var(--jacarta);
    letter-spacing: -0.01em;
    margin: 0;
}

.card-head-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-foot {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.82rem;
    color: var(--ink-3);
    background: var(--surface-3);
}

/* Dark brand card for hero moments inside the app */
.card-brand {
    background: var(--mesh-dark);
    color: var(--lavender-lll);
    border-color: var(--jacarta-dd);
    position: relative;
    overflow: hidden;
}

.card-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(500px circle at 80% 20%, rgba(196, 156, 224, 0.18), transparent 55%),
        radial-gradient(400px circle at 10% 100%, rgba(152, 137, 192, 0.14), transparent 55%);
    pointer-events: none;
}

.card-brand > * { position: relative; z-index: 1; }

.card-brand .card-head-title,
.card-brand h1, .card-brand h2, .card-brand h3, .card-brand h4 { color: var(--white); }

.card-brand .card-head { border-bottom-color: rgba(152, 137, 192, 0.18); }
.card-brand .card-foot { background: rgba(0, 0, 0, 0.25); border-top-color: rgba(152, 137, 192, 0.18); color: var(--lavender-l); }

/* Accented card with left gradient bar */
.card-accent {
    position: relative;
    padding-left: 4px;
}

.card-accent::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--grad-accent);
    border-radius: 4px 0 0 4px;
}

/* ============================================================================
   8. METRIC / PULSE WIDGETS
   ============================================================================ */
.metric-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.metric {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 1.25rem 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all var(--t) var(--ease);
}

.metric:hover {
    border-color: var(--lavender);
    box-shadow: var(--shadow-sm);
}

.metric-label {
    font-family: var(--ff-heading);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.metric-value {
    font-family: var(--ff-heading);
    font-size: 2rem;
    font-weight: 800;
    color: var(--jacarta);
    line-height: 1;
    letter-spacing: -0.03em;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.metric-value-unit {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink-3);
    letter-spacing: 0;
}

.metric-delta {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ink-3);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.metric-delta.up { color: var(--ok); }
.metric-delta.down { color: var(--danger); }

.metric-spark {
    position: absolute;
    right: 1rem;
    top: 1rem;
    opacity: 0.22;
    color: var(--lavender);
}

/* ============================================================================
   9. ENTITY AVATAR & CHIP
   ============================================================================ */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--iris), var(--lavender));
    color: var(--jacarta-dd);
    display: inline-grid;
    place-items: center;
    font-family: var(--ff-heading);
    font-weight: 800;
    font-size: 0.82rem;
    letter-spacing: -0.01em;
    flex-shrink: 0;
    position: relative;
}

.avatar-sm { width: 24px; height: 24px; font-size: 0.65rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.2rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.6rem; }

/* Entity color variants — deterministic by class */
.avatar.a-2 { background: linear-gradient(135deg, #9FC4E8, #7BB0FF); }
.avatar.a-3 { background: linear-gradient(135deg, #F6C897, #E8A65A); color: #3B2413; }
.avatar.a-4 { background: linear-gradient(135deg, #BDE5C8, #7FC795); color: #1E3522; }
.avatar.a-5 { background: linear-gradient(135deg, #E8B4DD, #D98EC7); }
.avatar.a-6 { background: linear-gradient(135deg, #CFC3F2, #A791E5); }
.avatar.a-7 { background: linear-gradient(135deg, #F5B5B5, #E87A7A); }
.avatar.a-8 { background: linear-gradient(135deg, #B5D3D3, #7AAFAF); }

.avatar-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--surface);
    background: var(--ok);
}

/* Entity chip (inline with avatar + name) */
.entity-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.25rem 0.65rem 0.25rem 0.25rem;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    transition: all var(--t-fast) var(--ease);
    cursor: pointer;
    white-space: nowrap;
}

.entity-chip:hover {
    background: var(--surface);
    border-color: var(--lavender);
    color: var(--jacarta);
}

.entity-chip .avatar { width: 22px; height: 22px; font-size: 0.6rem; }

/* ============================================================================
   10. PILLS & STATUS BADGES
   ============================================================================ */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.22rem 0.7rem;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    font-family: var(--ff-heading);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--ink-2);
    letter-spacing: 0.02em;
    line-height: 1.5;
}

.pill .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.pill-ok      { color: var(--ok);     background: var(--ok-soft);    border-color: transparent; }
.pill-warn    { color: var(--warn);   background: var(--warn-soft);  border-color: transparent; }
.pill-danger  { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.pill-info    { color: var(--info);   background: var(--info-soft);  border-color: transparent; }
.pill-brand   { color: var(--jacarta); background: var(--lavender-10); border-color: var(--lavender-20); }
.pill-iris    { color: var(--jacarta-dd); background: var(--iris); border-color: var(--iris); }

.pill-sm { font-size: 0.62rem; padding: 0.1rem 0.5rem; }

/* Status-specific named pills */
.status-live     { color: var(--ok);     background: var(--ok-soft); }
.status-draft    { color: var(--info);   background: var(--info-soft); }
.status-pending  { color: var(--warn);   background: var(--warn-soft); }
.status-stale    { color: var(--danger); background: var(--danger-soft); }
.status-done     { color: var(--ink-3);  background: var(--surface-3); }

/* ============================================================================
   11. LISTS & ROWS (feed / commitments / people)
   ============================================================================ */
.list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
}

.list-row {
    display: grid;
    grid-template-columns: 84px 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    transition: background var(--t-fast) var(--ease);
    cursor: pointer;
    position: relative;
}

.list-row:last-child { border-bottom: none; }

.list-row:hover { background: var(--surface-3); }

.list-row-time {
    font-family: var(--ff-heading);
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--ink-3);
    letter-spacing: 0.01em;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.15;
}

.list-row-time .abs {
    font-size: 0.65rem;
    color: var(--ink-4);
    font-weight: 600;
}

.list-row-main {
    min-width: 0;
}

.list-row-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.35rem;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.list-row-title .kind {
    font-family: var(--ff-heading);
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--lavender-d);
    flex-shrink: 0;
}

.list-row-sub {
    font-size: 0.84rem;
    color: var(--ink-2);
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.list-row-chips {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.list-row-aside {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

@media (max-width: 700px) {
    .list-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    .list-row-time { flex-direction: row; }
    .list-row-aside { justify-self: flex-start; }
}

/* ============================================================================
   12. GRID (cards in 2/3 column layouts)
   ============================================================================ */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.grid-auto-sm { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-auto    { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-auto-lg { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }

.grid-sidebar {
    grid-template-columns: 1fr 320px;
    gap: 1.25rem;
}

@media (max-width: 900px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .grid-sidebar { grid-template-columns: 1fr; }
}

/* ============================================================================
   13. BRIEF — the morning hero card
   ============================================================================ */
.brief-hero {
    background: var(--mesh-hero);
    color: var(--lavender-lll);
    border-radius: var(--r-xl);
    padding: clamp(2rem, 4vw, 3.5rem);
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.brief-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(500px circle at 85% 15%, rgba(196, 156, 224, 0.22), transparent 55%),
        radial-gradient(500px circle at 15% 90%, rgba(152, 137, 192, 0.18), transparent 55%);
    pointer-events: none;
}

.brief-hero-orbit {
    position: absolute;
    top: 50%;
    right: -80px;
    transform: translateY(-50%);
    width: 340px;
    height: 340px;
    background-image: url('../img/favicon.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.12;
    filter: drop-shadow(0 20px 60px rgba(196, 156, 224, 0.35));
    pointer-events: none;
    animation: brief-orb 18s ease-in-out infinite alternate;
}

@keyframes brief-orb {
    0%   { transform: translateY(-50%) rotate(0) scale(1); }
    100% { transform: translateY(-50%) rotate(12deg) scale(1.06); }
}

.brief-hero > * { position: relative; z-index: 1; }

.brief-date {
    font-family: var(--ff-heading);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--lavender-l);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.brief-date-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--iris);
    box-shadow: 0 0 10px var(--iris-soft);
    animation: pulse-dot 2.5s ease-in-out infinite;
}

.brief-greeting {
    font-family: var(--ff-display);
    font-size: clamp(2rem, 4.5vw, 3.75rem);
    font-weight: 500;
    letter-spacing: 0.03em;
    line-height: 1;
    color: var(--white);
    margin: 0 0 1.25rem;
    max-width: 18ch;
}

.brief-summary {
    font-family: var(--ff-tag);
    font-size: clamp(1.1rem, 1.8vw, 1.35rem);
    font-style: italic;
    font-weight: 400;
    color: var(--lavender-ll);
    line-height: 1.45;
    max-width: 46ch;
    margin: 0;
}

/* The callout inside the brief summary — must read cleanly on dark purple */
.brief-accent {
    color: var(--white);
    font-style: normal;
    font-weight: 600;
    position: relative;
    padding: 0 0.08em;
    background: linear-gradient(180deg, transparent 62%, rgba(196, 156, 224, 0.28) 62%, rgba(196, 156, 224, 0.28) 100%);
    text-shadow: 0 0 24px rgba(196, 156, 224, 0.45);
}

.brief-hero-foot {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(152, 137, 192, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    font-family: var(--ff-heading);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--lavender-l);
    flex-wrap: wrap;
}

/* Decision card — featured */
.decision-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    position: relative;
    margin-bottom: 2rem;
}

.decision-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 6px;
    background: var(--grad-accent);
}

.decision-card-head {
    padding: 1.5rem 1.75rem 0.75rem;
}

.decision-kicker {
    font-family: var(--ff-heading);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.34em;
    text-transform: uppercase;
    color: var(--iris);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.decision-title {
    font-family: var(--ff-heading);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--jacarta);
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 0 0 0.5rem;
}

.decision-context {
    color: var(--ink-2);
    font-size: 0.95rem;
    padding: 0 1.75rem 1.25rem;
    line-height: 1.55;
    border-bottom: 1px solid var(--border);
}

.decision-options {
    padding: 1.25rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.decision-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
    transition: all var(--t-fast) var(--ease);
    cursor: pointer;
}

.decision-option:hover {
    border-color: var(--lavender);
    background: var(--surface-3);
}

.decision-option.recommended {
    border-color: var(--iris);
    background: linear-gradient(90deg, rgba(196, 156, 224, 0.06), transparent);
}

.decision-option-main { min-width: 0; flex: 1; }
.decision-option-title {
    font-weight: 700;
    color: var(--ink);
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.decision-option-sub {
    font-size: 0.8rem;
    color: var(--ink-3);
    margin-top: 0.15rem;
}

.decision-card-foot {
    padding: 1rem 1.75rem;
    border-top: 1px solid var(--border);
    background: var(--surface-3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--ink-3);
}

/* ============================================================================
   14. SECTION HEADERS within a page
   ============================================================================ */
.section-h {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 2rem 0 1rem;
}

.section-h-title {
    font-family: var(--ff-heading);
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--jacarta);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.section-h-title .count {
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ink-3);
    background: var(--surface-3);
    padding: 0.15rem 0.5rem;
    border-radius: var(--r-pill);
}

.section-h-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-h-link {
    font-family: var(--ff-heading);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--lavender-d);
    text-decoration: none;
    transition: color var(--t-fast) var(--ease);
}

.section-h-link:hover { color: var(--jacarta); }

/* ============================================================================
   15. FILTER / TAB BAR
   ============================================================================ */
.filters {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    margin-bottom: 1.5rem;
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}

.filters::-webkit-scrollbar { display: none; }

.filter {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    font-family: var(--ff-heading);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ink-3);
    cursor: pointer;
    border-radius: var(--r-pill);
    transition: all var(--t-fast) var(--ease);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.filter:hover { color: var(--jacarta); }

.filter.active {
    background: var(--jacarta);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(45, 39, 105, 0.22);
}

.filter-count {
    font-family: var(--ff-mono);
    font-size: 0.7rem;
    opacity: 0.72;
}

/* ============================================================================
   16. SCOPE MATRIX TABLE (tender detail)
   ============================================================================ */
.matrix {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
}

.matrix thead th {
    text-align: left;
    padding: 1rem 1.25rem;
    background: var(--surface-3);
    font-family: var(--ff-heading);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--ink-3);
    border-bottom: 1px solid var(--border);
}

.matrix tbody td {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--ink);
}

.matrix tbody tr:last-child td { border-bottom: none; }

.matrix tbody tr:hover td { background: var(--surface-3); }

.matrix .w-weight { width: 80px; font-family: var(--ff-mono); font-weight: 700; color: var(--jacarta); }
.matrix .w-status { width: 140px; }
.matrix .w-action { width: 180px; text-align: right; }

.matrix-criterion {
    font-weight: 700;
    color: var(--jacarta);
    margin-bottom: 0.35rem;
    font-size: 0.92rem;
}

.matrix-note {
    font-size: 0.8rem;
    color: var(--ink-3);
    font-style: italic;
}

.matrix-draft {
    color: var(--ink-2);
    font-size: 0.88rem;
    line-height: 1.55;
    max-width: 48ch;
}

.matrix-evidence {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    color: var(--lavender-d);
    margin-top: 0.5rem;
    font-weight: 600;
}

/* ============================================================================
   17. CHAT
   ============================================================================ */
.chat-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    height: calc(100vh - var(--app-topbar-h) - 4rem);
    min-height: 600px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
}

.chat-threads {
    background: var(--surface-3);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 0.75rem;
    scrollbar-width: none;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.3s ease;
}
.chat-threads::-webkit-scrollbar { width: 6px; }
.chat-threads::-webkit-scrollbar-track { background: transparent; }
.chat-threads::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; transition: background 0.3s ease; }
.chat-threads:hover { scrollbar-width: thin; scrollbar-color: rgba(152, 137, 192, 0.3) transparent; }
.chat-threads:hover::-webkit-scrollbar-thumb { background: rgba(152, 137, 192, 0.3); }

.chat-thread {
    padding: 0.75rem 0.9rem;
    border-radius: var(--r);
    cursor: pointer;
    transition: background var(--t-fast) var(--ease);
    margin-bottom: 2px;
}

.chat-thread:hover { background: var(--surface); }

.chat-thread.active {
    background: var(--surface);
    border: 1px solid var(--lavender-20);
}

.chat-thread-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--jacarta);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-thread-preview {
    font-size: 0.76rem;
    color: var(--ink-3);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chat-thread-time {
    font-family: var(--ff-mono);
    font-size: 0.68rem;
    color: var(--ink-4);
    margin-top: 0.35rem;
}

.chat-convo {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-convo-head {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--surface);
}

.chat-convo-title {
    font-family: var(--ff-heading);
    font-size: 1rem;
    font-weight: 800;
    color: var(--jacarta);
}

.chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    scrollbar-width: none;
    scrollbar-color: transparent transparent;
    gap: 1.25rem;
    transition: scrollbar-color 0.3s ease;
}

.chat-log::-webkit-scrollbar { width: 6px; }
.chat-log::-webkit-scrollbar-track { background: transparent; }
.chat-log::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; transition: background 0.3s ease; }
.chat-convo:hover .chat-log { scrollbar-width: thin; scrollbar-color: rgba(45, 39, 105, 0.2) transparent; }
.chat-convo:hover .chat-log::-webkit-scrollbar-thumb { background: rgba(45, 39, 105, 0.22); }

.chat-msg {
    display: flex;
    gap: 0.85rem;
    max-width: 90%;
}

.chat-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    background-image: url('../img/favicon.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

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

.chat-msg.user .chat-msg-avatar {
    background-image: none;
    background: linear-gradient(135deg, var(--iris), var(--lavender));
    color: var(--jacarta-dd);
    display: grid;
    place-items: center;
    font-family: var(--ff-heading);
    font-weight: 800;
    font-size: 0.72rem;
}

.chat-msg-bubble {
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 0.9rem 1.1rem;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--ink);
    max-width: 100%;
    position: relative;
}

.chat-msg.user .chat-msg-bubble {
    background: var(--jacarta);
    color: var(--white);
    border-color: var(--jacarta);
}

.chat-msg.user .chat-msg-bubble strong { color: var(--iris); }

/* mdLite wraps every message in <p>. The global `p { color: var(--ink) }` in
   atlas.css was beating the bubble color — force inheritance + tighten margins. */
.chat-msg-bubble p {
    color: inherit;
    margin: 0 0 0.55em;
    text-wrap: pretty;
}
.chat-msg-bubble p:last-child { margin-bottom: 0; }
.chat-msg-bubble ol,
.chat-msg-bubble ul {
    margin: 0.3em 0 0.55em;
    padding-left: 1.3em;
    color: inherit;
}
.chat-msg-bubble li { margin-bottom: 0.2em; }
.chat-msg-bubble li:last-child { margin-bottom: 0; }
.chat-msg-bubble strong { font-weight: 700; }
.chat-msg.assistant .chat-msg-bubble strong { color: var(--jacarta); }

.chat-msg-meta {
    font-family: var(--ff-mono);
    font-size: 0.68rem;
    color: var(--ink-4);
    margin-top: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-msg-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.6rem;
    flex-wrap: wrap;
}

.chat-sources {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px dashed var(--border);
    font-size: 0.78rem;
    color: var(--ink-3);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.chat-suggestions {
    padding: 1rem 2rem 0;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.chat-suggestion {
    padding: 0.5rem 0.85rem;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink-2);
    cursor: pointer;
    transition: all var(--t-fast) var(--ease);
    font-family: inherit;
}

.chat-suggestion:hover {
    background: var(--surface);
    border-color: var(--lavender);
    color: var(--jacarta);
}

.chat-composer {
    padding: 1rem 1.5rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    align-items: flex-end;
    gap: 0.6rem;
}

.chat-composer-input {
    flex: 1;
    min-height: 44px;
    max-height: 200px;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface-3);
    font-family: inherit;
    font-size: 0.92rem;
    color: var(--ink);
    resize: none;
    line-height: 1.45;
    transition: all var(--t) var(--ease);
}

.chat-composer-input:focus {
    outline: none;
    border-color: var(--lavender);
    box-shadow: 0 0 0 4px var(--lavender-10);
    background: var(--surface);
}

.chat-composer-input::placeholder { color: var(--ink-3); }

@media (max-width: 900px) {
    .chat-shell { grid-template-columns: 1fr; height: auto; min-height: 70vh; }
    .chat-threads { display: none; }
}

/* ============================================================================
   18. CAPTURE DROP ZONE
   ============================================================================ */
.dropzone {
    border: 2px dashed var(--border-2);
    border-radius: var(--r-xl);
    padding: 3.5rem 2rem;
    text-align: center;
    background: var(--surface-3);
    transition: all var(--t) var(--ease);
    position: relative;
    cursor: pointer;
}

.dropzone:hover,
.dropzone.drag {
    border-color: var(--lavender);
    background: var(--lavender-10);
}

.dropzone.drag {
    border-color: var(--iris);
    background: rgba(196, 156, 224, 0.08);
    transform: scale(1.005);
}

.dropzone-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1.25rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--lavender);
    box-shadow: var(--shadow-sm);
}

.dropzone-title {
    font-family: var(--ff-heading);
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--jacarta);
    margin-bottom: 0.5rem;
    letter-spacing: -0.015em;
}

.dropzone-sub {
    color: var(--ink-2);
    font-size: 0.9rem;
    line-height: 1.55;
    max-width: 50ch;
    margin: 0 auto 1.5rem;
}

.dropzone-methods {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.capture-queue {
    margin-top: 2rem;
}

.capture-item {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    gap: 0.85rem;
    align-items: center;
    padding: 0.85rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    margin-bottom: 0.5rem;
    transition: all var(--t-fast) var(--ease);
}

.capture-item:hover { border-color: var(--lavender); }

.capture-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--surface-3);
    color: var(--lavender-d);
}

.capture-item-main { min-width: 0; }

.capture-item-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.capture-item-meta {
    font-size: 0.76rem;
    color: var(--ink-3);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.capture-item-status {
    flex-shrink: 0;
}

/* ============================================================================
   19. SETTINGS
   ============================================================================ */
.settings-group {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    margin-bottom: 1rem;
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.settings-row:last-child { border-bottom: none; }

.settings-row-main { flex: 1; min-width: 0; }

.settings-row-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--jacarta);
    margin-bottom: 0.25rem;
    letter-spacing: -0.01em;
}

.settings-row-sub {
    font-size: 0.82rem;
    color: var(--ink-2);
    line-height: 1.55;
    max-width: 60ch;
}

/* Toggle switch */
.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}

.toggle input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.toggle-track {
    position: absolute;
    inset: 0;
    background: var(--border-2);
    border-radius: var(--r-pill);
    transition: background var(--t) var(--ease);
}

.toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--white);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    transition: transform var(--t) var(--ease-spring);
}

.toggle input:checked ~ .toggle-track {
    background: var(--grad-accent);
}

.toggle input:checked ~ .toggle-thumb {
    transform: translateX(20px);
}

.toggle input:focus-visible ~ .toggle-track {
    box-shadow: 0 0 0 3px var(--lavender-20);
}

/* ============================================================================
   20. DRAWER (right slide-in)
   ============================================================================ */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 8, 32, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t) var(--ease);
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--app-drawer-w);
    max-width: 92vw;
    background: var(--surface);
    box-shadow: -20px 0 60px rgba(10, 8, 32, 0.16);
    z-index: 95;
    transform: translateX(100%);
    transition: transform var(--t) var(--ease-out);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.drawer.open { transform: translateX(0); }
.drawer.open ~ .drawer-backdrop,
body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }

.drawer-head {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.drawer-head-main { flex: 1; min-width: 0; }

.drawer-eyebrow {
    font-family: var(--ff-heading);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--lavender-d);
    margin-bottom: 0.35rem;
}

.drawer-title {
    font-family: var(--ff-heading);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--jacarta);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.drawer-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink-2);
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--t-fast) var(--ease);
}

.drawer-close:hover { background: var(--surface-3); color: var(--jacarta); border-color: var(--lavender); }

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    scrollbar-width: none;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.3s ease;
}
.drawer-body::-webkit-scrollbar { width: 6px; }
.drawer-body::-webkit-scrollbar-track { background: transparent; }
.drawer-body::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; transition: background 0.3s ease; }
.drawer:hover .drawer-body { scrollbar-width: thin; scrollbar-color: rgba(45, 39, 105, 0.2) transparent; }
.drawer:hover .drawer-body::-webkit-scrollbar-thumb { background: rgba(45, 39, 105, 0.22); }

.drawer-foot {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--surface-3);
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* Form primitives used by drawers (change password, invite user, edit user). */
.drawer-lead {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--ink-2);
}

.drawer-label {
    display: block;
    margin: 0.35rem 0 -0.25rem;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.drawer-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid rgba(45, 39, 105, 0.14);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.92rem;
    color: var(--ink-1);
    background: var(--surface);
    transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.drawer-input:focus {
    outline: none;
    border-color: var(--iris);
    box-shadow: 0 0 0 4px rgba(196, 156, 224, 0.14);
}
.drawer-input:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    background: var(--surface-2);
}
select.drawer-input {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232d2769' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 16px;
    padding-right: 2.2rem;
}

/* ============================================================================
   21. TOAST
   ============================================================================ */
.toast-stack {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.95rem 1.1rem;
    background: var(--jacarta-dd);
    color: var(--lavender-ll);
    border-radius: var(--r);
    box-shadow: 0 12px 36px rgba(10, 8, 32, 0.35);
    font-size: 0.88rem;
    min-width: 280px;
    max-width: 420px;
    pointer-events: auto;
    animation: toast-in 320ms var(--ease-out);
    border: 1px solid rgba(152, 137, 192, 0.22);
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--iris);
}

.toast-icon {
    width: 18px;
    height: 18px;
    color: var(--iris);
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-main { flex: 1; }

.toast-title {
    font-weight: 800;
    color: var(--white);
    margin-bottom: 2px;
    font-size: 0.88rem;
    letter-spacing: -0.005em;
}

.toast-msg { font-size: 0.82rem; color: var(--lavender-ll); line-height: 1.45; }

.toast.out { animation: toast-out 280ms var(--ease-in) forwards; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

@keyframes toast-out {
    to { opacity: 0; transform: translateY(14px) scale(0.98); }
}

/* ============================================================================
   22. EMPTY & LOADING STATES
   ============================================================================ */
.empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--ink-2);
}

.empty-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1.25rem;
    color: var(--lavender-d);
    opacity: 0.6;
}

.empty-title {
    font-family: var(--ff-heading);
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--jacarta);
    margin-bottom: 0.4rem;
}

.empty-sub {
    font-size: 0.9rem;
    color: var(--ink-3);
    max-width: 46ch;
    margin: 0 auto 1.5rem;
    line-height: 1.55;
}

.skeleton {
    background: linear-gradient(90deg,
        var(--surface-3) 0%,
        var(--surface-4) 50%,
        var(--surface-3) 100%
    );
    background-size: 200% 100%;
    animation: skeleton 1.4s linear infinite;
    border-radius: var(--r-sm);
}

@keyframes skeleton {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* ============================================================================
   23. UTILITIES (app-scoped)
   ============================================================================ */
.row       { display: flex; align-items: center; gap: 0.5rem; }
.row-2     { gap: 0.75rem; }
.row-3     { gap: 1rem; }
.row-wrap  { flex-wrap: wrap; }
.col       { display: flex; flex-direction: column; gap: 0.5rem; }
.col-2     { gap: 0.75rem; }
.col-3     { gap: 1rem; }
.col-4     { gap: 1.5rem; }

.spacer    { flex: 1; }

.stack-gap > * + * { margin-top: 1rem; }

.app-reveal {
    animation: app-reveal 500ms var(--ease-out) backwards;
}

@keyframes app-reveal {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

.app-reveal:nth-child(1) { animation-delay: 0ms; }
.app-reveal:nth-child(2) { animation-delay: 40ms; }
.app-reveal:nth-child(3) { animation-delay: 80ms; }
.app-reveal:nth-child(4) { animation-delay: 120ms; }
.app-reveal:nth-child(5) { animation-delay: 160ms; }
.app-reveal:nth-child(6) { animation-delay: 200ms; }
.app-reveal:nth-child(7) { animation-delay: 240ms; }
.app-reveal:nth-child(8) { animation-delay: 280ms; }

/* Kbd shortcut display */
.kbd {
    font-family: var(--ff-mono);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 5px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    color: var(--ink-2);
}

/* Tiny icon that wraps inline content */
.i { display: inline-flex; align-items: center; justify-content: center; vertical-align: -2px; }
.i-sm svg { width: 14px; height: 14px; }
.i svg    { width: 16px; height: 16px; }
.i-lg svg { width: 20px; height: 20px; }

/* ============================================================================
   24. COMMAND PALETTE (global search result overlay)
   ============================================================================ */
.palette-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 8, 32, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 140;
    display: none;
}

body.palette-open .palette-backdrop { display: block; }

.palette {
    position: fixed;
    top: 15vh;
    left: 50%;
    transform: translateX(-50%);
    width: 620px;
    max-width: 92vw;
    max-height: 70vh;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--r-lg);
    box-shadow: 0 32px 80px rgba(10, 8, 32, 0.4);
    z-index: 150;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: palette-in 280ms var(--ease-out);
}

@keyframes palette-in {
    from { opacity: 0; transform: translate(-50%, -8px) scale(0.98); }
    to   { opacity: 1; transform: translateX(-50%) scale(1); }
}

body.palette-open .palette { display: flex; }

.palette-input-wrap {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.palette-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--ink);
    font-family: inherit;
}

.palette-input:focus { outline: none; }

.palette-results {
    overflow-y: auto;
    padding: 0.5rem;
    flex: 1;
}

.palette-group-title {
    font-family: var(--ff-heading);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--ink-3);
    padding: 0.75rem 0.75rem 0.35rem;
}

.palette-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background var(--t-fast) var(--ease);
}

.palette-item:hover,
.palette-item.selected {
    background: var(--lavender-10);
}

.palette-item-icon {
    color: var(--lavender-d);
    flex-shrink: 0;
}

.palette-item-main {
    flex: 1;
    min-width: 0;
}

.palette-item-title {
    font-weight: 600;
    color: var(--ink);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.palette-item-sub {
    font-size: 0.76rem;
    color: var(--ink-3);
}

.palette-item-kbd {
    font-family: var(--ff-mono);
    font-size: 0.72rem;
    color: var(--ink-3);
}

/* ============================================================================
   25. MEETINGS / PREP
   ============================================================================ */
.prep-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    margin-bottom: 1rem;
}

.prep-head {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.prep-time {
    text-align: right;
    min-width: 80px;
}
.prep-time-hour {
    font-family: var(--ff-display);
    font-size: 1.35rem;
    color: var(--jacarta);
    letter-spacing: 0.04em;
}
.prep-time-sub {
    font-family: var(--ff-heading);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-top: 2px;
}

.prep-main { flex: 1; }

.prep-title {
    font-family: var(--ff-heading);
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--jacarta);
    margin-bottom: 0.35rem;
    letter-spacing: -0.015em;
    line-height: 1.25;
}

.prep-sub {
    font-size: 0.85rem;
    color: var(--ink-2);
    margin-bottom: 0.75rem;
}

.prep-attendees {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.prep-body { padding: 1.25rem 1.5rem; }

.prep-block { margin-bottom: 1.25rem; }
.prep-block:last-child { margin-bottom: 0; }

.prep-block-label {
    font-family: var(--ff-heading);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--iris);
    margin-bottom: 0.5rem;
}

.prep-block-body {
    font-size: 0.9rem;
    color: var(--ink);
    line-height: 1.6;
}

.prep-block-body ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.prep-block-body ul li {
    padding-left: 1.25rem;
    position: relative;
    color: var(--ink-2);
}

.prep-block-body ul li::before {
    content: '';
    position: absolute;
    left: 0; top: 0.55em;
    width: 8px;
    height: 2px;
    background: var(--iris);
    border-radius: 2px;
}

/* ============================================================================
   26. DRAFT CARDS
   ============================================================================ */
.draft-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    transition: all var(--t) var(--ease-out);
}

.draft-card:hover { border-color: var(--lavender); box-shadow: var(--shadow-sm); }

.draft-head {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface-3);
}

.draft-kind {
    font-family: var(--ff-heading);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--iris);
}

.draft-to {
    font-size: 0.85rem;
    color: var(--ink-2);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.draft-to strong { color: var(--jacarta); font-weight: 700; }

.draft-time {
    font-family: var(--ff-mono);
    font-size: 0.72rem;
    color: var(--ink-3);
    flex-shrink: 0;
}

.draft-body {
    padding: 1.25rem;
}

.draft-subject {
    font-weight: 700;
    color: var(--jacarta);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.draft-preview {
    color: var(--ink-2);
    font-size: 0.88rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.draft-foot {
    padding: 0.9rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.5rem;
    align-items: center;
    background: var(--surface-2);
}

.draft-foot .chip-row-sm {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
    min-width: 0;
}

/* ============================================================================
   27. COMMITMENTS
   ============================================================================ */
.commit-list-title {
    font-family: var(--ff-heading);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.commit-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    margin-bottom: 0.5rem;
    transition: all var(--t-fast) var(--ease);
}

.commit-row:hover {
    border-color: var(--lavender);
    background: var(--surface-3);
}

.commit-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border-2);
    cursor: pointer;
    background: var(--surface);
    display: grid;
    place-items: center;
    color: transparent;
    transition: all var(--t-fast) var(--ease);
    flex-shrink: 0;
}

.commit-check:hover { border-color: var(--iris); }

.commit-check.done {
    background: var(--iris);
    border-color: var(--iris);
    color: var(--jacarta-dd);
}

.commit-main { min-width: 0; }

.commit-text {
    font-size: 0.92rem;
    color: var(--ink);
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.35rem;
}

.commit-row.done .commit-text {
    text-decoration: line-through;
    color: var(--ink-3);
}

.commit-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.76rem;
    color: var(--ink-3);
    flex-wrap: wrap;
}

.commit-due {
    font-family: var(--ff-heading);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: right;
    min-width: 70px;
}

.commit-due.overdue { color: var(--danger); }
.commit-due.soon    { color: var(--warn); }
.commit-due.ok      { color: var(--ink-3); }

@media (max-width: 640px) {
    .commit-row { grid-template-columns: auto 1fr; }
    .commit-due, .commit-row > :last-child { grid-column: 2; justify-self: start; }
}

/* ============================================================================
   28. SUB-NAV / VIEW TABS
   ============================================================================ */
.subnav {
    display: flex;
    align-items: center;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.subnav::-webkit-scrollbar { display: none; }

.subnav-item {
    padding: 0.85rem 1.25rem;
    border: none;
    background: transparent;
    font-family: var(--ff-heading);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ink-3);
    cursor: pointer;
    position: relative;
    transition: color var(--t-fast) var(--ease);
    letter-spacing: 0.01em;
    white-space: nowrap;
    text-decoration: none;
}

.subnav-item:hover { color: var(--jacarta); }

.subnav-item.active { color: var(--jacarta); }

.subnav-item.active::after {
    content: '';
    position: absolute;
    left: 1.25rem; right: 1.25rem;
    bottom: -1px;
    height: 2px;
    background: var(--grad-accent);
    border-radius: 2px 2px 0 0;
}

.subnav-item .count {
    margin-left: 0.35rem;
    font-family: var(--ff-mono);
    font-weight: 700;
    color: var(--ink-4);
}

/* ============================================================================
   29. PERSON DETAIL (drawer contents)
   ============================================================================ */
.person-hero {
    text-align: center;
    padding: 0 0 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.person-hero .avatar { margin: 0 auto 1rem; }

.person-name {
    font-family: var(--ff-heading);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--jacarta);
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

.person-role {
    font-size: 0.92rem;
    color: var(--ink-2);
    margin-bottom: 0.25rem;
}

.person-company {
    font-family: var(--ff-heading);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--lavender-d);
}

.signal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin: 1rem 0;
}

.signal {
    text-align: center;
    padding: 0.85rem 0.5rem;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--r);
}

.signal-num {
    font-family: var(--ff-display);
    font-size: 1.55rem;
    color: var(--jacarta);
    line-height: 1;
    letter-spacing: 0.02em;
    margin-bottom: 0.25rem;
}

.signal-lbl {
    font-family: var(--ff-heading);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-3);
    line-height: 1.2;
}

.strength-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin: 0.4rem 0 0.2rem;
}

.strength-bar-fill {
    height: 100%;
    background: var(--grad-accent);
    border-radius: 2px;
}

/* ============================================================================
   30. RESPONSIVE APP
   ============================================================================ */
@media (max-width: 700px) {
    .app-content { padding: 1.5rem 1rem 3rem; }
    .page-head { flex-direction: column; align-items: flex-start; }
    .page-actions { width: 100%; }
    .brief-hero { padding: 2rem 1.5rem; min-height: 240px; border-radius: var(--r-lg); }
    .brief-hero-orbit { width: 240px; height: 240px; right: -100px; opacity: 0.08; }
    .metric-row { gap: 0.6rem; }
    .drawer { width: 100vw; max-width: 100vw; }
    .modal-card { width: calc(100vw - 2rem); max-height: calc(100vh - 2rem); }
    .kanban { grid-template-columns: 1fr; }
    .notif-panel { right: 0.5rem; left: 0.5rem; width: auto; top: 58px; }
}

/* ============================================================================
   31. KEYBOARD SHORTCUT PULSE + HELP GRID
   ============================================================================ */
.shortcut-pulse {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.7);
    font-family: var(--ff-mono);
    font-size: 2rem;
    font-weight: 800;
    color: var(--white);
    background: var(--grad-accent);
    padding: 1.1rem 1.6rem;
    border-radius: var(--r-lg);
    letter-spacing: 0.08em;
    box-shadow: 0 24px 60px rgba(45, 39, 105, 0.42);
    pointer-events: none;
    z-index: 9000;
    animation: shortcut-pulse 700ms var(--ease-out) forwards;
}

@keyframes shortcut-pulse {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
    30%  { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
    60%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.2); }
}

.shortcut-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin-top: 1rem;
}

.shortcut-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.55rem 0.75rem;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--r);
    font-size: 0.88rem;
    color: var(--ink);
}

.shortcut-row .kbd {
    flex-shrink: 0;
    min-width: 30px;
    text-align: center;
}

/* ============================================================================
   32. NOTIFICATIONS PANEL
   ============================================================================ */
.notif-panel {
    position: fixed;
    top: 58px;
    right: 1.25rem;
    width: 380px;
    max-width: calc(100vw - 2rem);
    max-height: calc(100vh - 80px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: 0 28px 80px rgba(45, 39, 105, 0.24), 0 6px 18px rgba(45, 39, 105, 0.08);
    z-index: 800;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform-origin: top right;
    animation: notif-in 200ms var(--ease-spring);
}

@keyframes notif-in {
    from { opacity: 0; transform: scale(0.92) translateY(-8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.notif-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.1rem 0.85rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.notif-title {
    font-family: var(--ff-display);
    font-size: 1.05rem;
    color: var(--jacarta);
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.notif-sub {
    font-size: 0.78rem;
    color: var(--ink-3);
    margin-top: 0.2rem;
}

.notif-mark { flex-shrink: 0; }

.notif-list {
    overflow-y: auto;
    flex: 1;
    scrollbar-width: none;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.3s ease;
}

.notif-list::-webkit-scrollbar { width: 6px; }
.notif-list::-webkit-scrollbar-track { background: transparent; }
.notif-list::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; transition: background 0.3s ease; }
.notif-panel:hover .notif-list { scrollbar-width: thin; scrollbar-color: rgba(45, 39, 105, 0.2) transparent; }
.notif-panel:hover .notif-list::-webkit-scrollbar-thumb { background: rgba(45, 39, 105, 0.22); }

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--ink);
    transition: background var(--t) var(--ease);
    position: relative;
}

.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--lavender-08); }

.notif-item-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-3);
    color: var(--iris);
}

.notif-item-decision .notif-item-icon { background: var(--iris); color: var(--white); }
.notif-item-commit .notif-item-icon   { background: rgba(230, 116, 63, 0.14); color: #b55a2e; }
.notif-item-draft .notif-item-icon    { background: var(--lavender-10); color: var(--iris); }

.notif-item-main { flex: 1; min-width: 0; }

.notif-item-title {
    font-weight: 700;
    color: var(--jacarta);
    font-size: 0.9rem;
    line-height: 1.3;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-item-sub {
    font-size: 0.78rem;
    color: var(--ink-2);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-empty {
    padding: 2rem 1.5rem;
    text-align: center;
    color: var(--ink-3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
}

.notif-empty svg { color: var(--iris); width: 28px; height: 28px; }

/* Sidebar pulse (live indicator) */
.sidebar-pulse {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--iris);
    box-shadow: 0 0 0 0 rgba(93, 71, 179, 0.55);
    animation: sidebar-pulse-kf 2.4s ease-in-out infinite;
}

@keyframes sidebar-pulse-kf {
    0%   { box-shadow: 0 0 0 0 rgba(93, 71, 179, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(93, 71, 179, 0); }
    100% { box-shadow: 0 0 0 0 rgba(93, 71, 179, 0); }
}

/* ============================================================================
   33. MODALS (shared) + CAPTURE MODAL
   ============================================================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms var(--ease-out);
}

.modal.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(24, 20, 55, 0.62);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-card {
    position: relative;
    width: 100%;
    max-width: 620px;
    max-height: calc(100vh - 4rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: 0 40px 120px rgba(24, 20, 55, 0.42), 0 8px 24px rgba(45, 39, 105, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(16px) scale(0.98);
    opacity: 0;
    transition: transform 240ms var(--ease-spring), opacity 240ms var(--ease-out);
}

.modal.open .modal-card {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid var(--border);
}

.modal-eyebrow {
    font-family: var(--ff-heading);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--iris);
    margin-bottom: 0.35rem;
}

.modal-title {
    font-family: var(--ff-display);
    font-size: 1.4rem;
    color: var(--jacarta);
    letter-spacing: -0.015em;
    line-height: 1.2;
    margin: 0;
}

.modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(45, 39, 105, 0.2) transparent;
}

.modal-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

.modal-foot-hint {
    font-size: 0.78rem;
    color: var(--ink-3);
    font-family: var(--ff-mono);
}

/* Capture-modal specifics */
.capture-modal-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 0.9rem 1rem;
    font-family: var(--ff-body);
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--ink);
    background: var(--surface-2);
    resize: vertical;
    min-height: 180px;
    transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}

.capture-modal-input:focus {
    outline: none;
    border-color: var(--iris);
    box-shadow: 0 0 0 3px var(--lavender-20);
}

.capture-modal-hints {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.9rem;
}

.capture-modal-hint-label {
    font-family: var(--ff-heading);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-right: 0.4rem;
}

.capture-modal-parse {
    margin-top: 1.1rem;
    padding: 1rem;
    background: var(--surface-3);
    border: 1px dashed var(--border-2);
    border-radius: var(--r);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.capture-modal-parse-step {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 0.88rem;
    color: var(--ink);
    animation: parse-step-in 240ms var(--ease-out);
}

@keyframes parse-step-in {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}

.capture-modal-parse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--iris);
    box-shadow: 0 0 0 4px var(--lavender-10);
    flex-shrink: 0;
    animation: parse-dot-pulse 1s ease-in-out infinite;
}

.capture-modal-parse-step.done .capture-modal-parse-dot {
    background: var(--success, #5a8b7b);
    animation: none;
}

@keyframes parse-dot-pulse {
    0%, 100% { box-shadow: 0 0 0 4px var(--lavender-10); }
    50%      { box-shadow: 0 0 0 8px rgba(196, 156, 224, 0.1); }
}

/* ============================================================================
   34. KANBAN (projects)
   ============================================================================ */
.kanban {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

@media (max-width: 1100px) {
    .kanban { grid-template-columns: repeat(2, 1fr); }
}

.kanban-col {
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 360px;
    transition: border-color var(--t) var(--ease), background var(--t) var(--ease), transform var(--t) var(--ease);
}

.kanban-col.drag-over {
    border-color: var(--iris);
    background: var(--lavender-08);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(45, 39, 105, 0.14);
}

.kanban-head {
    padding: 0.9rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.kanban-head-title {
    font-family: var(--ff-heading);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--jacarta);
}

.kanban-body {
    flex: 1;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-height: 200px;
    transition: background var(--t) var(--ease);
}

.kanban-body.drag-over {
    background: var(--lavender-08);
    border-radius: var(--r);
}

.kanban-foot {
    padding: 0.6rem 1rem 0.75rem;
    border-top: 1px solid var(--border);
    font-family: var(--ff-mono);
    font-size: 0.76rem;
    color: var(--ink-3);
    text-align: right;
    letter-spacing: 0.02em;
}

.kanban-card {
    padding: 0;
    cursor: grab;
    user-select: none;
}

.kanban-card:active { cursor: grabbing; }

.kanban-card.dragging {
    opacity: 0.4;
    transform: rotate(-1.5deg) scale(0.98);
    border-color: var(--iris);
    box-shadow: 0 20px 40px rgba(45, 39, 105, 0.2);
}

.kanban-card-body {
    padding: 0.85rem 0.95rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.kanban-card-title {
    font-weight: 700;
    color: var(--jacarta);
    font-size: 0.92rem;
    letter-spacing: -0.005em;
    line-height: 1.3;
}

.kanban-card-co {
    font-size: 0.8rem;
    color: var(--ink-2);
}

.kanban-card-foot {
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: var(--ink-3);
    font-family: var(--ff-mono);
    padding-top: 0.3rem;
}

/* Celebration pulse when a project lands in "Won" */
.celebrate {
    animation: celebrate-kf 900ms var(--ease-spring);
}

@keyframes celebrate-kf {
    0%   { box-shadow: 0 0 0 0 rgba(93, 71, 179, 0.4) inset; }
    40%  { box-shadow: 0 0 0 18px rgba(196, 156, 224, 0.22) inset; }
    100% { box-shadow: 0 0 0 0 rgba(93, 71, 179, 0) inset; }
}

/* ============================================================================
   35. GRAPH (interactive)
   ============================================================================ */
.graph-wrap {
    position: relative;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    min-height: 560px;
}

.graph-edge {
    transition: stroke 180ms var(--ease-out), stroke-width 180ms var(--ease-out);
}

.graph-node circle {
    transition: r 180ms var(--ease-spring), stroke 180ms var(--ease-out);
}

.graph-node:hover text {
    fill: var(--white);
    font-weight: 800;
}

.graph-tip {
    position: absolute;
    min-width: 200px;
    max-width: 260px;
    background: rgba(24, 20, 55, 0.96);
    border: 1px solid rgba(196, 156, 224, 0.22);
    border-radius: var(--r);
    padding: 0.7rem 0.85rem;
    color: var(--white);
    box-shadow: 0 18px 40px rgba(24, 20, 55, 0.5);
    backdrop-filter: blur(10px);
    pointer-events: none;
    z-index: 20;
    animation: graph-tip-in 180ms var(--ease-out);
}

@keyframes graph-tip-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.graph-tip-kind {
    font-family: var(--ff-heading);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--lavender);
    margin-bottom: 0.25rem;
}

.graph-tip-title {
    font-family: var(--ff-display);
    font-size: 1rem;
    color: var(--white);
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin-bottom: 0.15rem;
}

.graph-tip-sub {
    font-size: 0.78rem;
    color: var(--lavender-ll);
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.graph-tip-meta {
    display: flex;
    gap: 0.85rem;
    font-size: 0.78rem;
    color: var(--lavender-ll);
    padding-top: 0.4rem;
    border-top: 1px solid rgba(196, 156, 224, 0.14);
}

.graph-tip-meta strong {
    color: var(--white);
    font-weight: 700;
    margin-right: 0.2rem;
}

/* ============================================================================
   36. CHAT TYPING + STREAMING
   ============================================================================ */
.chat-typing {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.8rem 1rem;
    min-width: 56px;
}

.chat-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--iris);
    opacity: 0.55;
    animation: chat-typing-kf 1.1s ease-in-out infinite;
}

.chat-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes chat-typing-kf {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50%      { transform: translateY(-4px); opacity: 1; }
}

.chat-msg-bubble.streaming::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 1em;
    margin-left: 2px;
    vertical-align: text-bottom;
    background: var(--iris);
    animation: chat-cursor 1s steps(2) infinite;
}

@keyframes chat-cursor {
    0%, 50%   { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ============================================================================
   37. SETTINGS — TONE SELECTOR + DRAFT REGENERATING
   ============================================================================ */
.tone-selector {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.tone-chip {
    font-family: var(--ff-heading);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding: 0.5rem 0.9rem;
    background: var(--surface-3);
    border: 1px solid var(--border);
    color: var(--ink-2);
    border-radius: 999px;
    cursor: pointer;
    transition: all var(--t) var(--ease);
}

.tone-chip:hover {
    border-color: var(--iris);
    color: var(--jacarta);
}

.tone-chip.active {
    background: var(--grad-accent);
    border-color: transparent;
    color: var(--white);
    box-shadow: 0 6px 18px rgba(93, 71, 179, 0.22);
}

/* Draft textarea — while regenerating */
textarea.regenerating {
    background: linear-gradient(120deg, var(--lavender-08) 0%, var(--surface-2) 40%, var(--lavender-08) 100%);
    background-size: 200% 100%;
    animation: regen-shimmer 1.4s linear infinite;
    border-color: var(--iris);
}

@keyframes regen-shimmer {
    from { background-position: 100% 0; }
    to   { background-position: -100% 0; }
}

/* ============================================================================
   INBOX CHIP — subtle per-inbox tag on capture rows so users can see, at a
   glance, which mailbox a message came from. Each inbox gets a deterministic
   colour assigned server-side in /api/bootstrap.
   ============================================================================ */
.inbox-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.14rem 0.5rem 0.14rem 0.42rem;
    font-family: var(--ff-mono);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-2);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    white-space: nowrap;
    line-height: 1.4;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inbox-chip-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inbox-chip-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    background: var(--iris);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.65);
    flex-shrink: 0;
}

/* Deterministic colour variants — referenced from the backend palette in
   api/routes/bootstrap.php. Keep both ends in sync when adding colours. */
.inbox-chip-iris     .inbox-chip-dot,
.inbox-chip-dot.inbox-chip-iris     { background: #7e6dd9; }
.inbox-chip-lavender .inbox-chip-dot,
.inbox-chip-dot.inbox-chip-lavender { background: #c49ce0; }
.inbox-chip-teal     .inbox-chip-dot,
.inbox-chip-dot.inbox-chip-teal     { background: #4cbfb0; }
.inbox-chip-amber    .inbox-chip-dot,
.inbox-chip-dot.inbox-chip-amber    { background: #e4a94a; }
.inbox-chip-rose     .inbox-chip-dot,
.inbox-chip-dot.inbox-chip-rose     { background: #d96e8a; }
.inbox-chip-cobalt   .inbox-chip-dot,
.inbox-chip-dot.inbox-chip-cobalt   { background: #4a7bd9; }

.inbox-chip-iris     { border-color: rgba(126, 109, 217, 0.32); color: #4b3fa6; }
.inbox-chip-lavender { border-color: rgba(196, 156, 224, 0.42); color: #7c4fa1; }
.inbox-chip-teal     { border-color: rgba( 76, 191, 176, 0.38); color: #2a7e72; }
.inbox-chip-amber    { border-color: rgba(228, 169,  74, 0.38); color: #8f5f11; }
.inbox-chip-rose     { border-color: rgba(217, 110, 138, 0.36); color: #a33e5b; }
.inbox-chip-cobalt   { border-color: rgba( 74, 123, 217, 0.36); color: #2f53a0; }

/* ============================================================================
   38. SETTINGS — SUB-TABS (Overview / Live log)
   ============================================================================ */
.settings-tabs {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    margin-bottom: 1.75rem;
}

.settings-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    font-family: var(--ff-heading);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--ink-3);
    text-decoration: none;
    border-radius: var(--r-pill);
    transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.settings-tab svg { width: 15px; height: 15px; }

.settings-tab:hover { color: var(--jacarta); }

.settings-tab.active {
    color: var(--white);
    background: var(--jacarta);
    box-shadow: 0 4px 14px rgba(45, 39, 105, 0.22);
}

/* Subtle pulsing dot on the Live-log tab — signals it's a living surface. */
.settings-tab-pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--iris);
    position: relative;
    margin-left: 0.1rem;
    box-shadow: 0 0 0 0 var(--iris-soft);
    animation: livelog-tab-pulse 2.4s var(--ease-out) infinite;
}
.settings-tab.active .settings-tab-pulse {
    background: #ffffff;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.75);
    animation-name: livelog-tab-pulse-white;
}

@keyframes livelog-tab-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(196, 156, 224, 0.55); }
    70%  { box-shadow: 0 0 0 9px rgba(196, 156, 224, 0); }
    100% { box-shadow: 0 0 0 0 rgba(196, 156, 224, 0); }
}
@keyframes livelog-tab-pulse-white {
    0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.75); }
    70%  { box-shadow: 0 0 0 9px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* ============================================================================
   39. SETTINGS — LIVE LOG
   ============================================================================ */
/* Neutralise the marketing-brand global `section { padding: clamp(5rem,10vw,10rem) 0 }`
   in case anyone wraps live-log content in a <section>. The app SPA uses
   divs for layout — sectioning elements only make sense on the brand site. */
.livelog,
section.livelog {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0;
    margin: 0;
    overflow: visible;
}

/* ---- Category chip strip ---- */
.livelog-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.35rem;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}
.livelog-chips::-webkit-scrollbar { display: none; }

.livelog-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    border: none;
    background: transparent;
    font-family: var(--ff-heading);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--ink-3);
    cursor: pointer;
    border-radius: var(--r-pill);
    white-space: nowrap;
    transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.livelog-chip svg { width: 13px; height: 13px; }
.livelog-chip:hover:not(.active) { color: var(--jacarta); background: var(--surface); }

.livelog-chip.active {
    color: var(--white);
    background: var(--grad-accent);
    box-shadow: 0 4px 14px rgba(93, 71, 179, 0.22);
}

.livelog-chip-label { letter-spacing: 0.02em; }

.livelog-chip-count {
    font-family: var(--ff-mono);
    font-size: 0.66rem;
    font-weight: 700;
    padding: 0.08rem 0.42rem;
    border-radius: var(--r-pill);
    background: rgba(45, 39, 105, 0.08);
    color: var(--ink-2);
    min-width: 1.4rem;
    text-align: center;
}
.livelog-chip.active .livelog-chip-count {
    background: rgba(255, 255, 255, 0.22);
    color: var(--white);
}
.livelog-chip-count-zero { opacity: 0.45; }

/* ---- Controls row (search + live indicator) ---- */
.livelog-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
    flex-wrap: wrap;
}

.livelog-search-wrap {
    position: relative;
    flex: 1 1 260px;
    min-width: 220px;
    max-width: 420px;
}

.livelog-search-icon {
    position: absolute;
    top: 50%;
    left: 0.85rem;
    transform: translateY(-50%);
    color: var(--ink-3);
    pointer-events: none;
    display: inline-flex;
}
.livelog-search-icon svg { width: 14px; height: 14px; }

.livelog-search {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.35rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    font-family: var(--ff-body);
    font-size: 0.86rem;
    color: var(--ink);
    transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.livelog-search::placeholder { color: var(--ink-3); }
.livelog-search:focus {
    outline: none;
    border-color: var(--lavender);
    box-shadow: 0 0 0 3px var(--lavender-20);
}

/* Strip the browser's cancel button for a cleaner look */
.livelog-search::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

/* ---- Live indicator ---- */
.livelog-live {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 0.45rem 0.35rem 0.85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    font-family: var(--ff-heading);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ink-2);
    letter-spacing: 0.04em;
}

.livelog-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 0 0 rgba(106, 138, 107, 0.55);
    animation: livelog-dot-pulse 1.8s var(--ease-out) infinite;
}
.livelog-live.paused .livelog-live-dot {
    background: var(--ink-3);
    animation: none;
    box-shadow: none;
}

@keyframes livelog-dot-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(106, 138, 107, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(106, 138, 107, 0); }
    100% { box-shadow: 0 0 0 0 rgba(106, 138, 107, 0); }
}

.livelog-live-label {
    text-transform: uppercase;
    color: var(--jacarta);
}
.livelog-live.paused .livelog-live-label { color: var(--ink-3); }

.livelog-live-meta {
    font-family: var(--ff-mono);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--ink-3);
    text-transform: none;
}

.livelog-pause-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    background: var(--surface-3);
    color: var(--ink-2);
    border-radius: 50%;
    cursor: pointer;
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
    margin-left: 0.15rem;
}
.livelog-pause-btn:hover { background: var(--lavender-10); color: var(--jacarta); }
.livelog-pause-btn svg { width: 12px; height: 12px; }

/* ---- Feed container ---- */
.livelog-feed {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    min-height: 240px;
    box-shadow: var(--shadow-sm);
}

.livelog-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    padding: 3rem 1.5rem;
    color: var(--ink-3);
    font-family: var(--ff-heading);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.livelog-loading-pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--iris);
    animation: livelog-loading-pulse 1.2s var(--ease-out) infinite;
}
@keyframes livelog-loading-pulse {
    0%, 100% { transform: scale(0.8); opacity: 0.55; }
    50%      { transform: scale(1.2); opacity: 1; }
}

.livelog-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 4rem 2rem;
    text-align: center;
}
.livelog-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--lavender-10);
    color: var(--lavender-d);
    margin-bottom: 0.4rem;
}
.livelog-empty-icon svg { width: 22px; height: 22px; }
.livelog-empty-title {
    font-family: var(--ff-heading);
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--jacarta);
    letter-spacing: -0.005em;
}
.livelog-empty-sub {
    font-size: 0.86rem;
    color: var(--ink-2);
    max-width: 44ch;
    line-height: 1.6;
    margin: 0;
}

/* ---- Row list ---- */
.livelog-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.livelog-row {
    display: grid;
    grid-template-columns: 18px 78px 96px minmax(180px, 240px) 1fr 72px;
    align-items: center;
    gap: 0.9rem;
    padding: 0.78rem 1.25rem;
    border-top: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--t-fast) var(--ease);
}
.livelog-row:first-child { border-top: none; }
.livelog-row:hover { background: var(--surface-3); }

/* Animated pink ribbon along the left edge when a brand-new row arrives.
   `livelog-row-fresh` is attached by the JS on insert; we fade it after
   a couple of seconds so returning eyes aren't chasing a moving target. */
.livelog-row-fresh {
    animation: livelog-row-flash 2.8s var(--ease-out);
}
@keyframes livelog-row-flash {
    0%   { background: rgba(196, 156, 224, 0.30); }
    35%  { background: rgba(196, 156, 224, 0.18); }
    100% { background: transparent; }
}

/* Left status dot — the only heavy colour in a calm design */
.livelog-row-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 0 3px rgba(106, 138, 107, 0.12);
}
.livelog-status-ok    .livelog-row-dot { background: var(--ok);     box-shadow: 0 0 0 3px rgba(106, 138, 107, 0.12); }
.livelog-status-warn  .livelog-row-dot { background: var(--warn);   box-shadow: 0 0 0 3px rgba(197, 147,  88, 0.14); }
.livelog-status-error .livelog-row-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(182,  75,  91, 0.14); }
.livelog-status-info  .livelog-row-dot { background: var(--info);   box-shadow: 0 0 0 3px rgba(106, 123, 166, 0.14); }

/* Timestamp — monospaced, understated */
.livelog-row-time {
    font-family: var(--ff-mono);
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--ink-3);
    letter-spacing: 0.02em;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Category tag — uppercase micro pill */
.livelog-row-cat {
    display: inline-flex;
    justify-content: center;
    padding: 0.2rem 0.6rem;
    font-family: var(--ff-heading);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    color: var(--ink-2);
    border: 1px solid var(--border);
    width: fit-content;
}
/* Category-specific tints — all within the brand palette */
.livelog-cat-auth     { background: var(--info-soft);   color: var(--info);     border-color: transparent; }
.livelog-cat-inbox    { background: var(--lavender-10); color: var(--jacarta);  border-color: var(--lavender-20); }
.livelog-cat-oauth    { background: rgba(196, 156, 224, 0.18); color: #7c4fa1;  border-color: transparent; }
.livelog-cat-sync     { background: rgba( 74, 123, 217, 0.12); color: #2f53a0;  border-color: transparent; }
.livelog-cat-capture  { background: var(--ok-soft);     color: var(--ok);       border-color: transparent; }
.livelog-cat-ai       { background: rgba(217, 110, 138, 0.14); color: #a33e5b;  border-color: transparent; }
.livelog-cat-settings { background: var(--surface-3);   color: var(--ink-2);    border-color: var(--border); }
.livelog-cat-system   { background: var(--warn-soft);   color: var(--warn);     border-color: transparent; }

/* Dotted-verb action — monospaced */
.livelog-row-action {
    font-family: var(--ff-mono);
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--jacarta);
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Human message — truncated on one line until the row expands */
.livelog-row-msg {
    font-size: 0.86rem;
    color: var(--ink);
    line-height: 1.45;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.livelog-status-error .livelog-row-msg { color: var(--danger); }

/* Actor chip — user vs system vs cron */
.livelog-row-actor {
    font-family: var(--ff-heading);
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    text-align: center;
    padding: 0.18rem 0.5rem;
    border-radius: var(--r-pill);
    color: var(--ink-3);
    background: transparent;
    border: 1px solid var(--border);
    width: fit-content;
    justify-self: end;
}
.livelog-actor-user   { color: var(--jacarta);   border-color: var(--lavender-20); background: var(--lavender-10); }
.livelog-actor-system { color: var(--ink-2);     border-color: var(--border);      background: var(--surface-3); }
.livelog-actor-cron   { color: #2f53a0;           border-color: rgba(74, 123, 217, 0.28); background: rgba(74, 123, 217, 0.10); }

/* Expanded state — show full message + raw JSON meta */
.livelog-row.expanded {
    background: var(--surface-3);
    grid-template-columns: 18px 78px 96px minmax(180px, 240px) 1fr 72px;
    grid-auto-rows: auto;
    align-items: start;
    padding-top: 0.9rem;
    padding-bottom: 1.1rem;
}
.livelog-row.expanded .livelog-row-msg {
    white-space: normal;
    grid-column: 4 / 6;
    align-self: start;
}

.livelog-row-meta {
    grid-column: 2 / 7;
    margin: 0.5rem 0 0;
    padding: 0.75rem 1rem;
    background: var(--jacarta-ddd);
    color: var(--lavender-ll);
    border-radius: var(--r-sm);
    font-family: var(--ff-mono);
    font-size: 0.72rem;
    line-height: 1.55;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---- Responsive collapse ---- */
@media (max-width: 980px) {
    .livelog-row {
        grid-template-columns: 10px 70px 1fr 60px;
        grid-template-rows: auto auto;
        row-gap: 0.3rem;
    }
    .livelog-row-cat    { grid-column: 3 / 4; grid-row: 1 / 2; justify-self: start; }
    .livelog-row-actor  { grid-column: 4 / 5; grid-row: 1 / 2; }
    .livelog-row-action { grid-column: 2 / 4; grid-row: 2 / 3; }
    .livelog-row-msg    { grid-column: 2 / 5; grid-row: 3 / 4; white-space: normal; }
    .livelog-row-time   { grid-column: 2 / 3; grid-row: 1 / 2; text-align: left; }
    .livelog-row-dot    { grid-column: 1 / 2; grid-row: 1 / 2; align-self: center; }
    .livelog-row.expanded .livelog-row-meta { grid-column: 1 / 5; }
}

/* Prefers-reduced-motion: kill the pulse animations so dots stay still */
@media (prefers-reduced-motion: reduce) {
    .livelog-live-dot,
    .livelog-loading-pulse,
    .settings-tab-pulse,
    .livelog-row-fresh { animation: none !important; }
}
