/* ============ z-control :: dark ops console ============ */
/* palette: deep charcoal-green, amber signal color, hairline steel borders */

:root {
    --bg0: #0a0d0b;
    --bg1: #0e1210;
    --bg2: #131815;
    --bg3: #1a201c;
    --bg4: #222925;
    --line: #2a332e;
    --line-soft: #20272380;
    --txt: #c8d2cb;
    --txt-dim: #7d8a81;
    --txt-faint: #55605a;
    --amber: #e8a33d;
    --amber-hi: #ffc35e;
    --amber-dim: #8a6323;
    --green: #57c98a;
    --green-dim: #2c6e4a;
    --red: #e05c5c;
    --red-dim: #7a3434;
    --blue: #5aa7d8;
    --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace;
    --sans: "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    background: var(--bg0);
    color: var(--txt);
    font-family: var(--sans);
    font-size: 14px;
    overflow: hidden;
}

/* faint scanline texture */
body::after {
    content: "";
    position: fixed; inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(0deg, transparent 0 2px, #ffffff02 2px 4px);
    z-index: 9999;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--amber-dim); }
::-webkit-scrollbar-corner { background: transparent; }

button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ---------- login ---------- */
.login-wrap {
    height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(1200px 500px at 70% -10%, #12241b55, transparent),
        radial-gradient(900px 400px at 20% 110%, #241a0844, transparent),
        var(--bg0);
}
.login-box {
    width: 360px;
    background: var(--bg1);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 36px 32px 30px;
    box-shadow: 0 20px 60px #000a;
}
.login-logo {
    font-family: var(--mono);
    font-size: 26px;
    letter-spacing: 4px;
    color: var(--amber);
    margin-bottom: 4px;
}
.login-sub {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--txt-faint);
    letter-spacing: 2px;
    margin-bottom: 28px;
}
.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--txt-dim);
    margin-bottom: 6px;
}
.field input, .field select, .field textarea {
    width: 100%;
    background: var(--bg0);
    border: 1px solid var(--line);
    color: var(--txt);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--amber-dim);
}
.btn {
    background: var(--bg3);
    border: 1px solid var(--line);
    color: var(--txt);
    border-radius: 6px;
    padding: 9px 16px;
    font-size: 13px;
    transition: all .15s;
}
.btn:hover { background: var(--bg4); border-color: var(--amber-dim); }
.btn-primary {
    background: linear-gradient(180deg, #3a2c10, #2b2008);
    border: 1px solid var(--amber-dim);
    color: var(--amber-hi);
    font-weight: 600;
}
.btn-primary:hover { background: linear-gradient(180deg, #4a3814, #35270a); border-color: var(--amber); }
.btn-danger { border-color: var(--red-dim); color: var(--red); }
.btn-danger:hover { background: #2a1414; border-color: var(--red); }
.btn-mini { padding: 4px 10px; font-size: 12px; border-radius: 4px; }
.btn-block { width: 100%; padding: 11px; }
.login-err {
    color: var(--red);
    font-size: 12px;
    margin-top: 12px;
    min-height: 16px;
    font-family: var(--mono);
}

/* ---------- top bar ---------- */
.topbar {
    height: 54px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 18px;
    background: var(--bg1);
    border-bottom: 1px solid var(--line);
}
.topbar .brand {
    font-family: var(--mono);
    color: var(--amber);
    letter-spacing: 3px;
    font-size: 16px;
    margin-right: 22px;
    user-select: none;
}
.tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--txt-dim);
    padding: 8px 18px;
    border-radius: 7px;
    font-size: 13.5px;
    letter-spacing: .3px;
}
.tab-btn:hover { color: var(--txt); background: var(--bg2); }
.tab-btn.active {
    color: var(--amber-hi);
    background: var(--bg3);
    border-color: var(--amber-dim);
}
.topbar .spacer { flex: 1; }
.topbar .srv-online {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--txt-dim);
    margin-right: 14px;
}
.topbar .srv-online b { color: var(--green); }
.btn-logout {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--txt-dim);
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 12.5px;
}
.btn-logout:hover { color: var(--red); border-color: var(--red-dim); }

/* ---------- main area ---------- */
.main {
    height: calc(100vh - 54px);
    overflow: auto;
    padding: 22px;
}

/* ---------- clients table ---------- */
.panel {
    background: var(--bg1);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}
.panel-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}
.panel-title {
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: 2px;
    color: var(--txt-dim);
    text-transform: uppercase;
}
.panel-head .spacer { flex: 1; }
.count-chip {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--green);
    background: #14251b;
    border: 1px solid var(--green-dim);
    padding: 3px 10px;
    border-radius: 20px;
}
.count-chip.off { color: var(--txt-dim); background: var(--bg2); border-color: var(--line); }
.count-chip.fav { color: var(--amber-hi); background: #241c0c; border-color: var(--amber-dim); }

table.grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.grid th {
    text-align: left;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--txt-faint);
    font-weight: 600;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    background: var(--bg2);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 5;
}
table.grid td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--line-soft);
    white-space: nowrap;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--txt);
}
table.grid tr.row-off td { color: var(--txt-faint); }
table.grid tr.row-off td .status { color: var(--txt-faint); }
table.grid tbody tr { cursor: default; }
table.grid tbody tr:hover { background: #161c19; }
table.grid tbody tr.fav-row { background: #17140c; }
table.grid tbody tr.fav-row:hover { background: #1d1810; }

.status { font-family: var(--mono); font-size: 12.5px; }
.status.on { color: var(--green); }
.status.off { color: var(--txt-faint); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.ping-ok { color: var(--green); }
.ping-warn { color: var(--amber); }
.ping-bad { color: var(--red); }

.dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 7px;
    vertical-align: middle;
}
.dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.off { background: var(--txt-faint); }

.star {
    background: none; border: none;
    font-size: 15px;
    color: var(--txt-faint);
    padding: 2px 4px;
    line-height: 1;
}
.star.on { color: var(--amber); text-shadow: 0 0 8px #e8a33d66; }
.star:hover { color: var(--amber-hi); }

.pill {
    display: inline-block;
    font-family: var(--mono);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--line);
    background: var(--bg2);
    color: var(--txt-dim);
}
.pill.admin { color: var(--amber-hi); border-color: var(--amber-dim); background: #241c0c; }
.pill.system { color: var(--blue); border-color: #2d5a7a; background: #0f1a24; }
.pill.user { color: var(--txt-dim); }

.empty-note {
    padding: 40px;
    text-align: center;
    color: var(--txt-faint);
    font-family: var(--mono);
    font-size: 13px;
}

/* ---------- context menu ---------- */
.ctx-menu {
    position: fixed;
    z-index: 3000;
    min-width: 220px;
    background: var(--bg2);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 40px #000c;
    padding: 5px;
    user-select: none;
    animation: ctxin .08s ease-out;
}
@keyframes ctxin { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }
.ctx-item {
    padding: 8px 14px;
    border-radius: 5px;
    font-size: 13px;
    color: var(--txt);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}
.ctx-item:hover { background: var(--bg4); }
.ctx-item .arr { color: var(--txt-faint); font-size: 11px; }
.ctx-item.disabled { color: var(--txt-faint); cursor: default; }
.ctx-item.disabled:hover { background: transparent; }
.ctx-sep { height: 1px; background: var(--line); margin: 5px 8px; }
.ctx-item.danger { color: var(--red); }
.ctx-item.danger:hover { background: #2a1414; }

.submenu {
    position: fixed;
    z-index: 3001;
    min-width: 190px;
    background: var(--bg2);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 40px #000c;
    padding: 5px;
}

/* ---------- floating window (console etc.) ---------- */
.fwin {
    position: fixed;
    z-index: 2000;
    background: var(--bg1);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 24px 80px #000d;
    display: flex;
    flex-direction: column;
    min-width: 420px;
    min-height: 260px;
    overflow: hidden;
}
.fwin-head {
    height: 38px;
    display: flex;
    align-items: center;
    padding: 0 8px 0 14px;
    background: var(--bg2);
    border-bottom: 1px solid var(--line);
    cursor: move;
    user-select: none;
    flex: none;
}
.fwin-title {
    font-family: var(--mono);
    font-size: 12.5px;
    letter-spacing: 1px;
    color: var(--txt-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fwin-title b { color: var(--amber); }
.fwin-btns { margin-left: auto; display: flex; gap: 4px; }
.fwin-btn {
    width: 28px; height: 26px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    color: var(--txt-dim);
    font-size: 13px;
    line-height: 1;
}
.fwin-btn:hover { background: var(--bg4); color: var(--txt); }
.fwin-btn.close:hover { color: var(--red); border-color: var(--red-dim); }
.fwin-body { flex: 1; overflow: hidden; position: relative; display: flex; }

/* console */
.console-out {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
    background: #070a08;
}
.console-out .cmd-echo { color: var(--amber); }
.console-out .cmd-err { color: var(--red); }
.console-in {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--line);
    background: var(--bg1);
    flex: none;
}
.console-in .ps { font-family: var(--mono); color: var(--green); font-size: 12.5px; white-space: nowrap; }
.console-in input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--txt);
    font-family: var(--mono);
    font-size: 12.5px;
}

/* resize handles */
.rz { position: absolute; z-index: 10; }
.rz-e { right: -3px; top: 8px; bottom: 8px; width: 7px; cursor: ew-resize; }
.rz-w { left: -3px; top: 8px; bottom: 8px; width: 7px; cursor: ew-resize; }
.rz-s { bottom: -3px; left: 8px; right: 8px; height: 7px; cursor: ns-resize; }
.rz-n { top: -3px; left: 8px; right: 8px; height: 7px; cursor: ns-resize; }
.rz-se { right: -3px; bottom: -3px; width: 14px; height: 14px; cursor: nwse-resize; }
.rz-sw { left: -3px; bottom: -3px; width: 14px; height: 14px; cursor: nesw-resize; }
.rz-ne { right: -3px; top: -3px; width: 14px; height: 14px; cursor: nesw-resize; }
.rz-nw { left: -3px; top: -3px; width: 14px; height: 14px; cursor: nwse-resize; }

/* ---------- modal ---------- */
.modal-back {
    position: fixed; inset: 0;
    background: #000a;
    z-index: 4000;
    display: flex; align-items: center; justify-content: center;
    animation: fadin .12s ease-out;
}
@keyframes fadin { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: var(--bg1);
    border: 1px solid var(--line);
    border-radius: 10px;
    min-width: 380px;
    max-width: 92vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px #000d;
}
.modal-head {
    padding: 16px 22px 12px;
    border-bottom: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--amber);
}
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot {
    padding: 14px 22px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ---------- builder ---------- */
.builder-wrap { max-width: 760px; margin: 0 auto; }
.bgrid { display: grid; grid-template-columns: 220px 1fr; gap: 14px 18px; align-items: center; margin-bottom: 8px; }
.bgrid .lbl {
    font-size: 12.5px;
    color: var(--txt-dim);
    text-align: right;
}
.bgrid .lbl b { color: var(--txt); font-weight: 600; }
.servers-box { display: flex; flex-direction: column; gap: 8px; }
.server-row { display: flex; gap: 8px; }
.server-row input { flex: 1; }
.server-row .btn { padding: 8px 12px; }
.check-row { display: flex; align-items: center; gap: 10px; }
.check-row input[type=checkbox] {
    appearance: none;
    width: 17px; height: 17px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--bg0);
    cursor: pointer;
    position: relative;
}
.check-row input[type=checkbox]:checked { background: var(--amber-dim); border-color: var(--amber); }
.check-row input[type=checkbox]:checked::after {
    content: "✓";
    position: absolute;
    inset: 0;
    color: #0a0d0b;
    font-size: 13px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.hint { font-size: 11.5px; color: var(--txt-faint); margin-top: 4px; line-height: 1.45; }

.build-actions { display: flex; gap: 12px; margin: 22px 0 8px; }

table.builds { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
table.builds th {
    text-align: left;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--txt-faint);
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
    background: var(--bg2);
}
table.builds td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); }
table.builds td.mono { color: var(--txt); }

/* ---------- server info ---------- */
.si-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.si-card {
    background: var(--bg2);
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 20px;
}
.si-card .k {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--txt-faint);
    margin-bottom: 8px;
}
.si-card .v {
    font-family: var(--mono);
    font-size: 26px;
    color: var(--amber-hi);
}

/* placeholder panels */
.ph-note {
    padding: 60px 20px;
    text-align: center;
    color: var(--txt-faint);
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: 1px;
}

/* toast */
#toast-zone {
    position: fixed;
    bottom: 22px; right: 22px;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    background: var(--bg2);
    border: 1px solid var(--line);
    border-left: 3px solid var(--amber);
    color: var(--txt);
    padding: 10px 16px;
    border-radius: 7px;
    font-size: 13px;
    box-shadow: 0 8px 30px #000a;
    animation: tstin .15s ease-out;
    max-width: 360px;
}
.toast.err { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }
@keyframes tstin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.sel-uid {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--txt-faint);
    padding: 3px 10px;
    border: 1px solid var(--line);
    border-radius: 20px;
}
