:root {
    --bg: #0a0e17;
    --bg2: #111827;
    --bg3: #1a2332;
    --card: #1e293b;
    --border: #2d3748;
    --text: #e2e8f0;
    --text2: #94a3b8;
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.25);
    --green: #22c55e;
    --green-bg: rgba(34, 197, 94, 0.12);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.12);
    --yellow: #eab308;
    --yellow-bg: rgba(234, 179, 8, 0.12);
    --purple: #a855f7;
    --purple-bg: rgba(168, 85, 247, 0.12);
    --blue: #3b82f6;
    --blue-bg: rgba(59, 130, 246, 0.12);
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

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

html {
    scroll-behavior: smooth;
}

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

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text2); }

* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--bg2);
}

.loader {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.6s, visibility 0.6s;
}
.loader.hidden {
    opacity: 0;
    visibility: hidden;
}
.loader p {
    color: var(--text2);
    margin-top: 20px;
    font-size: 14px;
    animation: pulse-text 1.5s infinite;
}
.loader-ring {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.sidebar {
    width: 240px;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
    font-weight: 700;
    font-size: 18px;
}
.sidebar-menu {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text2);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 14px;
    position: relative;
}
.menu-item:hover {
    background: var(--bg3);
    color: var(--text);
}
.menu-item.active {
    background: var(--primary-glow);
    color: var(--primary);
}
.menu-item.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}
.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sidebar-footer-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.last-update {
    font-size: 11px;
    color: var(--text2);
}
.sync-status {
    font-size: 10px;
    color: var(--green);
    text-align: center;
    transition: opacity 0.4s;
    opacity: 0;
    min-height: 14px;
}
.refresh-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text2);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}
.refresh-btn:hover {
    background: var(--bg3);
    color: var(--primary);
    border-color: var(--primary);
}
.refresh-btn.spinning svg {
    animation: spin 0.8s linear infinite;
}

.force-sync-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--green);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}
.force-sync-btn:hover {
    background: rgba(34,197,94,0.1);
    border-color: var(--green);
    color: var(--green);
}
.force-sync-btn.spinning svg {
    animation: spin 0.8s linear infinite;
}

.logout-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--red);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}
.logout-btn:hover {
    background: var(--red-bg);
    border-color: var(--red);
    color: var(--red);
}

.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 0 24px 40px;
    min-height: 100vh;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 50;
}
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
}
.page-title {
    font-size: 20px;
    font-weight: 600;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text2);
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}
.status-dot.live { background: var(--green); }
.status-dot.offline { background: var(--red); animation: none; }
.status-dot.error { background: var(--red); animation: none; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: default;
    animation: slideUp 0.5s ease-out both;
    transition: transform 0.3s, box-shadow 0.3s;
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}
.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon-blue { background: var(--blue-bg); color: var(--blue); }
.stat-icon-green { background: var(--green-bg); color: var(--green); }
.stat-icon-red { background: var(--red-bg); color: var(--red); }
.stat-icon-purple { background: var(--purple-bg); color: var(--purple); }
.stat-info {
    display: flex;
    flex-direction: column;
}
.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}
.stat-label {
    font-size: 13px;
    color: var(--text2);
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    animation: slideUp 0.5s ease-out both;
    overflow: hidden;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.card-header h3 {
    font-size: 15px;
    font-weight: 600;
}
.card-badge {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--primary-glow);
    color: var(--primary);
}
.card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-body {
    padding: 20px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    color: var(--text2);
}
.search-box input {
    background: none;
    border: none;
    color: var(--text);
    font-size: 13px;
    outline: none;
    width: 180px;
}
.search-box input::placeholder { color: var(--text2); }

#clientChart, #statusChart {
    width: 100%;
    height: 240px;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 10px 0;
    position: relative;
}

.bar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    height: 100%;
    justify-content: flex-end;
    position: relative;
}
.bar {
    width: 100%;
    max-width: 48px;
    border-radius: 4px 4px 0 0;
    transition: height 1s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-height: 0;
    position: relative;
    cursor: pointer;
}
.bar:hover {
    opacity: 0.85;
}
.bar-label {
    font-size: 10px;
    color: var(--text2);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}
.bar-value {
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
}

.donut-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 24px;
}
.donut-svg {
    width: 160px;
    height: 160px;
    transform: rotate(-90deg);
}
.donut-segment {
    transition: stroke-dasharray 1s ease-out, stroke-dashoffset 1s ease-out;
    cursor: pointer;
}
.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.donut-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text2);
}
.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.table-wrapper {
    overflow-x: auto;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table thead th {
    text-align: left;
    padding: 10px 12px;
    color: var(--text2);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table tbody tr {
    transition: background 0.2s;
    animation: fadeIn 0.4s ease-out both;
}
.data-table tbody tr:hover {
    background: var(--bg3);
}
.data-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.status-badge.connected {
    background: var(--green-bg);
    color: var(--green);
}
.status-badge.disconnected {
    background: var(--red-bg);
    color: var(--red);
}
.status-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.status-badge.connected .dot { background: var(--green); animation: pulse-dot 2s infinite; }
.status-badge.disconnected .dot { background: var(--red); }
.status-badge.isolated { background: var(--blue-bg); color: var(--blue); }
.status-badge.isolated .dot { background: var(--blue); animation: pulse-dot 2s infinite; }

.load-bar {
    height: 6px;
    background: var(--bg3);
    border-radius: 3px;
    overflow: hidden;
    min-width: 80px;
}
.load-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s ease-out;
}
.load-bar-fill.low { background: var(--green); }
.load-bar-fill.medium { background: var(--yellow); }
.load-bar-fill.high { background: var(--red); }

.client-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.client-card {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    animation: fadeIn 0.4s ease-out both;
    transition: transform 0.2s, box-shadow 0.2s;
}
.client-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.client-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.client-card-name {
    font-weight: 600;
    font-size: 14px;
}
.client-card-count {
    font-size: 18px;
    font-weight: 700;
}
.client-card-load {
    margin-top: 8px;
}
.client-card-load .load-bar-fill {
    transition: width 1.5s ease-out;
}
.client-card-clients {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    max-height: 100px;
    overflow-y: auto;
}
.client-chip {
    font-size: 11px;
    padding: 2px 8px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text2);
    white-space: nowrap;
}

.report-builder {
    margin-bottom: 20px;
}
.report-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.report-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.report-field label {
    font-size: 12px;
    color: var(--text2);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.report-field select,
.report-field input {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
.report-field select:focus,
.report-field input:focus {
    border-color: var(--primary);
}
.report-field select option {
    background: var(--bg2);
}
.report-actions {
    justify-content: flex-end;
}
.btn-group {
    display: flex;
    gap: 8px;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: #2563eb;
    box-shadow: 0 0 20px var(--primary-glow);
}
.btn-secondary {
    background: var(--bg3);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--border);
}
.btn-sm {
    background: var(--bg3);
    color: var(--text2);
    border: 1px solid var(--border);
    padding: 4px 12px;
    font-size: 11px;
}

.report-output {
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.report-output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg3);
    border-bottom: 1px solid var(--border);
}
.report-output-header h4 {
    font-size: 13px;
    font-weight: 600;
}
.report-output pre {
    padding: 14px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text2);
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    background: var(--bg2);
    font-family: 'Cascadia Code', 'Fira Code', monospace;
}

.settings-form {
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.scroll-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 90;
}
.scroll-top.visible {
    opacity: 1;
    visibility: visible;
}
.scroll-top:hover {
    background: var(--bg3);
    color: var(--primary);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
@keyframes pulse-text {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}
@keyframes countUp {
    from { opacity: 1; }
    to { opacity: 1; }
}

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

.stat-card:nth-child(1) { animation-delay: 0s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.2s; }
.stat-card:nth-child(4) { animation-delay: 0.3s; }

@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
    .report-grid { grid-template-columns: repeat(2, 1fr); }
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    backdrop-filter: blur(4px);
}
.sidebar-backdrop.visible {
    display: block;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }
    .main-content {
        margin-left: 0;
        padding: 0 16px 24px;
    }
    .menu-toggle {
        display: block;
    }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 22px; }
    .stat-icon { width: 44px; height: 44px; }
    .report-grid { grid-template-columns: 1fr; }
    .donut-wrapper { flex-direction: column; gap: 16px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .search-box input { width: 120px; }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 4px var(--green); }
    50% { box-shadow: 0 0 16px var(--green); }
}

@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 4px var(--red); }
    50% { box-shadow: 0 0 16px var(--red); }
}

@keyframes fade-in-slide {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.status-badge.connected.changed {
    animation: pulse-glow 1s ease-in-out 3;
}

.status-badge.disconnected.changed {
    animation: pulse-red 1s ease-in-out 3;
}

tr.changed td:first-child {
    animation: fade-in-slide 0.4s ease-out;
}

.client-chip.new {
    animation: pulse-glow 1s ease-in-out 2;
}

/* ─── LOGIN SCREEN ─── */
.login-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    overflow: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}
.login-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.login-screen.hidden .login-card {
    transform: scale(0.9) translateY(20px);
    opacity: 0;
}

.login-bg {
    position: absolute;
    inset: -50%;
    background:
        radial-gradient(ellipse 80% 60% at 20% 30%, rgba(59, 130, 246, 0.15), transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 20%, rgba(139, 92, 246, 0.12), transparent 50%),
        radial-gradient(ellipse 50% 50% at 50% 80%, rgba(6, 182, 212, 0.1), transparent 50%),
        radial-gradient(ellipse 70% 40% at 70% 70%, rgba(59, 130, 246, 0.08), transparent 50%);
    animation: login-bg-shift 12s ease-in-out infinite alternate;
}
@keyframes login-bg-shift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-5%, -3%) rotate(3deg); }
}

.login-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.login-particle {
    position: absolute;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0;
    animation: login-particle-float 8s ease-in-out infinite;
}
@keyframes login-particle-float {
    0% { transform: translateY(100vh) scale(0); opacity: 0; }
    10% { opacity: 0.3; }
    90% { opacity: 0.3; }
    100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

.login-card {
    position: relative;
    width: 400px;
    max-width: 92vw;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 20px;
    padding: 48px 36px 36px;
    text-align: center;
    box-shadow:
        0 0 60px rgba(59, 130, 246, 0.08),
        0 20px 60px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.6s ease;
    animation: login-card-enter 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes login-card-enter {
    from { transform: scale(0.9) translateY(30px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.login-wifi {
    color: var(--primary);
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
}
.wifi-icon {
    filter: drop-shadow(0 0 12px rgba(59, 130, 246, 0.4));
}
.wifi-bar {
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    animation: wifi-draw 1.5s ease-out forwards;
}
.wifi-bar-1 { animation-delay: 0s; }
.wifi-bar-2 { animation-delay: 0.2s; }
.wifi-bar-3 { animation-delay: 0.4s; }
.wifi-dot {
    animation: wifi-pulse 2s ease-in-out infinite;
    animation-delay: 0.6s;
}
@keyframes wifi-draw {
    to { stroke-dashoffset: 0; }
}
@keyframes wifi-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.login-brand {
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(135deg, #60a5fa, #a78bfa, #22d3ee);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
    animation: login-glow 3s ease-in-out infinite alternate;
}
@keyframes login-glow {
    from { filter: brightness(1); }
    to { filter: brightness(1.3); }
}
.login-subtitle {
    font-size: 12px;
    color: var(--text2);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 32px;
    font-weight: 400;
}

.login-form {
    text-align: left;
}

.login-field {
    position: relative;
    margin-bottom: 20px;
}
.login-input {
    width: 100%;
    background: rgba(30, 41, 59, 0.6);
    border: none;
    border-radius: 12px;
    padding: 16px 16px 8px;
    font-size: 15px;
    color: var(--text);
    outline: none;
    transition: background 0.3s, box-shadow 0.3s;
    font-family: inherit;
}
.login-input:focus {
    background: rgba(30, 41, 59, 0.9);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.3);
}
.login-input:not(:placeholder-shown) {
    background: rgba(30, 41, 59, 0.8);
}
.login-label {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--text2);
    pointer-events: none;
    transition: all 0.25s ease;
    background: transparent;
    padding: 0 4px;
}
.login-input:focus ~ .login-label,
.login-input:not(:placeholder-shown) ~ .login-label {
    top: 10px;
    transform: translateY(0);
    font-size: 10px;
    color: var(--primary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.login-field-border {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), #a78bfa);
    border-radius: 2px;
    transition: all 0.4s ease;
    transform: translateX(-50%);
}
.login-input:focus ~ .login-field-border {
    width: 80%;
}

.login-error {
    font-size: 12px;
    color: var(--red);
    min-height: 20px;
    margin-bottom: 12px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s;
}
.login-error.visible {
    opacity: 1;
}

.login-btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.25);
    font-family: inherit;
}
.login-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 30%, rgba(255,255,255,0.08) 50%, transparent 70%);
    background-size: 200% 100%;
    animation: login-btn-shine 3s ease-in-out infinite;
}
@keyframes login-btn-shine {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.4);
}
.login-btn:active {
    transform: translateY(0);
}
.login-btn.loading {
    pointer-events: none;
}
.login-btn.loading .login-btn-text { display: none; }
.login-btn.loading .login-btn-loader { display: flex; }
.login-btn .login-btn-loader {
    display: none;
    animation: spin 1s linear infinite;
    color: rgba(255,255,255,0.8);
}

.login-footer {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.login-version {
    font-size: 10px;
    color: rgba(148, 163, 184, 0.3);
    letter-spacing: 1px;
}
.login-credits {
    font-size: 9px;
    color: rgba(34, 197, 94, 0.7);
    margin-top: 4px;
    letter-spacing: 0.3px;
    animation: login-credits-blink 1.5s ease-in-out infinite;
}
@keyframes login-credits-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@media (max-width: 480px) {
    .login-card {
        padding: 36px 24px 28px;
    }
    .login-brand {
        font-size: 22px;
    }
}

/* ─── MODAL ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    animation: modal-fade-in 0.2s ease;
}
.modal-overlay.open {
    display: flex;
}
@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
.modal-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 420px;
    max-width: 92vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: modal-slide-in 0.25s ease;
}
@keyframes modal-slide-in {
    from { transform: translateY(20px) scale(0.97); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text2);
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}
.modal-close:hover {
    background: var(--bg3);
    color: var(--text);
}
.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.modal-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.modal-field label {
    font-size: 12px;
    color: var(--text2);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.modal-input {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}
.modal-input:focus {
    border-color: var(--primary);
}
.modal-input option {
    background: var(--bg2);
}
.checkbox-row {
    display: flex;
    align-items: center;
}
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text2);
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
    accent-color: var(--primary);
    width: 15px;
    height: 15px;
    cursor: pointer;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px 18px;
    border-top: 1px solid var(--border);
}

/* Action buttons */
.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg3);
    color: var(--text2);
}
.btn-icon:hover {
    background: var(--border);
    color: var(--text);
}
.btn-icon.edit:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--blue-bg);
}
.btn-icon.delete:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--red-bg);
}
.btn-icon.reset:hover {
    border-color: var(--yellow);
    color: var(--yellow);
    background: var(--yellow-bg);
}
.actions-cell {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
}

/* Loading skeleton (WIFI-016) */
.skeleton {
    background: linear-gradient(90deg, var(--bg3) 25%, var(--border) 50%, var(--bg3) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.short { width: 60%; }
.skeleton-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.skeleton-row {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.skeleton-row .skeleton { height: 12px; flex: 1; }

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 24px;
    transition: all 0.3s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--text2);
    border-radius: 50%;
    transition: all 0.3s;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
    border-color: var(--primary);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
    background: white;
}

/* ─── PAGE FOOTER ─── */
.page-footer {
    border-top: 1px solid var(--border);
    margin-top: 32px;
    padding: 20px 0 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}
.footer-info {
    display: flex;
    align-items: center;
    gap: 16px;
}
.footer-copyright {
    font-size: 11px;
    color: var(--text2);
}
.footer-version {
    font-size: 10px;
    color: var(--text2);
    opacity: 0.5;
    letter-spacing: 1px;
}
