:root {
    --blue: #0d6efd;
    --blue-dark: #0a58ca;
    --bg: #f1f4f9;
    --panel: #ffffff;
    --border: #e3e8ef;
    --text: #17233b;
    --muted: #66748c;
    --danger: #d92d20;
    --warn: #b54708;
    --ok: #067647;
    --radius: 14px;
}
* { box-sizing: border-box; margin: 0; }
body {
    font-family: "Segoe UI", system-ui, sans-serif;
    background: var(--bg); color: var(--text); font-size: 14px;
}

/* ---------------- login ---------------- */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(150deg, #0b2b57, #0d6efd);
}
.login-card {
    width: 380px; background: #fff; padding: 40px 36px 30px;
    border-radius: 20px; box-shadow: 0 18px 50px rgba(0,0,0,.35);
    display: flex; flex-direction: column; gap: 10px;
}
.brand { font-size: 24px; font-weight: 800; text-align: center; margin-bottom: 12px; }
.brand em { display:block; font-style: normal; font-size: 13px; color: var(--muted); font-weight: 500;}
.brand-k { color: var(--blue); }

/* ---------------- shell ---------------- */
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar {
    background: #101c33; color: #dbe4f3; padding: 22px 16px;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand { font-size: 19px; font-weight: 800; color: #fff; margin-bottom: 26px; }
.side-brand .muted { font-size: 11px; }
#nav a {
    display: block; padding: 10px 12px; border-radius: 9px;
    color: #c6d2e6; text-decoration: none; margin-bottom: 3px; font-size: 13.5px;
}
#nav a:hover { background: rgba(255,255,255,.07); }
#nav a.active { background: var(--blue); color: #fff; }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; }
.side-foot .muted { font-size: 12px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { padding: 28px 32px; max-width: 1250px; }

/* ---------------- common ---------------- */
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 18px; font-size: 13px; }
.hidden { display: none !important; }
h2.page-title { font-size: 21px; margin-bottom: 18px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

.btn {
    border: 1px solid transparent; border-radius: 9px; cursor: pointer;
    padding: 8px 15px; font-size: 13.5px; background: #e8edf5; color: var(--text);
}
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.warn { background: var(--warn); color: #fff; }
.btn.ghost { background: transparent; border-color: #94a3bb; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.big { padding: 11px; font-size: 15px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.inp, select, textarea {
    width: 100%; padding: 9px 11px; border: 1px solid var(--border);
    border-radius: 9px; font-size: 13.5px; background: #fff; font-family: inherit;
}
label { font-size: 12.5px; color: var(--muted); display: block; margin-top: 8px; }

.card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px;
}

table.tbl { width: 100%; border-collapse: collapse; background: var(--panel);
    border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted);
    padding: 10px 12px; background: #f7f9fc; border-bottom: 1px solid var(--border); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: #fafcff; }

.badge { padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge.ACTIVE     { background:#e7f6ee; color:var(--ok); }
.badge.PENDING    { background:#fff4dc; color:var(--warn); }
.badge.SUSPENDED  { background:#ffe9e0; color:#c2410c; }
.badge.EXPIRED    { background:#eceff4; color:var(--muted); }
.badge.REVOKED    { background:#fde8e8; color:var(--danger); }

.key-code { font-family: Consolas, monospace; font-weight: 700; letter-spacing: .5px; }

/* ---------------- dashboard ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(160px,1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-card b { display: block; font-size: 26px; margin-top: 4px; }
.stat-card span { font-size: 12px; color: var(--muted); }
.notif { padding: 10px 13px; border-radius: 9px; margin-bottom: 8px; font-size: 13px; }
.notif.warn   { background:#fff7ea; border-left: 4px solid #f59e0b; }
.notif.danger { background:#fdf0ef; border-left: 4px solid var(--danger); }
.notif.info   { background:#eef4ff; border-left: 4px solid var(--blue); }

.grid-2 { display:grid; grid-template-columns: 1.25fr .75fr; gap: 16px; align-items:start; }

/* ---------------- modal / toast ---------------- */
.modal {
    position: fixed; inset: 0; background: rgba(9,17,34,.55);
    display:flex; align-items:center; justify-content:center; z-index:50;
}
.modal-card {
    width: 480px; max-width: 94vw; max-height: 90vh; overflow:auto;
    background:#fff; border-radius: 16px; padding: 24px;
}
.toast {
    position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
    background: #101c33; color: #fff; padding: 11px 20px; border-radius: 10px;
    font-size: 13.5px; z-index: 99; box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.pager { display:flex; gap:6px; align-items:center; margin-top: 14px; justify-content:flex-end; }
.pager button { min-width: 34px; }
.chip { border:1px solid var(--border); background:#fff; border-radius:999px; padding:5px 13px; font-size:12.5px; cursor:pointer; }
.chip.on { background: var(--blue); color:#fff; border-color: var(--blue); }
.searchbar { display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-bottom:14px; }
.searchbar .inp { width: 320px; }

.quota-bar {
    height: 6px; border-radius: 4px;
    background: #e5e7eb; margin-top: 4px; overflow: hidden;
}
.quota-bar span {
    display: block; height: 100%;
    background: linear-gradient(90deg, #0d6efd, #067647);
    border-radius: 4px;
}
