/* =========================================================
   Regjistrimet UMSH — Stil profesional (light + dark)
   ========================================================= */
:root {
    --bg: #eef2f9;
    --bg-grad-1: #eef3fb;
    --bg-grad-2: #e4ebf6;
    --surface: #ffffff;
    --surface-2: #f7f9fd;
    --text: #14213d;
    --muted: #64748b;
    --brand: #0b6e4f;
    --brand-2: #12a47a;
    --accent: #2563eb;
    --accent-2: #7c3aed;
    --warn: #f59e0b;
    --danger: #dc2626;
    --line: #e2e8f0;
    --ring: rgba(37, 99, 235, .25);
    --shadow: 0 18px 40px rgba(20, 33, 61, .08);
    --shadow-sm: 0 6px 16px rgba(20, 33, 61, .06);
    --radius: 18px;
    --sidebar-w: 264px;
}
[data-theme="dark"] {
    --bg: #0b1220;
    --bg-grad-1: #0b1220;
    --bg-grad-2: #0e1626;
    --surface: #131c2e;
    --surface-2: #0f1828;
    --text: #e6edf7;
    --muted: #93a4bd;
    --brand: #19c08a;
    --brand-2: #12a47a;
    --accent: #60a5fa;
    --accent-2: #a78bfa;
    --line: #223047;
    --ring: rgba(96, 165, 250, .3);
    --shadow: 0 18px 50px rgba(0, 0, 0, .45);
    --shadow-sm: 0 6px 18px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: "Segoe UI", Inter, Tahoma, system-ui, sans-serif;
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 100% -10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, color-mix(in srgb, var(--brand) 12%, transparent), transparent 60%),
        linear-gradient(180deg, var(--bg-grad-1), var(--bg-grad-2));
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* ---------- Login ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
    width: 100%; max-width: 420px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 24px; box-shadow: var(--shadow); padding: 36px 32px;
    animation: rise .5s ease;
}
.auth-logo {
    width: 60px; height: 60px; border-radius: 16px; display: grid; place-items: center;
    color: #fff; font-weight: 800; font-size: 22px; margin-bottom: 18px;
    background: linear-gradient(135deg, var(--brand), var(--accent));
    box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 35%, transparent);
}
.auth-card h1 { margin: 0 0 4px; font-size: 24px; }
.auth-card .sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
    background: var(--surface); border-right: 1px solid var(--line);
    padding: 22px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column; gap: 6px;
}
.brand-row { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; }
.brand-badge {
    width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
    color: #fff; font-weight: 800; flex: none;
    background: linear-gradient(135deg, var(--brand), var(--accent));
}
.brand-row .t { font-weight: 700; line-height: 1.1; }
.brand-row .s { font-size: 12px; color: var(--muted); }

.menu-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 14px 12px 6px; }
.menu-item {
    display: flex; align-items: center; gap: 12px; text-decoration: none;
    padding: 11px 12px; border-radius: 12px; color: var(--text); font-size: 14.5px;
    transition: background .15s, color .15s, transform .1s;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: var(--shadow-sm); }
.menu-item.active svg { stroke: #fff; }
.menu-item svg { width: 19px; height: 19px; stroke: var(--muted); flex: none; }
.menu-spacer { flex: 1; }

.main { padding: 26px 30px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-title h2 { margin: 0; font-size: 22px; }
.page-title p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.icon-btn {
    width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
    background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--text);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }

.user-chip {
    display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
}
.avatar {
    width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
    color: #fff; font-size: 12px; font-weight: 700;
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
}
.user-chip .nm { font-size: 13px; font-weight: 600; line-height: 1; }
.user-chip .rl { font-size: 11px; color: var(--muted); }

/* ---------- Cards ---------- */
.panel {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px;
}
.panel h3 { margin: 0 0 14px; font-size: 16px; }
.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Stat cards */
.stat {
    position: relative; overflow: hidden; padding: 20px;
    border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
    box-shadow: var(--shadow-sm);
    animation: rise .5s ease both;
}
.stat .ico {
    width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; margin-bottom: 14px;
}
.stat .ico svg { width: 22px; height: 22px; stroke: #fff; }
.stat .lbl { color: var(--muted); font-size: 13px; }
.stat .val { font-size: 30px; font-weight: 800; margin-top: 2px; letter-spacing: -.5px; }
.stat .trend { font-size: 12px; color: var(--brand); margin-top: 6px; font-weight: 600; }
.g-brand .ico { background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.g-blue .ico { background: linear-gradient(135deg, #2563eb, #38bdf8); }
.g-violet .ico { background: linear-gradient(135deg, #7c3aed, #c084fc); }
.g-amber .ico { background: linear-gradient(135deg, #f59e0b, #fbbf24); }

/* ---------- Quota progress ---------- */
.quota-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.quota-item:last-child { border-bottom: 0; }
.quota-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.quota-head .nm { font-weight: 600; font-size: 14px; }
.quota-head .nums { font-size: 13px; color: var(--muted); }
.bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); }
.bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .9s cubic-bezier(.2,.8,.2,1); }
.bar.warn > span { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.bar.full > span { background: linear-gradient(90deg, #dc2626, #f87171); }

/* ---------- Forms ---------- */
form .form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
label.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
input, select, textarea {
    font: inherit; width: 100%; color: var(--text);
    border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; background: var(--surface-2);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
textarea { min-height: 92px; resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text); }
.check input { width: auto; }

.btn {
    border: 0; border-radius: 12px; padding: 12px 20px; cursor: pointer; font: inherit; font-weight: 600;
    color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2));
    box-shadow: var(--shadow-sm); transition: transform .1s, filter .15s;
    display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.btn.blue { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.btn.sm { padding: 8px 14px; font-size: 13px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.aktiv { color: #15803d; background: #dcfce7; }
.badge.pasiv { color: #b45309; background: #fef3c7; }
.badge.mesuar { color: #1d4ed8; background: #dbeafe; }
.badge.nderprerje { color: #b91c1c; background: #fee2e2; }
.badge.soft { color: var(--muted); background: var(--surface-2); }
[data-theme="dark"] .badge.aktiv { background: rgba(34,197,94,.15); }
[data-theme="dark"] .badge.pasiv { background: rgba(245,158,11,.15); }
[data-theme="dark"] .badge.mesuar { background: rgba(59,130,246,.15); }
[data-theme="dark"] .badge.nderprerje { background: rgba(239,68,68,.15); }

/* ---------- Messages ---------- */
.msg { padding: 13px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; display: flex; gap: 10px; align-items: center; }
.msg.error { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }
.msg.success { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; stroke: var(--muted); }
.search input { padding-left: 36px; min-width: 240px; }
.spacer { flex: 1; }

/* Pagination */
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pager a, .pager span {
    min-width: 38px; height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line);
    display: grid; place-items: center; text-decoration: none; font-size: 13.5px; background: var(--surface);
}
.pager .cur { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager .disabled { opacity: .4; pointer-events: none; }

/* Live quota indicator (forma e regjistrimit) */
.quota-live {
    border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin-bottom: 18px;
    background: var(--surface-2); animation: rise .3s ease;
    border-left: 4px solid var(--brand);
}
.quota-live.is-warn { border-left-color: var(--warn); }
.quota-live.is-full { border-left-color: var(--danger); }
.quota-live-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.quota-live .ql-name { font-weight: 700; font-size: 14.5px; }
.quota-live .ql-state { font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; border-radius: 999px; }
.quota-live .ql-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.quota-live .ql-state.ok { color: #15803d; background: #dcfce7; }
.quota-live .ql-state.warn { color: #b45309; background: #fef3c7; }
.quota-live .ql-state.full { color: #b91c1c; background: #fee2e2; }
[data-theme="dark"] .quota-live .ql-state.ok { background: rgba(34,197,94,.16); }
[data-theme="dark"] .quota-live .ql-state.warn { background: rgba(245,158,11,.16); }
[data-theme="dark"] .quota-live .ql-state.full { background: rgba(239,68,68,.16); }
.quota-live .ql-meta { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.quota-live .bar > span { transition: width .6s cubic-bezier(.2,.8,.2,1), background .3s; }

/* Password meter */
.meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); margin-top: 6px; }
.meter > span { display: block; height: 100%; width: 0; transition: width .25s, background .25s; }
.meter-text { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Donut + sparkline */
.chart-legend { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.chart-legend .row { display: flex; align-items: center; gap: 8px; }
.dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 28px; font-size: 14px; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Responsive */
.menu-toggle { display: none; }
@media (max-width: 980px) {
    .cols-4 { grid-template-columns: repeat(2, 1fr); }
    .cols-3, .cols-2 { grid-template-columns: 1fr; }
    form .form-grid { grid-template-columns: 1fr; }
    .layout { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; z-index: 50; width: 270px; left: 0; top: 0;
        transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow);
    }
    body.nav-open .sidebar { transform: none; }
    .menu-toggle { display: grid; }
    .scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; }
    body.nav-open .scrim { display: block; }
}
