:root {
    --bg: #0f172a;
    --panel: #ffffff;
    --panel-muted: #f8fafc;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --success: #16a34a;
    --danger: #dc2626;
    --radius: 12px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f1f5f9;
    color: var(--text);
}

.topbar {
    background: var(--bg);
    color: #fff;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.topbar a { color: #fff; text-decoration: none; }
.topbar .brand { font-weight: 700; font-size: 1.1rem; }
.topbar .brand span { color: #818cf8; }
.topbar nav a { margin-left: 18px; opacity: .85; font-size: .92rem; }
.topbar nav a:hover { opacity: 1; }

.container {
    max-width: 1100px;
    margin: 32px auto;
    padding: 0 20px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.card h1, .card h2 { margin-top: 0; }

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a, #312e81);
}
.login-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 36px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 20px 40px rgba(0,0,0,.25);
}
.login-card h1 { font-size: 1.3rem; margin-bottom: 4px; }
.login-card p.sub { color: var(--text-muted); margin-top: 0; font-size: .9rem; }

label { display: block; font-size: .85rem; font-weight: 600; margin: 14px 0 6px; }
input[type=text], input[type=password], input[type=url], textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .95rem;
    background: var(--panel-muted);
}
input:focus, textarea:focus { outline: 2px solid var(--primary); background: #fff; }

.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: .92rem;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--primary-dark); }
.btn.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn.btn-danger { background: var(--danger); }
.btn.btn-sm { padding: 6px 12px; font-size: .82rem; }
.btn-block { width: 100%; text-align: center; margin-top: 18px; }

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: .9rem;
}
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #166534; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: .9rem; }
th { color: var(--text-muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; }
tr:hover td { background: var(--panel-muted); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge-on { background: #dcfce7; color: #166534; }
.badge-off { background: #fee2e2; color: #991b1b; }

.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-box { background: var(--panel-muted); border-radius: 10px; padding: 16px; text-align: center; }
.stat-box .num { font-size: 1.6rem; font-weight: 700; color: var(--primary); }
.stat-box .label { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; }

.actions a, .actions button { margin-right: 6px; }

.qr-preview img { border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 8px; }

.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }

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

.small-link { font-size: .82rem; color: var(--text-muted); }
