/* ══════════════════════════════════════════════════
   Panel — Design System 2.0
   ══════════════════════════════════════════════════ */

/* ── Variables ───────────────────────────────────── */
:root {
    --bg:        #07090f;
    --bg-2:      #0d1117;
    --bg-3:      #161b22;
    --surface:   #0d1117;
    --border:    #21262d;
    --border-2:  #30363d;
    --text:      #e6edf3;
    --text-2:    #b0bac7;
    --muted:     #6e7681;
    --primary:   #58a6ff;
    --primary-d: #1f6feb;
    --green:     #3fb950;
    --red:       #f85149;
    --amber:     #d29922;
    --purple:    #bc8cff;
    --radius:    10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --shadow:    0 4px 24px rgba(0,0,0,.5);
    --font:      -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
    --mono:      "JetBrains Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
    --sidebar-w: 220px;
    --transition: .15s ease;
}

/* ── Reset ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1 { font-size: 20px; font-weight: 700; letter-spacing: -.025em; }
h2 { font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: 13px; font-weight: 600; }
button { cursor: pointer; font-family: inherit; }
::selection { background: rgba(88,166,255,.25); }

.muted   { color: var(--muted); }
.small   { font-size: 12px; }
em.muted { font-style: normal; }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ══════════════════════════════════════════════════
   AUTH
   ══════════════════════════════════════════════════ */
body.auth {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 24px;
    background: radial-gradient(ellipse at top left, rgba(88,166,255,.06) 0%, transparent 60%), var(--bg);
}
.auth-wrap { width: 100%; max-width: 360px; }
.auth-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    box-shadow: var(--shadow);
}
.auth-card .brand { margin-bottom: 28px; }
.auth-card h1 { font-size: 18px; margin-bottom: 20px; }

/* ══════════════════════════════════════════════════
   BRAND
   ══════════════════════════════════════════════════ */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; letter-spacing: -.01em; }
.brand-dot {
    width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary-d), var(--primary));
    box-shadow: 0 0 16px rgba(88,166,255,.25);
    display: flex; align-items: center; justify-content: center;
}
.brand-dot::after {
    content: ''; width: 10px; height: 10px;
    background: rgba(255,255,255,.9); border-radius: 3px;
}
.brand-lg { font-size: 16px; }

/* ══════════════════════════════════════════════════
   APP SHELL
   ══════════════════════════════════════════════════ */
body.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    padding: 16px 10px;
    position: sticky; top: 0; height: 100vh;
    overflow-y: auto;
}
.sidebar .brand { padding: 8px 8px 20px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: var(--radius-sm);
    color: var(--muted); font-size: 13px; font-weight: 500;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}
.nav-item:hover { background: var(--bg-3); color: var(--text-2); }
.nav-item.is-active { background: rgba(88,166,255,.12); color: var(--primary); font-weight: 600; }
.nav-ic { width: 16px; height: 16px; flex-shrink: 0; opacity: .5; display: flex; align-items: center; }
.nav-ic svg { width: 16px; height: 16px; }
.nav-item.is-active .nav-ic { opacity: 1; }
.nav-item:hover .nav-ic { opacity: .8; }

.sidebar-foot {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 8px 4px; border-top: 1px solid var(--border); margin-top: 8px;
}
.user { display: flex; align-items: center; gap: 8px; overflow: hidden; min-width: 0; }
.user-av { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: var(--primary-d); color: #fff; font-weight: 700; font-size: 11px; }
.user-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout { padding: 5px 8px; border-radius: var(--radius-sm); color: var(--muted); font-size: 16px; line-height: 1; transition: background var(--transition), color var(--transition); flex-shrink: 0; }
.logout:hover { background: rgba(248,81,73,.12); color: var(--red); }
.settings-link { padding: 5px 7px; border-radius: var(--radius-sm); color: var(--muted); transition: background var(--transition), color var(--transition); flex-shrink: 0; display: flex; align-items: center; }
.settings-link:hover { background: rgba(88,166,255,.12); color: var(--primary); }
.settings-link.is-active { color: var(--primary); background: rgba(88,166,255,.1); }

.content { padding: 24px 28px; overflow-x: hidden; }

/* ══════════════════════════════════════════════════
   PAGE HEADER
   ══════════════════════════════════════════════════ */
.page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 20px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-head p.muted { font-size: 13px; margin-top: 3px; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.summary { display: flex; gap: 6px; flex-wrap: wrap; }

/* ══════════════════════════════════════════════════
   CHIPS / BADGES
   ══════════════════════════════════════════════════ */
.chip { display: inline-flex; align-items: center; background: var(--bg-3); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.chip b { color: var(--text); margin-right: 2px; }
.chip-on   { background: rgba(63,185,80,.12); border-color: rgba(63,185,80,.35); color: #7ee787; }
.chip-on b { color: var(--green); }
.chip-off b { color: var(--red); }
.chip-warn b { color: var(--amber); }
.chip-dead { background: rgba(248,81,73,.12); border-color: rgba(248,81,73,.35); color: #ff7b72; }
.chip-disk { gap: 4px; }
.chip-disk.is-ok { border-color: rgba(63,185,80,.35); }
.chip-disk.is-warn { border-color: rgba(210,153,34,.45); color: var(--amber); }
.chip-disk.is-warn b { color: var(--amber); }
.chip-disk.is-critical { background: rgba(248,81,73,.12); border-color: rgba(248,81,73,.4); color: #ff7b72; }
.chip-disk.is-critical b { color: #ff7b72; }

.panel-disk-card { margin-bottom: 14px; padding: 14px 16px; }
.panel-disk-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.panel-disk-head h2 { margin: 0; font-size: 15px; }
.panel-disk-bar {
    height: 10px;
    border-radius: 999px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 10px;
}
.panel-disk-fill {
    display: block;
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, #3fb950, #58a6ff);
    transition: width .4s ease, background .3s ease;
}
.panel-disk-fill.is-warn { background: linear-gradient(90deg, #d29922, #e3b341); }
.panel-disk-fill.is-critical { background: linear-gradient(90deg, #f85149, #ff7b72); }
.panel-disk-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    font-size: 12px;
    color: var(--muted);
}
.panel-disk-meta b { color: var(--text); font-weight: 600; }
.panel-disk-card.is-warn #panel-disk-chip { border-color: rgba(210,153,34,.45); color: var(--amber); }
.panel-disk-card.is-critical #panel-disk-chip {
    background: rgba(248,81,73,.12);
    border-color: rgba(248,81,73,.4);
    color: #ff7b72;
}

.btn-warning { background: rgba(210,153,34,.15); border-color: rgba(210,153,34,.4); color: var(--amber); }
.btn-warning:hover { background: rgba(210,153,34,.28); border-color: var(--amber); color: #fff; }

.badge { display: inline-flex; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; background: var(--bg-3); color: var(--muted); }
.badge-pending, .badge-running, .badge-sent { background: rgba(88,166,255,.15); color: #79c0ff; }
.badge-done    { background: rgba(63,185,80,.15); color: #7ee787; }
.badge-failed  { background: rgba(248,81,73,.15); color: #ff7b72; }
.badge-partial { background: rgba(210,153,34,.15); color: #e3b341; }

/* ══════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════ */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    background: var(--bg-3); color: var(--text-2);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 7px 14px; font: inherit; font-size: 13px; font-weight: 500;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
    white-space: nowrap;
}
.btn:hover { background: var(--border); border-color: var(--border-2); color: var(--text); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary-d); border-color: var(--primary-d); color: #fff; }
.btn-primary:hover { background: #388bfd; border-color: #388bfd; color: #fff; }
.btn-danger { background: transparent; border-color: rgba(248,81,73,.4); color: var(--red); }
.btn-danger:hover { background: rgba(248,81,73,.1); border-color: var(--red); }
.btn-block { width: 100%; justify-content: center; margin-top: 6px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.chip-filter-btn { cursor: pointer; }
.chip-filter-btn.active { background: var(--primary-d); border-color: var(--primary-d); color: #fff; }

/* ══════════════════════════════════════════════════
   TOOLBAR
   ══════════════════════════════════════════════════ */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .input { max-width: 320px; }
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-left: auto; }
.seg button { background: none; border: none; color: var(--muted); padding: 7px 14px; font: inherit; font-size: 13px; transition: background var(--transition), color var(--transition); }
.seg button:hover { background: var(--bg-3); color: var(--text-2); }
.seg button.is-active { background: var(--primary-d); color: #fff; }

/* ══════════════════════════════════════════════════
   INPUTS / FORMS
   ══════════════════════════════════════════════════ */
.input,
input[type=text], input[type=password], input[type=number],
input[type=search], input[type=email], textarea, select {
    width: 100%;
    background: var(--bg-2); border: 1px solid var(--border);
    color: var(--text); border-radius: var(--radius-sm);
    padding: 8px 12px; font-family: inherit; font-size: 13px; line-height: 1.5;
    outline: none; transition: border-color var(--transition), box-shadow var(--transition);
    appearance: none;
}
.input::placeholder, input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }
.input:focus, input:focus, textarea:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(88,166,255,.15);
}
form label { display: block; margin-bottom: 14px; }
form label > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
textarea { font-family: var(--mono); font-size: 12.5px; resize: vertical; min-height: 180px; line-height: 1.55; }

/* ══════════════════════════════════════════════════
   CARD
   ══════════════════════════════════════════════════ */
.card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { font-size: 13px; }

/* ══════════════════════════════════════════════════
   GRIDS
   ══════════════════════════════════════════════════ */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ══════════════════════════════════════════════════
   VPS CARD
   ══════════════════════════════════════════════════ */
.vps-card {
    background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px; display: flex; flex-direction: column; gap: 11px;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
    cursor: pointer;
}
.vps-card:hover { border-color: rgba(88,166,255,.4); box-shadow: 0 4px 20px rgba(0,0,0,.4); transform: translateY(-1px); }
.vps-card-head { display: flex; align-items: center; gap: 10px; }
.vps-name { font-weight: 600; font-size: 14px; }
.vps-badge { margin-left: auto; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; background: var(--bg-3); color: var(--muted); }
.vps-badge.online    { background: rgba(63,185,80,.15); color: #7ee787; }
.vps-badge.offline   { background: rgba(248,81,73,.12); color: #ff7b72; }
.vps-badge.installing, .vps-badge.maintenance { background: rgba(210,153,34,.15); color: #e3b341; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.status-dot.online    { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.offline   { background: var(--red); }
.status-dot.installing, .status-dot.maintenance { background: var(--amber); box-shadow: 0 0 6px var(--amber); }

.vps-host { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.metrics { display: flex; flex-direction: column; gap: 7px; }
.metric { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 8px; }
.metric-label { font-size: 11px; color: var(--muted); }
.bar { height: 4px; background: var(--bg-3); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 999px; transition: width .4s ease; }
.bar-fill.warn { background: var(--amber); }
.bar-fill.crit { background: var(--red); }
.metric-val { font-size: 11px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.vps-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.vps-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tag { font-size: 10px; background: var(--bg-3); color: var(--muted); padding: 2px 7px; border-radius: 999px; }
.vps-uptime { font-size: 11px; color: var(--muted); }

/* ══════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════ */
.empty { grid-column: 1 / -1; text-align: center; padding: 60px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.empty p { font-size: 13px; }

/* ══════════════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════════════ */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 12px; font-size: 13px; border-width: 1px; border-style: solid; }
.alert-error { background: rgba(248,81,73,.08); border-color: rgba(248,81,73,.3); color: #ff7b72; }
.alert-ok    { background: rgba(63,185,80,.08); border-color: rgba(63,185,80,.3); color: #7ee787; }
.alert-strip { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; margin-bottom: 18px; background: rgba(248,81,73,.07); border: 1px solid rgba(248,81,73,.3); border-radius: var(--radius); }
.alert-strip-left { display: flex; align-items: center; gap: 12px; }
.alert-icon { font-size: 20px; color: var(--red); }
.alert-strip .muted.small u { color: inherit; }

/* ══════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════ */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.72); display: grid; place-items: center; z-index: 50; padding: 20px; backdrop-filter: blur(3px); }
.modal[hidden] { display: none; }
.modal-box { background: var(--bg-2); border: 1px solid var(--border-2); border-radius: var(--radius-lg); width: 100%; max-width: 480px; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.7); animation: popIn .15s cubic-bezier(.34,1.56,.64,1); }
.modal-lg { max-width: 900px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h2 { font-size: 16px; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 20px; line-height: 1; transition: color var(--transition); padding: 4px; }
.modal-close:hover { color: var(--text); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

@keyframes popIn  { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(16px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ══════════════════════════════════════════════════
   CODE / PRE
   ══════════════════════════════════════════════════ */
.code { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-all; color: #79c0ff; line-height: 1.6; }
.code.out { max-height: 240px; overflow: auto; color: #cdd9e5; }
.code.err { max-height: 160px; overflow: auto; color: #ff7b72; border-color: rgba(248,81,73,.35); }
.code-block { position: relative; margin: 8px 0 12px; }
.code-block .copy-btn { position: absolute; top: 8px; right: 8px; }

/* ══════════════════════════════════════════════════
   TOASTS
   ══════════════════════════════════════════════════ */
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--bg-3); border: 1px solid var(--border-2); border-left: 3px solid var(--primary); border-radius: var(--radius-sm); padding: 10px 16px; box-shadow: var(--shadow); font-size: 13px; animation: slideIn .2s ease; max-width: 320px; min-width: 220px; }
.toast.ok  { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }

/* ══════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════ */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 8px 12px; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); }
td { padding: 9px 12px; border-bottom: 1px solid rgba(33,38,45,.8); font-size: 13px; }
tbody tr:hover td { background: rgba(255,255,255,.02); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.mono { font-family: var(--mono); font-size: 12px; }

/* ══════════════════════════════════════════════════
   STAT TILES (VPS detail)
   ══════════════════════════════════════════════════ */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 5px; min-width: 0; transition: border-color var(--transition); }
.tile:hover { border-color: rgba(88,166,255,.3); }
.tile-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tile-val { font-size: 22px; font-weight: 700; letter-spacing: -.03em; }
.tile-sub { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.back-link { display: inline-block; color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.back-link:hover { color: var(--text); }
.detail-title { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; }
.detail-title .status-dot { width: 10px; height: 10px; }
.detail-title .vps-badge { margin-left: 4px; font-size: 11px; }

.chart-card { min-height: 200px; }
.chart-wrap { position: relative; height: 240px; width: 100%; }
.chart-wrap canvas { position: absolute !important; top: 0; left: 0; width: 100% !important; height: 100% !important; }
.info-card { grid-column: 1 / -1; }
.info-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 20px; margin: 0; list-style: none; }
.info-list dt { color: var(--muted); font-size: 11px; margin-top: 10px; text-transform: uppercase; letter-spacing: .03em; }
.info-list dd { margin: 0; font-family: var(--mono); font-size: 12px; word-break: break-all; color: var(--text-2); }
.console-card .card-head { margin-bottom: 8px; }
.console-log { max-height: 240px; min-height: 120px; overflow: auto; white-space: pre-wrap; word-break: break-word; background: var(--bg); border: 1px solid rgba(88,166,255,.2); color: #cdd9e5; font-size: 12px; line-height: 1.6; border-radius: var(--radius-sm); padding: 10px; }

/* ══════════════════════════════════════════════════
   COMMANDS PAGE
   ══════════════════════════════════════════════════ */
.cmd-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; }
.cmd-compose { display: flex; flex-direction: column; gap: 12px; min-height: 440px; }
.cmd-side { display: flex; flex-direction: column; gap: 14px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: -4px -4px 4px; padding: 0 4px; }
.tabs button { background: none; border: none; color: var(--muted); padding: 9px 14px; font: inherit; font-size: 13px; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color var(--transition); }
.tabs button:hover { color: var(--text-2); }
.tabs button.is-active { color: var(--text); border-bottom-color: var(--primary); }
.tab-pane { display: flex; flex-direction: column; gap: 6px; }
.compose-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }

.install-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 8px 0 12px; }
.install-tab { background: transparent; border: none; color: var(--muted); padding: 7px 14px; cursor: pointer; border-bottom: 2px solid transparent; font-size: 13px; transition: color var(--transition); }
.install-tab:hover { color: var(--text-2); }
.install-tab.is-active { color: var(--text); border-bottom-color: var(--primary); }
.install-panel { animation: fadeIn .15s ease; }

.target-actions { display: flex; gap: 6px; }
.target-list { max-height: 300px; overflow-y: auto; margin-top: 8px; display: flex; flex-direction: column; gap: 1px; }
.target-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--radius-sm); cursor: pointer; transition: background var(--transition); }
.target-row:hover { background: var(--bg-3); }
.target-row.is-offline { opacity: .5; }
.target-cb { margin: 0; }
.target-name { font-size: 13px; font-weight: 500; }
.target-host { font-size: 11px; margin-left: auto; font-family: var(--mono); color: var(--muted); }
.small { font-size: 12px; }

.batches { display: flex; flex-direction: column; gap: 6px; max-height: 380px; overflow-y: auto; }
.batch-item { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--bg-2); transition: border-color var(--transition); }
.batch-item:hover { border-color: rgba(88,166,255,.35); }
.batch-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; gap: 8px; }
.batch-label { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-type { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--bg-3); padding: 2px 7px; border-radius: 999px; }
.batch-meta { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.batch-bar { height: 3px; background: var(--bg-3); border-radius: 999px; overflow: hidden; }
.batch-bar-fill { display: block; height: 100%; width: 0; background: var(--green); border-radius: 999px; transition: width .3s ease; }
.batch-bar-fill.running { background: var(--primary); }
.batch-bar-fill.has-fail { background: var(--red); }

.batch-summary { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.batch-list { max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.batch-cmd { border: 1px solid var(--border); border-left: 3px solid var(--muted); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--bg-2); }
.batch-cmd.status-done { border-left-color: var(--green); }
.batch-cmd.status-failed, .batch-cmd.status-timeout { border-left-color: var(--red); }
.batch-cmd.status-running, .batch-cmd.status-sent, .batch-cmd.status-pending { border-left-color: var(--primary); }
.batch-cmd-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }

.status-pill { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; background: var(--bg-3); color: var(--muted); }
.status-pill.s-done   { background: rgba(63,185,80,.15); color: #7ee787; }
.status-pill.s-failed, .status-pill.s-timeout { background: rgba(248,81,73,.15); color: #ff7b72; }
.status-pill.s-running, .status-pill.s-sent, .status-pill.s-pending { background: rgba(88,166,255,.15); color: #79c0ff; }

/* ══════════════════════════════════════════════════
   FILES / SCRIPTS
   ══════════════════════════════════════════════════ */
#upload-progress { margin: -8px 0 18px; }
.upload-bar { height: 4px; background: var(--bg-3); border-radius: 999px; overflow: hidden; margin-bottom: 6px; }
#upload-bar-fill { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 999px; transition: width .2s ease; }

/* ══════════════════════════════════════════════════
   JOBS
   ══════════════════════════════════════════════════ */
.target-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--radius-sm); cursor: pointer; }
.target-item:hover { background: var(--bg-3); }
.target-item input { margin: 0; }
.target-item span:last-child { font-size: 11px; margin-left: auto; font-family: var(--mono); color: var(--muted); }
.progress { height: 4px; background: var(--bg-3); border-radius: 999px; overflow: hidden; margin-bottom: 4px; }
.progress i { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 999px; transition: width .3s ease; }
#detail-body h3 { margin: 14px 0 8px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ══════════════════════════════════════════════════
   TERMINAL
   ══════════════════════════════════════════════════ */
.xterm-host { height: calc(100vh - 260px); min-height: 360px; padding: 8px; background: var(--bg); border-radius: var(--radius-sm); }
.xterm-host .xterm { height: 100%; }
.xterm-host .xterm-viewport { background-color: transparent !important; }
#term-status.chip-on  { background: rgba(63,185,80,.15); color: #7ee787; border-color: rgba(63,185,80,.3); }
#term-status.chip-off { background: rgba(248,81,73,.12); color: #ff7b72; border-color: rgba(248,81,73,.3); }

/* ══════════════════════════════════════════════════
   IP RANGES
   ══════════════════════════════════════════════════ */
#ip-ranges-page textarea { min-height: 280px; }
#ip-ranges-page .table-wrap { overflow-x: auto; }
#ip-ranges-errors { max-height: 200px; overflow: auto; margin-top: 10px; }

/* ══════════════════════════════════════════════════
   PATHS PAGE
   ══════════════════════════════════════════════════ */
.path-list, .range-list { max-height: 340px; overflow: auto; display: flex; flex-direction: column; gap: 1px; margin-top: 8px; }
.path-item { align-items: center; }
.path-item .mono { font-family: var(--mono); font-size: 12px; }
.path-item .muted.small { margin-left: auto; }
#paths-import-errors { max-height: 200px; overflow: auto; margin-top: 10px; }
#paths-page .table-wrap { overflow-x: auto; }
#paths-results-body .mono { font-family: var(--mono); }

.paths-live { max-height: 340px; overflow-y: auto; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; font-family: var(--mono); font-size: 12px; line-height: 1.6; }
.paths-live .live-line { color: var(--text-2); white-space: pre-wrap; word-break: break-all; }
.paths-live .live-line.check { color: var(--muted); }
.paths-live .live-line.found { color: var(--green); font-weight: 600; }
.paths-live .live-line.prog  { color: var(--primary); font-weight: 600; }
.paths-live .live-line.start { color: var(--amber); font-weight: 600; }
.paths-live .live-line.err   { color: var(--red); }
.paths-live .live-host { display: inline-block; background: var(--bg-3); color: var(--muted); border-radius: 4px; padding: 1px 6px; margin-right: 6px; font-size: 11px; }

#paths-live-status.chip.running { background: var(--primary-d); color: #fff; border-color: var(--primary-d); }
#paths-live-status.chip.done    { background: rgba(63,185,80,.2); color: #7ee787; border-color: rgba(63,185,80,.4); }
#paths-live-status.chip.idle    { background: var(--bg-3); color: var(--muted); }

.paths-live-meta { display: flex; gap: 14px; margin-bottom: 6px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.paths-live-meta b { color: var(--text-2); }

.paths-live .cmd-section { margin-bottom: 8px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.paths-live .cmd-section:last-child { border-bottom: 0; margin-bottom: 0; }
.paths-live .cmd-log { padding-left: 4px; max-height: 240px; overflow-y: auto; }
.paths-live .cmd-log .live-line { padding-left: 6px; border-left: 2px solid transparent; }
.paths-live .cmd-log .live-line.found { border-left-color: var(--green); }
.paths-live .cmd-log .live-line.err   { border-left-color: var(--red); }

.paths-live .cmd-stats { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 4px 0 6px; padding: 6px 10px; background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px; color: var(--muted); }
.paths-live .cmd-stats .stat { display: inline-flex; align-items: baseline; gap: 4px; }
.paths-live .cmd-stats .stat b { color: var(--text-2); font-weight: 600; }
.paths-live .cmd-stats .stat .v { color: var(--primary); font-weight: 700; font-size: 14px; }
.paths-live .cmd-stats .stat.found .v { color: var(--green); }
.paths-live .cmd-stats .stat.pct .v   { color: var(--amber); }

.paths-live .cmd-disc { margin: 6px 0 4px; padding: 6px 10px; max-height: 160px; overflow-y: auto; background: var(--bg); border: 1px dashed rgba(63,185,80,.35); border-radius: var(--radius-sm); font-size: 11px; }
.paths-live .cmd-disc .disc-title { color: var(--green); font-weight: 700; margin-bottom: 4px; }
.paths-live .cmd-disc .disc-row { color: var(--text-2); padding: 1px 4px; border-left: 2px solid var(--green); margin: 2px 0; }
.paths-live .cmd-disc .disc-row .code { color: var(--red); font-weight: 700; margin-left: 6px; }
.paths-live .cmd-disc .disc-row.matched-1 .code { color: var(--green); }
.paths-live .cmd-disc .empty { color: var(--muted); font-style: italic; }

.vuln-list { display: flex; flex-direction: column; gap: 5px; max-height: 320px; overflow-y: auto; padding: 6px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.vuln-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 7px 10px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); transition: border-color var(--transition); }
.vuln-row:hover { border-color: rgba(88,166,255,.3); }
.vuln-row code.vuln-path { font-family: var(--mono); color: var(--primary); font-size: 13px; flex: 1; min-width: 180px; word-break: break-all; }

.pager-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 10px 4px 4px; margin-top: 4px; border-top: 1px solid var(--border); font-size: 13px; }
.pager-bar .pager-btn { min-width: 32px; padding: 4px 10px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text-2); border-radius: var(--radius-sm); font-size: 12px; cursor: pointer; transition: border-color var(--transition), color var(--transition); }
.pager-bar .pager-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager-bar .pager-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ══════════════════════════════════════════════════
   SCAN QUEUE
   ══════════════════════════════════════════════════ */
.queue-list { display: flex; flex-direction: column; gap: 8px; }
.queue-item {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: flex; flex-direction: column; gap: 6px;
    transition: border-color var(--transition);
}
.queue-item-running {
    border-color: rgba(88,166,255,.4);
    background: rgba(88,166,255,.05);
}
.queue-item-head {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.queue-item-label { font-size: 13px; font-weight: 600; flex: 1; }
.queue-item-meta { font-size: 11px; }
.queue-item-actions {
    display: flex; gap: 6px; flex-wrap: wrap;
    padding-top: 4px; border-top: 1px solid var(--border); margin-top: 4px;
}

/* ══════════════════════════════════════════════════
   SCAN STATS BAR (dashboard live)
   ══════════════════════════════════════════════════ */
.scan-stats-bar {
    display: flex; align-items: center; flex-wrap: wrap; gap: 0;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 6px;
    margin-bottom: 18px;
    overflow: hidden;
    animation: fadeIn .3s ease;
}
.scan-stat {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px;
    white-space: nowrap;
}
.scan-stat-sep {
    width: 1px; height: 32px;
    background: var(--border); flex-shrink: 0;
    margin: 0 4px;
}
.scan-stat-ic {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.scan-stat-running { background: var(--primary); box-shadow: 0 0 6px var(--primary); animation: pulse 1.5s infinite; }
.scan-stat-blue    { background: var(--primary); }
.scan-stat-purple  { background: var(--purple); }
.scan-stat-green   { background: var(--green); box-shadow: 0 0 6px var(--green); }
.scan-stat-amber   { background: var(--amber); }

.scan-stat-val { font-size: 16px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--text); }
.scan-stat-lbl { font-size: 11px; color: var(--muted); font-weight: 500; }

.scan-stat-progress { gap: 10px; flex: 1; min-width: 200px; }
.sstat-prog-bar { flex: 1; height: 5px; background: var(--bg-3); border-radius: 999px; overflow: hidden; min-width: 80px; }
.sstat-prog-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--primary-d), var(--primary)); border-radius: 999px; transition: width .6s ease; }

/* Cracker bar variant */
.cracker-bar {
    border-color: #30363d;
    background: linear-gradient(90deg, rgba(56,58,89,.25), var(--bg-2));
}
.cracker-bar .scan-stat-running {
    background: #a371f7; box-shadow: 0 0 6px #a371f7;
}

/* HIT section on dashboard */
.hit-card { margin-bottom: 16px; }
.hit-toolbar {
   margin-top: -6px;
   margin-bottom: 10px;
}
.hit-toolbar .seg { margin-left: 0; }
.hit-toolbar .input {
   max-width: 320px;
}
.chip-git,
.chip-env,
.chip-wp2s { cursor: pointer; }
.chip-git {
    background: rgba(88,166,255,.12);
    border-color: rgba(88,166,255,.35);
    color: #79c0ff;
}
.chip-git b { color: #79c0ff; }
.chip-env {
    background: rgba(63,185,80,.12);
    border-color: rgba(63,185,80,.35);
    color: #7ee787;
}
.chip-env b { color: #7ee787; }
.chip-wp2s {
    background: rgba(163,113,247,.12);
    border-color: rgba(163,113,247,.4);
    color: #d2a8ff;
}
.chip-wp2s b { color: #d2a8ff; }
.hit-table-wrap {
   max-height: 420px;
   overflow: auto;
   border: 1px solid var(--border);
   border-radius: var(--radius-sm);
}
.hit-url {
   font-family: var(--mono);
   font-size: 12px;
   word-break: break-all;
   color: var(--text-2);
}
.hit-source {
   font-size: 12px;
   color: var(--muted);
}
.hit-batches {
   font-family: var(--mono);
   font-size: 12px;
   color: var(--text-2);
}
.code-badge {
   display: inline-flex;
   align-items: center;
   justify-content: center;
   min-width: 44px;
   padding: 2px 8px;
   border-radius: 999px;
   font-size: 11px;
   font-weight: 700;
   letter-spacing: .03em;
   background: rgba(88,166,255,.16);
   color: #79c0ff;
   border: 1px solid rgba(88,166,255,.35);
}
.code-badge.s2xx {
   background: rgba(63,185,80,.14);
   color: #7ee787;
   border-color: rgba(63,185,80,.35);
}
.code-badge.s3xx {
   background: rgba(210,153,34,.16);
   color: #e3b341;
   border-color: rgba(210,153,34,.35);
}
.code-badge.s4xx,
.code-badge.s5xx {
   background: rgba(248,81,73,.16);
   color: #ff7b72;
   border-color: rgba(248,81,73,.35);
}

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* ══════════════════════════════════════════════════
   CHECKER (SMTP live)
   ══════════════════════════════════════════════════ */
.btn-success {
    background: rgba(63,185,80,.15);
    border-color: rgba(63,185,80,.45);
    color: #7ee787;
}
.btn-success:hover {
    background: rgba(63,185,80,.25);
    border-color: var(--green);
    color: #fff;
}
.btn-success:disabled,
.btn-danger:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.checker-page { display: flex; flex-direction: column; gap: 16px; }
.checker-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.checker-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.checker-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-3);
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-2);
}
.dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--muted);
    flex-shrink: 0;
}
.dot.on {
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: pulse 1.4s infinite;
}
.dot.watch {
    background: var(--amber);
    box-shadow: 0 0 8px var(--amber);
    animation: pulse 2s infinite;
}
.dot.off { background: var(--muted); }

.checker-stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}
.checker-stats .stat-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    text-align: center;
}
.checker-stats .stat-num {
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
    color: var(--text);
}
.checker-stats .stat-label {
    margin-top: 4px;
    font-size: 11px;
    color: var(--muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.checker-stats .stat-valid .stat-num { color: #7ee787; }
.checker-stats .stat-rate .stat-num { color: var(--primary); }

.checker-console {
    background: #05070c;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 320px;
    max-height: 52vh;
    overflow: auto;
    padding: 12px 14px;
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.55;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.02);
}
.console-placeholder {
    color: var(--muted);
    font-style: italic;
    padding: 8px 0;
}
.console-line {
    white-space: pre-wrap;
    word-break: break-all;
    color: #9da7b5;
    border-left: 2px solid transparent;
    padding-left: 8px;
    margin-left: -2px;
}
.console-line.line-ok   { color: #7ee787; border-left-color: var(--green); }
.console-line.line-err  { color: #ff7b72; border-left-color: var(--red); }
.console-line.line-info { color: #79c0ff; border-left-color: var(--primary); }
.console-line.line-watch{ color: #e3b341; border-left-color: var(--amber); }
.console-line.line-auth { color: #e3b341; border-left-color: var(--amber); }
.console-line.line-conn { color: #bc8cff; border-left-color: var(--purple); }
.console-line.line-warn { color: #e3b341; border-left-color: var(--amber); }
.console-line.line-skip { color: #6e7681; border-left-color: #3d444d; }
.console-line.line-tg   { color: #58a6ff; border-left-color: #1f6feb; }

@keyframes stat-flash {
    0%   { color: #fff; transform: scale(1.15); }
    100% { color: inherit; transform: scale(1); }
}
.stat-flash {
    animation: stat-flash .4s ease-out;
}

.checker-valid-table h3 {
    font-size: 15px;
    margin-bottom: 10px;
}
.checker-valid-table .table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: auto;
    max-height: 280px;
}
.checker-valid-table .table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.checker-valid-table th,
.checker-valid-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.checker-valid-table th {
    background: var(--bg-3);
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    position: sticky;
    top: 0;
}
.checker-valid-table code {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-2);
}

@media (max-width: 900px) {
    .checker-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
    .checker-stats { grid-template-columns: repeat(2, 1fr); }
    .checker-console { max-height: 40vh; }
}

/* ══════════════════════════════════════════════════
   ALIBABA CLOUD
   ══════════════════════════════════════════════════ */
code.ali-key { color: #f59e0b; font-size: .85em; word-break: break-all; }
code.ali-secret { color: #34d399; font-size: .85em; word-break: break-all; }
.perm-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: .75em;
    font-weight: 600;
    background: rgba(99,102,241,.18);
    color: #818cf8;
    margin: 1px 2px;
}
.perm-badge.perm-create {
    background: rgba(34,197,94,.2);
    color: #4ade80;
    border: 1px solid rgba(74,222,128,.35);
}
.ali-create-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.ali-count-input {
    width: 56px;
    padding: 4px 6px;
    border: 1px solid var(--border-2);
    border-radius: 6px;
    background: var(--bg-1);
    color: var(--text);
    font-size: .85em;
}

/* ══════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════ */
@media (max-width: 900px) {
    :root { --sidebar-w: 200px; }
    .content { padding: 18px 20px; }
}
@media (max-width: 700px) {
    body.app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .sidebar { position: sticky; top: 0; z-index: 40; height: auto; flex-direction: row; align-items: center; padding: 10px 14px; gap: 10px; border-right: none; border-bottom: 1px solid var(--border); }
    .sidebar .brand { padding: 0; }
    .nav { flex-direction: row; flex: 0; gap: 2px; }
    .nav-item span:last-child { display: none; }
    .sidebar-foot { border: none; padding: 0; margin-left: auto; }
    .content { padding: 16px; }
    .detail-grid, .grid-2 { grid-template-columns: 1fr; }
    .cmd-layout { grid-template-columns: 1fr; }
    .stat-tiles { grid-template-columns: repeat(2, 1fr); }
    .info-card { grid-column: 1; }
}
