:root {
    --bg: #05080b;
    --bg-alt: #0b1116;
    --border: #3ba37c;
    --accent: #4fd1a5;
    --accent-soft: rgba(79, 209, 165, 0.15);
    --text: #e5f2ff;
    --text-soft: #9fb3c8;
    --danger: #ff6b6b;
    --card-bg: #0f1720;
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.45);
    --font-main: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: radial-gradient(circle at top, #0f172a 0, #020617 55%);
    color: var(--text);
    font-family: var(--font-main);
}

/* Layout */

#app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */

.sidebar {
    width: 280px;
    padding: 18px 16px;
    border-right: 1px solid rgba(79, 209, 165, 0.25);
    background: linear-gradient(180deg, #020617 0, #020617 40%, #020617 100%);
    overflow-y: auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.logo-dot {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 12px rgba(79, 209, 165, 0.9);
}

.logo-text {
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-soft);
}

/* Heartbeat Indicator */

.heartbeat {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: auto;
    background: #4fd1a5;
    animation: heartbeatPulse 1.8s infinite ease-in-out;
}

@keyframes heartbeatPulse {
    0% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.4); opacity: 1; }
    100% { transform: scale(1); opacity: 0.7; }
}

.section {
    margin-top: 16px;
}

.section h2 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-soft);
    margin-bottom: 8px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid rgba(79, 209, 165, 0.25);
    padding: 10px 12px;
    box-shadow: var(--shadow-soft);
}

.card.small {
    font-size: 12px;
}

.logs-panel {
    height: 120px;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.7);
}

/* Status Lines */

.status-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

/* Main */

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 18px 22px;
}

/* Header */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.title-main {
    font-size: 20px;
    font-weight: 600;
}

.title-sub {
    display: block;
    font-size: 12px;
    color: var(--text-soft);
}

/* Thinking Indicator */

.sage-thinking {
    width: 10px;
    height: 10px;
    background-color: #4cffd7;
    border-radius: 50%;
    animation: pulse 1.2s infinite ease-in-out;
    display: inline-block;
    margin-left: 8px;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.5); opacity: 1; }
    100% { transform: scale(1); opacity: 0.7; }
}

/* Waveform */

.waveform {
    display: flex;
    align-items: center;
    height: 20px;
    margin-left: 10px;
}

.waveform div {
    width: 4px;
    height: 10px;
    background: #4cffd7;
    margin: 0 2px;
    animation: wave 1.2s infinite ease-in-out;
}

.waveform div:nth-child(2) { animation-delay: 0.2s; }
.waveform div:nth-child(3) { animation-delay: 0.4s; }
.waveform div:nth-child(4) { animation-delay: 0.6s; }

@keyframes wave {
    0% { height: 10px; }
    50% { height: 20px; }
    100% { height: 10px; }
}

/* Chat */

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.chat-log {
    flex: 1;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: radial-gradient(circle at top left, #020617 0, #020617 40%, #020617 100%);
    padding: 14px 16px;
    overflow-y: auto;
    box-shadow: var(--shadow-soft);
}

/* Messages */

.message {
    max-width: 80%;
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.4;
}

.message.user {
    margin-left: auto;
    background: rgba(79, 209, 165, 0.12);
    border: 1px solid rgba(79, 209, 165, 0.6);
}

.message.sage {
    margin-right: auto;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.6);
}

.message-meta {
    font-size: 11px;
    color: var(--text-soft);
    margin-top: 4px;
}

/* Upload Zone */

#upload-zone {
    border: 2px dashed #4cffd7;
    padding: 25px;
    margin: 20px 0;
    border-radius: 12px;
    text-align: center;
    color: #4cffd7;
    font-size: 16px;
    background: rgba(76, 255, 215, 0.05);
    transition: 0.3s ease;
}

#upload-zone.dragover {
    background: rgba(76, 255, 215, 0.15);
    border-color: #00ffaa;
    color: #00ffaa;
}

/* Autonomy Status Bar */

#autonomy-status-bar {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(79, 209, 165, 0.3);
    font-size: 13px;
    color: var(--text-soft);
}

/* Input */

.input-container {
    border-radius: var(--radius-lg);
    border: 1px solid rgba(79, 209, 165, 0.35);
    background: rgba(15, 23, 42, 0.9);
    padding: 10px 12px;
    box-shadow: var(--shadow-soft);
}

.input-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#chat-input {
    flex: 1;
    resize: none;
    border-radius: var(--radius-md);
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: #020617;
    color: var(--text);
    padding: 8px 10px;
    font-size: 14px;
    outline: none;
}

#chat-input::placeholder {
    color: var(--text-soft);
}

.input-meta {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-soft);
}

/* Buttons */

.btn-primary,
.btn-secondary {
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 7px 12px;
    font-size: 13px;
    cursor: pointer;
    background: var(--accent-soft);
    color: var(--text);
    transition: background 0.15s ease, transform 0.1s ease;
}

.btn-secondary {
    border-color: rgba(148, 163, 184, 0.7);
    background: rgba(15, 23, 42, 0.9);
}

.btn-primary:hover,
.btn-secondary:hover {
    transform: translateY(-1px);
    background: rgba(79, 209, 165, 0.25);
}

/* Responsive */

@media (max-width: 900px) {
    .sidebar {
        display: none;
    }

    .main {
        padding: 12px;
    }

    .chat-log {
        border-radius: var(--radius-md);
    }

    .input-container {
        border-radius: var(--radius-md);
    }
}
/* ---------------------------------------------------
   BOOK MODE: Next Steps Modal
--------------------------------------------------- */

.next-steps-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.next-steps-content {
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    width: 420px;
    max-width: 90%;
    box-shadow: 0 0 25px rgba(0,0,0,0.25);
    text-align: center;
    animation: fadeIn 0.25s ease-out;
}

.next-steps-content h3 {
    margin-bottom: 15px;
    font-size: 22px;
    font-weight: bold;
}

.next-steps-content button {
    display: block;
    width: 100%;
    margin: 8px 0;
    padding: 12px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    background: #4a90e2;
    color: white;
    cursor: pointer;
    transition: background 0.2s;
}

.next-steps-content button:hover {
    background: #357ABD;
}

.next-steps-close {
    margin-top: 15px;
    background: #999;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
