/* ============================================================================
   VERITAS COMMAND CENTER v2.0 — Premium Black & Gold Dashboard
   Design: Glassmorphism + Gold Pulse + Professional Typography
   ============================================================================ */

/* --- RESET & BASE --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-deep: #000000;
    --bg-surface: #080808;
    --bg-card: rgba(12, 12, 12, 0.92);
    --bg-glass: rgba(18, 18, 18, 0.75);
    --border-subtle: rgba(176, 152, 69, 0.10);
    --border-glow: rgba(176, 152, 69, 0.22);
    --accent: #b09845;
    --accent-dim: rgba(176, 152, 69, 0.12);
    --accent2: #7a6530;
    --accent2-dim: rgba(122, 101, 48, 0.12);
    --text: #c4b488;
    --text-dim: #6e6245;
    --text-muted: #352f1e;
    --green: #6abf69;
    --red: #c44545;
    --yellow: #b09845;
    --blue: #7a6530;
    --radius: 12px;
    --radius-sm: 8px;
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;
    --font-sans: 'Inter', -apple-system, sans-serif;
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 30px rgba(176, 152, 69, 0.03);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.5);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-size: 15px;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-deep);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- SESSION LOCK SCREEN --- */
.omega-lock {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000000;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.omega-lock.unlocked {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.lock-content {
    text-align: center;
    animation: fade-in 0.6s ease-out;
}

.lock-icon {
    font-size: 5rem;
    color: var(--accent);
    margin-bottom: 16px;
    animation: lock-glow 3s ease-in-out infinite;
    font-family: serif;
}

@keyframes lock-glow {

    0%,
    100% {
        text-shadow: 0 0 20px rgba(176, 152, 69, 0.2), 0 0 40px rgba(176, 152, 69, 0.1);
        opacity: 0.7;
    }

    50% {
        text-shadow: 0 0 30px rgba(176, 152, 69, 0.4), 0 0 60px rgba(176, 152, 69, 0.15);
        opacity: 1;
    }
}

.lock-title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 4px;
    color: var(--accent);
    margin-bottom: 4px;
}

.lock-sub {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-dim);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 32px;
}

.lock-input {
    width: 200px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 6px;
    color: var(--accent);
    background: transparent;
    border: none;
    border-bottom: 2px solid rgba(176, 152, 69, 0.2);
    padding: 8px 0;
    outline: none;
    caret-color: var(--accent);
    transition: border-color 0.3s ease;
    -webkit-text-security: disc;
}

.lock-input:focus {
    border-bottom-color: rgba(176, 152, 69, 0.5);
}

.lock-hint {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--red);
    margin-top: 12px;
    height: 16px;
    letter-spacing: 1px;
}

/* --- AMBIENT BACKGROUND --- */
.ambient-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.ambient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.25;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(201, 168, 76, 0.1), transparent 70%);
    top: -10%;
    left: -5%;
    animation: float-1 25s ease-in-out infinite;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(201, 168, 76, 0.06), transparent 70%);
    bottom: -15%;
    right: -5%;
    animation: float-2 30s ease-in-out infinite;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139, 115, 48, 0.06), transparent 70%);
    top: 40%;
    left: 50%;
    animation: float-3 20s ease-in-out infinite;
}

/* --- GOLD PULSE ANIMATION --- */
@keyframes gold-pulse {

    0%,
    100% {
        border-color: rgba(176, 152, 69, 0.15);
        box-shadow: 0 0 10px rgba(176, 152, 69, 0.03);
    }

    50% {
        border-color: rgba(176, 152, 69, 0.30);
        box-shadow: 0 0 16px rgba(176, 152, 69, 0.06);
    }
}

@keyframes float-1 {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(60px, 40px);
    }
}

@keyframes float-2 {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(-50px, -30px);
    }
}

@keyframes float-3 {

    0%,
    100% {
        transform: translate(-50%, 0);
    }

    50% {
        transform: translate(-50%, -40px);
    }
}

/* --- HEADER --- */
.header {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-mark {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--accent);
    animation: pulse-ring 3s ease-in-out infinite;
}

@keyframes pulse-ring {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.6;
    }

    50% {
        transform: scale(1.15);
        opacity: 1;
    }
}

.logo-icon {
    font-size: 18px;
    color: var(--accent);
}

.header-title {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--accent);
}

.header-sub {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 1px;
    margin-top: 1px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--accent-dim);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--accent);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    animation: blink 2s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.backend-chip {
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--accent2-dim);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: #b794f4;
}

/* --- NAVIGATION TABS --- */
.nav-tabs {
    position: relative;
    z-index: 10;
    display: flex;
    gap: 2px;
    padding: 0 24px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
}

.nav-tab {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 12px 20px;
    position: relative;
    transition: color var(--transition);
}

.nav-tab:hover {
    color: var(--text);
}

.nav-tab.active {
    color: var(--accent);
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    animation: tab-in 0.3s ease-out;
}

@keyframes tab-in {
    from {
        transform: scaleX(0);
    }

    to {
        transform: scaleX(1);
    }
}

.tab-icon {
    margin-right: 6px;
    font-size: 0.85rem;
}

/* --- CONTENT --- */
.content {
    position: relative;
    z-index: 5;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 24px;
    min-height: calc(100vh - 120px);
}

.tab-panel {
    display: none;
    animation: fade-in 0.3s ease-out;
}

.tab-panel.active {
    display: block;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-header h2 {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--accent);
}

.panel-sub {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 4px;
}

/* --- CHAT --- */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 170px);
    background: var(--bg-card);
    border-radius: var(--radius);
    backdrop-filter: blur(20px);
    overflow: hidden;
    position: relative;
    border: 1px solid transparent;
    background-clip: padding-box;
    z-index: 1;
}

/* Animated gradient border — always spinning */
.chat-container::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: var(--radius);
    padding: 1px;
    background: conic-gradient(from var(--border-angle, 0deg),
            transparent 40%,
            rgba(176, 152, 69, 0.35) 50%,
            transparent 60%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: rotate-border 6s linear infinite;
    z-index: -1;
}

@property --border-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@keyframes rotate-border {
    to {
        --border-angle: 360deg;
    }
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
    background: #141414;
    position: relative;
}

/* Subtle scanline overlay — CRT effect */
.chat-messages::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(176, 152, 69, 0.008) 2px,
            rgba(176, 152, 69, 0.008) 4px);
    z-index: 1;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 3px;
}

.msg {
    margin-bottom: 16px;
    animation: msg-in 0.3s ease-out;
    max-width: 85%;
}

@keyframes msg-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.msg-user {
    margin-left: auto;
    background: linear-gradient(135deg, var(--accent-dim), rgba(176, 152, 69, 0.08));
    border: 1px solid rgba(176, 152, 69, 0.15);
    border-radius: var(--radius) var(--radius) 4px var(--radius);
    padding: 10px 16px;
}

.msg-user .msg-label {
    color: var(--accent);
}

.msg-ai {
    background: var(--bg-glass);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius) var(--radius) var(--radius) 4px;
    padding: 10px 16px;
}

.msg-ai .msg-label {
    color: var(--accent);
}

.msg-system {
    background: rgba(68, 136, 255, 0.06);
    border: 1px solid rgba(68, 136, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    max-width: 100%;
}

.msg-system .msg-label {
    color: var(--blue);
}

.msg-error {
    background: rgba(255, 68, 102, 0.06);
    border: 1px solid rgba(255, 68, 102, 0.15);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    max-width: 100%;
}

.msg-error .msg-label {
    color: var(--red);
}

.msg-module {
    background: rgba(180, 130, 255, 0.06);
    border: 1px solid rgba(180, 130, 255, 0.12);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    max-width: 100%;
}

.msg-module .msg-label {
    color: #cc88ff;
}

.msg-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.msg-text {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

.msg-meta {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Typing indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.typing-indicator.active {
    display: flex;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.4;
    animation: typing-bounce 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Chat input */
.chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(10, 12, 24, 0.6);
    position: relative;
}

/* Glowing accent line above input */
.chat-input-area::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(176, 152, 69, 0.4), transparent);
    animation: input-glow-pulse 3s ease-in-out infinite;
}

@keyframes input-glow-pulse {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }
}

#chat-input {
    flex: 1;
    resize: none;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    outline: none;
    transition: border-color var(--transition);
    max-height: 120px;
}

#chat-input:focus {
    border-color: var(--accent);
}

#chat-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 46px;
    height: 46px;
    background: #0a0a0a;
    border: 1px solid rgba(176, 152, 69, 0.25);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.send-btn:hover {
    transform: scale(1.05);
    border-color: rgba(176, 152, 69, 0.5);
    box-shadow: 0 4px 16px rgba(176, 152, 69, 0.15);
}

.send-btn:active {
    transform: scale(0.95);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* --- MODULE GRID --- */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 12px;
}

.module-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: border-color var(--transition), transform var(--transition);
    backdrop-filter: blur(10px);
}

.module-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-2px);
}

.module-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.module-dot.ok {
    background: var(--green);
    box-shadow: 0 0 8px rgba(0, 230, 138, 0.4);
}

.module-dot.warn {
    background: var(--yellow);
}

.module-dot.err {
    background: var(--red);
}

.module-info {
    flex: 1;
    min-width: 0;
}

.module-name {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.module-desc {
    font-size: 0.72rem;
    color: var(--text-dim);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.module-meta {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.module-run-btn {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--accent);
    background: #0a0a0a;
    border: 1px solid rgba(176, 152, 69, 0.25);
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.module-run-btn:hover {
    transform: scale(1.05);
    border-color: rgba(176, 152, 69, 0.5);
    box-shadow: 0 4px 16px rgba(176, 152, 69, 0.15);
}

/* --- CONFIG PANEL --- */
.config-panel {
    max-width: 600px;
}

.backend-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    margin-bottom: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color var(--transition);
}

.backend-option:hover {
    border-color: var(--border-glow);
}

.backend-option.active {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.backend-option-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.backend-radio {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--text-muted);
    position: relative;
    transition: border-color var(--transition);
}

.backend-option.active .backend-radio {
    border-color: var(--accent);
}

.backend-option.active .backend-radio::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: var(--accent);
}

.backend-label {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 500;
}

.backend-status {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
}

.backend-status.up {
    color: var(--green);
    background: rgba(0, 230, 138, 0.1);
}

.backend-status.down {
    color: var(--red);
    background: rgba(255, 68, 102, 0.1);
}

/* --- AUDIT LIST --- */
.audit-list {
    max-height: calc(100vh - 220px);
    overflow-y: auto;
}

.audit-entry {
    display: flex;
    gap: 12px;
    padding: 8px 14px;
    margin-bottom: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    transition: border-color var(--transition);
}

.audit-entry:hover {
    border-color: var(--border-glow);
}

.audit-ts {
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 160px;
}

.audit-role {
    padding: 1px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.6rem;
    white-space: nowrap;
}

.audit-role.user {
    color: var(--blue);
    background: rgba(68, 136, 255, 0.1);
}

.audit-role.assistant {
    color: var(--accent);
    background: var(--accent-dim);
}

.audit-role.error {
    color: var(--red);
    background: rgba(255, 68, 102, 0.1);
}

.audit-role.system {
    color: var(--yellow);
    background: rgba(255, 170, 0, 0.1);
}

.audit-role.dispatch {
    color: #cc88ff;
    background: rgba(180, 130, 255, 0.1);
}

.audit-content {
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* --- SYSTEM INFO --- */
.system-info {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.sys-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.sys-key {
    color: var(--text-dim);
}

.sys-val {
    color: var(--accent);
    font-weight: 500;
}

.selftest-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 8px;
}

.selftest-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.selftest-badge {
    font-weight: 700;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 1px;
}

.selftest-badge.pass {
    color: var(--green);
    background: rgba(0, 230, 138, 0.1);
}

.selftest-badge.fail {
    color: var(--red);
    background: rgba(255, 68, 102, 0.1);
}

.selftest-badge.warn {
    color: var(--yellow);
    background: rgba(255, 170, 0, 0.1);
}

/* --- BUTTONS --- */
.btn-primary {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--accent);
    background: #0a0a0a;
    border: 1px solid rgba(176, 152, 69, 0.25);
    border-radius: var(--radius-sm);
    padding: 10px 24px;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.btn-primary:hover {
    transform: translateY(-1px);
    border-color: rgba(176, 152, 69, 0.5);
    box-shadow: 0 4px 16px rgba(176, 152, 69, 0.15);
}

.btn-secondary {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-dim);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition);
}

.btn-secondary:hover {
    border-color: var(--border-glow);
    color: var(--text);
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 10px;
        padding: 12px 16px;
    }

    .nav-tabs {
        overflow-x: auto;
        padding: 0 12px;
    }

    .nav-tab {
        white-space: nowrap;
        padding: 10px 14px;
    }

    .content {
        padding: 12px;
    }

    .module-grid {
        grid-template-columns: 1fr;
    }

    .msg {
        max-width: 95%;
    }
}

/* --- COMMAND DROPDOWN --- */
.cmd-dropdown-wrap {
    position: relative;
}

.cmd-dropdown-btn {
    width: 46px;
    height: 46px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color var(--transition), color var(--transition);
}

.cmd-dropdown-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.cmd-dropdown {
    display: none;
    position: absolute;
    bottom: 54px;
    left: 0;
    min-width: 280px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius);
    padding: 8px;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    animation: fade-in 0.2s ease-out;
}

.cmd-dropdown.open {
    display: block;
}

.cmd-dropdown-title {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 8px 10px 4px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 4px;
}

.cmd-dropdown button {
    display: block;
    width: 100%;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-dim);
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.cmd-dropdown button:hover {
    background: var(--accent-dim);
    color: var(--accent);
}

/* --- MIC BUTTON --- */
.mic-btn {
    width: 46px;
    height: 46px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.mic-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.mic-btn.recording {
    border-color: var(--red);
    color: var(--red);
    background: rgba(255, 68, 102, 0.1);
    animation: mic-pulse 1.5s infinite;
}

@keyframes mic-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 68, 102, 0.3);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(255, 68, 102, 0);
    }
}

/* --- LEDGER TAB --- */
.ledger-search-input {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    width: 280px;
    outline: none;
    transition: border-color var(--transition);
}

.ledger-search-input:focus {
    border-color: var(--accent);
}

.ledger-search-input::placeholder {
    color: var(--text-muted);
}

.ledger-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.ledger-stat {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
}

.ledger-stat-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 1px;
    color: var(--text-dim);
    text-transform: uppercase;
}

.ledger-stat-value {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
    margin-top: 2px;
}

.ledger-results {
    max-height: calc(100vh - 320px);
    overflow-y: auto;
}

.ledger-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    margin-bottom: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    transition: border-color var(--transition);
}

.ledger-item:hover {
    border-color: var(--border-glow);
}

.ledger-item-name {
    color: var(--accent);
    font-weight: 600;
}

.ledger-item-meta {
    color: var(--text-muted);
    font-size: 0.65rem;
}

.ledger-item-hook {
    color: var(--text-dim);
    font-size: 0.7rem;
}

/* --- STATUS FOOTER BAR --- */
.status-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 24px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.footer-left,
.footer-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.footer-item {
    padding: 0 4px;
}

.footer-divider {
    color: var(--border-subtle);
}

.footer-ver {
    color: var(--accent);
    font-weight: 600;
}

/* --- TOAST NOTIFICATIONS --- */
.toast-container {
    position: fixed;
    top: 72px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: all;
    background: var(--bg-surface);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text);
    box-shadow: var(--shadow-lg);
    animation: toast-in 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    max-width: 360px;
}

.toast.toast-success {
    border-color: var(--green);
}

.toast.toast-error {
    border-color: var(--red);
}

.toast.toast-info {
    border-color: var(--blue);
}

.toast-title {
    font-weight: 700;
    font-size: 0.65rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.toast-success .toast-title {
    color: var(--green);
}

.toast-error .toast-title {
    color: var(--red);
}

.toast-info .toast-title {
    color: var(--blue);
}

.toast.toast-out {
    animation: toast-out 0.3s ease-in forwards;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(80px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(80px);
    }
}

/* --- GRADIENT CARD BORDERS ON HOVER --- */
.module-card {
    position: relative;
    overflow: hidden;
}

.module-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    padding: 1px;
    background: linear-gradient(135deg, transparent, transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    transition: background 0.4s ease;
    pointer-events: none;
}

.module-card:hover::before {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
}

/* --- CHAT TIMESTAMPS --- */
.msg-timestamp {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    float: right;
    margin-top: 2px;
}

/* --- RESPONSE TIME BADGE --- */
.msg-response-time {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.55rem;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 8px;
    letter-spacing: 0.5px;
}

/* --- MARKDOWN IN MESSAGES --- */
.msg-text code {
    background: rgba(0, 212, 170, 0.08);
    border: 1px solid rgba(0, 212, 170, 0.1);
    border-radius: 3px;
    padding: 1px 5px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--accent);
}

.msg-text pre {
    background: rgba(5, 6, 15, 0.8);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin: 6px 0;
    overflow-x: auto;
    font-size: 0.75rem;
    line-height: 1.5;
}

.msg-text pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text);
}

.msg-text strong {
    color: var(--accent);
    font-weight: 600;
}

.msg-text em {
    color: var(--text-dim);
    font-style: italic;
}

/* --- WELCOME HERO --- */
.welcome-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    text-align: center;
    padding: 40px;
    position: relative;
}

/* Ambient radial glow behind welcome */
.welcome-hero::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(176, 152, 69, 0.08) 0%, transparent 70%);
    animation: hero-breathe 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes hero-breathe {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.5;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
}

.welcome-icon {
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
    animation: icon-pulse 3s ease-in-out infinite;
    filter: drop-shadow(0 0 12px rgba(176, 152, 69, 0.4));
}

@keyframes icon-pulse {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
        filter: drop-shadow(0 0 12px rgba(176, 152, 69, 0.3));
    }

    50% {
        transform: scale(1.15) rotate(5deg);
        filter: drop-shadow(0 0 24px rgba(176, 152, 69, 0.6));
    }
}

.welcome-title {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 4px;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
    text-shadow: 0 0 20px rgba(176, 152, 69, 0.3), 0 0 60px rgba(176, 152, 69, 0.1);
    animation: title-glow 3s ease-in-out infinite;
}

@keyframes title-glow {

    0%,
    100% {
        text-shadow: 0 0 20px rgba(176, 152, 69, 0.2), 0 0 60px rgba(176, 152, 69, 0.05);
    }

    50% {
        text-shadow: 0 0 30px rgba(176, 152, 69, 0.5), 0 0 80px rgba(176, 152, 69, 0.15);
    }
}

.welcome-sub {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-dim);
    max-width: 400px;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.welcome-hint {
    margin-top: 20px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.welcome-chip {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-dim);
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: chip-fade-in 0.6s ease-out both;
    position: relative;
    overflow: hidden;
}

.welcome-chip:nth-child(1) {
    animation-delay: 0.1s;
}

.welcome-chip:nth-child(2) {
    animation-delay: 0.2s;
}

.welcome-chip:nth-child(3) {
    animation-delay: 0.3s;
}

.welcome-chip:nth-child(4) {
    animation-delay: 0.4s;
}

@keyframes chip-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
    box-shadow: 0 0 16px rgba(176, 152, 69, 0.15);
    transform: translateY(-1px);
}

/* Shimmer sweep on chip hover */
.welcome-chip::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(176, 152, 69, 0.1), transparent);
    transition: left 0.4s ease;
}

.welcome-chip:hover::before {
    left: 100%;
}

/* Adjust content for footer */
.content {
    padding-bottom: 40px;
}

.chat-container {
    height: calc(100vh - 200px);
}

/* --- SECURITY TAB --- */
.security-posture {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 18px 24px;
    margin-bottom: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
}

.posture-score {
    font-family: var(--font-mono);
    font-size: 2.2rem;
    font-weight: 700;
    min-width: 90px;
    text-align: center;
}

.posture-score.secure {
    color: var(--green);
}

.posture-score.degraded {
    color: var(--yellow);
}

.posture-score.compromised {
    color: var(--red);
}

.posture-verdict {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 2px;
}

.posture-detail {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-dim);
    line-height: 1.6;
}

.security-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.security-section {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 14px 18px;
}

.sec-section-title {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-subtle);
}

.sec-scroll {
    max-height: 280px;
    overflow-y: auto;
}

.sec-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    margin-bottom: 4px;
    background: rgba(5, 6, 15, 0.4);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

.sec-row:hover {
    background: rgba(10, 12, 24, 0.8);
}

.esm-bar {
    width: 60px;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.esm-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.esm-bar-fill.green {
    background: var(--green);
}

.esm-bar-fill.yellow {
    background: var(--yellow);
}

.esm-bar-fill.red {
    background: var(--red);
}

.sec-badge {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.sec-badge.ok {
    color: var(--green);
    background: rgba(0, 230, 138, 0.1);
}

.sec-badge.warn {
    color: var(--yellow);
    background: rgba(255, 170, 0, 0.1);
}

.sec-badge.crit {
    color: var(--red);
    background: rgba(255, 68, 102, 0.1);
}

.sec-badge.new {
    color: var(--blue);
    background: rgba(68, 136, 255, 0.1);
}

.sec-name {
    color: var(--text);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sec-pid {
    color: var(--text-muted);
    min-width: 50px;
}

.sec-port {
    color: var(--accent);
    font-weight: 600;
    min-width: 60px;
}

.honey-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.honey-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.honey-dot.intact {
    background: var(--green);
    box-shadow: 0 0 10px rgba(0, 230, 138, 0.4);
}

.honey-dot.breached {
    background: var(--red);
    box-shadow: 0 0 10px rgba(255, 68, 102, 0.4);
    animation: blink 1s infinite;
}

@media (max-width: 900px) {
    .security-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Modal + Defense Controls --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--red);
    border-radius: var(--radius);
    padding: 28px 32px;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 0 40px rgba(255, 68, 102, 0.15);
}

.modal-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 6px;
    background: var(--bg-main);
    border: 1px solid var(--border-subtle);
    color: var(--red);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-align: center;
}

.modal-input:focus {
    border-color: var(--red);
    outline: none;
    box-shadow: 0 0 10px rgba(255, 68, 102, 0.2);
}

.btn-danger {
    padding: 8px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #ff4466, #cc2244);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ff5577, #dd3355);
    box-shadow: 0 0 15px rgba(255, 68, 102, 0.3);
}

.sec-action {
    padding: 2px 6px;
    border-radius: 3px;
    border: none;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    transition: all 0.15s;
}

.sec-action.kill {
    background: rgba(255, 68, 102, 0.15);
    color: var(--red);
}

.sec-action.kill:hover {
    background: rgba(255, 68, 102, 0.3);
}

.sec-action.block {
    background: rgba(255, 170, 0, 0.15);
    color: var(--yellow);
}

.sec-action.block:hover {
    background: rgba(255, 170, 0, 0.3);
}

/* ===========================================================================
   KID MODE VISUAL INDICATOR — Rainbow Sparky Theme
   =========================================================================== */

body.kid-mode .header {
    border-bottom: 3px solid transparent;
    background-image: linear-gradient(var(--bg-surface), var(--bg-surface)),
        linear-gradient(90deg, #ff6b6b, #ffd93d, #6bcb77, #4d96ff, #9b59b6, #ff6b6b);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    animation: rainbow-shift 4s linear infinite;
}

@keyframes rainbow-shift {
    0% {
        filter: hue-rotate(0deg);
    }

    100% {
        filter: hue-rotate(360deg);
    }
}

body.kid-mode .header-title::after {
    content: '  🤖 SPARKY MODE';
    font-size: 0.5em;
    color: #ffd93d;
    margin-left: 12px;
    animation: sparky-bounce 1.5s ease-in-out infinite;
}

@keyframes sparky-bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }
}

body.kid-mode .nav-tab[data-tab="security"],
body.kid-mode .nav-tab[data-tab="system"],
body.kid-mode .nav-tab[data-tab="audit"],
body.kid-mode .nav-tab[data-tab="ledger"],
body.kid-mode .nav-tab[data-tab="llm"] {
    display: none !important;
}

body.kid-mode .chat-input-area {
    border-color: rgba(107, 203, 119, 0.3);
}

body.kid-mode .msg-user .msg-label {
    color: #ffd93d;
}

body.kid-mode .msg-user .msg-label::before {
    content: '⭐ ';
}

.mic-btn.recording {
    background: rgba(255, 68, 68, 0.2) !important;
    border-color: #ff4444 !important;
    animation: mic-pulse 1s ease-in-out infinite;
}

@keyframes mic-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.4);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(255, 68, 68, 0);
    }
}

/* ===========================================================================
   MOBILE RESPONSIVE — Tablet + Phone
   =========================================================================== */

@media (max-width: 768px) {
    .header {
        padding: 8px 12px;
        flex-wrap: wrap;
    }

    .header-title {
        font-size: 0.8rem;
    }

    .header-sub {
        font-size: 0.5rem;
    }

    .header-right {
        display: none;
    }

    .nav-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 0 8px;
    }

    .nav-bar::-webkit-scrollbar {
        display: none;
    }

    .nav-tab {
        font-size: 0.6rem;
        padding: 6px 8px;
        white-space: nowrap;
    }

    .main-content {
        padding: 8px;
    }

    .chat-messages {
        padding: 8px;
    }

    .chat-input-area {
        padding: 6px 8px;
    }

    .chat-input-area textarea {
        font-size: 14px;
    }

    .module-grid {
        grid-template-columns: 1fr;
    }

    .welcome-title {
        font-size: 1.2rem;
    }

    .welcome-sub {
        font-size: 0.65rem;
    }

    .welcome-chips {
        flex-wrap: wrap;
    }

    .msg-bubble {
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    .header-logo {
        width: 28px;
        height: 28px;
    }

    .header-title {
        font-size: 0.7rem;
    }

    .nav-tab {
        font-size: 0.55rem;
        padding: 5px 6px;
    }

    .chat-input-area {
        gap: 4px;
    }

    .send-btn,
    .mic-btn,
    .cmd-dropdown-btn {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }

    .msg-bubble {
        padding: 8px 10px;
        font-size: 0.75rem;
    }

    .module-card {
        padding: 10px;
    }
}

/* --- PIPELINE STEP TRACKER --- */
.pipeline-tracker .pipeline-steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.pipeline-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(176, 152, 69, 0.08);
    border-left: 3px solid #333;
    border-radius: 0 4px 4px 0;
    font-size: 0.8rem;
    transition: border-color 0.3s, background 0.3s;
}

.pipeline-step[data-status="PASS"] {
    border-left-color: #4caf50;
    background: rgba(76, 175, 80, 0.1);
}

.pipeline-step[data-status="RUNNING"] {
    border-left-color: #ffc107;
    background: rgba(255, 193, 7, 0.1);
    animation: pulse-step 1.2s infinite;
}

.pipeline-step[data-status="VIOLATION"] {
    border-left-color: #f44336;
    background: rgba(244, 67, 54, 0.1);
}

.pipeline-step[data-status="INCONCLUSIVE"] {
    border-left-color: #ff9800;
    background: rgba(255, 152, 0, 0.1);
}

.pipeline-step[data-status="RETRYING"] {
    border-left-color: #2196f3;
    background: rgba(33, 150, 243, 0.1);
}

.pipeline-step[data-status="AWAITING_APPROVAL"] {
    border-left-color: #9c27b0;
    background: rgba(156, 39, 176, 0.1);
}

.step-icon {
    font-size: 1rem;
    width: 18px;
    text-align: center;
    color: #888;
    flex-shrink: 0;
}

.step-label {
    flex: 1;
    color: #ccc;
}

.step-status {
    font-size: 0.7rem;
    color: #888;
    text-align: right;
    min-width: 80px;
}

@keyframes pulse-step {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* ── ABORT Button ── */
.abort-mode {
    background: #b71c1c !important;
    color: #fff !important;
    font-size: 0.7rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: 1px solid #f44336 !important;
    animation: abort-pulse 1s ease-in-out infinite;
    cursor: pointer !important;
}

.abort-mode:hover {
    background: #f44336 !important;
    box-shadow: 0 0 12px rgba(244, 67, 54, 0.6);
}

@keyframes abort-pulse {

    0%,
    100% {
        box-shadow: 0 0 4px rgba(244, 67, 54, 0.3);
    }

    50% {
        box-shadow: 0 0 12px rgba(244, 67, 54, 0.7);
    }
}


/* ============================================================================
   MODERN ENHANCEMENTS v2.1 — Premium micro-interactions & visual polish
   No color or layout changes — purely additive refinements
   ============================================================================ */

/* ── Shimmer border on chat container ────────────────────────────── */
@keyframes shimmer-border {
    0% {
        border-image-source: linear-gradient(135deg, rgba(176, 152, 69, 0.08), rgba(176, 152, 69, 0.25), rgba(176, 152, 69, 0.08));
    }

    50% {
        border-image-source: linear-gradient(135deg, rgba(176, 152, 69, 0.25), rgba(176, 152, 69, 0.08), rgba(176, 152, 69, 0.25));
    }

    100% {
        border-image-source: linear-gradient(135deg, rgba(176, 152, 69, 0.08), rgba(176, 152, 69, 0.25), rgba(176, 152, 69, 0.08));
    }
}

/* ── Noise texture overlay ───────────────────────────────────────── */
.header::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

.header>* {
    position: relative;
    z-index: 1;
}

/* ── Message cards — hover micro-interactions ─────────────────────── */
.msg {
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.msg-ai:hover,
.msg-system:hover,
.msg-module:hover {
    box-shadow: 0 2px 20px rgba(176, 152, 69, 0.06), 0 0 1px rgba(176, 152, 69, 0.12);
    transform: translateX(2px);
}

.msg-user:hover {
    box-shadow: 0 2px 16px rgba(176, 152, 69, 0.08);
    transform: translateX(-2px);
}

/* ── Module cards — glass shimmer on hover ────────────────────────── */
.module-card {
    position: relative;
    overflow: hidden;
}

.module-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg,
            transparent 40%,
            rgba(176, 152, 69, 0.04) 45%,
            rgba(176, 152, 69, 0.08) 50%,
            rgba(176, 152, 69, 0.04) 55%,
            transparent 60%);
    transform: translateX(-100%) rotate(0deg);
    transition: transform 0.6s ease;
    pointer-events: none;
}

.module-card:hover::before {
    transform: translateX(100%) rotate(0deg);
}

.module-card:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 1px rgba(176, 152, 69, 0.15);
}

/* ── Chat input — glass focus effect ──────────────────────────────── */
#chat-input {
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

#chat-input:focus {
    box-shadow: 0 0 0 1px rgba(176, 152, 69, 0.15), 0 4px 20px rgba(0, 0, 0, 0.3);
    background: rgba(12, 12, 12, 0.95);
}

/* ── Send button — glow pulse on hover ────────────────────────────── */
.send-btn {
    transition: transform 0.2s ease, box-shadow 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}

.send-btn:hover {
    background: rgba(176, 152, 69, 0.08);
    box-shadow: 0 0 20px rgba(176, 152, 69, 0.15), 0 4px 16px rgba(176, 152, 69, 0.08);
}

/* ── Header title — subtle text shadow ────────────────────────────── */
.header-title {
    text-shadow: 0 0 20px rgba(176, 152, 69, 0.15);
}

/* ── Status chips — breathing glow ────────────────────────────────── */
.status-chip {
    transition: box-shadow 0.3s ease;
}

.status-chip:hover {
    box-shadow: 0 0 12px rgba(176, 152, 69, 0.12);
}

/* ── Tab navigation — smooth underline transition ─────────────────── */
.nav-tab {
    transition: color 0.25s ease, text-shadow 0.3s ease;
}

.nav-tab:hover {
    text-shadow: 0 0 12px rgba(176, 152, 69, 0.15);
}

.nav-tab.active {
    text-shadow: 0 0 16px rgba(176, 152, 69, 0.2);
}

/* ── Backend options — smoother glass transitions ────────────────── */
.backend-option {
    transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}

.backend-option:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

/* ── Typing indicator — smoother animation ───────────────────────── */
.typing-indicator {
    animation: fade-in 0.3s ease;
}

/* ── Status bar bottom — gradient accent line ────────────────────── */
.status-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(176, 152, 69, 0.2) 30%, rgba(176, 152, 69, 0.3) 50%, rgba(176, 152, 69, 0.2) 70%, transparent);
}

/* ── Scrollbar on all panels — matching gold theme ───────────────── */
.audit-list::-webkit-scrollbar,
.system-info::-webkit-scrollbar {
    width: 4px;
}

.audit-list::-webkit-scrollbar-thumb,
.system-info::-webkit-scrollbar-thumb {
    background: rgba(176, 152, 69, 0.15);
    border-radius: 2px;
}

.audit-list::-webkit-scrollbar-thumb:hover,
.system-info::-webkit-scrollbar-thumb:hover {
    background: rgba(176, 152, 69, 0.3);
}

/* ── Lock screen — enhanced entrance ──────────────────────────────── */
.lock-content {
    animation: lock-entrance 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes lock-entrance {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
        filter: blur(4px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
}

/* ==============================================================================
   MOBILE RESPONSIVE — PWA Touch Optimization
   ============================================================================== */

/* ── Agent status badge (cloud mode) ───────────────────────────────── */
.agent-badge {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 1px;
}

.agent-badge.online {
    background: rgba(0, 212, 170, 0.15);
    color: var(--green);
    border: 1px solid rgba(0, 212, 170, 0.3);
}

.agent-badge.offline {
    background: rgba(255, 85, 85, 0.15);
    color: var(--red);
    border: 1px solid rgba(255, 85, 85, 0.3);
}

/* ── Tablet breakpoint ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .header {
        padding: 10px 12px;
    }

    .header-sub {
        display: none;
    }

    /* Horizontal scrollable tabs */
    .nav-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
    }

    .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .nav-tab {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .tab-icon {
        display: none;
    }

    /* Content area */
    .content {
        padding: 0 8px 60px 8px;
    }

    /* Touch-friendly input */
    #chat-input {
        font-size: 16px;
        /* Prevents iOS zoom */
    }

    .send-btn,
    .mic-btn,
    .cmd-dropdown-btn {
        min-width: 44px;
        min-height: 44px;
    }

    /* Security grid — single column */
    .security-grid {
        grid-template-columns: 1fr;
    }

    /* Panel headers */
    .panel-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
}

/* ── Phone breakpoint ──────────────────────────────────────────────── */
@media (max-width: 480px) {

    /* Module grid — single column on small phones */
    .module-grid {
        grid-template-columns: 1fr;
    }

    /* Quick command dropdown — full width on mobile */
    .cmd-dropdown {
        position: fixed;
        bottom: 60px;
        left: 8px;
        right: 8px;
        width: auto;
        max-height: 50vh;
    }
}

/* ── Standalone PWA mode (installed on home screen) ───────────────── */
@media (display-mode: standalone) {

    /* Extra padding for notch/safe area */
    .header {
        padding-top: env(safe-area-inset-top, 10px);
    }

    .status-footer {
        padding-bottom: env(safe-area-inset-bottom, 6px);
    }

    .chat-input-area {
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    }
}

/* ── Ambient orbs — reduced motion for accessibility ──────────────── */
@media (prefers-reduced-motion: reduce) {

    .ambient-orb,
    .logo-ring,
    .status-dot,
    .typing-dot {
        animation: none;
    }

    .module-card::before {
        display: none;
    }
}