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

:root {
    --bg: #0a0a0f;
    --surface: #0f0f1a;
    --surface2: #12121f;
    --border: #1e1e2e;
    --gold: #c9a227;
    --gold-dim: #c9a22733;
    --gold-mid: #c9a22766;
    --green: #22c55e;
    --text: #e8e8f0;
    --muted: #888;
    --faint: #555;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── Header ─────────────────────────────── */
.header {
    background: linear-gradient(135deg, #0d0d1a 0%, #10101c 100%);
    border-bottom: 1px solid var(--gold-dim);
    padding: 0.9rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.logo-mark {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--gold);
    letter-spacing: 0.08em;
    line-height: 1;
}

.logo-sub {
    font-size: 0.65rem;
    color: var(--faint);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.agents-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface2);
    border: 1px solid var(--gold-dim);
    border-radius: 20px;
    padding: 0.35rem 0.9rem;
    font-size: 0.8rem;
}

.pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pill-count { color: var(--gold); font-weight: 700; }
.pill-label { color: var(--muted); }

.header-time {
    font-size: 0.75rem;
    color: var(--faint);
    text-align: right;
    line-height: 1.4;
}

.logout-btn {
    color: var(--muted);
    font-size: 0.78rem;
    text-decoration: none;
    border: 1px solid #333;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    transition: border-color 0.2s, color 0.2s;
}

.logout-btn:hover { border-color: var(--gold-mid); color: var(--gold); }

/* ── Layout ─────────────────────────────── */
.container {
    max-width: 1560px;
    margin: 0 auto;
    padding: 2rem;
}

/* ── Stats Bar ──────────────────────────── */
.stats-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.stat-chip {
    background: var(--surface2);
    border: 1px solid var(--gold-dim);
    border-radius: 10px;
    padding: 0.8rem 1.4rem;
    min-width: 130px;
}

.chip-val {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--gold);
    line-height: 1;
}

.chip-lbl {
    font-size: 0.7rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 4px;
}

/* ── Grid ───────────────────────────────── */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 1.25rem;
}

/* ── Agent Card ─────────────────────────── */
.agent-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.4rem;
    transition: border-color 0.25s, transform 0.2s, box-shadow 0.25s;
    position: relative;
    overflow: hidden;
}

.agent-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: transparent;
    transition: background 0.25s;
}

.agent-card:hover {
    border-color: var(--gold-mid);
    transform: translateY(-3px);
    box-shadow: 0 8px 32px #c9a22710;
}

.agent-card:hover::before { background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.agent-card.is-active::before { background: linear-gradient(90deg, transparent, var(--green), transparent); opacity: 0.6; }
.agent-card.is-pending { opacity: 0.65; }

/* ── Card Header ────────────────────────── */
.card-top {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1.1rem;
}

.avatar {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--gold-dim);
    flex-shrink: 0;
    background: var(--surface2);
}

.agent-meta { flex: 1; min-width: 0; }

.agent-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.agent-role {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 3px;
}

/* ── Status Badge ───────────────────────── */
.badge {
    padding: 0.22rem 0.65rem;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-ACTIVE  { background: #22c55e1a; color: var(--green); border: 1px solid #22c55e44; }
.badge-IDLE    { background: #88888815; color: #666; border: 1px solid #88888833; }
.badge-RUNNING { background: #c9a2271a; color: var(--gold); border: 1px solid var(--gold-dim); animation: badgepulse 1.5s ease-in-out infinite; }

@keyframes badgepulse {
    0%, 100% { opacity: 1; box-shadow: none; }
    50% { opacity: 0.65; box-shadow: 0 0 10px var(--gold-dim); }
}

/* ── Stat Block ─────────────────────────── */
.stat-block {
    background: var(--bg);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    margin-bottom: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gold);
    line-height: 1;
}

.stat-text {
    text-align: right;
}

.stat-label {
    font-size: 0.73rem;
    color: var(--muted);
    line-height: 1.3;
}

.pending-tag {
    font-size: 0.6rem;
    color: var(--gold);
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 3px;
}

/* ── Schedule ───────────────────────────── */
.schedule {
    font-size: 0.73rem;
    color: var(--faint);
    margin-bottom: 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.sched-icon { color: var(--gold-mid); font-size: 0.85rem; }

/* ── Last Action ────────────────────────── */
.last-action {
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 0.9rem;
    line-height: 1.4;
}

.last-time {
    color: var(--faint);
    font-size: 0.73rem;
}

/* ── Activity Log ───────────────────────── */
.activity {
    border-top: 1px solid var(--border);
    padding-top: 0.8rem;
}

.activity-title {
    font-size: 0.6rem;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.5rem;
}

.activity-item {
    font-size: 0.72rem;
    color: #5a5a6e;
    padding: 0.28rem 0;
    border-bottom: 1px solid #1a1a2a;
    line-height: 1.35;
}

.activity-item:last-child { border-bottom: none; }

/* ── Login ──────────────────────────────── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse at 50% 40%, #c9a22709 0%, transparent 60%);
    padding: 1rem;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--gold-dim);
    border-radius: 18px;
    padding: 2.8rem 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 0 80px #c9a22710, 0 20px 60px #00000060;
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-name {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--gold);
    letter-spacing: 0.1em;
    line-height: 1;
}

.login-tagline {
    font-size: 0.7rem;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: 0.25em;
    margin-top: 6px;
}

.login-hint {
    font-size: 0.82rem;
    color: var(--muted);
    text-align: center;
    margin-bottom: 1.8rem;
}

.field { margin-bottom: 1.1rem; }

.field label {
    display: block;
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 6px;
}

.field input {
    width: 100%;
    background: var(--bg);
    border: 1px solid #2a2a3e;
    border-radius: 9px;
    padding: 0.78rem 1rem;
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px #c9a22720;
}

.login-btn {
    width: 100%;
    background: linear-gradient(135deg, #c9a227 0%, #a88218 100%);
    color: #0a0a0f;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: none;
    border-radius: 9px;
    padding: 0.9rem;
    cursor: pointer;
    margin-top: 1.5rem;
    transition: opacity 0.2s, transform 0.15s;
}

.login-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.login-btn:active { transform: translateY(0); }

.error-box {
    background: #ff44441a;
    border: 1px solid #ff444440;
    color: #ff6666;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.83rem;
    text-align: center;
    margin-bottom: 1.2rem;
}

/* ── Responsive ─────────────────────────── */
@media (max-width: 900px) {
    .container { padding: 1.25rem; }
    .agents-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .header { padding: 0.75rem 1rem; }
    .header-time { display: none; }
    .container { padding: 1rem; }
    .agents-grid { grid-template-columns: 1fr; }
    .stats-bar { gap: 0.75rem; }
    .chip-val { font-size: 1.5rem; }
}

@media (max-width: 400px) {
    .login-card { padding: 2rem 1.5rem; }
}
