/* ==========================================================================
   spp-pay 控制台 · 统一设计系统
   角色：总后台 / 运营商 / 商户 / 码商（data-role 驱动主题色）
   仅前端样式，不涉及任何业务逻辑
   ========================================================================== */

:root {
    --bg: #f2f5fa;
    --bg-soft: #f7f9fc;
    --panel: #ffffff;
    --panel-2: #f1f5fb;
    --line: #e6ebf3;
    --line-strong: #d5dde9;
    --text: #101a2e;
    --muted: #68788f;

    --primary: #3b63f6;
    --primary-2: #2c4fe0;
    --primary-soft: #eef2ff;
    --primary-line: #c7d5ff;

    --green: #12a150;
    --green-soft: #e9f9f0;
    --green-line: #b7ebcd;
    --red: #e02d3c;
    --red-soft: #fef2f2;
    --red-line: #fbd0d3;
    --amber: #c2790a;
    --amber-soft: #fffaeb;
    --amber-line: #fbe3b0;
    --cyan: #0a91b6;
    --violet: #7a5af8;
    --violet-soft: #f3f0ff;
    --violet-line: #ddd4ff;

    --radius: 14px;
    --radius-lg: 18px;

    --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-sm: 0 2px 10px -4px rgba(16, 24, 40, .12), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-md: 0 18px 44px -28px rgba(16, 24, 40, .34);
    --ring: 0 0 0 3px rgba(59, 99, 246, .16);

    --side-1: #101b2f;
    --side-2: #0a1120;
    --side-text: #a7b6cb;
    --side-glow: rgba(59, 99, 246, .22);
}

/* 四端统一使用同一主色，避免运营商/码商后台出现绿色或橙色按钮 */

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    color: var(--text);
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", -apple-system, system-ui, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

body {
    background:
        radial-gradient(1100px 520px at 82% -12%, rgba(59, 99, 246, .07), transparent 62%),
        radial-gradient(900px 460px at -8% 104%, rgba(10, 145, 182, .05), transparent 60%),
        var(--bg);
}

.hidden { display: none !important; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; }

::selection { background: rgba(59, 99, 246, .18); }

/* 细滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: #cfd8e6;
    border: 3px solid transparent;
    background-clip: padding-box;
    border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: #b4c1d4; background-clip: padding-box; }

/* ---------------- 按钮 ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 13px;
    border: 1px solid #dde4ee;
    border-radius: 10px;
    background: #fff;
    color: #3a4a60;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn:hover { background: #f7f9fc; border-color: #c9d3e1; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }

/* 主按钮只用纯色，去掉渐变与彩色投影，避免整页色块过多 */
.btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: none;
}
.btn.primary:hover { background: var(--primary-2); border-color: var(--primary-2); }

.btn.ghost { background: transparent; border-color: transparent; color: #5d6d84; }
.btn.ghost:hover { background: #f2f5fa; color: var(--text); }

/* 危险操作默认保持中性，仅文字提示，悬停才泛红 */
.btn.danger { color: #a6353f; border-color: #dde4ee; background: #fff; }
.btn.danger:hover { background: #fff5f5; border-color: #f0c9cd; color: #96212b; }

.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
/* 表格内的小号主按钮：白底 + 主色描边，避免每行都出现彩色色块 */
.btn.sm.primary {
    background: #fff;
    border-color: var(--primary-line);
    color: var(--primary-2);
    font-weight: 600;
}
.btn.sm.primary:hover { background: var(--primary-soft); border-color: var(--primary); }
.btn.block { width: 100%; height: 44px; font-size: 14px; letter-spacing: 2px; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

/* ---------------- 登录 ---------------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background:
        radial-gradient(900px 480px at 18% 0%, rgba(59, 99, 246, .10), transparent 62%),
        radial-gradient(760px 460px at 92% 100%, rgba(10, 145, 182, .08), transparent 62%),
        var(--bg);
}

.login-shell {
    display: grid;
    grid-template-columns: 1.04fr .96fr;
    width: 900px;
    max-width: 100%;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 44px 100px -52px rgba(16, 24, 40, .45), var(--shadow-sm);
}

.login-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px 38px;
    overflow: hidden;
    color: var(--text);
    background:
        radial-gradient(520px 300px at 100% 0%, var(--primary-soft), transparent 72%),
        radial-gradient(420px 300px at 0% 100%, rgba(10, 145, 182, .07), transparent 70%),
        linear-gradient(160deg, #f7faff 0%, #f1f6ff 52%, #ffffff 100%);
    border-right: 1px solid var(--line);
}
.login-hero::after {
    content: "";
    position: absolute;
    right: -90px;
    bottom: -120px;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    border: 1px solid rgba(59, 99, 246, .10);
    box-shadow: 0 0 0 44px rgba(59, 99, 246, .035), 0 0 0 92px rgba(59, 99, 246, .022);
    pointer-events: none;
}
.login-hero .brand .logo { box-shadow: 0 10px 24px -14px rgba(59, 99, 246, .75); }
.hero-title {
    margin: 30px 0 12px;
    font-size: 25px;
    line-height: 1.36;
    font-weight: 650;
    letter-spacing: .3px;
    color: var(--text);
}
.hero-desc { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.85; }
.hero-list { margin: 26px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.hero-list li { display: flex; align-items: center; gap: 10px; color: #4b5c74; font-size: 12.5px; }
.hero-list .tick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--green-line);
    color: var(--green);
    font-size: 10px;
    box-shadow: var(--shadow-xs);
}
.hero-foot { margin-top: 30px; color: var(--muted); font-size: 11px; letter-spacing: .3px; }

.login-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 44px 42px;
    background: var(--panel);
}
.login-card .login-title { margin: 0 0 6px; font-size: 20px; font-weight: 650; color: var(--text); }
.login-card .login-sub { margin: 0 0 24px; color: var(--muted); font-size: 12.5px; }
.login-divider { display: none; }
.login-hint { color: var(--muted); font-size: 11.5px; text-align: center; margin: 18px 0 0; line-height: 1.7; }

.field { display: block; margin-bottom: 15px; }
.field > span { display: block; color: #4c5b71; font-size: 12.5px; font-weight: 500; margin-bottom: 7px; }
.field input, .field select, .field textarea {
    width: 100%;
    height: 40px;
    background: #fff;
    border: 1px solid var(--line-strong);
    color: var(--text);
    border-radius: 10px;
    padding: 0 12px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: auto; min-height: 78px; padding: 10px 12px; resize: vertical; font-family: Consolas, monospace; }
.field input::placeholder, .field textarea::placeholder { color: #a4b1c2; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: var(--ring); }
.field .hint { color: var(--muted); font-size: 11px; margin-top: 5px; line-height: 1.5; }
.field.full { grid-column: 1 / -1; }

.login-error { color: var(--red); font-size: 12px; min-height: 18px; margin: 2px 0 8px; }

.captcha-row { display: flex; align-items: center; gap: 8px; }
.captcha-row input { flex: 1; min-width: 0; }
.captcha-img {
    width: 122px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    object-fit: cover;
    flex: 0 0 122px;
}

/* 品牌 */
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--primary), var(--cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 14px;
    letter-spacing: .5px;
}
.brand h1 { margin: 0; font-size: 18px; color: var(--text); font-weight: 650; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.brand.small .logo { width: 36px; height: 36px; flex-basis: 36px; font-size: 12px; border-radius: 11px; }
.brand.small h1 { font-size: 15px; }

.role-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    padding: 5px;
    border-radius: 10px;
    margin: 24px 0 18px;
}
.role-tabs button {
    border: none;
    background: transparent;
    color: var(--muted);
    padding: 8px 4px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12px;
}
.role-tabs button.active { background: var(--primary); color: #fff; }

/* ---------------- 布局 ---------------- */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
    width: 242px;
    flex: 0 0 242px;
    display: flex;
    flex-direction: column;
    padding: 18px 14px 14px;
    color: var(--muted);
    background: #ffffff;
    border-right: 1px solid var(--line);
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 30;
}

.sidebar .brand { padding: 2px 8px 18px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.sidebar .brand .logo { background: linear-gradient(135deg, var(--primary), var(--cyan)); box-shadow: 0 10px 22px -14px rgba(59, 99, 246, .7); }
.sidebar .brand h1 { color: var(--text); }
.sidebar .brand p { color: var(--muted); }

.sidebar nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding-right: 2px; }
.sidebar nav::-webkit-scrollbar-thumb { background: #d7e0ec; background-clip: padding-box; }

.sidebar nav button {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: none;
    background: transparent;
    color: #334155;
    text-align: left;
    padding: 9px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.sidebar nav button:hover { background: var(--bg-soft); color: var(--text); }
.sidebar nav button.active {
    color: var(--primary-2);
    font-weight: 600;
    background: var(--primary-soft);
    box-shadow: inset 0 0 0 1px var(--primary-line);
}
.sidebar nav button.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--primary);
}
.sidebar nav .mi {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    opacity: .92;
}
.sidebar nav .mi svg { width: 17px; height: 17px; display: block; }
.sidebar nav button.active .mi { opacity: 1; color: var(--primary); }
.sidebar nav .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .55; }
.sidebar nav .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar nav .menu-group { margin-bottom: 2px; }
.sidebar nav .menu-group-head { width: 100%; justify-content: flex-start; }
.sidebar nav .menu-group-head .caret {
    margin-left: auto;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg);
    opacity: .45;
    transition: transform .18s ease;
}
.sidebar nav .menu-group.open .menu-group-head .caret { transform: rotate(45deg); }
.sidebar nav .menu-sub { display: none; padding-left: 14px; margin-bottom: 4px; }
.sidebar nav .menu-group.open .menu-sub { display: block; }
.sidebar nav .menu-sub button { padding: 7px 10px 7px 12px; font-size: 13px; color: #475569; }
.sidebar nav .menu-sub button .mi { width: 14px; height: 14px; flex-basis: 14px; opacity: .8; }
.sidebar nav .menu-sub button .mi svg { width: 14px; height: 14px; }

.side-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 12px 10px 4px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 11.5px;
}
.side-foot .live {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, .16);
}

.main { flex: 1; min-width: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
    height: 66px;
    padding: 0 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 20;
}
.title-group { display: flex; align-items: center; gap: 10px; min-width: 0; }
.title-group h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 650;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.crumb-sep { color: #c2cbd9; font-size: 15px; margin: 0 2px; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 99px;
    background: var(--primary-soft);
    color: var(--primary-2);
    border: 1px solid var(--primary-line);
    white-space: nowrap;
}
.badge::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary);
}

.user { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--cyan));
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: .5px;
    box-shadow: 0 6px 14px -10px rgba(16, 24, 40, .8);
    flex: 0 0 32px;
}
.user-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #34445c; font-weight: 500; }
.user-sep { width: 1px; height: 18px; background: var(--line); margin: 0 2px; }

.content {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    padding: 22px 26px 28px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}
.content > * { animation: pp-rise .3s cubic-bezier(.2, .7, .3, 1) both; }
.content > *:nth-child(2) { animation-delay: .04s; }
.content > *:nth-child(3) { animation-delay: .08s; }
.content > *:nth-child(4) { animation-delay: .12s; }
.content > *:nth-child(n+5) { animation-delay: .16s; }

@keyframes pp-rise {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

/* 内容区内裸表单控件（筛选栏等）统一质感 */
.content input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.content select {
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font-size: 12.5px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.content input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
.content select:focus { border-color: var(--primary); box-shadow: var(--ring); }
.content input::placeholder { color: #a4b1c2; }

.loading, .empty, .error {
    padding: 40px 20px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    background: var(--bg-soft);
    font-size: 13px;
}
.empty::before {
    content: "—";
    display: block;
    color: #c3ccda;
    font-size: 18px;
    margin-bottom: 8px;
}
.error {
    padding: 12px 16px;
    text-align: left;
    color: #b42318;
    background: var(--red-soft);
    border: 1px solid var(--red-line);
    border-left: 3px solid var(--red);
    border-radius: 10px;
}

/* ---------------- 统计卡 ---------------- */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.stat {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 15px 16px 14px;
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    transition: box-shadow .18s, transform .18s, border-color .18s;
}
.stat:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); border-color: #dbe3ef; }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.stat .label { color: var(--muted); font-size: 12px; line-height: 1.4; }
.stat .ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 9px;
    color: var(--primary);
    background: var(--primary-soft);
}
.stat .ico svg { width: 15px; height: 15px; display: block; }
.stat .value {
    font-size: 23px;
    font-weight: 650;
    letter-spacing: .2px;
    color: var(--text);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    word-break: break-word;
}
.stat .value.sm { font-size: 17px; font-weight: 600; }
.stat .sub { color: var(--muted); font-size: 11px; margin-top: 6px; }

/* 统计卡统一使用主色，不再按指标切换多彩图标 */

/* ---------------- 卡片 ---------------- */
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}
.card-head h3 {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    font-size: 14.5px;
    font-weight: 650;
    color: var(--text);
}
.card-head h3::before {
    content: "";
    width: 3px;
    height: 14px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--primary), var(--cyan));
}
.card-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
/* flush 卡片用于表格时保持零内边距；密钥、收银台这类键值对内容补回内边距，避免文字贴框 */
.card-body.flush > .kv { padding: 18px; }
.card-body.flush > p { padding: 0 18px 18px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input, .filters select {
    background: #fff;
    border: 1px solid var(--line-strong);
    color: var(--text);
    border-radius: 9px;
    padding: 7px 10px;
    font-size: 12px;
    outline: none;
}
.filters input:focus, .filters select:focus { border-color: var(--primary); box-shadow: var(--ring); }

/* ---------------- 表格 ---------------- */
.table-wrap { width: 100%; overflow-x: auto; }
/* 页面整页展示：不限制表格高度，由页面整体滚动 */
.content .table-wrap {
    max-height: none;
    overflow: visible;
}
.content .table-wrap thead th { position: static; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; }
thead th {
    position: relative;
    text-align: left;
    color: #5d6d84;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: .2px;
    padding: 10px 14px;
    background: #f7f9fd;
    border-bottom: 1px solid var(--line);
    white-space: normal;
    word-break: break-word;
}
td {
    padding: 11px 14px;
    border-bottom: 1px solid #eef2f8;
    vertical-align: middle;
    color: #26364d;
    white-space: normal;
}
td .mono { white-space: normal; word-break: break-all; }
/* 失败原因统一由下方 .reason-cell 规则处理：默认单行省略，点击才展开 */
tbody tr { transition: background .12s; }
tbody tr:nth-child(even) { background: #fcfdff; }
tbody tr:hover { background: #f5f8ff; }
tbody tr:last-child td { border-bottom: none; }
td .ops { display: flex; gap: 6px; flex-wrap: wrap; }
.mono { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: 11.5px; color: #4a5a72; }
td .mono { display: inline-block; padding: 2px 7px; border-radius: 6px; background: #f5f7fb; }
.muted { color: var(--muted); }
.strong { color: var(--text); font-weight: 600; }

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.45;
    border: 1px solid transparent;
    white-space: nowrap;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 1; flex: 0 0 6px; }
/* 状态标签提高饱和度与对比度，订单状态一眼可辨 */
.tag { font-weight: 600; }
.tag.green { color: #067a3c; background: #dcfce7; border-color: #86efac; }
.tag.red { color: #c81e2b; background: #fee2e2; border-color: #fca5a5; }
.tag.amber { color: #b45309; background: #fef3c7; border-color: #fcd34d; }
.tag.blue { color: #1d4ed8; background: #dbeafe; border-color: #93c5fd; }
.tag.gray { color: #475569; background: #f1f5f9; border-color: #cbd5e1; }

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    color: var(--muted);
    font-size: 12px;
    border-top: 1px solid var(--line);
    background: #fff;
}
.pager .btns { display: flex; gap: 8px; }

/* ---------------- 弹窗 / Toast ---------------- */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(10, 17, 32, .42);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 50;
    animation: pp-fade .16s ease both;
}
.modal {
    width: 600px;
    max-width: 100%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: 0 40px 90px -36px rgba(10, 17, 32, .55);
    animation: pp-pop .2s cubic-bezier(.2, .8, .3, 1) both;
}
.modal.wide { width: min(820px, calc(100vw - 48px)); }
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 17px 22px;
    border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 15.5px; font-weight: 650; color: var(--text); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-body .field:last-child { margin-bottom: 0; }
.modal-body h4 {
    margin: 18px 0 10px;
    padding-left: 10px;
    border-left: 3px solid var(--primary);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
}
.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid var(--line);
    background: #fcfdff;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* 订单详情：宽弹窗分区与时间线 */
.od-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.od-grid .kv { margin-bottom: 4px; }
.timeline { display: flex; flex-direction: column; gap: 9px; margin: 6px 0 2px; }
.timeline-item { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; }
.timeline-item .tl { color: var(--muted); min-width: 62px; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 5px; flex: 0 0 auto; }
.timeline-item.off .timeline-dot { background: #cbd5e1; }
@media (max-width: 720px) {
    .od-grid { grid-template-columns: 1fr; }
}

@keyframes pp-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pp-pop { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }

.toast {
    position: fixed;
    top: 82px;
    right: 24px;
    left: auto;
    transform: none;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    max-width: min(420px, calc(100vw - 32px));
    background: #fff;
    border: 1px solid var(--line);
    border-left: 3px solid var(--green);
    color: var(--text);
    padding: 11px 16px;
    border-radius: 11px;
    font-size: 13px;
    z-index: 100;
    box-shadow: 0 18px 44px -20px rgba(16, 24, 40, .35), var(--shadow-xs);
    animation: pp-slide .22s cubic-bezier(.2, .8, .3, 1) both;
}
.toast::before {
    content: "✓";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    border-radius: 50%;
    background: var(--green-soft);
    color: var(--green);
    font-size: 11px;
    font-weight: 700;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast.err::before { content: "!"; background: var(--red-soft); color: var(--red); }

@keyframes pp-slide { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

.kv { display: grid; grid-template-columns: minmax(96px, 148px) minmax(0, 1fr); gap: 10px 16px; font-size: 13px; align-items: start; }
.kv .k { color: var(--muted); font-size: 12.5px; padding-top: 1px; }
.kv .v { min-width: 0; word-break: break-word; overflow-wrap: anywhere; color: var(--text); font-weight: 500; }
/* 密钥/AppId 这类超长串允许在任意位置换行，避免撑破卡片或贴边被裁切 */
.kv .v .mono { white-space: normal; word-break: break-all; overflow-wrap: anywhere; }
.kv .v .btn { margin: 2px 0; }

/* ---------------- 骨架屏 ---------------- */
.sk-page { display: block; }
.sk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 14px; margin-bottom: 18px; }
.sk {
    position: relative;
    overflow: hidden;
    background: #eef2f8;
    border-radius: 10px;
}
.sk::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .72), transparent);
    animation: pp-shimmer 1.25s infinite;
}
.sk-stat { height: 92px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); }
.sk-stat .sk { height: 10px; margin: 14px 16px 0; }
.sk-stat .sk.big { height: 20px; width: 55%; margin-top: 12px; }
.sk-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; }
.sk-card .sk { height: 12px; margin-bottom: 12px; }
.sk-card .sk.head { height: 16px; width: 30%; margin-bottom: 18px; }
.sk-card .sk.row { height: 32px; }
@keyframes pp-shimmer { 100% { transform: translateX(100%); } }

.spinner {
    width: 26px;
    height: 26px;
    margin: 0 auto;
    border: 3px solid #e5ebf4;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spp-spin .8s linear infinite;
}
@keyframes spp-spin { to { transform: rotate(360deg); } }

/* ---------------- 悬浮刷新（保留原需求，改为克制的圆形按钮） ---------------- */
.fab-refresh {
    position: fixed;
    right: 22px;
    bottom: 24px;
    z-index: 80;
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--line-strong);
    color: var(--primary);
    box-shadow: 0 12px 28px -16px rgba(16, 24, 40, .5);
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .12s;
}
.fab-refresh:hover { background: var(--primary-soft); border-color: var(--primary-line); }
.fab-refresh:active { transform: translateY(1px); }
.fab-refresh:disabled { opacity: .6; cursor: not-allowed; }
.fab-refresh svg { width: 18px; height: 18px; display: block; }
.fab-refresh.spinning svg { animation: spp-spin .9s linear infinite; }

/* ---------------- 侧栏收起 / 移动端 ---------------- */
.menu-toggle { width: 36px; height: 36px; }
.app.sidebar-collapsed .sidebar { width: 76px; flex-basis: 76px; padding: 16px 10px; }
.app.sidebar-collapsed .sidebar .brand div,
.app.sidebar-collapsed .sidebar nav button .label,
.app.sidebar-collapsed .sidebar nav .menu-group-head .caret,
.app.sidebar-collapsed .side-foot span.txt { display: none; }
.app.sidebar-collapsed .sidebar .brand { justify-content: center; padding: 2px 0 16px; }
.app.sidebar-collapsed .sidebar nav button { justify-content: center; padding: 10px 0; }
.app.sidebar-collapsed .sidebar nav .menu-sub { display: none; }
.app.sidebar-collapsed .side-foot { justify-content: center; padding-left: 0; padding-right: 0; }
.side-mask { display: none; }

@media (max-width: 1180px) {
    .content { padding: 20px 18px 48px; }
    .topbar { padding: 0 18px; }
    .user-name { display: none; }
}

@media (max-width: 980px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 242px;
        flex-basis: 242px;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 18px 0 44px rgba(16, 24, 40, .18);
    }
    .sidebar .brand div,
    .sidebar nav button .label { display: block; }
    .app.sidebar-open .sidebar { transform: translateX(0); }
    .app.sidebar-collapsed .sidebar { width: 242px; flex-basis: 242px; padding: 18px 14px 14px; }
    .app.sidebar-collapsed .sidebar .brand div,
    .app.sidebar-collapsed .sidebar nav button .label,
    .app.sidebar-collapsed .side-foot span.txt { display: block; }
    .app.sidebar-collapsed .sidebar .brand { justify-content: flex-start; }
    .app.sidebar-collapsed .sidebar nav button { justify-content: flex-start; padding: 9px 12px; }
    .app.sidebar-collapsed .sidebar nav .menu-group-head .caret { display: block; }
    .app.sidebar-collapsed .sidebar nav .menu-sub { display: none; }
    .app.sidebar-collapsed .sidebar nav .menu-group.open .menu-sub { display: block; }
    .side-foot { justify-content: flex-start; }
    .app.sidebar-open .side-mask {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 25;
        background: rgba(10, 17, 32, .42);
        backdrop-filter: blur(2px);
    }
    .topbar { height: 60px; padding: 0 12px; gap: 8px; }
    .title-group { min-width: 0; }
    .title-group h2 { font-size: 15.5px; }
    .title-group .crumb-sep { display: none; }
    .title-group .badge { display: none; }
    .user { gap: 4px; }
    .user .btn { padding: 0 9px; font-size: 12px; height: 30px; }
    .user-sep { display: none; }
    .content { padding: 14px 12px 44px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat .value { font-size: 19px; }
    .form-grid { grid-template-columns: 1fr; }
    .kv { grid-template-columns: minmax(88px, 108px) minmax(0, 1fr); }
    .modal { width: calc(100vw - 24px); max-height: 88vh; }
    .toast { top: 70px; right: 12px; }
}

@media (max-width: 900px) {
    .login-shell { grid-template-columns: 1fr; width: 460px; }
    .login-hero { padding: 26px 26px 22px; border-right: none; border-bottom: 1px solid var(--line); }
    .hero-title { margin: 18px 0 8px; font-size: 21px; }
    .hero-list { display: none; }
    .hero-foot { display: none; }
    .login-card { padding: 26px 26px 30px; }
}

@media (max-width: 560px) {
    .stats { grid-template-columns: 1fr; }
    .login-wrap { padding: 14px; }
    .login-hero { display: none; }
    .login-card { padding: 26px 22px; }
    .captcha-img { width: 104px; flex-basis: 104px; }
    /* 窄屏下键值对改为上下排列，长密钥可获得整行宽度 */
    .kv { grid-template-columns: 1fr; gap: 3px 0; }
    .kv .k { margin-top: 9px; }
    .kv .k:first-child { margin-top: 0; }
    .user .btn.ghost { padding: 0 8px; }
    .avatar { width: 28px; height: 28px; flex-basis: 28px; font-size: 11.5px; }
    .fab-refresh { width: 42px; height: 42px; right: 14px; bottom: 16px; }
    .card-head { padding: 13px 14px; }
    .card-body { padding: 14px; }
    td, thead th { padding: 10px 12px; }
    .pager { padding: 10px 14px; }
}

/* ---------------- 门户页 ---------------- */
.portal-wrap {
    min-height: 100vh;
    padding: 52px 24px;
    background:
        radial-gradient(900px 480px at 16% 0%, rgba(59, 99, 246, .09), transparent 62%),
        radial-gradient(760px 460px at 92% 100%, rgba(10, 145, 182, .07), transparent 62%),
        var(--bg);
}
.portal-head {
    max-width: 1040px;
    margin: 0 auto 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.portal-grid { max-width: 1040px; margin: 0 auto; display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.portal-card {
    display: block;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 24px;
    color: var(--text);
    box-shadow: var(--shadow-xs);
    transition: border-color .18s, transform .18s, box-shadow .18s;
}
.portal-card:hover {
    text-decoration: none;
    border-color: var(--primary-line);
    transform: translateY(-2px);
    box-shadow: 0 20px 40px -26px rgba(59, 99, 246, .45);
}
.portal-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--cyan));
    color: #fff;
    font-weight: 700;
    margin-bottom: 14px;
}
.portal-card h2 { margin: 0 0 6px; font-size: 16px; color: var(--text); }
.portal-card p { margin: 0 0 14px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.portal-link { color: var(--primary); font-size: 12.5px; }
.portal-foot { max-width: 1040px; margin: 24px auto 0; color: var(--muted); font-size: 12px; text-align: center; }

@media (max-width: 720px) {
    .portal-grid { grid-template-columns: 1fr; }
    .portal-head { flex-direction: column; align-items: flex-start; }
}

/* ---------------- MTH5 CK 列表：失败原因截断 ---------------- */
.reason-cell {
    display: inline-block;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    color: var(--muted);
}
.reason-cell:hover { color: var(--primary); }
.reason-cell.expanded {
    white-space: normal;
    max-width: min(520px, 46vw);
    overflow-wrap: anywhere;
    color: var(--text);
}
.mth5-ck-compact table { font-size: 12px; }
.mth5-ck-compact th,
.mth5-ck-compact td { padding: 6px 10px; line-height: 1.35; white-space: nowrap; }
.mth5-ck-compact th { padding: 8px 10px; }
/* 行内操作按钮与标签一起收紧，缩短 CK 列表行高 */
.mth5-ck-compact .btn.sm { height: 24px; padding: 0 8px; font-size: 11.5px; border-radius: 7px; }
.mth5-ck-compact .ops { gap: 4px; }
.mth5-ck-compact .tag { padding: 1px 7px; font-size: 11px; }
.mth5-ck-compact .mono { font-size: 11px; }
.mth5-ck-compact td .reason-cell { max-width: 260px; }
