/* ============================================================
   电脑宝管家 · 后台样式（单文件，无外部依赖）
   ============================================================ */

:root {
    --bg: #0f1218;
    --bg-soft: #161b24;
    --bg-card: #1b212c;
    --bg-hover: #232b38;
    --line: #2a3342;
    --text: #e6ebf2;
    --text-dim: #9aa7b8;
    --text-mute: #6b7787;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --ok: #22c55e;
    --warn: #f59e0b;
    --danger: #ef4444;
    --info: #38bdf8;
    --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: .92em; background: rgba(255,255,255,.06); padding: 1px 5px; border-radius: 4px; }
pre { margin: 0; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 208px;
    flex: 0 0 208px;
    background: var(--bg-soft);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 18px 18px 14px; font-weight: 600; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 10px var(--primary); }
.brand-name { font-size: 15px; letter-spacing: .5px; }

.nav { display: flex; flex-direction: column; padding: 6px 10px; gap: 2px; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 8px;
    color: var(--text-dim); font-size: 13.5px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav-item.active { background: rgba(59,130,246,.16); color: #cfe0ff; }
.nav-icon { width: 16px; text-align: center; opacity: .85; }
.sidebar-foot { padding: 12px 18px; color: var(--text-mute); font-size: 12px; border-top: 1px solid var(--line); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 22px; border-bottom: 1px solid var(--line);
    background: rgba(15,18,24,.9); backdrop-filter: blur(6px);
    position: sticky; top: 0; z-index: 20;
}
.page-title { margin: 0; font-size: 17px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.who { color: var(--text-dim); font-size: 13px; }
.content { padding: 20px 22px 40px; flex: 1; }
.foot { padding: 14px 22px; color: var(--text-mute); font-size: 12px; border-top: 1px solid var(--line); }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-block; cursor: pointer; user-select: none;
    padding: 8px 14px; border-radius: 8px; font-size: 13.5px;
    border: 1px solid transparent; background: var(--bg-hover); color: var(--text);
    line-height: 1.2; text-align: center;
}
.btn:hover { text-decoration: none; filter: brightness(1.12); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-warn { background: rgba(245,158,11,.15); border-color: rgba(245,158,11,.5); color: #ffd08a; }
.btn-danger { background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.5); color: #ffb4b4; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); border-color: #3a465a; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 6px; }
.btn-block { display: block; width: 100%; padding: 11px; font-size: 15px; }
.inline { display: inline-block; margin: 0; }

/* ---------- 提示条 ---------- */
.flash { margin: 14px 22px 0; padding: 11px 14px; border-radius: 8px; border: 1px solid; font-size: 13.5px; }
.flash-success { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.45); color: #b6f2cd; }
.flash-warn { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.45); color: #ffddab; }
.flash-danger { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.45); color: #ffc2c2; }

.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13.5px; }
.alert-danger { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.45); color: #ffc2c2; }

.hint {
    margin-top: 20px; padding: 14px 16px; border-radius: var(--radius);
    background: var(--bg-soft); border: 1px dashed var(--line);
    color: var(--text-dim); font-size: 13px;
}

/* ---------- 卡片 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 12px; margin-bottom: 18px; }
.card { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card-num { font-size: 26px; font-weight: 700; letter-spacing: .5px; }
.card-label { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }
.card-ok .card-num { color: var(--ok); }
.card-warn .card-num { color: var(--warn); }
.card-danger .card-num { color: var(--danger); }

/* ---------- 面板 ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }
.panel { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.panel-title {
    font-size: 14px; font-weight: 600; margin: 0 0 12px;
    display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.panel-title:not(:first-child) { margin-top: 22px; }
.panel-extra { font-size: 12.5px; font-weight: 400; color: var(--text-mute); }
.sub-title { font-size: 13px; color: var(--text-dim); margin: 16px 0 8px; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table thead th { color: var(--text-dim); font-weight: 500; font-size: 12.5px; white-space: nowrap; }
.table tbody tr:hover { background: rgba(255,255,255,.025); }
.table-sm th, .table-sm td { padding: 6px 8px; font-size: 12.5px; }
.table-kv th { width: 132px; color: var(--text-dim); font-weight: 500; }
.ta-r { text-align: right; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }

/* ---------- 标签 ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; border: 1px solid transparent; }
.badge-ok { background: rgba(34,197,94,.14); color: #a6efc2; border-color: rgba(34,197,94,.35); }
.badge-warn { background: rgba(245,158,11,.14); color: #ffd79a; border-color: rgba(245,158,11,.35); }
.badge-danger { background: rgba(239,68,68,.14); color: #ffb1b1; border-color: rgba(239,68,68,.35); }
.badge-info { background: rgba(56,189,248,.14); color: #a8e5ff; border-color: rgba(56,189,248,.35); }
.badge-muted { background: rgba(255,255,255,.06); color: var(--text-dim); border-color: var(--line); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 6px; }
.chip { padding: 4px 10px; border-radius: 999px; font-size: 12.5px; border: 1px solid var(--line); color: var(--text-dim); background: var(--bg-soft); }
.chip:hover { text-decoration: none; border-color: #3a465a; color: var(--text); }
.chip b { color: var(--text); margin-left: 3px; }
.chip-ok { border-color: rgba(34,197,94,.4); }
.chip-warn { border-color: rgba(245,158,11,.4); }
.chip-danger { border-color: rgba(239,68,68,.4); }
.chip-muted { }

.bar-row { display: flex; align-items: center; gap: 9px; margin-bottom: 5px; font-size: 12.5px; }
.bar-key { width: 88px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { flex: 1; height: 7px; background: var(--bg-hover); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #60a5fa); }
.bar-val { width: 42px; text-align: right; color: var(--text-dim); }

/* ---------- 表单 ---------- */
.filters {
    display: flex; flex-wrap: wrap; gap: 9px; align-items: center;
    background: var(--bg-card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 11px 13px; margin-bottom: 16px;
}
input[type=text], input[type=password], input[type=number], input[type=file], select, textarea {
    background: var(--bg); color: var(--text); border: 1px solid var(--line);
    border-radius: 8px; padding: 7px 10px; font-size: 13.5px; font-family: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; width: 100%; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.w-70 { width: 70px; }

.field { display: block; margin-bottom: 13px; }
.field > span { display: block; color: var(--text-dim); font-size: 12.5px; margin-bottom: 5px; }
.field input[type=text], .field input[type=password], .field input[type=number], .field select, .field textarea { width: 100%; }
.form-row { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 12px; flex-wrap: wrap; }
.form-row.tight { margin-bottom: 4px; }
.grow { flex: 1; min-width: 140px; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 13px; margin-bottom: 10px; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.op-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

/* ---------- 代码块 ---------- */
.code-block {
    background: #0b0e13; border: 1px solid var(--line); border-radius: 8px;
    padding: 10px 12px; overflow: auto; font-family: ui-monospace, Consolas, monospace;
    font-size: 12px; color: #c8d3e0; max-height: 320px; white-space: pre-wrap; word-break: break-all;
}
.code-block.log { max-height: 420px; white-space: pre-wrap; }
.code-inline {
    background: transparent; padding: 0; margin: 0; max-width: 320px;
    font-size: 11.5px; color: var(--text-mute); white-space: pre-wrap; word-break: break-all;
}

/* ---------- 缩略图 ---------- */
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb { width: 148px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg-soft); }
.thumb:hover { border-color: var(--primary); text-decoration: none; }
.thumb img { display: block; width: 100%; height: 92px; object-fit: cover; background: #000; }
.thumb-cap { display: block; padding: 5px 7px; font-size: 11.5px; color: var(--text-dim); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.shot { margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg-soft); }
.shot img { display: block; width: 100%; height: 130px; object-fit: cover; background: #000; }
.shot figcaption { padding: 7px 9px; }
.shot .tiny { margin-top: 2px; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; padding-top: 12px; }
.pg { padding: 4px 10px; border-radius: 7px; border: 1px solid var(--line); font-size: 12.5px; color: var(--text-dim); }
.pg:hover { text-decoration: none; border-color: #3a465a; color: var(--text); }
.pg.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pg-dots { color: var(--text-mute); padding: 0 3px; }
.pg-info { margin-left: auto; color: var(--text-mute); font-size: 12.5px; }

/* ---------- 模板按钮 ---------- */
.templates { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.template {
    text-align: left; cursor: pointer; padding: 10px 12px; border-radius: 8px;
    background: var(--bg-soft); border: 1px solid var(--line); color: var(--text); font: inherit;
}
.template:hover { border-color: var(--primary); }
.template b { display: block; font-size: 13px; margin-bottom: 3px; }
.template code { font-size: 11.5px; color: var(--text-mute); background: none; padding: 0; }

/* ---------- 点状状态 ---------- */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 6px; vertical-align: middle; }
.dot-on { background: var(--ok); box-shadow: 0 0 7px var(--ok); }
.dot-off { background: #4b5563; }

/* ---------- 杂项 ---------- */
.muted { color: var(--text-dim); }
.tiny { font-size: 11.5px; }
.page-actions { display: flex; gap: 9px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }

/* ---------- 登录页 ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: radial-gradient(1000px 500px at 50% -10%, #1c2740 0%, var(--bg) 60%); }
.login-card { width: 100%; max-width: 372px; background: var(--bg-card); border: 1px solid var(--line); border-radius: 14px; padding: 30px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.login-brand { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 600; }
.login-sub { color: var(--text-mute); font-size: 12.5px; margin: 4px 0 20px; }
.login-form { margin-top: 6px; }
.login-tip { color: var(--text-mute); font-size: 11.5px; margin: 18px 0 0; line-height: 1.7; }

/* ---------- 远程操作面板 ---------- */
.remote-grid { display: grid; grid-template-columns: minmax(0, 1fr) 396px; gap: 16px; align-items: start; }
@media (max-width: 1180px) { .remote-grid { grid-template-columns: 1fr; } }
.remote-col { min-width: 0; }

.shot-viewer {
    position: relative; background: #0b0e13; border: 1px solid var(--line);
    border-radius: 8px; overflow: hidden; min-height: 170px;
    display: flex; align-items: center; justify-content: center;
}
.shot-viewer img {
    display: block; width: 100%; height: auto;
    cursor: crosshair; user-select: none; -webkit-user-drag: none;
}
.shot-empty { padding: 44px 22px; color: var(--text-mute); font-size: 13px; text-align: center; line-height: 1.9; }

/* 取点十字准星 */
.marker { position: absolute; pointer-events: none; transform: translate(-50%, -50%); width: 0; height: 0; }
.marker::before {
    content: ''; position: absolute; left: -13px; top: -1px; width: 26px; height: 2px;
    background: var(--danger); box-shadow: 0 0 7px var(--danger);
}
.marker::after {
    content: ''; position: absolute; left: -1px; top: -13px; width: 2px; height: 26px;
    background: var(--danger); box-shadow: 0 0 7px var(--danger);
}

.pick-info {
    margin-top: 10px; padding: 9px 12px; border-radius: 8px;
    background: var(--bg-soft); border: 1px dashed var(--line);
    font-size: 12.5px; color: var(--text-dim);
}
.field input[readonly] { color: var(--text-dim); background: var(--bg-soft); border-style: dashed; }
.when { display: block; }

/* ---------- 居中提示页 ---------- */
.center-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.center-card { max-width: 540px; text-align: center; padding: 34px; background: var(--bg-card); border: 1px solid var(--line); border-radius: 14px; }
.center-card .big { font-size: 44px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.center-card .code-block { text-align: left; margin: 14px 0; }
.center-card .btn { margin-top: 14px; }
