:root {
    --bg: #05070b;
    --bg-2: #0a1018;
    --card: rgba(14, 22, 34, 0.72);
    --card-solid: #101924;
    --line: rgba(94, 231, 255, 0.12);
    --text: #eef6fb;
    --muted: #8aa0b2;
    --accent: #3ee0a4;
    --accent-2: #5ee7ff;
    --accent-dim: rgba(62, 224, 164, 0.14);
    --blue: #7aa2ff;
    --warn: #e7c16a;
    --danger: #ff6b7a;
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    --radius: 22px;
    --font: "IBM Plex Sans", sans-serif;
    --display: "Syne", sans-serif;
    --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { color-scheme: dark; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    letter-spacing: 0.01em;
}
body.is-app { overflow-x: hidden; }

a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

.ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.45;
    animation: drift 18s ease-in-out infinite;
}
.orb-a { width: 420px; height: 420px; left: -80px; top: -60px; background: #123d3a; }
.orb-b { width: 380px; height: 380px; right: -90px; top: 10%; background: #16324e; animation-delay: -7s; }
.grid-overlay {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(94, 231, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(94, 231, 255, 0.035) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(circle at 30% 20%, black, transparent 70%);
}
@keyframes drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, 24px) scale(1.08); }
}

.app {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, rgba(8, 14, 22, 0.92), rgba(8, 14, 22, 0.78));
    border-right: 1px solid var(--line);
    padding: 28px 18px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    backdrop-filter: blur(22px);
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    color: var(--text);
}
.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, var(--accent), #1aa37a 55%, var(--accent-2));
    color: #062016;
    font-family: var(--display);
    font-weight: 800;
    font-size: 22px;
    box-shadow: 0 0 28px rgba(62, 224, 164, 0.35);
}
.brand strong {
    display: block;
    font-family: var(--display);
    font-size: 24px;
    letter-spacing: 0.08em;
}
.brand small { color: var(--muted); font-size: 12px; }

.nav-search { display: grid; gap: 6px; }
.nav-search span { font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
.nav-search input {
    background: #0b141d;
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 12px;
    padding: 10px 12px;
    outline: none;
}
.nav-search input:focus { border-color: var(--accent); }

.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a {
    color: var(--muted);
    padding: 12px 12px;
    border-radius: 14px;
    display: grid;
    gap: 2px;
    border: 1px solid transparent;
    transition: 0.2s ease;
}
.sidebar nav a small { color: #6d8294; font-size: 11px; }
.sidebar nav a:hover,
.sidebar nav a.is-active {
    background: linear-gradient(90deg, var(--accent-dim), rgba(94, 231, 255, 0.08));
    color: var(--text);
    border-color: var(--line);
}
.sidebar nav a.is-active { box-shadow: inset 0 0 0 1px rgba(62, 224, 164, 0.18); }

.sidebar-live { margin-top: auto; }
.sidebar-foot { margin: 10px 0 0; color: var(--muted); font-size: 12px; }

.wave {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 28px;
    padding: 0 4px;
}
.wave span {
    width: 4px;
    height: 8px;
    border-radius: 99px;
    background: linear-gradient(180deg, var(--accent-2), var(--accent));
    animation: wave 1.1s ease-in-out infinite;
}
.wave span:nth-child(2) { animation-delay: 0.1s; }
.wave span:nth-child(3) { animation-delay: 0.18s; }
.wave span:nth-child(4) { animation-delay: 0.05s; }
.wave span:nth-child(5) { animation-delay: 0.22s; }
.wave span:nth-child(6) { animation-delay: 0.12s; }
.wave span:nth-child(7) { animation-delay: 0.28s; }
@keyframes wave {
    0%, 100% { height: 7px; opacity: 0.45; }
    50% { height: 26px; opacity: 1; }
}

.main { padding: 28px 36px 64px; animation: rise 0.45s ease; }
@keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 24px;
    gap: 16px;
}
.topbar-meta { display: flex; gap: 12px; align-items: center; }
.clock-block {
    text-align: right;
    background: var(--card);
    border: 1px solid var(--line);
    padding: 8px 14px;
    border-radius: 16px;
    backdrop-filter: blur(16px);
}
.clock {
    display: block;
    font-family: var(--mono);
    font-size: 18px;
    color: var(--accent-2);
}
.clock-block small { color: var(--muted); }

.eyebrow {
    margin: 0 0 4px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 11px;
    font-weight: 600;
}
h1, h2, h3 { font-family: var(--display); margin: 0; }
h1 { font-size: 36px; letter-spacing: -0.03em; }
h2 { font-size: 20px; margin-bottom: 12px; }

.who {
    background: var(--card);
    border: 1px solid var(--line);
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(16px);
}
.who-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

.toasts {
    position: sticky;
    top: 12px;
    z-index: 20;
    display: grid;
    gap: 8px;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(16, 25, 36, 0.92);
    backdrop-filter: blur(18px);
    animation: rise 0.25s ease;
}
.toast-ok { border-color: rgba(62, 224, 164, 0.4); color: var(--accent); }
.toast-erro { border-color: rgba(255, 107, 122, 0.45); color: #ff9aa5; }

.flash {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
}
.flash-ok { background: var(--accent-dim); color: var(--accent); }
.flash-erro { background: rgba(255, 107, 122, 0.12); color: #ff9aa5; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: 1.15fr 0.85fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    position: relative;
    overflow: hidden;
}
.card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(94, 231, 255, 0.45), transparent);
}
.card.kpi .stat-value { font-family: var(--mono); }

.stat-label {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 8px;
}
.stat-value {
    font-family: var(--display);
    font-size: 32px;
    margin: 0;
}
.stat-note { margin: 8px 0 0; color: var(--muted); font-size: 13px; }

.chart-wrap { height: 260px; position: relative; }

.checks { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.checks li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}
.dot {
    width: 9px; height: 9px; border-radius: 50%;
    display: inline-block; margin-right: 8px;
}
.dot-ok { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.dot-off { background: var(--danger); }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td {
    text-align: left;
    padding: 12px 8px;
    border-bottom: 1px solid var(--line);
}
.table th { color: var(--muted); font-weight: 500; }
.table tbody tr:hover { background: rgba(94, 231, 255, 0.04); }

.muted { color: var(--muted); }
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 12px;
}
.badge-off { background: rgba(255, 107, 122, 0.14); color: #ff9aa5; }
.mod-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    margin-bottom: 8px;
}
.mod-card small { color: var(--muted); display: block; margin-top: 8px; line-height: 1.4; }
.mod-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: start;
}
.mod-head strong { font-size: 15px; }
.mod-card.is-hidden { display: none; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea {
    background: #0b141d;
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 12px;
    padding: 11px 12px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.hint { font-size: 12px; color: var(--muted); margin: 0; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tab {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 14px;
    cursor: pointer;
}
.tab.is-active {
    background: var(--accent);
    color: #062016;
    border-color: var(--accent);
}

.panel { display: none; }
.panel.is-active { display: block; }

.rows { display: grid; gap: 10px; }
.row-2 {
    display: grid;
    grid-template-columns: 1fr 1.4fr auto;
    gap: 8px;
    align-items: center;
}

.btn, button.btn {
    border: 0;
    cursor: pointer;
    border-radius: 12px;
    padding: 11px 16px;
    font-weight: 600;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
    background: linear-gradient(180deg, #62f0ba, var(--accent));
    color: #062016;
    box-shadow: 0 10px 24px rgba(62, 224, 164, 0.25);
}
.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--line);
}
.btn-danger { background: var(--danger); color: #2b0a10; }
.btn[disabled] { opacity: 0.55; cursor: wait; transform: none; }
.actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 18px;
    flex-wrap: wrap;
}

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    position: relative;
}
.auth-card {
    width: min(460px, 100%);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 28px;
    padding: 36px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
    position: relative;
    z-index: 1;
}
.auth-card h1 { margin: 8px 0 6px; }
.auth-card p { color: var(--muted); margin-top: 0; }
.auth-card .field { margin-bottom: 12px; }
.auth-card .btn { width: 100%; margin-top: 8px; }
.auth-wave { margin: 16px 0 8px; }

.empty {
    padding: 24px;
    text-align: center;
    color: var(--muted);
}

.meter {
    height: 10px;
    background: #0b141d;
    border-radius: 999px;
    overflow: hidden;
    margin: 12px 0;
}
.meter > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width 0.4s ease;
}

.qr-box {
    min-height: 260px;
    margin: 16px 0;
    border: 1px dashed var(--line);
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: #0b141d;
    padding: 16px;
    text-align: center;
}
.qr-box img {
    max-width: 240px;
    width: 100%;
    border-radius: 12px;
    background: #fff;
}
.evolux-actions { flex-wrap: wrap; }
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--accent-dim);
    color: var(--accent);
}
.status-pill.status-open,
.status-pill.status-connected { background: var(--accent-dim); color: var(--accent); }
.status-pill.status-connecting { background: rgba(231, 193, 106, 0.16); color: var(--warn); }
.status-pill.status-close,
.status-pill.status-closed,
.status-pill.status-offline,
.status-pill.status-nao_configurado,
.status-pill.status-disconnected { background: rgba(255, 107, 122, 0.14); color: #ff9aa5; }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
textarea {
    background: #0b141d;
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 12px;
    padding: 11px 12px;
    outline: none;
    width: 100%;
    resize: vertical;
}

.copy-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    margin: 10px 0 14px;
}
.copy-row input {
    width: 100%;
    background: #0b141d;
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 12px;
    padding: 11px 12px;
}
.cron-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}
.cron-item:last-child { border-bottom: 0; }

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; }
.chip {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    border-radius: 999px;
    padding: 7px 12px;
    cursor: pointer;
}
.chip.is-active { background: var(--accent); color: #062016; border-color: var(--accent); }

.hero-status {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}
.pulse {
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--muted);
    box-shadow: 0 0 0 0 rgba(62, 224, 164, 0.4);
}
.pulse.is-on {
    background: var(--accent);
    animation: pulse 1.8s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(62, 224, 164, 0.45); }
    70% { box-shadow: 0 0 0 12px rgba(62, 224, 164, 0); }
    100% { box-shadow: 0 0 0 0 rgba(62, 224, 164, 0); }
}

@media (max-width: 1100px) {
    .grid-4, .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
    .app { grid-template-columns: 1fr; }
    .sidebar { flex-direction: row; align-items: center; gap: 16px; flex-wrap: wrap; }
    .sidebar nav { display: flex; flex-wrap: wrap; }
    .sidebar-live { display: none; }
    .nav-search { min-width: 180px; }
}
