/* ===== CSS VARIABLES ===== */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(20, 20, 32, 0.85);
    --bg-card-hover: rgba(28, 28, 44, 0.95);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --border-glass: rgba(255, 255, 255, 0.08);
    --text-primary: #e8e4e0;
    --text-secondary: #9a95a0;
    --text-muted: #5a5660;
    --accent-gold: #d4a574;
    --accent-gold-light: #e8c9a0;
    --accent-rose: #c77dba;
    --accent-rose-light: #daa0d2;
    --accent-red: #e05555;
    --accent-green: #4ecb71;
    --accent-blue: #5b9bd5;
    --gradient-main: linear-gradient(135deg, #d4a574, #c77dba);
    --gradient-subtle: linear-gradient(135deg, rgba(212, 165, 116, 0.15), rgba(199, 125, 186, 0.15));
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --nav-height: 68px;
    --top-bar-height: 56px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --font-sans: 'Outfit', 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* ===== RESET ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent-gold);
    text-decoration: none;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    color: inherit;
}

input,
textarea,
select {
    font-family: inherit;
    color: inherit;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.95rem;
    outline: none;
    width: 100%;
    transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent-gold);
}

textarea {
    resize: vertical;
}

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

/* ===== BOOT SCREEN ===== */
.boot-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s;
}

.boot-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.boot-content {
    text-align: center;
    padding: 2rem;
}

.boot-logo {
    margin-bottom: 1.5rem;
    animation: pulse-glow 2s ease-in-out infinite;
}

.boot-logo svg {
    width: 80px;
    height: 96px;
}

.boot-title {
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: 0.3em;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.boot-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 2rem;
}

.boot-progress {
    width: 200px;
    height: 3px;
    background: var(--bg-secondary);
    border-radius: 3px;
    margin: 0 auto 1rem;
    overflow: hidden;
}

.boot-progress-bar {
    height: 100%;
    width: 0;
    background: var(--gradient-main);
    border-radius: 3px;
    transition: width 0.3s;
}

.boot-status {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

@keyframes pulse-glow {

    0%,
    100% {
        filter: drop-shadow(0 0 8px rgba(212, 165, 116, 0.3));
    }

    50% {
        filter: drop-shadow(0 0 20px rgba(212, 165, 116, 0.6));
    }
}

/* ===== APP LAYOUT ===== */
.app {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.app.hidden {
    display: none;
}

/* ===== TOP BAR ===== */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--top-bar-height);
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.logo-mark svg {
    width: 22px;
    height: 26px;
}

.logo-text {
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.2em;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: var(--bg-glass);
}

.icon-btn svg {
    width: 20px;
    height: 20px;
}

.icon-moon {
    display: none;
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--nav-height);
    padding-bottom: var(--safe-bottom);
    background: rgba(10, 10, 15, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-around;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.05em;
}

.nav-item svg {
    width: 22px;
    height: 22px;
    transition: all 0.2s;
}

.nav-item.active {
    color: var(--accent-gold);
}

.nav-item.active svg {
    stroke: var(--accent-gold);
    filter: drop-shadow(0 0 6px rgba(212, 165, 116, 0.4));
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    padding-top: var(--top-bar-height);
    padding-bottom: var(--nav-height);
}

.view {
    display: none;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== HOME VIEW ===== */
.home-hero {
    text-align: center;
    padding: 2rem 0 1.5rem;
}

.hero-greeting {
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.hero-title {
    font-size: 2rem;
    font-weight: 900;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-style: italic;
}

.status-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    margin-bottom: 1.5rem;
    background-image: var(--gradient-subtle);
}

.status-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
    animation: blink 2s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.status-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--accent-green);
    text-transform: uppercase;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    text-align: center;
}

.status-value {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
}

.status-name {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.section-title {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.quick-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    transition: all 0.25s;
    text-align: left;
}

.quick-card:hover,
.quick-card:active {
    background: var(--bg-card-hover);
    border-color: rgba(212, 165, 116, 0.2);
    transform: translateY(-2px);
}

.quick-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.3rem;
}

.quick-icon svg {
    width: 22px;
    height: 22px;
}

.chat-icon {
    background: rgba(212, 165, 116, 0.15);
    color: var(--accent-gold);
}

.chat-icon svg {
    stroke: var(--accent-gold);
}

.protocol-icon {
    background: rgba(199, 125, 186, 0.15);
    color: var(--accent-rose);
}

.protocol-icon svg {
    stroke: var(--accent-rose);
}

.assess-icon {
    background: rgba(91, 155, 213, 0.15);
    color: var(--accent-blue);
}

.assess-icon svg {
    stroke: var(--accent-blue);
}

.journal-icon {
    background: rgba(78, 203, 113, 0.15);
    color: var(--accent-green);
}

.journal-icon svg {
    stroke: var(--accent-green);
}

.quick-label {
    font-weight: 700;
    font-size: 0.95rem;
}

.quick-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.daily-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    margin-bottom: 1.5rem;
}

.daily-card .protocol-tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    margin-bottom: 0.6rem;
}

.daily-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.4rem;
}

.daily-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.8rem;
}

.daily-card .protocol-steps {
    list-style: none;
}

.daily-card .protocol-steps li {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.3rem 0;
    padding-left: 1.2rem;
    position: relative;
}

.daily-card .protocol-steps li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--accent-gold);
    font-weight: bold;
}

.reminder-banner {
    background: var(--gradient-subtle);
    border: 1px solid rgba(212, 165, 116, 0.15);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    margin-bottom: 1rem;
}

.reminder-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.reminder-text strong {
    color: var(--accent-gold);
}

/* ===== CHAT VIEW ===== */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - var(--top-bar-height) - var(--nav-height));
    margin: -1rem;
}

.chat-header-bar {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-glass);
    background: var(--bg-secondary);
}

.back-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
    flex-shrink: 0;
}

.back-btn:hover {
    background: var(--bg-glass);
}

.back-btn svg {
    width: 20px;
    height: 20px;
}

.chat-header-info h2 {
    font-size: 1rem;
    font-weight: 700;
}

.chat-header-info .chat-status {
    font-size: 0.7rem;
    color: var(--accent-gold);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* --- Mode Selector --- */
.mode-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-glass);
    background: rgba(18, 18, 26, 0.9);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.mode-selector::-webkit-scrollbar {
    display: none;
}

.mode-label {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    text-transform: uppercase;
    white-space: nowrap;
    font-family: var(--font-mono);
}

.mode-chip {
    flex-shrink: 0;
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    transition: all 0.25s;
}

.mode-chip:hover {
    border-color: rgba(212, 165, 116, 0.3);
    color: var(--text-secondary);
}

.mode-chip.active[data-mode="aegis"] {
    background: rgba(212, 165, 116, 0.15);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    box-shadow: 0 0 12px rgba(212, 165, 116, 0.2);
}

.mode-chip.active[data-mode="surgeon"] {
    background: rgba(91, 155, 213, 0.15);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    box-shadow: 0 0 12px rgba(91, 155, 213, 0.2);
}

.mode-chip.active[data-mode="realist"] {
    background: rgba(224, 85, 85, 0.15);
    border-color: var(--accent-red);
    color: var(--accent-red);
    box-shadow: 0 0 12px rgba(224, 85, 85, 0.2);
}

.mode-chip.active[data-mode="omni"] {
    background: rgba(78, 203, 113, 0.15);
    border-color: var(--accent-green);
    color: var(--accent-green);
    box-shadow: 0 0 12px rgba(78, 203, 113, 0.2);
}

.mode-chip.active[data-mode="vitruvian"] {
    background: rgba(199, 125, 186, 0.15);
    border-color: var(--accent-rose);
    color: var(--accent-rose);
    box-shadow: 0 0 12px rgba(199, 125, 186, 0.2);
}

.mode-chip.active[data-mode="truth"] {
    background: rgba(0, 210, 211, 0.12);
    border-color: #00d2d3;
    color: #00d2d3;
    box-shadow: 0 0 14px rgba(0, 210, 211, 0.25);
}

.mode-chip.active[data-mode="singularity"] {
    background: linear-gradient(135deg, rgba(212, 165, 116, 0.2), rgba(0, 210, 211, 0.15));
    border-color: #e8c9a0;
    color: #e8c9a0;
    box-shadow: 0 0 18px rgba(212, 165, 116, 0.3), 0 0 30px rgba(0, 210, 211, 0.1);
    animation: singularityPulse 3s ease-in-out infinite;
}

@keyframes singularityPulse {

    0%,
    100% {
        box-shadow: 0 0 18px rgba(212, 165, 116, 0.3), 0 0 30px rgba(0, 210, 211, 0.1);
    }

    50% {
        box-shadow: 0 0 22px rgba(212, 165, 116, 0.5), 0 0 40px rgba(0, 210, 211, 0.2);
    }
}

/* --- Pre-Flight Sequence Box (V10) --- */
.preflight-box {
    background: linear-gradient(135deg, rgba(212, 165, 116, 0.08), rgba(0, 210, 211, 0.06));
    border: 1px solid rgba(212, 165, 116, 0.25);
    border-left: 3px solid #e8c9a0;
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    margin: 0 0 0.8rem 0;
    font-size: 0.78rem;
}

.preflight-box strong {
    color: #e8c9a0;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

.preflight-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.4rem;
}

.pf-check {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    letter-spacing: 0.03em;
}

.pf-check.pass {
    background: rgba(78, 203, 113, 0.1);
    border: 1px solid rgba(78, 203, 113, 0.3);
    color: var(--accent-green);
}

.pf-check.pass::before {
    content: '✓ ';
    font-weight: 800;
}

/* --- Truth Check Box (V7) --- */
.truth-check-box {
    background: rgba(0, 210, 211, 0.06);
    border: 1px solid rgba(0, 210, 211, 0.25);
    border-left: 3px solid #00d2d3;
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    margin: 0.6rem 0;
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.truth-check-box strong {
    color: #00d2d3;
    font-weight: 700;
}

.truth-check-box .search-term {
    background: rgba(0, 210, 211, 0.1);
    border: 1px solid rgba(0, 210, 211, 0.2);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: #00d2d3;
    white-space: nowrap;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.message {
    max-width: 88%;
    animation: msgIn 0.3s ease;
}

@keyframes msgIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.system-message {
    align-self: flex-start;
}

.system-message .message-content {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 4px var(--radius-md) var(--radius-md) var(--radius-md);
    padding: 1rem;
    font-size: 0.88rem;
    line-height: 1.6;
}

.system-message .message-content p {
    margin-bottom: 0.5rem;
}

.system-message .message-content p:last-child {
    margin-bottom: 0;
}

.system-message .message-content ul {
    margin: 0.3rem 0 0.5rem 0;
    padding-left: 0;
    list-style: none;
}

.system-message .message-content ul li {
    font-size: 0.85rem;
    padding: 0.3rem 0 0.3rem 1rem;
    position: relative;
    line-height: 1.5;
    color: var(--text-secondary);
}

.system-message .message-content ul li::before {
    content: '\25B8';
    position: absolute;
    left: 0;
    color: var(--accent-gold);
    font-weight: bold;
}

.system-message .message-content ul li strong {
    color: var(--text-primary);
}

.user-message {
    align-self: flex-end;
}

.user-message .message-content {
    background: var(--gradient-main);
    color: #1a1a1a;
    border-radius: var(--radius-md) 4px var(--radius-md) var(--radius-md);
    padding: 0.8rem 1rem;
    font-size: 0.88rem;
    line-height: 1.5;
    font-weight: 500;
}

.typing-indicator {
    align-self: flex-start;
}

.typing-indicator .message-content {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 4px var(--radius-md) var(--radius-md) var(--radius-md);
    padding: 1rem;
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.2s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-6px);
    }
}

.chat-input-area {
    border-top: 1px solid var(--border-glass);
    background: var(--bg-secondary);
    padding: 0.6rem;
}

.chat-quick-prompts {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.chat-quick-prompts::-webkit-scrollbar {
    display: none;
}

.prompt-chip {
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    transition: all 0.2s;
    white-space: nowrap;
}

.prompt-chip:hover {
    background: rgba(212, 165, 116, 0.1);
    border-color: rgba(212, 165, 116, 0.3);
    color: var(--accent-gold);
}

.chat-form {
    display: flex;
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: 4px 4px 4px 16px;
    transition: border-color 0.2s;
}

.chat-input-wrapper:focus-within {
    border-color: var(--accent-gold);
}

.chat-input {
    background: none;
    border: none;
    padding: 8px 0;
    font-size: 0.9rem;
    line-height: 1.4;
    max-height: 120px;
    resize: none;
    flex: 1;
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--gradient-main);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s, opacity 0.2s;
}

.send-btn svg {
    width: 18px;
    height: 18px;
    stroke: #1a1a1a;
}

.send-btn:hover {
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.4;
}

/* ===== PROTOCOLS VIEW ===== */
.view-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.view-header h2 {
    font-size: 1.2rem;
    font-weight: 800;
    flex: 1;
}

.protocol-filters {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding-bottom: 0.8rem;
    scrollbar-width: none;
}

.protocol-filters::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    transition: all 0.2s;
    text-transform: capitalize;
}

.filter-chip.active {
    background: var(--gradient-main);
    color: #1a1a1a;
    border-color: transparent;
}

.protocols-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.protocol-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.25s;
}

.protocol-card:hover {
    border-color: rgba(212, 165, 116, 0.2);
}

.protocol-card-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem;
    cursor: pointer;
}

.protocol-number {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-gold);
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(212, 165, 116, 0.1);
    flex-shrink: 0;
}

.protocol-card-header h3 {
    font-size: 0.92rem;
    font-weight: 700;
    flex: 1;
}

.protocol-chevron {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    transition: transform 0.3s;
    flex-shrink: 0;
}

.protocol-card.open .protocol-chevron {
    transform: rotate(180deg);
}

.protocol-card-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.protocol-card.open .protocol-card-body {
    max-height: 500px;
}

.protocol-card-body-inner {
    padding: 0 1rem 1rem;
    border-top: 1px solid var(--border-glass);
    padding-top: 1rem;
}

.protocol-card-body-inner p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.8rem;
}

.protocol-card-body-inner ul {
    list-style: none;
    margin-bottom: 0.5rem;
}

.protocol-card-body-inner ul li {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.25rem 0 0.25rem 1rem;
    position: relative;
}

.protocol-card-body-inner ul li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--accent-gold);
}

.protocol-group-tag {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 0.5rem;
}

.tag-paralysis {
    background: rgba(91, 155, 213, 0.15);
    color: var(--accent-blue);
}

.tag-anxiety {
    background: rgba(224, 85, 85, 0.15);
    color: var(--accent-red);
}

.tag-depression {
    background: rgba(199, 125, 186, 0.15);
    color: var(--accent-rose);
}

.tag-addiction {
    background: rgba(212, 165, 116, 0.15);
    color: var(--accent-gold);
}

.tag-ocd {
    background: rgba(78, 203, 113, 0.15);
    color: var(--accent-green);
}

.tag-purpose {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.tag-elite {
    background: linear-gradient(135deg, rgba(212, 165, 116, 0.2), rgba(199, 125, 186, 0.2));
    color: var(--accent-gold-light);
    border: 1px solid rgba(212, 165, 116, 0.25);
    text-shadow: 0 0 8px rgba(212, 165, 116, 0.3);
}

.filter-chip-elite {
    background: linear-gradient(135deg, rgba(212, 165, 116, 0.1), rgba(199, 125, 186, 0.1)) !important;
    border-color: rgba(212, 165, 116, 0.25) !important;
    color: var(--accent-gold) !important;
}

.filter-chip-elite.active {
    background: linear-gradient(135deg, #d4a574, #c77dba) !important;
    color: #1a1a1a !important;
    border-color: transparent !important;
    box-shadow: 0 0 15px rgba(212, 165, 116, 0.3);
}

/* ===== ASSESS VIEW ===== */
.assess-tabs {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.assess-tabs::-webkit-scrollbar {
    display: none;
}

.assess-tab {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.assess-tab.active {
    background: var(--gradient-main);
    color: #1a1a1a;
    border-color: transparent;
}

.assess-content {
    padding-bottom: 1rem;
}

.checklist-group {
    margin-bottom: 1.5rem;
}

.checklist-group h3 {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 0.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-glass);
}

.checklist-group h3.red-flags {
    color: var(--accent-red);
}

.checklist-group h3.green-flags {
    color: var(--accent-green);
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.6rem 0;
}

.checklist-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    accent-color: var(--accent-gold);
    margin-top: 2px;
    cursor: pointer;
}

.checklist-item label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    cursor: pointer;
}

.assess-result {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-top: 1rem;
    text-align: center;
}

.assess-score {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 0.3rem;
}

.assess-verdict {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===== JOURNAL VIEW ===== */
.journal-intro {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
}

.journal-intro p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.journal-entries {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.journal-entry {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.journal-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.journal-entry-type {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(224, 85, 85, 0.15);
    color: var(--accent-red);
}

.journal-entry-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.journal-entry h4 {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.journal-entry p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.severity-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 0.4rem;
}

.severity-1 {
    background: rgba(91, 155, 213, 0.15);
    color: var(--accent-blue);
}

.severity-2 {
    background: rgba(212, 165, 116, 0.15);
    color: var(--accent-gold);
}

.severity-3 {
    background: rgba(224, 85, 85, 0.15);
    color: var(--accent-red);
}

.severity-4 {
    background: rgba(224, 85, 85, 0.3);
    color: #ff6b6b;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state p {
    font-size: 0.85rem;
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.5rem;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 800;
}

.close-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.4rem;
    color: var(--text-secondary);
    transition: background 0.2s;
}

.close-btn:hover {
    background: var(--bg-glass);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.severity-selector {
    display: flex;
    gap: 0.4rem;
}

.severity-btn {
    flex: 1;
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.severity-btn.active {
    background: rgba(224, 85, 85, 0.15);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.submit-btn {
    width: 100%;
    padding: 14px;
    border-radius: var(--radius-md);
    background: var(--gradient-main);
    color: #1a1a1a;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    transition: transform 0.2s, opacity 0.2s;
}

.submit-btn:hover {
    transform: translateY(-1px);
}

.submit-btn:active {
    transform: translateY(0);
}

/* ===== EMERGENCY FAB ===== */
.emergency-fab {
    position: fixed;
    bottom: calc(var(--nav-height) + 16px);
    right: 16px;
    z-index: 90;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent-red);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(224, 85, 85, 0.4);
    transition: all 0.3s;
    animation: fabPulse 3s infinite;
}

.emergency-fab svg {
    width: 24px;
    height: 24px;
}

.emergency-fab:hover {
    transform: scale(1.1);
}

@keyframes fabPulse {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(224, 85, 85, 0.4);
    }

    50% {
        box-shadow: 0 4px 30px rgba(224, 85, 85, 0.7);
    }
}

/* ===== EMERGENCY PANEL ===== */
.emergency-panel {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    display: none;
    align-items: flex-end;
}

.emergency-panel.active {
    display: flex;
}

.emergency-panel-content {
    background: var(--bg-secondary);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    animation: slideUp 0.3s ease;
}

.emergency-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1rem;
    border-bottom: 1px solid var(--border-glass);
}

.emergency-header h2 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--accent-red);
    letter-spacing: 0.1em;
}

.emergency-body {
    padding: 1rem;
}

.emergency-note {
    font-size: 0.85rem;
    color: var(--accent-gold);
    font-weight: 600;
    text-align: center;
    margin-bottom: 1.2rem;
    font-style: italic;
}

.emergency-section {
    margin-bottom: 1.5rem;
}

.emergency-section h3 {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.6rem;
}

.emergency-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    text-align: left;
    transition: all 0.2s;
}

.action-btn:hover {
    border-color: rgba(212, 165, 116, 0.3);
    background: var(--bg-card-hover);
}

.action-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.action-label {
    font-weight: 700;
    font-size: 0.9rem;
    display: block;
}

.action-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: block;
}

.hotline-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.hotline-btn {
    display: block;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.hotline-btn:hover {
    border-color: rgba(78, 203, 113, 0.3);
}

.hotline-name {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.hotline-number {
    display: block;
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-green);
    margin: 0.2rem 0;
}

.hotline-detail {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.resource-chips {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.resource-chip {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(91, 155, 213, 0.1);
    border: 1px solid rgba(91, 155, 213, 0.2);
    color: var(--accent-blue);
    transition: all 0.2s;
}

.resource-chip:hover {
    background: rgba(91, 155, 213, 0.2);
}

/* ===== BREATHING OVERLAY ===== */
.breathing-overlay,
.grounding-overlay {
    position: fixed;
    inset: 0;
    z-index: 400;
    background: rgba(5, 5, 10, 0.95);
    backdrop-filter: blur(16px);
    display: none;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.breathing-overlay.active,
.grounding-overlay.active {
    display: flex;
}

.breathing-content,
.grounding-content {
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

.breathing-content h2,
.grounding-content h2 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.breathing-instruction {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-gold);
    margin-bottom: 2rem;
    min-height: 2rem;
}

.breathing-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    margin: 0 auto 2rem;
    border: 3px solid var(--accent-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 4s, border-color 0.5s;
    box-shadow: 0 0 30px rgba(212, 165, 116, 0.2);
}

.breathing-circle.inhale {
    transform: scale(1.3);
    border-color: var(--accent-gold);
}

.breathing-circle.exhale {
    transform: scale(0.8);
    border-color: var(--accent-rose);
}

.breathing-circle span {
    font-size: 2.5rem;
    font-weight: 900;
    font-family: var(--font-mono);
}

.breathing-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.breathing-progress {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.breathing-close,
.grounding-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.grounding-step {
    margin-bottom: 1.5rem;
}

.grounding-number {
    display: block;
    font-size: 4rem;
    font-weight: 900;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.grounding-prompt {
    font-size: 1rem;
    color: var(--text-secondary);
}

.grounding-inputs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.grounding-inputs input {
    text-align: center;
}

.grounding-next {
    max-width: 200px;
    margin: 0 auto;
}

/* ===== RESPONSIVE ===== */
@media (min-width: 600px) {
    .main-content {
        max-width: 540px;
        margin: 0 auto;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .quick-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .modal-content {
        border-radius: var(--radius-lg);
        margin-bottom: 2rem;
    }

    .emergency-panel-content {
        max-width: 440px;
        margin: 0 auto;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
}

@media (min-width: 768px) {
    .main-content {
        max-width: 640px;
    }

    .bottom-nav {
        max-width: 500px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
}