/* AI Confidant — JAGCON Group × Stephen Alexander DVC® i-Future Proof */
/* Inter font loaded via index.html <link> tag */

:root {
    /* DVC Brand Palette */
    --brand-blue: #0077C8;
    --brand-blue-dark: #005fa0;
    --brand-blue-light: #3399d6;
    --brand-gold: #C4A962;
    --brand-gold-light: #d4be82;
    --brand-dark: #1a1a2e;
    --brand-light: #f0f4f8;

    /* Functional colours */
    --bg: #f0f4f8;
    --bg-card: #ffffff;
    --bg-dark: var(--brand-dark);
    --text: #2d2d2d;
    --text-light: #6b6b6b;
    --text-muted: #999;
    --accent: var(--brand-blue);
    --accent-light: var(--brand-blue-light);
    --accent-bg: #e6f0fa;
    --border: #dde3ea;
    --success: #3d8b5a;
    --warning: #c4883a;
    --forming: #7a8a9a;
    --emerging: var(--brand-gold);
    --established: var(--brand-blue);
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    min-width: 260px;
    background: linear-gradient(180deg, var(--brand-dark) 0%, #0a1628 40%, var(--brand-blue) 100%);
    color: #e0e0e0;
    padding: 24px 16px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    margin-bottom: 6px;
}
.sidebar-logo img {
    height: 36px;
    width: auto;
}

.sidebar-brand {
    font-size: 13px;
    font-weight: 500;
    color: var(--brand-gold);
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.sidebar .subtitle {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    margin-bottom: 28px;
    letter-spacing: 0.3px;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: all 0.2s;
}

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

.sidebar nav a:hover {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.9);
}
.sidebar nav a.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--brand-gold);
}

/* Usage badge in sidebar */
.usage-badge {
    margin: 12px 0;
    padding: 10px 12px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
}
.usage-tier {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--brand-gold);
    margin-bottom: 6px;
}
.usage-bar-track {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}
.usage-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
}
.usage-text {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}
.usage-detail {
    font-size: 10px;
    color: rgba(255,255,255,0.3);
    margin-top: 2px;
}

/* Purchase modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}
.modal-content {
    background: var(--bg-card, #1a1a2e);
    border-radius: 12px;
    padding: 28px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.purchase-pack {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.purchase-pack:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
}
.purchase-pack.selected {
    border-color: var(--brand-gold);
    background: rgba(212,175,55,0.08);
}
.purchase-pack.featured {
    border-color: var(--brand-gold);
}
.purchase-pack.upgrade {
    border-left: 3px solid var(--brand-blue);
}
.pack-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pack-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--brand-gold);
    white-space: nowrap;
}
.pack-badge {
    position: absolute;
    top: -8px;
    right: 12px;
    background: var(--brand-gold);
    color: #000;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* Budget exceeded message */
.budget-exceeded {
    background: rgba(231,76,60,0.08);
    border: 1px solid rgba(231,76,60,0.2);
    border-radius: 8px;
    padding: 16px;
    color: var(--text);
}
.budget-exceeded p {
    margin: 0 0 8px;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer .user-email {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 4px;
    word-break: break-all;
}

.sidebar-footer a {
    font-size: 12px;
    color: rgba(255,255,255,0.35);
    text-decoration: none;
    transition: color 0.15s;
}
.sidebar-footer a:hover {
    color: var(--brand-gold);
}

.main {
    flex: 1;
    padding: 36px 40px;
    max-width: 960px;
}

.main h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--brand-dark);
}

.main h2 .gold-accent {
    color: var(--brand-gold);
}

.main .page-desc {
    color: var(--text-light);
    margin-bottom: 28px;
    font-size: 15px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

.card .hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-style: italic;
}

/* Forms */
textarea, input[type="text"], input[type="email"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

textarea:focus, input:focus {
    outline: none;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(0,119,200,0.1);
}

textarea { min-height: 80px; }

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

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

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: var(--brand-blue);
    color: #fff;
    box-shadow: 0 2px 4px rgba(0,119,200,0.25);
}
.btn-primary:hover {
    background: var(--brand-blue-dark);
    box-shadow: 0 4px 8px rgba(0,119,200,0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    color: var(--brand-blue);
    border: 1px solid var(--brand-blue);
}
.btn-secondary:hover {
    background: var(--accent-bg);
}

.btn-gold {
    background: var(--brand-gold);
    color: #fff;
    box-shadow: 0 2px 4px rgba(196,169,98,0.3);
}
.btn-gold:hover {
    background: var(--brand-gold-light);
}

.btn-small {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-approve { background: var(--success); color: #fff; }
.btn-approve:hover { background: #348a4e; }
.btn-decline { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-decline:hover { background: #fef2f2; color: #c53030; border-color: #c53030; }

/* Chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 160px);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.chat-message {
    margin-bottom: 16px;
    padding: 14px 18px;
    border-radius: 12px;
    max-width: 85%;
    line-height: 1.55;
}

.chat-message.user {
    background: linear-gradient(135deg, var(--accent-bg), #dbe8f8);
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.chat-message .role {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--brand-blue);
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.chat-message.assistant .role {
    color: var(--brand-gold);
}

.chat-input {
    display: flex;
    gap: 8px;
    padding: 16px 0;
    border-top: 1px solid var(--border);
}

.chat-input textarea {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
}

/* Observations */
.observation {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    background: #fff;
    transition: box-shadow 0.2s;
}

.observation:hover {
    box-shadow: var(--shadow);
}

.observation.pending {
    border-left: 4px solid var(--brand-gold);
}

.observation.approved {
    border-left: 4px solid var(--success);
}

.observation .category {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--brand-blue);
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.observation .content {
    font-size: 14px;
    margin-bottom: 10px;
    line-height: 1.55;
}

.observation .actions {
    display: flex;
    gap: 8px;
}

/* Discovery graph */
#discovery-graph {
    width: 100%;
    min-height: 900px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    overflow: visible;
    position: relative;
}

#discovery-graph svg {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

/* Let the discovery page use more width */
.main.discovery-expanded {
    max-width: 1400px;
}

/* Journey */
.waypoints {
    display: flex;
    gap: 6px;
    margin: 16px 0;
}

.waypoint {
    flex: 1;
    text-align: center;
    padding: 14px 8px;
    border-radius: var(--radius);
    font-size: 12px;
    background: #fff;
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.waypoint.active {
    background: var(--accent-bg);
    border-color: var(--brand-blue);
    box-shadow: 0 2px 8px rgba(0,119,200,0.1);
}

.waypoint .number {
    font-size: 20px;
    font-weight: 700;
    color: var(--brand-blue);
}

.waypoint .label {
    color: var(--text-light);
    margin-top: 4px;
    font-weight: 500;
}

.strength-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    margin-top: 6px;
    overflow: hidden;
}

.strength-bar .fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s;
}

.strength-bar .fill.forming { background: var(--forming); }
.strength-bar .fill.emerging { background: var(--brand-gold); }
.strength-bar .fill.established { background: var(--brand-blue); }

/* Waypoint checkbox selection (onboarding) */
.waypoint-select {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.waypoint-option {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.waypoint-option:hover { border-color: var(--brand-blue); background: var(--accent-bg); }
.waypoint-option.selected { border-color: var(--brand-blue); background: var(--accent-bg); box-shadow: inset 3px 0 0 var(--brand-blue); }

/* Auth pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand-dark) 0%, #0a1628 50%, var(--brand-blue) 100%);
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 80%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(0,119,200,0.15) 0%, transparent 60%);
    pointer-events: none;
}

.auth-page::after {
    content: '';
    position: absolute;
    bottom: -20%;
    left: -20%;
    width: 60%;
    height: 60%;
    background: radial-gradient(ellipse, rgba(196,169,98,0.08) 0%, transparent 60%);
    pointer-events: none;
}

.auth-container {
    max-width: 420px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

.auth-card {
    background: rgba(255,255,255,0.97);
    border-radius: 16px;
    padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo img {
    height: 80px;
    width: auto;
}

.auth-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--brand-gold), transparent);
    margin: 0 40px 24px;
}

.auth-tagline {
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 28px;
    line-height: 1.5;
}

.auth-card .form-group label {
    color: var(--text-light);
    font-weight: 500;
    font-size: 13px;
}

.auth-card input[type="email"] {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 14px 16px;
    font-size: 15px;
}

.auth-card .btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    border-radius: var(--radius);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
}

.auth-footer p {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    line-height: 1.6;
}

.auth-footer a {
    color: var(--brand-gold);
    text-decoration: none;
}

/* Token code entry */
.auth-card .token-section {
    text-align: center;
}

.auth-card .token-section p {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 16px;
}

.auth-card .token-section input[type="text"] {
    text-align: center;
    font-size: 24px;
    letter-spacing: 8px;
    font-weight: 600;
    padding: 14px;
    color: var(--brand-blue);
}

/* Loading */
.loading {
    color: var(--text-muted);
    font-style: italic;
    padding: 16px;
}

/* Admin toggle */
.admin-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    margin: 16px 0;
    background: rgba(255,255,255,0.08);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid rgba(255,255,255,0.06);
}
.admin-toggle:hover {
    background: rgba(255,255,255,0.12);
}
.admin-toggle-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--brand-gold);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
.admin-toggle-switch {
    width: 38px;
    height: 22px;
    background: rgba(255,255,255,0.15);
    border-radius: 11px;
    position: relative;
    transition: background 0.2s;
}
.admin-toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: rgba(255,255,255,0.5);
    border-radius: 50%;
    transition: transform 0.2s;
}
.admin-toggle-switch.active {
    background: var(--brand-gold);
}
.admin-toggle-switch.active::after {
    transform: translateX(16px);
    background: #fff;
}

/* Admin table */
.admin-table {
    overflow-x: auto;
}
.admin-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.admin-table th, .admin-table td {
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.admin-table th {
    font-weight: 600;
    color: var(--text-light);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    background: var(--bg);
}
.admin-table tr:hover {
    background: var(--accent-bg);
}

/* Admin user tabs */
.admin-user-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.admin-user-tabs button.active {
    background: var(--brand-blue);
    color: #fff;
    border-color: var(--brand-blue);
}

/* Conversation panel in sidebar */
.conv-panel {
    margin-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 16px;
    flex: 1;
    overflow-y: auto;
}
.conv-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 0 6px;
}
.conv-panel-header span {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255,255,255,0.35);
}
.btn-icon {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    color: var(--brand-gold);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.btn-icon:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
    transform: scale(1.1);
}
.conv-item {
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 2px;
    transition: all 0.15s;
}
.conv-item:hover {
    background: rgba(255,255,255,0.08);
}
.conv-item.active {
    background: rgba(255,255,255,0.13);
    box-shadow: inset 3px 0 0 var(--brand-gold);
}
.conv-item-name {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}
.conv-item.active .conv-item-name {
    color: #fff;
}
.conv-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: rgba(255,255,255,0.3);
    margin-top: 2px;
}
.conv-item-actions {
    display: none;
}
.conv-item:hover .conv-item-actions {
    display: flex;
    gap: 2px;
}
.conv-item-actions button {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    font-size: 13px;
    padding: 0 4px;
    border-radius: 3px;
}
.conv-item-actions button:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* Discovery Narrative Panel */
.discovery-narrative {
    background: rgba(255,255,255,0.97);
    border: 1px solid #e0e0e0;
    border-left: 4px solid var(--brand-gold);
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    overflow: hidden;
}
.narrative-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--brand-dark);
    user-select: none;
    transition: background 0.15s;
}
.narrative-toggle:hover {
    background: rgba(196, 169, 98, 0.06);
}
.toggle-icon {
    font-size: 12px;
    transition: transform 0.2s;
    color: var(--brand-gold);
}
.discovery-narrative.collapsed .toggle-icon {
    transform: rotate(-90deg);
}
.discovery-narrative.collapsed .narrative-body {
    display: none;
}
.narrative-body {
    padding: 0 18px 18px;
    font-size: 14px;
    line-height: 1.7;
    color: #444;
}
.narrative-body h3 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--brand-gold);
    margin: 18px 0 8px 0;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(196, 169, 98, 0.2);
}
.narrative-body h3:first-child {
    margin-top: 0;
}
.narrative-body p {
    margin: 8px 0;
}
.narrative-body strong {
    color: var(--brand-dark);
}

/* Discovery Legend */
.discovery-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: #f8f8f8;
    border-radius: 6px;
    font-size: 13px;
    color: #555;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}
.legend-line {
    width: 22px;
    height: 0;
    display: inline-block;
}
.legend-line.solid {
    border-top: 3px solid #1a6b35;
}
.legend-line.dashed {
    border-top: 2.5px dashed #2d8a4e;
}

/* Gold button variant */
.btn-gold {
    background: linear-gradient(135deg, var(--brand-gold), #b89a55);
    color: #fff;
    border: none;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(196, 169, 98, 0.3);
}
.btn-gold:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(196, 169, 98, 0.4);
}
.discovery-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}
.explore-btn {
    margin-top: 0;
}
.btn-outline-gold {
    background: transparent;
    color: var(--brand-gold);
    border: 2px solid var(--brand-gold);
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.btn-outline-gold:hover {
    background: rgba(196, 169, 98, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(196, 169, 98, 0.2);
}
.btn-outline-gold:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
}

/* Node detail panel (expanded) */
.node-detail {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}
.node-connections-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin-bottom: 6px;
}
.node-connection {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 12px;
}
.conn-strength {
    font-weight: 700;
    font-size: 11px;
    min-width: 36px;
    text-align: center;
    padding: 2px 6px;
    border-radius: 10px;
    background: #f0f0f0;
    color: #2d8a4e;
}
.conn-strength.echo {
    background: #1a6b35;
    color: #fff;
}
.conn-name {
    color: #555;
}
.node-explore-btn {
    margin-top: 8px;
    font-size: 11px;
    padding: 6px 12px;
}
.node-click-hint {
    transition: opacity 0.2s;
}

/* Responsive */
@media (max-width: 768px) {
    .app { flex-direction: column; }
    .sidebar { width: 100%; min-width: 100%; height: auto; position: relative; padding: 16px; }
    .sidebar nav { display: flex; gap: 4px; overflow-x: auto; }
    .sidebar nav a { white-space: nowrap; }
    .main { padding: 20px 16px; }
    .auth-card { padding: 28px 24px; }
    .conv-panel { display: none; }
    .discovery-legend { flex-direction: column; gap: 8px; }
}

/* ============================================================
   Chain Walk — Discovery
   ============================================================ */

/* Progress bar */
.walk-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.walk-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--brand-gold);
    border-radius: 2px;
    transition: width 0.4s ease;
}
.walk-progress::before {
    content: '';
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    position: absolute;
    left: 0; right: 0;
}
.walk-progress {
    position: relative;
    background: var(--border);
    border-radius: 2px;
    height: 4px;
    margin-bottom: 20px;
}
.walk-progress-bar {
    position: absolute;
    left: 0; top: 0;
    height: 4px;
    background: var(--brand-gold);
    border-radius: 2px;
    transition: width 0.5s ease;
}
.walk-progress-label {
    position: absolute;
    right: 0;
    top: -20px;
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Walk cards */
.walk-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 5px solid var(--brand-gold);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}
.walk-card h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 6px 0 10px;
}
.walk-card p {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-light);
}
.walk-step-type {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--brand-gold);
    margin-bottom: 4px;
}
.walk-attractor { border-left-color: #C4A962; }
.walk-echo      { border-left-color: #888; }  /* overridden inline */
.walk-proven    { border-left-color: #7c3aed; }
.walk-curvature { border-left-color: #e9730c; }
.walk-tension   { border-left-color: #3a8fb5; }
.walk-similarity{ border-left-color: #2d8a4e; }
.walk-reveal    { border-left-color: var(--brand-blue); }

.walk-hash-link {
    display: inline-block;
    margin-top: 10px;
    font-size: 11px;
    font-family: monospace;
    color: var(--text-muted);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 3px 8px;
    background: var(--bg-page);
    transition: color 0.2s;
}
.walk-hash-link:hover { color: var(--brand-gold); border-color: var(--brand-gold); }

/* Navigation */
.walk-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    gap: 12px;
}
.walk-next-btn {
    min-width: 160px;
}

/* Updated legend line types */
.legend-line.proven {
    background: repeating-linear-gradient(90deg,#7c3aed 0,#7c3aed 8px,transparent 8px,transparent 12px);
    height: 2.5px;
}

/* Auto-play controls */
.walk-auto-btn {
    min-width: 36px;
    font-size: 16px;
    padding: 4px 10px;
    transition: background 0.2s;
}
.walk-auto-btn.playing {
    background: var(--brand-gold);
    color: var(--bg-card);
    border-color: var(--brand-gold);
}
.walk-speed-select {
    font-size: 12px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
}

/* Walk hint text */
.walk-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    font-style: italic;
}

/* Node cards in full graph are clickable */
#discovery-graph div[style*="cursor"] {
    transition: box-shadow 0.15s, border-color 0.15s;
}
#discovery-graph div[style*="cursor"]:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15) !important;
}

/* Source panel — drill-down to observation text */
.source-panel {
    margin-top: 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    font-size: 13px;
}
.source-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-page);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    user-select: none;
    transition: background 0.15s;
}
.source-panel-header:hover {
    background: var(--border);
    color: var(--text-primary);
}
.source-panel-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}
.source-panel-body {
    display: none;
    padding: 12px 14px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
}
.source-panel.open .source-panel-body {
    display: block;
}
.source-panel.open .source-panel-header span:first-child::before {
    content: '↑ ';
}
.source-panel.open .source-panel-header span:first-child {
    color: var(--text-primary);
}
.source-conv-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.source-conv {
    font-weight: 600;
    color: var(--brand-gold);
    text-transform: capitalize;
}
.source-text {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-light);
    white-space: pre-wrap;
}

/* Connection index — traceability list on node-origin card */
.conn-index {
    margin: 14px 0 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.conn-index-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    text-decoration: none;
}
.conn-index-item:hover {
    background: var(--bg-card);
    border-color: var(--brand-gold);
}
.conn-index-badge {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid;
    white-space: nowrap;
}
.conn-index-label {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.3;
}
.conn-index-hash {
    flex-shrink: 0;
    font-size: 10px;
    font-family: monospace;
    color: var(--text-muted);
    white-space: nowrap;
}

/* === Try This Out: Sidebar Section Label === */
.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--brand-gold);
    padding: 16px 16px 4px;
    margin-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* === Test Drive Cards === */
.td-cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 16px;
}
.td-card {
    padding: 24px;
}
.td-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}
.td-card-header h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    display: inline;
    margin-left: 10px;
}
.td-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--brand-blue);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    vertical-align: middle;
}
.td-status {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
}
.td-not-started {
    background: var(--bg);
    color: var(--text-muted);
}
.td-started {
    background: #e6f9ee;
    color: var(--success);
}
.td-desc {
    font-size: 14px;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 12px;
}
.td-what {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.55;
    background: var(--bg);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
}
.td-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.td-note {
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.6;
    background: #fff;
    border: 1px solid var(--border);
    border-left: 3px solid var(--brand-gold);
    padding: 16px 20px;
    border-radius: 6px;
}

/* === Mode Banner (in chat) === */
.mode-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #e6f0fa, #f0f7ff);
    border: 1px solid #c4d9f0;
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-blue);
}
.mode-banner-icon {
    font-size: 18px;
}

/* === Conversation list mode badge === */
.conv-mode-badge {
    font-size: 11px;
    margin-right: 4px;
}
