:root {
    --bg: #f4f6fb;
    --panel: #ffffff;
    --line: #e6e9f2;
    --text: #1f2430;
    --muted: #7a8194;
    --brand: #4f46e5;
    --brand-soft: #eef0ff;
    --ok: #12a150;
    --ok-soft: #e6f7ee;
    --err: #d64545;
    --err-soft: #fdecec;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0; font-weight: 600; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.pos { color: var(--ok); }
.neg { color: var(--err); }

/* ---------------- 顶栏 ---------------- */
.site-top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.site-top-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 9px 16px;
    min-height: 56px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.site-brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
.site-brand:hover { text-decoration: none; }
.brand-dot {
    width: 9px; height: 9px; border-radius: 50%; background: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-soft); display: inline-block;
}
/* 返回软件：一个 × 就够了 */
.site-close {
    margin-left: auto;
    width: 38px; height: 38px; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; background: #f1f2f6; color: #6b7280;
    font-size: 22px; line-height: 1;
}
.site-close:hover { background: #e6e9f2; color: var(--text); text-decoration: none; }

/* 内容区：手机与电脑端一致，单列居中 */
.site-body {
    max-width: 760px;
    margin: 16px auto 0;
    padding: 0 16px;
}
.site-main { width: 100%; min-width: 0; }
.site-foot {
    max-width: 760px;
    margin: 0 auto;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    padding: 12px 16px calc(84px + env(safe-area-inset-bottom, 0px));
}

/* 底部标签栏（手机 / 电脑端统一） */
.site-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    background: #fff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 18px rgba(31, 36, 48, .05);
}
.tabbar-inner {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: 560px;
    margin: 0 auto;
    padding: 6px 4px calc(8px + env(safe-area-inset-bottom, 0px));
}
.site-tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px 2px;
    border-radius: 10px;
    font-size: 12px;
    color: var(--muted);
    text-decoration: none;
}
.site-tabbar a:hover { background: #f6f7fb; text-decoration: none; }
.site-tabbar a.active { color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.site-tabbar svg { width: 20px; height: 20px; }

/* ---------------- 面板 ---------------- */
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
}
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.panel-head h2 { font-size: 15px; }
.empty { color: var(--muted); text-align: center; padding: 22px 0; }

/* ---------------- 授权卡片 ---------------- */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}
.tool-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fcfcff;
}
.tool-card.is-active { border-color: #cfe9dc; background: #fbfffd; }
.tool-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tool-name { font-weight: 600; }
.tool-card-body { color: var(--muted); font-size: 13.5px; }
.tool-card-body b { color: var(--text); font-size: 16px; }
.tool-card .btn { align-self: flex-start; }

/* ---------------- 键值列表 ---------------- */
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 8px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}
table.data th { color: var(--muted); font-weight: 500; background: #fafbff; }
table.data .num { text-align: right; }

/* ---------------- 徽标 / 提示 ---------------- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    background: #eef0f6;
    color: var(--muted);
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-off { background: #f1f2f6; color: #8a90a2; }
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.badge-muted { background: #eef0f6; color: var(--muted); }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 13.5px; }
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-error { background: var(--err-soft); color: var(--err); }
.alert-info { background: var(--brand-soft); color: var(--brand); }
.alert-warn { background: #fdf6e3; color: #b7791f; }

/* ---------------- 按钮 / 表单 ---------------- */
.btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    background: #eef0f6;
    color: var(--text);
    line-height: 1.4;
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-soft { background: var(--brand-soft); color: var(--brand); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--text); }
.btn-block { display: block; width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.form-group { margin-bottom: 14px; }
.label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.hint { color: var(--muted); font-size: 12px; margin-top: 5px; }
.input-inline { display: flex; gap: 8px; }
.input-inline .input { flex: 1; }

/* ---------------- 未登录卡片 ---------------- */
body.site-guest {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(160deg, #eef0ff 0%, #f7f8fc 60%, #f4f6fb 100%);
}
.guest-box {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 14px;
    padding: 28px 26px;
    box-shadow: 0 12px 40px rgba(31, 36, 48, .08);
}
.guest-brand { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.guest-title { font-size: 19px; font-weight: 600; margin-bottom: 14px; }
.guest-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; }
.guest-actions { display: flex; flex-direction: column; gap: 10px; }
.guest-foot { margin-top: 16px; display: flex; justify-content: space-between; font-size: 13px; }

/* ---------------- 个人中心 ---------------- */
.input-sm { width: auto; padding: 6px 9px; font-size: 13px; }
.small { font-size: 12px; }

.me-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
}
.me-name { font-size: 18px; font-weight: 600; }
.me-sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.me-sub b { color: var(--text); }
.me-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.me-ctrl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.me-ctrl .input-sm { width: 180px; }

.range-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.range-tab {
    padding: 5px 12px;
    border: 1px solid var(--line);
    border-radius: 20px;
    font-size: 13px;
    color: var(--muted);
    background: #fff;
}
.range-tab:hover { text-decoration: none; }
.range-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.tool-list { display: flex; flex-direction: column; }
.tool-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--line);
}
.tool-row:last-child { border-bottom: none; }
.tool-row-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.tool-row-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.tool-row-sub b { color: var(--text); }
.tool-row-act { flex: 0 0 auto; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 16px; }

/* 手机端：底部标签栏与电脑端一致，只把间距、字号收小一点 */
@media (max-width: 700px) {
    .site-top-inner { padding: 8px 12px; min-height: 50px; }
    .site-close { width: 34px; height: 34px; font-size: 20px; }
    .site-body { padding: 0 10px; margin-top: 10px; }
    .panel { padding: 14px; }
    .site-foot { padding: 10px 12px calc(84px + env(safe-area-inset-bottom, 0px)); }
    .site-tabbar a { font-size: 11px; }
    .site-tabbar svg { width: 19px; height: 19px; }
}

@media (max-width: 560px) {
    .tool-row { flex-direction: column; align-items: stretch; }
    .tool-row-act .btn { display: block; width: 100%; text-align: center; }
    .me-ctrl { width: 100%; }
    .me-ctrl .input-sm { flex: 1; width: auto; }
    .me-actions .btn { flex: 1; text-align: center; }
    .me-hero { padding: 14px; }
}
