:root {
    --bg: #060a12;
    --bg-elevated: #0d1424;
    --bg-card: #121c32;
    --border: #1e2d4a;
    --border-light: #2a3f66;
    --text: #e8ecf4;
    --text-muted: #8b9bb8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --purple: #8b5cf6;
    --cyan: #06b6d4;
    --sidebar-width: 268px;
    --topbar-height: 72px;
    --radius: 14px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

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

html, body {
    height: 100%;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: #60a5fa; }

/* ── App shell (100% tela) ── */
.app-shell {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.main-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse 80% 50% at 100% 0%, rgba(59, 130, 246, 0.08), transparent 50%),
        radial-gradient(ellipse 60% 40% at 0% 100%, rgba(139, 92, 246, 0.06), transparent 50%),
        var(--bg);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 90;
}

.sidebar-overlay.visible { display: block; }

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: linear-gradient(180deg, #0a1020 0%, #0f172a 100%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand .logo-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
}

.sidebar-brand h2 {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.sidebar-brand small {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section { margin-bottom: 20px; }

.nav-section-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0 12px 8px;
    opacity: 0.75;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 10px;
    color: var(--text-muted);
    margin-bottom: 3px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.sidebar nav a .nav-icon {
    width: 22px;
    text-align: center;
    font-size: 1rem;
}

.sidebar nav a .nav-text { flex: 1; }

.sidebar nav a .nav-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.sidebar nav a .nav-badge.muted {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

.sidebar nav a .nav-external {
    font-size: 0.75rem;
    opacity: 0.5;
}

.sidebar nav a:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #fff;
    text-decoration: none;
}

.sidebar nav a.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.22), rgba(59, 130, 246, 0.06));
    color: #fff;
    box-shadow: inset 3px 0 0 var(--primary);
}

.sidebar nav a.danger-link { color: #f87171; }
.sidebar nav a.danger-link:hover { background: rgba(239, 68, 68, 0.12); color: #fca5a5; }

.sidebar-footer {
    padding: 16px 16px 20px;
    border-top: 1px solid var(--border);
}

.sidebar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.panel-url {
    font-size: 0.68rem;
    color: var(--text-muted);
    word-break: break-all;
    line-height: 1.4;
    margin-top: 10px;
    opacity: 0.8;
}

/* ── Topbar ── */
.topbar {
    min-height: var(--topbar-height);
    padding: 16px 28px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    background: rgba(6, 10, 18, 0.85);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: 0;
}

.menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
}

.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-top: 2px;
}

.breadcrumbs {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--primary); }
.bc-sep { margin: 0 6px; opacity: 0.4; }
.bc-current { color: #93c5fd; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.system-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sys-pill {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    white-space: nowrap;
}

.sys-pill.ok { background: rgba(16, 185, 129, 0.12); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.25); }
.sys-pill.warn { background: rgba(245, 158, 11, 0.12); color: #fcd34d; border-color: rgba(245, 158, 11, 0.25); }
.sys-pill.err { background: rgba(239, 68, 68, 0.12); color: #fca5a5; border-color: rgba(239, 68, 68, 0.25); }
.sys-pill.neutral { background: var(--bg-card); color: var(--text-muted); }

.user-chip {
    font-size: 0.82rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: #fff;
}

/* ── Main content ── */
.main {
    flex: 1;
    width: 100%;
    max-width: none;
    padding: 24px 28px 40px;
    overflow-x: hidden;
}

/* ── Dashboard KPIs ── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.25;
}

.kpi-primary::after { background: var(--primary); }
.kpi-success::after { background: var(--success); }
.kpi-info::after { background: var(--cyan); }
.kpi-warn::after { background: var(--warning); }
.kpi-danger::after { background: var(--danger); }

.kpi-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.kpi-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
}

.kpi-icon { font-size: 1.2rem; opacity: 0.85; }

.kpi-value {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 10px;
}

.kpi-foot {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.trend.up { color: #6ee7b7; font-weight: 600; }

/* ── Content split layout ── */
.content-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 20px;
    align-items: start;
}

.content-main { min-width: 0; }
.content-side { display: flex; flex-direction: column; gap: 16px; }

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.card-flush { padding: 0; overflow: hidden; }
.card-flush .card-header { padding: 22px 24px 0; }
.card-flush .table-wrap { padding: 0 24px 24px; }
.card-flush .empty-state { padding: 48px 24px 56px; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.card h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}

.card-desc {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.55;
}

.card-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Stats (legacy compat) ── */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
}

.stat-card.blue::before { background: var(--primary); }
.stat-card.green::before { background: var(--success); }
.stat-card.purple::before { background: var(--purple); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.red::before { background: var(--danger); }

.stat-card .num { font-size: 1.75rem; font-weight: 800; color: #fff; }
.stat-card .label { font-size: 0.85rem; color: var(--text-muted); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.data-table { width: 100%; border-collapse: collapse; min-width: 640px; }

.data-table th,
.data-table td,
table th,
table td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table th,
table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(0, 0, 0, 0.15);
}

.data-table tr:hover td,
table tr:hover td { background: rgba(255, 255, 255, 0.02); }

.cell-device {
    display: flex;
    align-items: center;
    gap: 12px;
}

.device-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.cell-url { word-break: break-all; max-width: 360px; font-size: 0.88rem; color: #93c5fd; }

.table-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

.id-chip-sm {
    display: inline-block;
    font-family: Consolas, monospace;
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-elevated);
    color: #93c5fd;
    margin-top: 4px;
}

.actions-cell {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.empty-cell { text-align: center; color: var(--text-muted); padding: 32px !important; }

/* ── Status indicators ── */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.ok { background: var(--success); box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
.status-dot.err { background: var(--danger); }
.status-dot.warn { background: var(--warning); }

.status-list { list-style: none; }

.status-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.status-list li:last-child { border-bottom: none; }

.status-list strong { display: block; color: #fff; font-size: 0.9rem; }
.status-list span { font-size: 0.8rem; color: var(--text-muted); }

.presence-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.presence-pill.online { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
.presence-pill.recent { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.presence-pill.idle { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
.presence-pill.offline { background: rgba(139, 155, 184, 0.12); color: var(--text-muted); }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-pill.on { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
.status-pill.off { background: rgba(239, 68, 68, 0.12); color: #fca5a5; }
.status-pill.warn { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }

.status-pill.on::before,
.status-pill.off::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.mini-tags { display: flex; gap: 4px; flex-wrap: wrap; }

.mini-tag {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: 6px;
    text-transform: uppercase;
}

.mini-tag.on { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
.mini-tag.off { background: rgba(255, 255, 255, 0.06); color: var(--text-muted); }

/* ── Metrics & progress ── */
.metric-rows { display: flex; flex-direction: column; gap: 10px; }

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.88rem;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.metric-row:last-child { border-bottom: none; }
.metric-row span { color: var(--text-muted); }
.metric-row strong { color: #fff; }

.progress-block { margin-top: 14px; }

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.progress-bar {
    height: 6px;
    background: var(--bg-elevated);
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--cyan));
    border-radius: 99px;
}

.endpoint-list { display: flex; flex-direction: column; gap: 10px; }

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

.endpoint-item code {
    font-size: 0.78rem;
    color: #93c5fd;
    word-break: break-all;
}

.endpoint-method {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 3px 7px;
    border-radius: 4px;
    letter-spacing: 0.04em;
}

.endpoint-method.get { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
.endpoint-method.post { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }

/* ── Tabs (device page) ── */
.tab-nav {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    padding: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow-x: auto;
}

.tab-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.tab-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.04); }
.tab-btn.active { background: var(--primary); color: #fff; }

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

.device-hero { margin-bottom: 16px; }

.device-hero-grid {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 20px;
    align-items: start;
}

.device-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.device-hero-stats {
    display: flex;
    gap: 20px;
    text-align: center;
}

.hero-stat strong { display: block; color: #fff; font-size: 1.1rem; }
.hero-stat small { font-size: 0.75rem; color: var(--text-muted); }

.device-badge {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 8px;
}

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

.device-id,
.id-chip {
    font-family: Consolas, monospace;
    font-size: 0.88rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 8px;
    color: #93c5fd;
    word-break: break-all;
}

.device-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.quick-links { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    max-width: none;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: #fff;
    font-size: 0.92rem;
    transition: border-color 0.15s;
}

.content-side .form-group input,
.content-side .form-group textarea { max-width: none; }

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.form-group textarea { min-height: 90px; resize: vertical; }

.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 5px; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    align-items: end;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-group-full { grid-column: 1 / -1; }
.form-group-action { display: flex; flex-direction: column; justify-content: flex-end; }

.toggle-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 14px;
    max-width: none;
    cursor: pointer;
}

.toggle-row.compact { padding: 12px 14px; }

.toggle-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--primary);
}

.toggle-row .toggle-info strong {
    display: block;
    color: #fff;
    font-size: 0.92rem;
    margin-bottom: 3px;
}

.toggle-row .toggle-info span { font-size: 0.82rem; color: var(--text-muted); }

.device-add-app {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-sm { padding: 7px 12px; font-size: 0.8rem; }

.btn.primary {
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: #fff;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.btn.primary:hover { transform: translateY(-1px); }

.btn.danger { background: linear-gradient(135deg, var(--danger), #dc2626); color: #fff; }
.btn.secondary { background: var(--border); color: #fff; }
.btn.secondary:hover { background: var(--border-light); }

.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ── Misc ── */
.flash {
    padding: 13px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: 0.9rem;
    font-weight: 500;
}

.flash.success { background: rgba(16, 185, 129, 0.12); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.25); }
.flash.error { background: rgba(239, 68, 68, 0.12); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.25); }
.flash.info { background: rgba(59, 130, 246, 0.12); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.25); }

.code-block {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 12px 14px;
    border-radius: 10px;
    word-break: break-all;
    font-family: Consolas, monospace;
    font-size: 0.82rem;
    color: #93c5fd;
    display: block;
}

.preview-img { max-width: 220px; border-radius: 10px; margin-top: 10px; border: 1px solid var(--border); }
.preview-img.wide { max-width: 100%; max-height: 200px; object-fit: cover; }
.icon-preview { width: 140px; height: 78px; object-fit: cover; border-radius: 8px; }

.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state h3 { color: #fff; margin-bottom: 8px; font-size: 1.1rem; }

.badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}

/* ── Login ── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(ellipse at top, #1e293b 0%, var(--bg) 60%);
    padding: 24px;
}

.login-page .login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px 36px;
    box-shadow: var(--shadow);
}

.login-page .login-brand { text-align: center; margin-bottom: 32px; }

.login-page .login-brand .logo-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 16px;
}

.login-page .login-brand h1 { font-size: 1.4rem; color: #fff; margin-bottom: 6px; }
.login-page .login-brand p { color: var(--text-muted); font-size: 0.9rem; }

.login-page .form-group input { max-width: none; }

/* ── Responsive ── */
@media (max-width: 1200px) {
    .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .content-split { grid-template-columns: 1fr; }
    .content-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
}

@media (max-width: 900px) {
    .menu-toggle { display: flex; align-items: center; justify-content: center; }

    .sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: var(--shadow);
    }

    .sidebar.open { transform: translateX(0); }

    .topbar { padding: 14px 16px; }
    .main { padding: 16px; }

    .system-pills .sys-pill.neutral { display: none; }

    .device-hero-grid { grid-template-columns: 1fr; }
    .device-hero-stats { justify-content: flex-start; }

    .card-grid-2,
    .form-grid-2 { grid-template-columns: 1fr; }

    .dashboard-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .kpi-value { font-size: 1.6rem; }
    .topbar-right { width: 100%; justify-content: space-between; }
    .user-chip { display: none; }
}

/* ── Dashboard monitoramento ── */
.dashboard-grid-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.kpi-cyan::after { background: var(--cyan); }
.kpi-health.kpi-good .kpi-value { color: #6ee7b7; }
.kpi-health.kpi-warn .kpi-value { color: #fcd34d; }
.kpi-health.kpi-bad .kpi-value { color: #fca5a5; }
.kpi-value small { font-size: 1rem; opacity: 0.7; }

.alert-banner {
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #fcd34d;
}

.alert-link { color: #fff; font-weight: 600; margin-left: auto; }

.monitor-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.monitor-card {
    border-left: 4px solid var(--border);
}

.monitor-blue { border-left-color: var(--primary); background: linear-gradient(135deg, rgba(59,130,246,0.06), transparent); }
.monitor-green { border-left-color: var(--success); background: linear-gradient(135deg, rgba(16,185,129,0.06), transparent); }
.monitor-purple { border-left-color: var(--purple); background: linear-gradient(135deg, rgba(139,92,246,0.06), transparent); }
.monitor-orange { border-left-color: var(--warning); background: linear-gradient(135deg, rgba(245,158,11,0.06), transparent); }
.monitor-dark { border-left-color: var(--text-muted); }

.monitor-items { display: flex; flex-direction: column; gap: 12px; }

.monitor-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

.monitor-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.monitor-dot.ok { background: var(--success); box-shadow: 0 0 8px rgba(16,185,129,0.5); }
.monitor-dot.warn { background: var(--warning); }
.monitor-dot.err { background: var(--danger); }

.monitor-item strong { display: block; color: #fff; font-size: 0.88rem; }
.monitor-item span { font-size: 0.78rem; color: var(--text-muted); }

.dist-bars { display: flex; flex-direction: column; gap: 12px; }

.dist-row {
    display: grid;
    grid-template-columns: 130px 1fr 36px;
    align-items: center;
    gap: 10px;
}

.dist-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot-green { background: var(--success); }
.dot-blue { background: var(--primary); }
.dot-yellow { background: var(--warning); }
.dot-gray { background: var(--text-muted); }

.dist-track {
    height: 8px;
    background: var(--bg-elevated);
    border-radius: 99px;
    overflow: hidden;
}

.dist-fill { height: 100%; border-radius: 99px; }
.fill-green { background: linear-gradient(90deg, #059669, #34d399); }
.fill-blue { background: linear-gradient(90deg, #2563eb, #60a5fa); }
.fill-yellow { background: linear-gradient(90deg, #d97706, #fbbf24); }
.fill-gray { background: linear-gradient(90deg, #475569, #94a3b8); }
.fill-purple { background: linear-gradient(90deg, #7c3aed, #a78bfa); }

.dist-num { font-size: 0.82rem; font-weight: 700; color: #fff; text-align: right; }

.progress-purple .progress-fill { background: linear-gradient(90deg, var(--purple), #c084fc); }

.text-blue { color: #93c5fd !important; }
.text-purple { color: #c4b5fd !important; }
.text-green { color: #6ee7b7 !important; }

.security-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.sec-stat {
    text-align: center;
    padding: 14px 8px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
}

.sec-stat.sec-green { border: 1px solid rgba(16,185,129,0.3); }
.sec-stat.sec-red { border: 1px solid rgba(239,68,68,0.3); }
.sec-stat.sec-yellow { border: 1px solid rgba(245,158,11,0.3); }

.sec-num { display: block; font-size: 1.5rem; font-weight: 800; color: #fff; }
.sec-label { font-size: 0.72rem; color: var(--text-muted); }

.activity-feed { list-style: none; }

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

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

.activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.activity-dot.online { background: var(--success); box-shadow: 0 0 6px rgba(16,185,129,0.5); }
.activity-dot.recent { background: var(--primary); }
.activity-dot.idle { background: var(--warning); }
.activity-dot.offline { background: var(--text-muted); }

.activity-body { flex: 1; min-width: 140px; }
.activity-body strong { display: block; color: #fff; font-size: 0.9rem; }
.activity-body span { font-size: 0.78rem; color: var(--text-muted); }

.quick-actions { display: flex; flex-direction: column; gap: 8px; }

.quick-btn {
    display: block;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 600;
    transition: all 0.15s;
}

.quick-btn:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--primary);
    color: #fff;
    text-decoration: none;
}

.quick-card.quick-blue { border-top: 3px solid var(--primary); }

.devices-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.toolbar-stats { display: flex; gap: 8px; flex-wrap: wrap; }

.toolbar-pill {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
}

.pill-green { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.pill-blue { background: rgba(59,130,246,0.15); color: #93c5fd; }
.pill-red { background: rgba(239,68,68,0.15); color: #fca5a5; }

.device-avatar.blocked { background: rgba(239,68,68,0.15); }

.form-narrow { max-width: 480px; }

.tips-list {
    list-style: none;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.8;
}

.tips-list li { padding-left: 16px; position: relative; }
.tips-list li::before { content: '•'; position: absolute; left: 0; color: var(--primary); }

@media (max-width: 1200px) {
    .dashboard-grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .monitor-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .dashboard-grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dist-row { grid-template-columns: 1fr; gap: 4px; }
    .dist-num { text-align: left; }
}
