:root {
    --bg: #eef3f7;
    --panel: #ffffff;
    --line: #d7e2eb;
    --text: #1f2937;
    --muted: #5f7387;
    --accent: #1f7a8c;
    --accent-2: #126782;
    --danger: #b42318;
    --radius: 12px;
    --shadow: 0 10px 24px rgba(31, 41, 55, 0.08);
    --font: "Trebuchet MS", "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background: radial-gradient(circle at 10% 10%, #f8fbff, #e8eef4 55%, #dee7ef 100%);
}

a {
    color: var(--accent-2);
}

.app-shell {
    min-height: 100vh;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.82);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    backdrop-filter: blur(4px);
    z-index: 100;
}

.topbar nav a {
    margin-left: 16px;
    text-decoration: none;
    font-weight: 600;
}

.main-content {
    width: min(1150px, 95%);
    margin: 22px auto 40px;
}

.card {
    background: var(--panel);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 18px;
}

.card.narrow {
    max-width: 520px;
    margin: 32px auto;
}

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

.card.subtle {
    background: #f8fbff;
}

.stack {
    display: grid;
    gap: 12px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 600;
}

input,
textarea,
select,
button {
    font: inherit;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid #bfd0df;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
}

button,
.button {
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    padding: 10px 14px;
    text-decoration: none;
    display: inline-block;
}

button:hover,
.button:hover {
    background: var(--accent-2);
}

button.secondary,
.button.secondary {
    background: #6b8aa6;
}

button.danger,
.button.danger {
    background: var(--danger);
}

.button.tiny {
    padding: 7px 10px;
    font-size: 13px;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.muted {
    color: var(--muted);
}

.form-message {
    min-height: 20px;
    margin: 0;
    color: #175f76;
}

.form-message.error {
    color: var(--danger);
}

.table-wrap {
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    border-bottom: 1px solid #e5edf3;
    padding: 10px 8px;
    font-size: 14px;
    vertical-align: middle;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 999px;
    background: #dbe8f4;
    color: #234;
}

.badge.waiting {
    background: #fbe6b2;
    color: #6c4e00;
}

.badge.active {
    background: #d2f6dc;
    color: #1c6a33;
}

.badge.completed {
    background: #e6e7ea;
    color: #3f4a5a;
}

.badge.cancelled {
    background: #ffd9d7;
    color: #871812;
}

.hidden {
    display: none;
}

.result-box {
    background: #eef9ff;
    border: 1px solid #cae8f8;
    border-radius: 10px;
    padding: 12px;
    margin-top: 14px;
}

.pulse-indicator {
    width: 16px;
    height: 16px;
    background: #37a26b;
    border-radius: 50%;
    margin: 10px auto;
    animation: pulse 1.6s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(55, 162, 107, 0.5); }
    70% { box-shadow: 0 0 0 14px rgba(55, 162, 107, 0); }
    100% { box-shadow: 0 0 0 0 rgba(55, 162, 107, 0); }
}

.call-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 18px;
}

.video-panel .videos {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.video-label {
    margin: 0 0 6px;
    font-size: 13px;
    color: var(--muted);
}

video {
    width: 100%;
    background: #0b1320;
    border-radius: 10px;
    min-height: 220px;
    object-fit: cover;
}

#emdrCanvas {
    width: 100%;
    max-width: 100%;
    border-radius: 12px;
    border: 1px solid #1e293b;
    background: #0f172a;
    margin-bottom: 10px;
}

.emdr-controls {
    margin-top: 12px;
    display: grid;
    gap: 10px;
}

.inline-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.inline-check input {
    width: auto;
}

@media (max-width: 980px) {
    .call-grid {
        grid-template-columns: 1fr;
    }

    .video-panel .videos {
        grid-template-columns: 1fr;
    }
}
