/* ── Pond Design System ── */

@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Inter:wght@400;500;600;700&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-0: #09090b;
    --bg-1: #111113;
    --bg-2: #1a1a1f;
    --bg-3: #232329;
    --border: #27272f;
    --border-hover: #38383f;
    --text-0: #ececef;
    --text-1: #b0b0bc;
    --text-2: #76768a;
    --accent: #8b7cf6;
    --accent-hover: #7b6ce6;
    --accent-glow: rgba(139, 124, 246, 0.12);
    --accent-text: #c4b8ff;
    --success: #3ecf8e;
    --warning: #f0b429;
    --danger: #f25757;
    --radius: 10px;
    --radius-lg: 14px;
    --font: 'Times New Roman', Times, Georgia, serif;
    --mono: 'SF Mono', 'JetBrains Mono', 'Cascadia Code', monospace;
    --transition: 150ms ease;
}

html { height: 100%; }
body {
    font-family: var(--font);
    font-size: 16px;
    font-weight: 500;
    background: #040406;
    color: var(--text-0);
    height: 100%;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Login Page ── */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(ellipse 60% 50% at 50% 0%, rgba(139,124,246,0.08) 0%, transparent 60%),
        var(--bg-0);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.login-logo p {
    color: var(--text-2);
    font-size: 14px;
    margin-top: 6px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-1);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-0);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-0);
    font-size: 15px;
    font-family: var(--font);
    outline: none;
    transition: border-color var(--transition);
}

.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder { color: var(--text-2); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-primary {
    width: 100%;
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-2);
}

.login-footer a { color: var(--accent-text); }

.form-error {
    background: rgba(242, 87, 87, 0.1);
    border: 1px solid rgba(242, 87, 87, 0.2);
    color: var(--danger);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.form-error.visible { display: block; }

/* ── Tabs ── */

.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border);
}

.tab {
    flex: 1;
    padding: 10px 0;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
}

.tab.active {
    color: var(--text-0);
    border-bottom-color: var(--accent);
}

.tab:hover { color: var(--text-1); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Dashboard Layout ── */

.dashboard {
    display: flex;
    height: 100vh;
    position: relative;
    z-index: 1;
}

.sidebar {
    width: 220px;
    background: rgba(17,17,19,0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-logo {
    padding: 20px 20px 16px;
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
}

.sidebar-nav {
    padding: 12px 10px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-1);
    transition: all var(--transition);
    text-decoration: none;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--bg-2);
    color: var(--text-0);
    text-decoration: none;
}

.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent-text);
}

.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.nav-svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.65;
    transition: opacity var(--transition);
}
.nav-item:hover .nav-svg,
.nav-item.active .nav-svg { opacity: 1; }
.nav-chat .nav-svg { opacity: 0.9; }

button.nav-item {
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    font-family: var(--font);
}

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 12px;
}

.nav-chat {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 0 12px rgba(139,124,246,0.2);
}
.nav-chat:hover {
    background: var(--accent-hover);
    color: #fff;
    box-shadow: 0 0 18px rgba(139,124,246,0.3);
}
.nav-chat .nav-svg { stroke: #fff; opacity: 1; }

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-1);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-text);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-2);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    font-family: var(--font);
}
.logout-btn:hover { color: var(--danger); }

/* ── Content Area ── */

.content {
    flex: 1;
    overflow-y: auto;
    padding: 32px 40px;
    background: rgba(9,9,11,0.35);
}

.content-header {
    margin-bottom: 28px;
}

.content-header h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.content-header p {
    color: var(--text-2);
    font-size: 14px;
    margin-top: 4px;
}

/* ── Stats Cards ── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-2);
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -1px;
}

.stat-sub {
    font-size: 13px;
    color: var(--text-2);
    margin-top: 4px;
}

/* ── Action Card ── */

.action-card {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all var(--transition);
}

.action-card:hover {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--accent-glow), transparent);
}

.action-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.action-info p { color: var(--text-2); font-size: 14px; }

.action-arrow {
    font-size: 20px;
    color: var(--text-2);
    transition: transform var(--transition);
}

.action-card:hover .action-arrow {
    transform: translateX(4px);
    color: var(--accent);
}

/* ── Plan Card ── */

.plan-card {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.plan-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.plan-name {
    font-size: 14px;
    font-weight: 600;
}

.plan-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: var(--accent-glow);
    color: var(--accent-text);
    border: 1px solid rgba(139, 124, 246, 0.2);
}

.limit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.limit-label { font-size: 14px; color: var(--text-1); }

.limit-value {
    font-size: 13px;
    font-family: var(--mono);
    color: var(--text-2);
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-3);
    border-radius: 3px;
    margin-top: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
    transition: width 0.5s ease;
}

.progress-fill.warn { background: var(--warning); }
.progress-fill.over { background: var(--danger); }

/* ── Terminal Page ── */

.terminal-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #000;
}

.terminal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    flex-shrink: 0;
}

.terminal-back {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-1);
    text-decoration: none;
    font-weight: 500;
}
.terminal-back:hover { color: var(--text-0); text-decoration: none; }

.terminal-session { color: var(--text-2); font-family: var(--mono); }

.terminal-status {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-2);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
}

.status-dot.disconnected { background: var(--danger); }

#terminal-container {
    flex: 1;
    overflow: hidden;
}

/* ── Lily List ── */

.lily-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.lily-tag {
    padding: 4px 12px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-1);
}

/* ── Upload Area ── */

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.upload-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.7; }
.upload-text { font-size: 15px; font-weight: 500; color: var(--text-1); }
.upload-sub  { font-size: 13px; color: var(--text-2); margin-top: 6px; }

/* ── Data Table ── */

.data-table {
    width: 100%;
    font-size: 13px;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 8px 12px;
    color: var(--text-2);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 8px 12px;
    color: var(--text-1);
    border-bottom: 1px solid rgba(39,39,47,0.5);
}

.data-table tr:hover td { background: var(--bg-2); }
.data-table th:last-child, .data-table td:last-child { text-align: center; }

.mono { font-family: var(--mono); font-size: 12px; }

.format-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg-3);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-2);
}

/* ── Lily Browser Layout ── */

.lily-browser {
    display: flex;
    gap: 16px;
    height: calc(100vh - 200px);
    min-height: 400px;
}

.lily-sb {
    width: 220px;
    flex-shrink: 0;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lily-sb-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-1);
}

.lily-sb-count {
    background: var(--bg-3);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-2);
}

.lily-sb-list { flex: 1; overflow-y: auto; padding: 8px; min-height: 0; }

.lily-sb-footer {
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-2);
}
.lily-sb-footer button {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text-1);
    cursor: pointer;
    font-family: var(--font);
}
.lily-sb-footer button:disabled {
    opacity: 0.3;
    cursor: default;
}

.lily-sb-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition);
}

.lily-sb-item:hover { background: var(--bg-2); }
.lily-sb-item.active { background: var(--accent-glow); }

.lily-sb-icon { font-size: 18px; flex-shrink: 0; }
.lily-sb-idx {
    flex-shrink: 0;
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    font-size: 11px; font-weight: 600;
    color: var(--text-1);
    background: rgba(139,124,246,0.08);
    border: 1px solid rgba(139,124,246,0.15);
}
.lily-sb-item.active .lily-sb-idx {
    background: rgba(139,124,246,0.18);
    color: var(--accent);
}
.lily-sb-info { min-width: 0; }

.lily-sb-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-0);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lily-sb-meta { font-size: 11px; color: var(--text-2); }

.lily-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ── Pond Visualization ── */

.pond-surface {
    position: relative;
    flex: 1;
    min-height: 200px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid rgba(140,120,80,0.2);
    margin-bottom: 0;
    background: #f4edd8;
}

#pond-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.pond-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    color: rgba(100,80,50,0.35);
    z-index: 1;
}

/* ── Home Tab ── */

.home-hero {
    padding: 32px 0 16px;
}
.home-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}
.home-icon { flex-shrink: 0; }
.home-title {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-text), #3ecf8e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.home-sub {
    color: var(--text-2);
    font-size: 14px;
    margin-top: 2px;
}
.home-desc {
    color: var(--text-2);
    font-size: 14px;
    line-height: 1.8;
    margin-top: 16px;
}

.home-chat-cta {
    display: inline-flex; align-items: center; gap: 8px;
    margin-top: 20px; padding: 12px 24px;
    font-family: var(--font); font-size: 15px; font-weight: 600;
    color: #fff; text-decoration: none;
    background: var(--accent); border-radius: 10px;
    transition: all 200ms ease;
    box-shadow: 0 0 20px rgba(139,124,246,0.25);
}
.home-chat-cta:hover {
    background: var(--accent-hover); text-decoration: none;
    box-shadow: 0 0 30px rgba(139,124,246,0.35);
    transform: translateY(-1px);
}
.home-pond-wrap {
    position: relative;
    height: 260px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid rgba(140,120,80,0.15);
    margin: 20px 0 8px;
    background: #ede6d0;
}
.home-pond-wrap canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.home-pipeline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 36px 16px;
    margin: 20px 0;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow-x: auto;
}
.pipeline-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 24px;
    min-width: 100px;
}
.pipeline-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    border: 1px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: transform 0.2s;
}
.pipeline-stage:hover .pipeline-icon { transform: translateY(-3px); }
.pipeline-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-0);
    margin-top: 10px;
}
.pipeline-desc {
    font-size: 11px;
    color: var(--text-2);
    margin-top: 2px;
    text-align: center;
}
.pipeline-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0 4px;
}
.pipeline-action {
    font-size: 10px;
    color: var(--text-2);
    letter-spacing: 0.5px;
}
.home-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.home-feature {
    padding: 20px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s;
}
.home-feature:hover { border-color: var(--border-hover); }
.home-feature h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-0);
}
.home-feature p {
    font-size: 12px;
    color: var(--text-2);
    margin-top: 6px;
    line-height: 1.5;
}
.feature-detail {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-1);
    line-height: 1.7;
}

/* ── Lily Detail ── */

.lily-detail {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    margin-top: 12px;
}

.lily-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 4px;
}

.lily-detail-head h3 {
    font-size: 18px;
    font-weight: 700;
}

.lily-detail-prism {
    font-size: 14px;
    color: var(--text-2);
    margin-bottom: 12px;
}

.lily-detail-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--text-2);
}

.lily-detail-meta b { color: var(--text-1); font-weight: 500; }

/* ── Petal Card ── */

.petal-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all var(--transition);
}

.petal-card:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.petal-card-name { font-size: 14px; font-weight: 500; }
.petal-card-meta { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* ── Format Download Dropdown ── */

.dl-drop { position: relative; display: inline-block; }

.dl-icon-btn {
    width: 30px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text-2);
    cursor: pointer;
    transition: all var(--transition);
}

.dl-icon-btn:hover { color: var(--text-0); border-color: var(--border-hover); }
.dl-icon-btn svg { display: block; }

.dl-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 4px);
    right: 0;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px;
    z-index: 20;
    min-width: 90px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.dl-menu.open { display: block; }

.dl-item {
    display: block;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-1);
    text-decoration: none;
    transition: background var(--transition);
}

.dl-item:hover {
    background: var(--bg-2);
    color: var(--text-0);
    text-decoration: none;
}

/* ── Petal Preview ── */

.petal-preview {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-top: 12px;
}

.petal-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    font-weight: 500;
}

.petal-back {
    background: none;
    border: none;
    color: var(--text-1);
    cursor: pointer;
    font-family: var(--font);
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 6px;
}

.petal-back:hover { background: var(--bg-2); color: var(--text-0); }

.petal-preview-body {
    padding: 24px;
    font-size: 14px;
    line-height: 1.7;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* ── Output Card ── */

.output-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.output-name { font-size: 14px; font-weight: 500; }
.output-meta { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* ── Pagination ── */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 16px;
    padding: 8px 0;
}
.pg-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-1);
    font-size: 13px;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
}
.pg-btn:hover:not(:disabled):not(.active) {
    background: var(--bg-3);
    border-color: var(--border-hover);
}
.pg-btn.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent-text);
    font-weight: 600;
}
.pg-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

/* ── Markdown Body ── */

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    margin-top: 20px; margin-bottom: 10px; font-weight: 600;
}
.markdown-body h1 { font-size: 20px; }
.markdown-body h2 { font-size: 17px; }
.markdown-body h3 { font-size: 15px; }
.markdown-body p { margin-bottom: 12px; }
.markdown-body ul, .markdown-body ol { margin-bottom: 12px; padding-left: 24px; }
.markdown-body li { margin-bottom: 4px; }

.markdown-body code {
    background: var(--bg-3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--mono);
    font-size: 13px;
}

.markdown-body pre {
    background: var(--bg-0);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin-bottom: 12px;
}

.markdown-body pre code { background: none; padding: 0; }

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
    font-size: 13px;
}

.markdown-body th, .markdown-body td {
    padding: 6px 12px;
    border: 1px solid var(--border);
    text-align: left;
}

.markdown-body th { background: var(--bg-2); font-weight: 600; }

.markdown-body blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 16px;
    color: var(--text-1);
    margin-bottom: 12px;
}

/* ── Skills Tab ── */

.skills-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.skill-chip {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-family: var(--font);
    cursor: pointer;
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.skill-chip:hover {
    color: var(--text-1);
    border-color: var(--border-hover);
    background: var(--bg-2);
}

.skill-chip.active {
    background: var(--accent-glow);
    color: var(--accent-text);
    border-color: rgba(139, 124, 246, 0.3);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}

.skill-card {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    cursor: pointer;
    transition: all 200ms ease;
    overflow: hidden;
    min-width: 0;
}

.skill-card:hover {
    border-color: var(--border-hover);
}

.skill-card.expanded {
    border-color: rgba(139, 124, 246, 0.25);
}

.skill-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.skill-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

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

.skill-card-sub {
    font-size: 12px;
    color: var(--text-2);
    margin-left: auto;
    white-space: nowrap;
}

.skill-chevron {
    flex-shrink: 0;
    transition: transform 200ms ease;
    opacity: 0.3;
}

.skill-card:hover .skill-chevron { opacity: 0.6; }
.skill-card.expanded .skill-chevron { transform: rotate(180deg); opacity: 0.8; }

.skill-card-desc {
    font-size: 13px;
    color: var(--text-1);
    margin-top: 6px;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

.skill-detail {
    max-height: 0;
    overflow: hidden;
    transition: max-height 350ms ease;
}

.skill-card.expanded .skill-detail {
    max-height: 60vh;
    overflow-y: auto;
}

.skill-detail-inner {
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid var(--border);
}

/* thin custom scrollbar */
.skill-detail::-webkit-scrollbar { width: 5px; }
.skill-detail::-webkit-scrollbar-track { background: transparent; }
.skill-detail::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }
.skill-detail::-webkit-scrollbar-thumb:hover { background: var(--text-2); }

.skill-detail .markdown-body {
    font-size: 13.5px;
    line-height: 1.7;
}

.skill-detail .markdown-body h1 { font-size: 18px; margin: 0 0 8px; }
.skill-detail .markdown-body h2 { font-size: 15px; margin: 16px 0 6px; }
.skill-detail .markdown-body h3 { font-size: 14px; }
.skill-detail .markdown-body pre { font-size: 12px; white-space: pre-wrap; }
.skill-detail .markdown-body ul,
.skill-detail .markdown-body ol { padding-left: 20px; }


/* ── Mobile Header + Tab Strip ── */
.mobile-header {
    display: none;
    height: 48px; padding: 0 16px;
    background: var(--bg-1); border-bottom: 1px solid var(--border);
    align-items: center; justify-content: space-between;
    flex-shrink: 0;
}
.mobile-header .logo { font-family: 'EB Garamond', serif; font-size: 20px; font-weight: 600; color: var(--text-0); letter-spacing: 0.5px; }
.mobile-chat-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px 6px 10px; border-radius: 8px;
    font-family: var(--font); font-size: 13px; font-weight: 600;
    color: var(--accent-text); text-decoration: none;
    background: var(--accent-glow); border: 1px solid rgba(139,124,246,0.25);
    transition: all var(--transition);
}
.mobile-chat-btn:hover { background: rgba(139,124,246,0.2); text-decoration: none; }
.mobile-chat-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Scrollable tab strip */
.mobile-tabs {
    display: none;
    overflow-x: auto;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
    padding: 0 4px;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.mobile-tabs::-webkit-scrollbar { display: none; }
.mobile-tab {
    flex-shrink: 0;
    padding: 10px 14px;
    font-size: 13px;
    font-family: var(--font);
    font-weight: 500;
    color: var(--text-2);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: color var(--transition);
}
.mobile-tab:hover { color: var(--text-1); }
.mobile-tab.active {
    color: var(--accent-text);
    border-bottom-color: var(--accent);
}

/* ── Responsive ── */

@media (max-width: 768px) {
    .dashboard { flex-direction: column; height: 100vh; }
    .mobile-header { display: flex; }
    .mobile-tabs { display: flex; }
    .sidebar { display: none; }

    .content { padding: 16px; flex: 1; min-height: 0; overflow-y: auto; }
    .content-header { padding-top: 0; }
    .stats-grid { grid-template-columns: 1fr; }
    .lily-browser { flex-direction: column; height: auto; min-height: 0; }
    .lily-sb { width: 100%; max-height: 200px; }
    .pond-surface { flex: none; height: 250px; min-height: 0; }

    /* Data tables: horizontal scroll on mobile */
    .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .data-table th, .data-table td { white-space: nowrap; font-size: 12px; padding: 8px 10px; }

    /* Upload area: reduce padding on mobile */
    .upload-area { padding: 24px 16px; }

    /* Pipeline: reduce min-width for very narrow screens */
    .pipeline-stage { min-width: 70px; }
    .pipeline-desc { font-size: 11px; }

    /* Home layout: stack vertically */
    .home-features { grid-template-columns: 1fr; }
}
