:root {
    --bg: #050505;
    --surface: #111111;
    --surface-2: #181818;
    --surface-3: #222222;
    --border: #2f2f2f;
    --border-soft: #202020;
    --text-main: #f7f7f7;
    --text-muted: #a3a3a3;
    --text-soft: #d4d4d4;
    --primary: #ffffff;
    --primary-hover: #e6e6e6;
    --primary-text: #050505;
    --success: #22c55e;
    --warning: #eab308;
    --danger: #ef4444;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    --font-sans: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', Consolas, monospace;
    --radius: 8px;
}

body[data-theme="white"] {
    --bg: #f5f5f3;
    --surface: #ffffff;
    --surface-2: #f1f1ef;
    --surface-3: #e8e8e5;
    --border: #d8d8d4;
    --border-soft: #e7e7e3;
    --text-main: #111111;
    --text-muted: #636363;
    --text-soft: #2b2b2b;
    --primary: #111111;
    --primary-hover: #2a2a2a;
    --primary-text: #ffffff;
    --shadow: 0 18px 45px rgba(17, 17, 17, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-sans);
}

body {
    background: var(--bg);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

button,
input,
select {
    font: inherit;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 272px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border-soft);
}

.logo-icon,
.agent-avatar,
.stat-icon {
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-main);
    font-weight: 700;
    letter-spacing: 0;
}

.logo-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    font-size: 13px;
}

.brand-text h2 {
    font-size: 18px;
    line-height: 1.1;
    font-weight: 700;
}

.badge-live {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    text-transform: uppercase;
}

.pulse {
    width: 7px;
    height: 7px;
    background-color: var(--success);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(1.2); }
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 24px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 11px 12px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    text-align: left;
}

.nav-item .icon {
    width: 28px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
}

.nav-item:hover,
.nav-item.active {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-main);
}

.nav-item.active .icon,
.nav-item.highlight .icon {
    background: var(--primary);
    color: var(--primary-text);
}

.sidebar-footer .tech-stack-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pill {
    font-size: 11px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 5px 8px;
    border-radius: 999px;
    color: var(--text-muted);
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 30px;
    overflow-y: auto;
}

.top-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
}

.header-title h1 {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.15;
}

.header-title p,
.text-subtle,
.doc-hours,
.stat-label,
.inspector-box label {
    color: var(--text-muted);
}

.header-title p {
    font-size: 14px;
    margin-top: 5px;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.theme-switch {
    display: inline-flex;
    align-items: center;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.theme-option {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    min-width: 66px;
    min-height: 32px;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

.theme-option.active {
    background: var(--primary);
    color: var(--primary-text);
}

.time-display,
.input-code,
.code-block {
    font-family: var(--font-mono);
}

.time-display {
    background: var(--surface);
    padding: 9px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    border: 1px solid var(--border);
    color: var(--text-soft);
}

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

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card,
.card,
.doctor-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-card {
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius);
    font-size: 14px;
}

.stat-value {
    font-size: 26px;
    line-height: 1.1;
    font-weight: 700;
    margin-top: 4px;
}

.text-green { color: var(--success); }

.card {
    padding: 22px;
}

.card-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.table-responsive {
    overflow-x: auto;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
    min-width: 720px;
}

.data-table th,
.data-table td {
    padding: 14px;
    border-bottom: 1px solid var(--border-soft);
}

.data-table th {
    color: var(--text-muted);
    font-weight: 700;
    background: var(--surface-2);
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover {
    background: var(--surface-2);
}

.text-center { text-align: center; }

.badge-status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    border: 1px solid currentColor;
}

.status-confirmed { background: rgba(34, 197, 94, 0.12); color: var(--success); }
.status-rescheduled { background: rgba(234, 179, 8, 0.14); color: var(--warning); }
.status-cancelled { background: rgba(239, 68, 68, 0.12); color: var(--danger); }

.btn {
    min-height: 38px;
    padding: 9px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-text);
}

.btn-primary:hover { background: var(--primary-hover); }

.btn-mic,
.btn-outline {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-main);
}

.btn-mic:hover,
.btn-outline:hover { background: var(--surface-3); }

.btn-mic.recording {
    background: var(--danger);
    border-color: var(--danger);
    color: #ffffff;
    animation: pulse 1s infinite;
}

.btn-sm {
    min-height: 30px;
    padding: 6px 10px;
    font-size: 12px;
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

select,
.chat-input-bar input,
.input-code {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-main);
}

select {
    min-height: 38px;
    padding: 8px 12px;
}

.doctors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.doctor-card {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: none;
}

.doc-name {
    font-size: 18px;
    font-weight: 700;
}

.doc-spec {
    display: inline-flex;
    margin-top: 6px;
    font-size: 12px;
    color: var(--primary-text);
    background: var(--primary);
    border-radius: 999px;
    padding: 4px 8px;
    font-weight: 700;
}

.voice-sim-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 20px;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 560px;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-soft);
}

.agent-avatar {
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    font-size: 13px;
}

.agent-meta h4 {
    font-size: 16px;
}

.agent-meta span {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 12px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 2px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message { display: flex; }
.msg-agent { justify-content: flex-start; }
.msg-user { justify-content: flex-end; }

.msg-bubble {
    max-width: min(78%, 560px);
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid var(--border);
}

.msg-agent .msg-bubble {
    background: var(--surface-2);
    color: var(--text-main);
}

.msg-user .msg-bubble {
    background: var(--primary);
    color: var(--primary-text);
}

.chat-input-bar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
}

.chat-input-bar input {
    width: 100%;
    min-height: 42px;
    padding: 11px 13px;
    font-size: 14px;
}

.chat-input-bar input:focus,
.input-code:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
}

.inspector-box { margin-top: 16px; }

.inspector-box label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 700;
}

.input-code {
    width: 100%;
    padding: 9px 11px;
    font-size: 13px;
}

.inspector-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 18px;
}

.step-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    background: var(--surface-2);
}

.step-num {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--primary-text);
    font-weight: 800;
    font-size: 12px;
    display: grid;
    place-items: center;
}

.step-desc {
    min-width: 0;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.code-block {
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    padding: 12px;
    border-radius: var(--radius);
    font-size: 11px;
    max-height: 150px;
    overflow-y: auto;
    color: var(--text-soft);
    white-space: pre-wrap;
}

.margin-top { margin-top: 18px; }

@media (max-width: 1100px) {
    .voice-sim-grid {
        grid-template-columns: 1fr;
    }

    .inspector-container {
        order: -1;
    }
}

@media (max-width: 820px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        gap: 18px;
    }

    .nav-menu {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .main-content {
        padding: 20px;
    }

    .top-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .chat-input-bar {
        grid-template-columns: 1fr;
    }

    .msg-bubble {
        max-width: 92%;
    }
}

