:root {
    --kasneb-blue: #0070AD;
    --kasneb-blue-dark: #005688;
    --kasneb-blue-darker: #004166;
    --kasneb-blue-tint: #e6f1f8;
    --ink: #1c2733;
    --muted: #5b6b7b;
    --line: #e2e8ee;
    --bg: #f4f7fa;
    --white: #ffffff;
    --success: #1f8b4c;
    --success-bg: #e7f4ec;
    --danger: #c0392b;
    --danger-bg: #fbeae8;
    --warn: #b7791f;
    --warn-bg: #fbf3e3;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(16, 42, 67, 0.08), 0 6px 20px rgba(16, 42, 67, 0.06);
    --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--kasneb-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Login ---------- */
.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(1200px 600px at 100% -10%, rgba(0,112,173,0.10), transparent),
        var(--bg);
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.login-head {
    background: var(--kasneb-blue);
    color: #fff;
    padding: 28px 28px 24px;
    text-align: center;
}
.login-head .mark {
    font-weight: 800;
    letter-spacing: 2px;
    font-size: 26px;
}
.login-head .sub {
    opacity: .85;
    font-size: 13px;
    margin-top: 4px;
    letter-spacing: .3px;
}
.login-body { padding: 28px; }
.login-body h1 {
    font-size: 18px;
    margin: 0 0 4px;
}
.login-body p.lead { color: var(--muted); margin: 0 0 22px; font-size: 14px; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 256px;
    background: var(--kasneb-blue-darker);
    background: linear-gradient(180deg, var(--kasneb-blue) 0%, var(--kasneb-blue-darker) 100%);
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand {
    padding: 22px 22px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.14);
}
.brand .mark { font-weight: 800; letter-spacing: 2px; font-size: 22px; }
.brand .sub { font-size: 11px; opacity: .8; letter-spacing: .4px; text-transform: uppercase; }

.nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.nav-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: .6;
    padding: 14px 12px 6px;
}
.nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #eaf3fa;
    font-size: 14px;
    margin-bottom: 2px;
    transition: background .15s;
}
.nav a:hover { background: rgba(255,255,255,0.10); text-decoration: none; }
.nav a.active { background: #fff; color: var(--kasneb-blue-dark); font-weight: 600; }
.nav a .ico { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-foot {
    padding: 14px 18px;
    border-top: 1px solid rgba(255,255,255,0.14);
    font-size: 12.5px;
}
.sidebar-foot .who { font-weight: 600; }
.sidebar-foot .role { opacity: .75; text-transform: capitalize; }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--line);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 5;
}
.topbar h1 { font-size: 19px; margin: 0; }
.topbar .crumb { color: var(--muted); font-size: 13px; }
.content { padding: 28px; max-width: 1100px; width: 100%; }

/* ---------- Cards & grid ---------- */
.card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-head h2 { font-size: 16px; margin: 0; }
.card-body { padding: 20px; }

.grid { display: grid; gap: 18px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

.stat {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 30px; font-weight: 700; color: var(--kasneb-blue-dark); line-height: 1.1; margin-top: 6px; }
.stat .foot { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.field input, .field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    color: var(--ink);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus {
    outline: none;
    border-color: var(--kasneb-blue);
    box-shadow: 0 0 0 3px var(--kasneb-blue-tint);
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    background: var(--kasneb-blue);
    color: #fff;
    transition: background .15s;
}
.btn:hover { background: var(--kasneb-blue-dark); text-decoration: none; }
.btn.block { width: 100%; justify-content: center; }
.btn.ghost { background: #fff; color: var(--kasneb-blue-dark); border-color: var(--line); }
.btn.ghost:hover { background: var(--bg); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #a13225; }
.btn.sm { padding: 6px 12px; font-size: 13px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
    text-align: left;
    padding: 11px 14px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    background: #fafcfe;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafcfe; }

/* ---------- Badges & alerts ---------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge.ok { background: var(--success-bg); color: var(--success); }
.badge.fail { background: var(--danger-bg); color: var(--danger); }
.badge.admin { background: var(--kasneb-blue-tint); color: var(--kasneb-blue-dark); }
.badge.user { background: #eef1f4; color: var(--muted); }
.badge.disabled { background: var(--warn-bg); color: var(--warn); }

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 18px;
    border: 1px solid transparent;
}
.alert.error { background: var(--danger-bg); color: var(--danger); border-color: #f3cfca; }
.alert.success { background: var(--success-bg); color: var(--success); border-color: #cce7d6; }

.muted { color: var(--muted); }
.right { text-align: right; }
.mt-0 { margin-top: 0; }
.section-gap { margin-top: 24px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
    .sidebar { width: 72px; }
    .brand .sub, .nav-label, .nav a span, .sidebar-foot { display: none; }
    .nav a { justify-content: center; padding: 12px; }
    .content, .topbar { padding-left: 16px; padding-right: 16px; }
}
