/* ============================================================
   稳链系统 · 样式
   颜色全部走 CSS 变量，由后台「前台管理 → 配色主题」控制
   ============================================================ */

:root {
    /* 兜底值，实际会被后台主题覆盖 */
    --bg: #0b0f17;
    --card: rgba(255, 255, 255, .035);
    --card2: rgba(0, 0, 0, .25);
    --line: rgba(255, 255, 255, .09);
    --line2: rgba(255, 255, 255, .06);
    --txt: #e8edf6;
    --sub: #7d879c;
    --ph: #4d5566;
    --main: #22d3a7;
    --main2: #3b82f6;
    --ink: #04120e;
    --field: rgba(0, 0, 0, .3);
    --field-txt: #e8edf6;
    --g1: rgba(34, 211, 167, .18);
    --g2: rgba(59, 130, 246, .14);
    --shadow: 0 18px 50px rgba(0, 0, 0, .35);
    --danger: #f0645a;
    --soft: rgba(34, 211, 167, .10);
    --soft-b: rgba(34, 211, 167, .32);
    --soft-s: rgba(34, 211, 167, .55);
    --top-bg: rgba(11, 15, 23, .9);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    background: var(--bg);
    color: var(--txt);
    font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--main); text-decoration: none; }
input, button, select, textarea { font-family: inherit; font-size: 15px; outline: none; }
code { background: var(--card2); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }
.dim { color: var(--sub); opacity: .75; }
.sm { font-size: 12px; }

/* ---------- 首页 ---------- */
.page-home { position: relative; overflow-x: hidden; }

.glow { position: fixed; border-radius: 50%; filter: blur(90px); pointer-events: none; z-index: 0; }
.g1 { width: 380px; height: 380px; background: var(--g1); top: -140px; left: -120px; }
.g2 { width: 420px; height: 420px; background: var(--g2); bottom: -180px; right: -140px; }

.wrap { position: relative; z-index: 1; max-width: 540px; margin: 0 auto; padding: 0 18px 40px; }

.hd { display: flex; align-items: center; justify-content: space-between; padding: 26px 2px 18px; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand .dot {
    width: 11px; height: 11px; border-radius: 50%;
    background: linear-gradient(135deg, var(--main), var(--main2));
    box-shadow: 0 0 12px var(--soft-s);
}
.brand .name { font-size: 17px; font-weight: 600; letter-spacing: 1px; }
.hd-link { font-size: 13px; color: var(--sub); }
.hd-link:hover { color: var(--main); }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 26px 22px 24px;
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow);
}

.card h1 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.desc { color: var(--sub); font-size: 13.5px; line-height: 1.65; margin-bottom: 22px; }

.notice {
    background: var(--soft);
    border: 1px solid var(--soft-b);
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 13px;
    color: var(--txt);
    margin-bottom: 18px;
    line-height: 1.6;
}

.locked { color: var(--sub); font-size: 14px; padding: 18px 0; }

.lbl { display: block; font-size: 13px; color: var(--sub); margin: 0 0 9px 2px; }
.lbl:not(:first-child) { margin-top: 22px; }

.inp {
    width: 100%;
    background: var(--field);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 15px;
    color: var(--field-txt);
    transition: border-color .2s, box-shadow .2s;
    -webkit-appearance: none;
    appearance: none;
}
textarea.inp { line-height: 1.6; resize: vertical; }
select.inp { background-image: none; }
.inp::placeholder { color: var(--ph); }
.inp:focus { border-color: var(--soft-s); box-shadow: 0 0 0 3px var(--soft); }

.plat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.pbtn {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    background: var(--card2);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 15px 6px;
    color: var(--sub);
    cursor: pointer;
    transition: all .18s;
}
.pbtn .pi { font-size: 20px; line-height: 1; }
.pbtn .pt { font-size: 13.5px; }
.pbtn:hover { border-color: var(--line); color: var(--txt); }
.pbtn.active {
    background: var(--soft);
    border-color: var(--soft-b);
    color: var(--txt);
    box-shadow: 0 6px 20px var(--soft);
}

.btn-main {
    width: 100%;
    margin-top: 24px;
    padding: 15px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--main), var(--main2));
    color: var(--ink);
    font-size: 15.5px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .18s, transform .1s;
}
.btn-main:hover { opacity: .9; }
.btn-main:active { transform: scale(.985); }
.btn-main:disabled { opacity: .5; cursor: default; transform: none; }

.result { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line2); }
.r-title { font-size: 13px; color: var(--main); margin-bottom: 10px; }
.r-url {
    background: var(--card2);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 13px 14px;
    font-size: 13.5px;
    color: var(--txt);
    word-break: break-all;
    line-height: 1.6;
    font-family: ui-monospace, Menlo, Consolas, monospace;
}
.r-acts { display: flex; gap: 9px; margin-top: 13px; flex-wrap: wrap; }

.btn-sm {
    flex: 1;
    min-width: 88px;
    text-align: center;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: linear-gradient(135deg, var(--main), var(--main2));
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn-sm.ghost {
    background: var(--card2);
    border-color: var(--line);
    color: var(--txt);
    font-weight: 400;
}
.btn-sm:hover { opacity: .9; }

.r-tip { font-size: 12.5px; color: var(--sub); margin-top: 12px; text-align: center; }
.r-tip b { color: var(--main); font-weight: 500; }

.err {
    margin-top: 16px;
    background: rgba(240, 100, 90, .1);
    border: 1px solid rgba(240, 100, 90, .3);
    color: var(--danger);
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 13px;
}

.ft { text-align: center; color: var(--sub); opacity: .5; font-size: 12px; margin-top: 26px; }

/* ---------- 登录页 ---------- */
.page-login { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { font-size: 19px; margin-bottom: 6px; }
.login-card .desc { margin-bottom: 20px; }

/* ---------- 后台 ---------- */
.page-admin { padding-bottom: 60px; }
.admin-top {
    border-bottom: 1px solid var(--line2);
    background: var(--top-bg);
    backdrop-filter: blur(12px);
    position: sticky; top: 0; z-index: 20;
}
.admin-top-in {
    max-width: 1180px; margin: 0 auto; padding: 14px 20px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.admin-top .ttl { font-size: 15.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.admin-top .ttl .dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: linear-gradient(135deg, var(--main), var(--main2));
}
.admin-top .out { font-size: 13px; color: var(--sub); }

.tabs {
    max-width: 1180px; margin: 0 auto; padding: 0 20px;
    display: flex; gap: 4px; overflow-x: auto;
}
.tab {
    padding: 11px 15px; font-size: 14px; color: var(--sub);
    border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--txt); }
.tab.on { color: var(--main); border-bottom-color: var(--main); }

.admin-body { max-width: 1180px; margin: 0 auto; padding: 24px 20px; }

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 20px;
}
.panel h2 { font-size: 15.5px; font-weight: 600; margin-bottom: 16px; overflow: hidden; }
.panel h2 span { font-size: 12.5px; color: var(--sub); font-weight: 400; margin-left: 8px; }

.sec-title {
    font-size: 13px; color: var(--main); font-weight: 600;
    margin: 24px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line2);
}
.sec-title:first-of-type { margin-top: 4px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat {
    background: var(--card2);
    border: 1px solid var(--line2);
    border-radius: 12px;
    padding: 16px;
    min-width: 0;
}
.stat .v { font-size: 24px; font-weight: 600; letter-spacing: .5px; word-break: break-all; }
.stat .k { font-size: 12.5px; color: var(--sub); margin-top: 4px; }

.tbl-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
th { color: var(--sub); font-weight: 400; font-size: 12.5px; }
td { color: var(--txt); }
tr:last-child td { border-bottom: 0; }
td .mono, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
td .tg { font-size: 12px; color: var(--sub); max-width: 240px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: middle; }
td .tg, td .mono { max-width: 340px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: middle; }
.empty { text-align: center; color: var(--sub); padding: 30px 0; font-size: 14px; }

.tag {
    display: inline-block; padding: 2px 9px; border-radius: 20px;
    font-size: 12px; line-height: 1.7;
}
.tag.wx, .tag.wechat { background: rgba(7, 193, 96, .16); color: #3fbf7f; }
.tag.qq { background: rgba(59, 130, 246, .18); color: #6ea3f0; }
.tag.all { background: var(--card2); color: var(--sub); }
.tag.on { background: var(--soft); color: var(--main); }
.tag.off { background: rgba(240, 100, 90, .16); color: var(--danger); }
.tag.warn { background: rgba(245, 158, 11, .18); color: #d99022; }

/* 状态灯 */
.light {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    margin-right: 7px; vertical-align: middle; background: var(--sub); opacity: .5;
}
.light.on   { background: #22c55e; box-shadow: 0 0 8px rgba(34,197,94,.6); opacity: 1; }
.light.warn { background: #f59e0b; box-shadow: 0 0 8px rgba(245,158,11,.6); opacity: 1; }
.light.bad  { background: #ef4444; box-shadow: 0 0 8px rgba(239,68,68,.6); opacity: 1; }
.light.off  { background: var(--sub); opacity: .4; }
.light.idle { background: var(--sub); opacity: .35; }

.acts a, .acts button, .lnk {
    font-size: 12.5px; color: var(--sub); background: none; border: 0;
    cursor: pointer; padding: 2px 6px; text-decoration: none;
}
.acts a:hover, .acts button:hover, .lnk:hover { color: var(--main); }
.acts .del:hover { color: var(--danger); }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row .fld { flex: 1; min-width: 180px; }
.row .fld label { display: block; font-size: 12.5px; color: var(--sub); margin-bottom: 7px; }

.btn {
    display: inline-block;
    padding: 12px 20px; border: 0; border-radius: 10px;
    background: linear-gradient(135deg, var(--main), var(--main2));
    color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer;
    text-decoration: none;
}
.btn:hover { opacity: .9; }
.btn.gray { background: var(--card2); color: var(--txt); font-weight: 400; border: 1px solid var(--line); }
.btn.red { background: rgba(240, 100, 90, .16); color: var(--danger); font-weight: 400; }

.msg { padding: 11px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 18px; }
.msg.ok { background: var(--soft); border: 1px solid var(--soft-b); color: var(--txt); }
.msg.no { background: rgba(240, 100, 90, .1); border: 1px solid rgba(240, 100, 90, .28); color: var(--danger); }

.hint { font-size: 12.5px; color: var(--sub); line-height: 1.8; margin-top: 10px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--line2); gap: 16px; }
.switch-row:last-of-type { border-bottom: 0; }
.switch-row .sl { font-size: 14px; }
.switch-row .sd { font-size: 12.5px; color: var(--sub); margin-top: 3px; line-height: 1.65; }

.chk { width: 20px; height: 20px; accent-color: var(--main); cursor: pointer; }
.chk-group { display: flex; gap: 16px; flex-wrap: wrap; }
.chk-group label { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--sub); cursor: pointer; }

.copy-mini { cursor: pointer; }
.copy-mini:hover { color: var(--main); }

/* 主题选择卡 */
.themes { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.theme-card {
    display: flex; align-items: center; gap: 12px;
    border: 1px solid var(--line); border-radius: 12px;
    padding: 13px 14px; cursor: pointer;
    background: var(--card2);
    transition: border-color .18s, box-shadow .18s;
}
.theme-card input { display: none; }
.theme-card.on { border-color: var(--soft-b); box-shadow: 0 0 0 3px var(--soft); }
.theme-card .tn { font-size: 13.5px; }
.theme-card .sw {
    width: 40px; height: 26px; border-radius: 7px; flex: 0 0 auto;
    border: 1px solid var(--line);
    display: flex; align-items: center; justify-content: center; gap: 3px;
}
.theme-card .sw i { width: 9px; height: 9px; border-radius: 50%; display: block; }

/* 前台预览 */
.prev-frame {
    width: 100%; height: 560px; border: 1px solid var(--line);
    border-radius: 12px; background: var(--bg); display: block;
}

@media (max-width: 600px) {
    .card { padding: 22px 17px; border-radius: 16px; }
    .admin-body { padding: 18px 14px; }
    .panel { padding: 16px 14px; }
    .tbl-wrap { margin: 0 -14px; padding: 0 14px; }
    .stat .v { font-size: 21px; }
    .prev-frame { height: 460px; }
    .switch-row { flex-direction: column; align-items: flex-start; gap: 10px; }
}
