:root {
    --bg: #0a0e17;
    --bg-card: #111827;
    --bg-elevated: #1a2234;
    --border: #243049;
    --text: #e8edf7;
    --muted: #8b9bb8;
    --accent: #00d4ff;
    --accent-dim: #0099b8;
    --success: #22c55e;
    --error: #ef4444;
    --radius: 14px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 212, 255, 0.12), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(99, 102, 241, 0.08), transparent);
}

body.page-home {
    background-image:
        linear-gradient(rgba(10, 14, 23, 0.72), rgba(10, 14, 23, 0.82)),
        url('../images/fundo.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

a { color: var(--accent); text-decoration: none; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
}

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: contain;
    display: block;
}

.nav { display: flex; gap: 0.25rem; align-items: center; }
.nav a {
    color: var(--muted);
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
}
.nav a:hover, .nav a.active { color: var(--text); background: var(--bg-elevated); }
.nav .btn { margin-left: 0.25rem; }
.nav-logout { font-size: 0.85rem !important; }

.container { max-width: 720px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.page-login { display: grid; place-items: center; min-height: 100vh; }
.login-card {
    width: min(100%, 380px);
    padding: 2.5rem 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}
.login-logo {
    width: 96px; height: 96px; margin: 0 auto 1.25rem; display: block; object-fit: contain;
}
.login-card h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
.subtitle { color: var(--muted); margin-bottom: 1.5rem; }
.login-form { text-align: left; }
.login-form label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.4rem; }
.login-form input {
    width: 100%; padding: 0.85rem; border-radius: 10px; border: 1px solid var(--border);
    background: var(--bg); color: var(--text); font-size: 1.1rem; letter-spacing: 0.15em;
    text-align: center; margin-bottom: 1rem;
}
.login-form input:focus { outline: none; border-color: var(--accent); }

.hero { text-align: center; margin-bottom: 2rem; }
.hero h2 { font-size: 1.5rem; margin: 1rem 0 0.5rem; }
.hero-hint { color: var(--muted); }
.status-pill {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.35rem 0.85rem; border-radius: 999px;
    background: var(--bg-elevated); border: 1px solid var(--border);
    font-size: 0.8rem; color: var(--muted);
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-pill.online .dot { background: var(--success); }
.status-pill.online { color: var(--success); }
.status-pill.offline .dot { background: var(--error); }
.status-pill.offline { color: var(--error); }

.voice-panel { text-align: center; margin: 2rem 0; }
.mic-btn {
    width: 120px; height: 120px; border-radius: 50%; border: 2px solid var(--accent);
    background: rgba(17, 24, 39, 0.85); cursor: pointer;
    display: grid; place-items: center; margin: 0 auto; padding: 0;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.mic-btn:hover { transform: scale(1.03); box-shadow: 0 0 40px rgba(0, 212, 255, 0.35); }
.mic-logo { width: 72px; height: 72px; object-fit: contain; pointer-events: none; }
.mic-btn.listening { border-color: var(--error); animation: pulse 1.2s infinite; box-shadow: 0 0 40px rgba(239, 68, 68, 0.35); }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.mic-label { margin-top: 1rem; color: var(--muted); font-size: 0.9rem; }

.btn {
    padding: 0.75rem 1.25rem; border-radius: 10px; border: none;
    font-size: 0.95rem; font-weight: 600; cursor: pointer;
}
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-dim)); color: #000; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--error); border: 1px solid rgba(239,68,68,0.3); }

.response-panel {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.25rem; margin-bottom: 2rem;
}
.response-meta { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.badge {
    font-size: 0.75rem; padding: 0.2rem 0.6rem; border-radius: 6px;
    background: rgba(0,212,255,0.15); color: var(--accent); text-transform: uppercase;
}
.badge-muted { background: var(--bg-elevated); color: var(--muted); }
.badge-success { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-error { background: rgba(239,68,68,0.15); color: var(--error); }
.response-speech { font-size: 1.15rem; line-height: 1.6; margin-bottom: 0.75rem; white-space: pre-wrap; }
.response-speech.response-error { color: var(--error); }
.stop-speech-btn { margin-top: 0.75rem; }
.music-action {
    margin-bottom: 0.75rem; padding: 0.85rem 1rem;
    background: rgba(245, 197, 24, 0.08); border: 1px solid rgba(245, 197, 24, 0.25);
    border-radius: 10px;
}
.music-action-label { font-size: 0.95rem; color: var(--gold, #f5c518); margin-bottom: 0.6rem; }
.music-open-btn { display: inline-flex; text-decoration: none; }
.voice-panel.speaking .mic-btn { border-color: var(--gold, #f5c518); }
.response-details summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; }
.response-details pre {
    background: var(--bg); padding: 1rem; border-radius: 8px;
    overflow-x: auto; font-size: 0.75rem; color: var(--muted); max-height: 240px;
}

.history-panel h3 { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.75rem; text-transform: uppercase; }
.history-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.history-list li {
    padding: 0.75rem 1rem; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: 10px; font-size: 0.9rem;
}
.history-list .cmd { color: var(--muted); font-size: 0.8rem; margin-bottom: 0.25rem; display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.history-list .log-time { color: var(--accent); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.history-list .fail { color: var(--error); }

.page-head { margin-bottom: 1.5rem; }
.page-head p { color: var(--muted); }
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem;
}
.form-grid { display: grid; gap: 1rem; margin-bottom: 1rem; }
.form-grid label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; color: var(--muted); }
.form-grid input {
    padding: 0.7rem 0.9rem; border-radius: 8px; border: 1px solid var(--border);
    background: var(--bg); color: var(--text);
}
.form-msg.ok { color: var(--success); }
.form-msg.err { color: var(--error); }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.contato-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.85rem 1rem; background: var(--bg); border-radius: 10px;
    border: 1px solid var(--border); gap: 1rem;
}
.contato-info span { font-size: 0.85rem; color: var(--muted); }
.alert-error { background: rgba(239,68,68,0.12); color: var(--error); padding: 0.75rem; border-radius: 8px; margin-bottom: 1rem; }
.muted { color: var(--muted); }
.footer {
    text-align: center; padding: 1.5rem; color: var(--muted); font-size: 0.8rem;
    display: flex; justify-content: center; gap: 1rem; border-top: 1px solid var(--border);
}

@media (max-width: 520px) {
    .topbar { flex-direction: column; gap: 0.75rem; }
}
