* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #0f1117;
    --bg-card: #1a1d27;
    --bg-hover: #242836;
    --border: #2a2e3a;
    --text: #e4e4e7;
    --text-muted: #71717a;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #eab308;
    --radius: 8px;
    --sidebar-w: 200px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 999;
}
.sidebar.hidden {
    transform: translateX(-100%);
}
.sidebar-overlay {
    display: none;
}
.sidebar-overlay.visible {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}
.hamburger-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    margin-bottom: 12px;
    align-self: flex-end;
    width: 100%;
    text-align: right;
}
.sidebar-brand { font-size: 18px; font-weight: 700; padding: 0 8px 16px; color: var(--accent); }
.nav-link {
    display: block; padding: 8px 12px; color: var(--text-muted);
    text-decoration: none; border-radius: var(--radius); font-size: 14px;
}
.nav-link:hover { background: var(--bg-hover); color: var(--text); }
.nav-link.active { background: var(--accent); color: #fff; }

.content { margin-left: var(--sidebar-w); padding: 24px 32px; flex: 1; max-width: 1200px; transition: margin-left 0.3s ease; }

@media (max-width: 768px) {
    .hamburger-btn {
        display: block;
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 1001;
        width: auto;
        text-align: left;
        margin: 0;
    }
    .sidebar {
        width: min(200px, 85vw);
        transform: translateX(-100%);
    }
    .sidebar.visible {
        transform: translateX(0);
    }
    .sidebar-overlay.visible {
        display: block;
    }
    .content {
        margin-left: 0;
        padding: 24px 16px;
    }
}

.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.card-title {
    font-size: 14px; font-weight: 600; color: var(--text-muted);
    margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.5px;
}

.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px; margin-bottom: 24px;
}
.stat-tile {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px;
}
.stat-value { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; font-size: 13px; }
th { color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border); }
td { border-bottom: 1px solid var(--border); }
tr:hover td { background: var(--bg-hover); }
.clickable-row { cursor: pointer; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-active { background: rgba(34,197,94,.15); color: var(--green); }
.badge-completed { background: rgba(99,102,241,.15); color: var(--accent); }
.badge-dropped { background: rgba(234,179,8,.15); color: var(--yellow); }
.badge-escalated { background: rgba(239,68,68,.15); color: var(--red); }
.badge-error { background: rgba(239,68,68,.15); color: var(--red); }

.transcript {
    display: flex; flex-direction: column; gap: 8px;
    max-height: 60vh; overflow-y: auto; padding: 12px;
}
.msg {
    max-width: 75%; padding: 10px 14px; border-radius: 12px;
    font-size: 13px; line-height: 1.5;
}
.msg-agent { background: var(--bg-hover); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg-user { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg-time { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

.textarea {
    width: 100%; min-height: 400px; padding: 12px; font-family: 'SF Mono', monospace;
    font-size: 13px; line-height: 1.6; background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius); resize: vertical;
}
.btn {
    display: inline-block; padding: 8px 16px; font-size: 13px; font-weight: 600;
    border: none; border-radius: var(--radius); cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { opacity: .85; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }

.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-header p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.flash { padding: 10px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; }
.flash-success { background: rgba(34,197,94,.15); color: var(--green); }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-running { background: var(--green); }
.status-stopped { background: var(--red); }

.log-viewer {
    background: #000; color: #0f0; font-family: monospace; font-size: 12px;
    padding: 12px; border-radius: var(--radius); max-height: 300px; overflow-y: auto;
    white-space: pre-wrap; word-break: break-all;
}
