:root {
    --bg: #060606;
    --s1: #0d0d0d;
    --s2: #141414;
    --s3: #1b1b1b;
    --line: #242424;
    --line2: #343434;
    --text: #ececec;
    --dim: #8a8a8a;
    --ok: #86c496;
    --warn: #cfaa5e;
    --bad: #d07272;
    --use: #9fadbf;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body { max-width: 100%; overflow-x: hidden; }

body {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
    font: 500 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
code, pre, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

#stars {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.login-wrap, .topbar, .deck { position: relative; z-index: 1; }

.card {
    background: var(--s1);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    white-space: nowrap;
    transition: background-color .15s, border-color .15s, color .15s;
}
.btn:active { opacity: .8; }
.btn-primary { background: #e9e9e9; color: #090909; }
.btn-primary:hover { background: #fff; }
.btn-ghost { background: var(--s2); border-color: var(--line2); color: var(--text); }
.btn-ghost:hover { background: var(--s3); border-color: #4a4a4a; }
.btn-danger { background: #2a1515; border-color: #4a2626; color: #e69393; }
.btn-danger:hover { background: #351a1a; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 11.5px; }
.btn-block { width: 100%; }

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid;
    font-size: 14px;
    margin-bottom: 16px;
}
.alert-error { background: #1c1010; border-color: #4a2626; color: #e69393; }
.alert-warn { background: #1a160b; border-color: #4a3d1c; color: #d9bc72; }
.alert-success { background: #101a13; border-color: #264a31; color: #98d5a8; }

.login-wrap {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
}
.portal {
    width: 100%;
    max-width: 380px;
    padding: 34px 24px 26px;
    text-align: center;
    animation: fade .4s ease both;
}
.mark {
    width: 54px;
    height: 54px;
    margin: 0 auto 18px;
    border: 1px solid var(--line2);
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--s2);
}
.mark i { width: 10px; height: 10px; border-radius: 50%; background: #e9e9e9; box-shadow: 0 0 14px rgba(255,255,255,.55); }
.title { font-size: 26px; font-weight: 800; letter-spacing: .22em; padding-left: .22em; }
.subtitle { margin: 6px 0 26px; font-size: 11px; letter-spacing: .34em; padding-left: .34em; color: var(--dim); text-transform: uppercase; }

.form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; text-align: left; }
.field { display: block; min-width: 0; }
.field > .lbl { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    background: var(--bg);
    border: 1px solid var(--line2);
    border-radius: 10px;
    color: var(--dim);
    transition: border-color .15s;
}
.box:focus-within { border-color: #8a8a8a; color: var(--text); }
.box input[type] { flex: 1; width: auto; min-width: 0; height: 48px; padding: 0; background: transparent; border: 0; border-radius: 0; outline: 0; font-size: 16px; color: var(--text); }
.box input::placeholder { color: #555; }
.eye { background: none; border: 0; padding: 6px; color: inherit; cursor: pointer; display: grid; place-items: center; }
.form .btn { margin-top: 6px; min-height: 48px; }
.foot-note { margin-top: 22px; font-size: 11px; letter-spacing: .18em; color: #5c5c5c; text-transform: uppercase; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(6,6,6,.96);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .mark { width: 32px; height: 32px; margin: 0; flex: none; }
.brand .mark i { width: 7px; height: 7px; }
.brand-name { font-weight: 800; letter-spacing: .18em; font-size: 14px; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex: none; }
.user { color: var(--dim); font-size: 13px; font-weight: 600; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.deck { width: 100%; max-width: 1100px; margin: 0 auto; padding: 16px 14px 40px; }

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { padding: 14px; min-width: 0; }
.stat-lbl { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.stat-num { margin-top: 6px; font-size: 28px; font-weight: 800; line-height: 1; }
.stat.t-ok .stat-num { color: var(--ok); }
.stat.t-use .stat-num { color: var(--use); }
.stat.t-warn .stat-num { color: var(--warn); }
.stat.t-bad .stat-num { color: var(--bad); }

.panel { padding: 16px; margin-bottom: 14px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-title { font-size: 12px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; display: flex; align-items: baseline; gap: 10px; }
.panel-title small { font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--dim); }
.panel > .panel-title { margin-bottom: 14px; }

.mini > span { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
select, input[type=text], input[type=number], input[type=search] {
    width: 100%;
    height: 46px;
    padding: 0 12px;
    background: var(--bg);
    border: 1px solid var(--line2);
    border-radius: 10px;
    outline: 0;
    font-size: 16px;
    color: var(--text);
    transition: border-color .15s;
}
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, #8a8a8a 50%), linear-gradient(135deg, #8a8a8a 50%, transparent 50%); background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
select option { background: #101010; color: #fff; }
select:focus, input:focus { border-color: #8a8a8a; }
input::placeholder { color: #555; }

.out { margin-top: 14px; padding: 12px; border: 1px dashed var(--line2); border-radius: 10px; background: var(--bg); }
.out-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.out pre { max-height: 150px; overflow: auto; font-size: 13px; line-height: 1.75; color: #d6d6d6; }

.api { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; background: var(--bg); border: 1px solid var(--line2); border-radius: 10px; }
.api code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-size: 12.5px; color: #cfcfcf; scrollbar-width: none; }
.api code::-webkit-scrollbar { display: none; }

.search { display: flex; gap: 8px; width: 100%; margin: 0 0 12px; }
.search input { flex: 1; min-width: 0; }
.search .btn { flex: none; min-height: 46px; }

.filters { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px 2px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters a, .filters .chip {
    flex: none;
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--line2);
    border-radius: 99px;
    background: var(--s2);
    color: var(--dim);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
}
.filters a.on { background: #e9e9e9; border-color: #e9e9e9; color: #090909; }
.filters .chip { color: var(--bad); border-color: #4a2626; background: #1c1010; }
form.inline { display: contents; }
.panel-head > form { margin: 0; }

.table-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
    text-align: left;
    padding: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--dim);
    background: var(--s2);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #101010; }
.dim { color: var(--dim); }
.ta-r { text-align: right; }
.empty { text-align: center; padding: 34px 12px; color: var(--dim); }
.hwid, .note { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hwid { font-size: 12px; }

.key {
    white-space: nowrap;
    background: var(--s2);
    border: 1px solid var(--line2);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12.5px;
    letter-spacing: .04em;
    cursor: pointer;
    transition: background-color .15s;
}
.key:hover { background: var(--s3); }

.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-active { color: var(--ok); }
.pill-used { color: var(--use); }
.pill-expired { color: var(--warn); }
.pill-blocked { color: var(--bad); }

.seg { display: flex; border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; background: var(--s2); }
.seg form { flex: 1; display: flex; }
.seg button {
    flex: 1;
    min-height: 38px;
    padding: 0 12px;
    background: transparent;
    border: 0;
    border-left: 1px solid var(--line2);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text);
    cursor: pointer;
    transition: background-color .15s;
}
.seg form:first-child button { border-left: 0; }
.seg button:hover { background: var(--s3); }
.seg .a-ok { color: var(--ok); }
.seg .a-use { color: var(--use); }
.seg .a-warn { color: var(--warn); }
.seg .a-bad { color: var(--bad); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; color: var(--dim); font-size: 13px; }
.pager a { display: inline-flex; align-items: center; min-height: 38px; padding: 0 16px; border: 1px solid var(--line2); border-radius: 10px; background: var(--s2); font-weight: 700; color: var(--text); }
.pager a.off { opacity: .3; pointer-events: none; }

.logbox { max-height: 72vh; overflow: auto; padding: 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-size: 12px; line-height: 1.65; color: #bcbcbc; white-space: pre-wrap; word-break: break-word; }

.foot { text-align: center; padding-top: 6px; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: #555; }

.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,.8); }
.modal-box { width: 100%; max-width: 340px; padding: 22px; text-align: center; }
.modal-box p { margin-bottom: 18px; font-size: 16px; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toast { position: fixed; z-index: 120; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 11px 20px; border-radius: 99px; background: #e9e9e9; color: #090909; font-size: 13px; font-weight: 700; white-space: nowrap; }


.tabs { position: relative; z-index: 1; display: flex; gap: 6px; overflow-x: auto; padding: 10px 14px 0; max-width: 1100px; margin: 0 auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; display: inline-flex; align-items: center; height: 38px; padding: 0 16px; border: 1px solid var(--line2); border-radius: 10px; background: var(--s1); color: var(--dim); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.tabs a.on { background: #e9e9e9; border-color: #e9e9e9; color: #090909; }

.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 560px; }
.fgrid .wide { grid-column: 1 / -1; }
.fgrid.sep { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.fgrid.top { margin-top: 14px; }
.fgrid form { display: block; }
.mini { display: block; min-width: 0; }

.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
.kv > div { min-width: 0; }
.kv span { display: block; margin-bottom: 2px; font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #666; }
.kv b { display: block; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }

.back { display: inline-block; margin-bottom: 12px; color: var(--dim); font-size: 13px; font-weight: 700; letter-spacing: .06em; }
.back:hover { color: var(--text); }
.key.big { font-size: 14px; padding: 9px 12px; }

.dev { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.dev:first-of-type { border-top: 0; padding-top: 0; }
.dev-main { min-width: 0; }
.dev-id { font-size: 12.5px; overflow-wrap: anywhere; }
.dev-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: 12.5px; color: var(--dim); }
.dev-meta b { color: var(--text); font-weight: 600; }

.loglist { display: grid; }
.logrow { display: flex; flex-wrap: wrap; gap: 2px 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--dim); }
.logrow:first-child { border-top: 0; }
.logrow b { color: var(--text); letter-spacing: .06em; min-width: 110px; }
.logrow .mono { overflow-wrap: anywhere; }

.seg a { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 12px; border-left: 1px solid var(--line2); font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; transition: background-color .15s; }
.seg a:first-child { border-left: 0; }
.seg a:hover { background: var(--s3); }

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

@media (min-width: 761px) {
    .deck { padding: 22px 20px 48px; }
    .topbar { padding: 12px 22px; }
    .panel { padding: 20px; }
    .filters { margin: 0 0 14px; padding: 0; flex-wrap: wrap; overflow: visible; }
    .search { width: auto; max-width: 380px; }
    .table-wrap { overflow-x: auto; }
    table { min-width: 760px; }
    td, th { white-space: nowrap; }
    .seg { display: inline-flex; }
    .seg form { flex: none; }
    .seg button, .seg a { flex: none; }
    .kv { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .tabs { padding: 14px 20px 0; }
    .desk-only { display: table-cell; }
}

@media (max-width: 760px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats .stat:first-child { grid-column: 1 / -1; }
    .user { display: none; }
    .desk-only { display: none; }

    .table-wrap { border: 0; border-radius: 0; overflow: visible; }
    table, tbody { display: block; }
    thead { display: none; }
    tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px 12px;
        padding: 14px;
        margin-bottom: 10px;
        background: var(--s2);
        border: 1px solid var(--line);
        border-radius: 12px;
    }
    tbody tr:hover { background: var(--s2); }
    tbody tr.empty-row { display: block; }
    td { display: block; padding: 0; border: 0; min-width: 0; }
    td[data-l]::before {
        content: attr(data-l);
        display: block;
        margin-bottom: 2px;
        font-size: 10px;
        font-weight: 700;
        letter-spacing: .14em;
        text-transform: uppercase;
        color: #666;
    }
    td.c-key { grid-column: 1 / -1; }
    td.c-status { grid-column: 2 / 3; text-align: right; align-self: end; }
    td.c-status::before { display: none; }
    td.c-act { grid-column: 1 / -1; }
    td.c-wide { grid-column: 1 / -1; }
    .hwid, .note { max-width: none; }
    .key { padding: 8px 10px; }
    .seg { display: flex; }
    .seg button, .seg a { min-height: 42px; }
}

@media (max-width: 380px) {
    .stat-num { font-size: 24px; }
    .brand-name { letter-spacing: .12em; }
}
