:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface-hover: #242836;
    --border: #2d3148;
    --text: #e1e4ed;
    --text-muted: #8b8fa3;
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --danger: #ef4444;
    --danger-hover: #f87171;
    --success: #22c55e;
    --warning: #eab308;
    --badge-manual: #3b82f6;
    --badge-hook: #a855f7;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* Nav */
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.nav-links { display: flex; gap: 1.5rem; }
.nav-links a {
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: color 0.15s;
}
.nav-links a:hover { color: var(--text); }

/* Layout */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.page-header h1 { font-size: 1.5rem; }

.header-actions { display: flex; gap: 0.5rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary { background: var(--surface-hover); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}
.btn-sm:hover { background: var(--surface-hover); }
.btn-sm.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-sm.btn-danger:hover { background: var(--danger); color: white; }

.btn-edit {
    background: rgba(99,102,241,0.1);
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-edit:hover {
    background: var(--primary);
    color: white;
}

.card-edit-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.15s;
}

.project-card-wrapper {
    position: relative;
}
.project-card-wrapper:hover .card-edit-btn {
    opacity: 1;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

/* Hero */
.hero {
    text-align: center;
    padding: 3rem 0;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle { color: var(--text-muted); margin-top: 0.5rem; }

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Quick actions */
.quick-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 1.5rem 0;
}

/* Project grid */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.project-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: border-color 0.15s;
}

.project-card:hover { border-color: var(--primary); }
.project-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.project-desc { color: var(--text-muted); font-size: 0.9rem; }
.project-path { color: var(--text-muted); font-size: 0.8rem; font-family: monospace; }
.project-date { color: var(--text-muted); font-size: 0.8rem; display: block; margin-top: 0.75rem; }

/* Prompt cards */
.prompt-list { display: flex; flex-direction: column; gap: 0.75rem; }

.prompt-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}

.prompt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.prompt-header h4 { font-size: 1rem; }

.prompt-meta { display: flex; gap: 0.5rem; align-items: center; }

.prompt-content {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
    background: var(--bg);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    margin: 0.5rem 0;
    max-height: 200px;
    overflow-y: auto;
}

.prompt-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.prompt-date { color: var(--text-muted); font-size: 0.8rem; }
.prompt-actions { display: flex; gap: 0.5rem; }

.favorite { color: #eab308; font-size: 1rem; }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-manual { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-hook { background: rgba(168,85,247,0.15); color: #c084fc; }
.badge-category { background: rgba(34,197,94,0.15); color: #4ade80; }

.prompt-project {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 500;
}

/* Forms */
.form-card {
    max-width: 600px;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}

textarea { resize: vertical; }

.form-inline {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    margin-bottom: 1rem;
}

.form-inline input { flex: 1; }

/* Filters */
.filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.search-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
}

.filter-select {
    padding: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
}

/* Key list */
.key-list { display: flex; flex-direction: column; gap: 0.5rem; }

.key-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.key-name { font-weight: 500; }
.key-date { color: var(--text-muted); font-size: 0.8rem; }

/* Account info */
.account-info p { margin-bottom: 0.5rem; }
.account-info strong { color: var(--text-muted); }

/* Help text */
.help-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 0;
    font-size: 0.95rem;
}

/* Recent section */
.recent { margin-top: 2rem; }
.recent h2 { font-size: 1.2rem; margin-bottom: 1rem; }

/* Dialog */
dialog {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 2rem;
    max-width: 500px;
    width: 90%;
}

dialog::backdrop { background: rgba(0,0,0,0.6); }

.dialog-form h3 { margin-bottom: 1rem; }
.dialog-form textarea { margin-bottom: 1rem; min-height: 120px; }
.dialog-form input { margin-bottom: 0.75rem; }
.dialog-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; }

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 4rem;
}

/* Responsive */
.nav-check { display: none; }
.nav-toggle {
    display: none;
    cursor: pointer;
    padding: 8px;
    align-items: center;
    gap: 6px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.85rem;
}
.nav-toggle span:not(.nav-toggle-text) {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
}
.nav-toggle .nav-toggle-text { font-size: 0.8rem; }
.nav-toggle .nav-bars { display: flex; flex-direction: column; gap: 3px; }

@media (max-width: 768px) {
    .nav-toggle { display: flex; }
    .nav {
        position: sticky;
        top: 0;
        z-index: 999;
        flex-wrap: wrap;
        padding: 0.5rem 1rem;
    }
    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        background: var(--surface);
        padding: 0.75rem 0;
        gap: 0;
        border-top: 1px solid var(--border);
        order: 3;
    }
    .nav-check:checked ~ .nav-links {
        display: flex;
    }
    .nav-links a, .nav-links span, .nav-links .logout-btn {
        padding: 0.6rem 0.5rem;
        border-bottom: 1px solid var(--border);
        display: block;
    }
    .nav-links .logout-form { display: block; width: 100%; }
    .nav-links .logout-btn { width: 100%; text-align: left; }
    .stats { grid-template-columns: 1fr; }
    .project-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .container { padding: 1rem; }
    .page-header { flex-direction: column; gap: 1rem; align-items: flex-start; }
}

/* Login */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    position: relative;
    overflow: hidden;
    padding: 1.5rem;
}
.login-page:has(.auth-wrap)::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(48% 38% at 50% 28%, rgba(35, 131, 226, 0.12) 0%, transparent 72%);
    pointer-events: none;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-card h1 {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
}

.login-card .subtitle { margin-bottom: 1.5rem; }

.login-card .form-group { text-align: left; margin-bottom: 1rem; }

.btn-full { width: 100%; justify-content: center; }

.login-footer {
    margin-top: 1.5rem;
    text-align: left;
}

.login-footer p { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; }

.login-footer pre {
    font-size: 0.7rem;
    background: var(--bg);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    color: var(--text-muted);
    white-space: pre-wrap;
}

/* Auth (login) — matches KeepMyPlan login design */

@keyframes auth-fade-in-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-wrap {
    --acc: #2383e2;
    --acc-hover: #4c9ee8;
    --acc-dim: #1a73d1;
    position: relative;
    width: 100%;
    max-width: 384px;
    animation: auth-fade-in-up 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-head { text-align: center; margin-bottom: 1.75rem; }
.auth-logo {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, #4c9ee8 0%, #2383e2 100%);
    box-shadow: 0 4px 18px rgba(35, 131, 226, 0.45);
}
.auth-logo svg { width: 24px; height: 24px; }
.auth-brand-name {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #2f9be4;
    background: linear-gradient(135deg, #4c9ee8 0%, #2383e2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.auth-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 0.55rem;
}
.auth-subtitle { color: var(--text-muted); font-size: 0.8125rem; margin-top: 0.2rem; }

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: left;
    box-shadow: 0 16px 50px -20px rgba(0, 0, 0, 0.6);
}
.auth-card .field { margin-bottom: 1rem; }
.auth-card label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
}
.auth-card input {
    width: 100%;
    padding: 0.75rem 0.875rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.84rem;
    font-family: inherit;
    transition: border-color 0.15s;
}
.auth-card input::placeholder { color: var(--text-muted); opacity: 0.7; }
.auth-card input:hover { border-color: rgba(255, 255, 255, 0.14); }
.auth-card input:focus { outline: none; border-color: var(--acc); }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input { padding-right: 2.75rem; }
.input-affix {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 1.9rem;
    height: 1.9rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
.input-affix:hover { color: var(--text); background: var(--surface-hover); }
.input-affix svg { width: 15px; height: 15px; }

.auth-card .btn-block {
    width: 100%;
    justify-content: center;
    margin-top: 0.25rem;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #fff;
    background: var(--acc);
    transition: background 0.15s, transform 0.1s;
}
.auth-card .btn-block:hover { background: var(--acc-dim); }
.auth-card .btn-block:active { transform: scale(0.985); }

.auth-alt {
    display: block;
    width: 100%;
    margin-top: 0.875rem;
    background: none;
    border: none;
    color: var(--acc);
    font-size: 0.78rem;
    font-weight: 500;
    font-family: inherit;
    text-align: center;
    cursor: pointer;
    transition: color 0.15s;
}
.auth-alt:hover { color: var(--acc-hover); text-decoration: underline; }

.auth-foot { text-align: center; margin-top: 1.25rem; font-size: 0.75rem; color: var(--text-muted); }
.auth-foot a { color: var(--acc); font-weight: 600; }
.auth-foot a:hover { color: var(--acc-hover); text-decoration: underline; }

.alert {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.alert-error {
    background: rgba(239,68,68,0.15);
    color: var(--danger);
    border: 1px solid rgba(239,68,68,0.3);
}

.alert-success {
    background: rgba(34,197,94,0.15);
    color: var(--success);
    border: 1px solid rgba(34,197,94,0.3);
}

/* Logout link in nav */
.nav-links a.logout { color: var(--danger); }
/* Logout is a POST form (CSRF-protected) styled to read like the old nav link. */
.logout-form { display: inline; margin: 0; padding: 0; }
.logout-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    color: var(--danger);
    transition: color 0.15s;
}
.logout-btn:hover { color: var(--text); }
.nav-user { color: var(--text-muted); font-size: 0.85rem; padding: 0.25rem 0.5rem; background: var(--surface-hover); border-radius: var(--radius-sm); }

/* Inline form (for action buttons) */
.inline-form {
    display: inline;
    margin: 0;
    padding: 0;
}

/* === Category Colors === */
.cat-debug { --cat: #ef4444; }
.cat-feature { --cat: #3b82f6; }
.cat-refactor { --cat: #8b5cf6; }
.cat-test { --cat: #f59e0b; }
.cat-docs { --cat: #10b981; }
.cat-config { --cat: #6366f1; }
.cat-deploy { --cat: #ec4899; }
.cat-review { --cat: #14b8a6; }
.cat-other { --cat: #6b7280; }
.cat-unnamed { --cat: #6b7280; }

/* === Tag Chips === */
.tag-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.4rem; }
.tag-chip {
    font-size: 0.7rem;
    padding: 0.1rem 0.5rem;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 99px;
    color: var(--text-muted);
}

/* === Token Count === */
.token-count { font-size: 0.75rem; color: var(--text-muted); }

/* === View Toggle === */
.view-toggle { display: flex; gap: 0.25rem; }
.view-toggle a {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    background: var(--surface);
}
.view-toggle a:hover { background: var(--surface-hover); color: var(--text); }
.view-toggle a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* === Kanban Layout === */
.kanban, .kanban-board {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}
.kanban-col {
    min-width: 260px;
    max-width: 320px;
    flex: 1;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 0.75rem;
}
.kanban-col-header {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.kanban-col-header .col-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.4rem;
}
.kanban-col-header .col-count, .kanban-count {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* === Rich Prompt Card === */
.rich-card, .kanban-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--cat, var(--border));
    transition: border-color 0.2s;
}
.rich-card:hover { border-color: var(--primary); }
.rich-card-title, .kanban-card-title {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rich-card-preview, .kanban-card-preview {
    font-size: 0.75rem;
    color: var(--text-muted);
    max-height: 60px;
    overflow: hidden;
    line-height: 1.4;
    margin-bottom: 0.4rem;
}
.rich-card-footer, .kanban-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* === Tree View === */
.tree { padding-left: 0; }
.tree-node { list-style: none; }
.tree-node-label {
    padding: 0.4rem 0.6rem;
    cursor: default;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}
.tree-node-label .tree-icon { font-size: 0.9rem; }
.tree-children { padding-left: 1.5rem; border-left: 1px solid var(--border); margin-left: 0.75rem; }
.tree-prompt {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.6rem;
    margin: 0.2rem 0;
    font-size: 0.8rem;
}

/* === Flowchart / Step Diagram === */
.flowchart { padding: 0.5rem 0; }
.step {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
    position: relative;
}
.step-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 28px;
}
.step-dot {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.step-line {
    width: 2px;
    flex: 1;
    background: var(--border);
    min-height: 8px;
}
.step-content {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    line-height: 1.5;
}
.step:last-child .step-line { display: none; }

.search-bar {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    padding: 1rem 0;
}

.pagination-info {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* HTMX polling indicators */
.htmx-swapping .prompt-card {
    opacity: 0.7;
}

.prompt-card {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.prompt-list .prompt-card:first-child {
    animation: fadeSlideIn 0.4s ease;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Live indicator dot */
.live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    margin-right: 6px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Plan cards */
.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.plan-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    transition: border-color 0.15s;
}

.plan-card.current { border-color: var(--primary); }
.plan-card:hover { border-color: var(--primary-hover); }

.plan-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0.5rem 0;
}

.plan-price-sub { font-size: 0.85rem; color: var(--text-muted); }

.plan-features {
    text-align: left;
    margin: 1rem 0;
    padding-left: 1rem;
    list-style: disc;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Usage bars */
.usage-bar-container { margin: 1rem 0; }
.usage-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    color: var(--text-muted);
}
.usage-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.usage-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s;
}
.usage-bar-fill.warning { background: #eab308; }
.usage-bar-fill.danger { background: var(--danger); }

/* Notification badge */
.notif-link { position: relative; }
.notif-badge {
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 9999px;
    margin-left: 4px;
    vertical-align: super;
}

/* Notification list */
.notif-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}
.notif-item.unread { background: rgba(99,102,241,0.08); }
.notif-title { font-weight: 500; }
.notif-time { color: var(--text-muted); font-size: 0.8rem; }

/* Org cards */
.org-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.org-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s;
}
.org-card:hover { border-color: var(--primary-hover); }

.member-list { list-style: none; padding: 0; }
.member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.member-role {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    background: rgba(99,102,241,0.15);
    color: var(--primary);
}

/* Divider text (login) */
.divider-text {
    text-align: center;
    position: relative;
    margin: 1rem 0;
}
.divider-text span {
    background: var(--surface);
    padding: 0 0.75rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    position: relative;
    z-index: 1;
}
.divider-text::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
}

/* Small button variants */
.btn-sm.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.btn-sm.btn-primary:hover {
    background: var(--primary-hover);
}

/* Language switcher */
.lang-switch {
    display: inline-flex;
    gap: 2px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 2px;
}
.lang-switch form {
    display: inline;
    margin: 0;
}
.lang-btn {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.15s;
    /* Reset so a <button>.lang-btn matches an <a>.lang-btn (no native chrome). */
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.4;
}
.lang-btn:hover {
    color: var(--text);
    background: var(--surface-hover);
}
.lang-btn.active {
    color: #fff;
    background: var(--primary);
}

/* Landing (public homepage) */
.landing-hero { padding: 4rem 0 2.5rem; }
.landing-hero h1 { font-size: 3rem; }
.landing-hero .subtitle {
    max-width: 540px;
    margin: 0.75rem auto 0;
    font-size: 1.1rem;
}
.hero-cta {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.75rem;
    flex-wrap: wrap;
}
.hero-cta .btn { padding: 0.65rem 1.5rem; font-size: 0.95rem; }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1rem 0 3rem;
}
.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.feature-card .feature-icon { font-size: 1.75rem; display: block; margin-bottom: 0.75rem; }
.feature-card h3 { font-size: 1.05rem; margin-bottom: 0.4rem; color: var(--text); }
.feature-card p { font-size: 0.875rem; color: var(--text-muted); }

@media (max-width: 640px) {
    .feature-grid { grid-template-columns: 1fr; }
    .landing-hero h1 { font-size: 2.25rem; }
}
