/* 圣杯远程显示 · 授权管理后台 —— 深蓝风格（参考图配色） */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #100d06;
    --bg-top: #241c08;
    --panel: #191408;
    --panel-2: #221b0b;
    --panel-3: #2b220e;
    --panel-border: #8a6a1c;
    --line: #4a3810;
    --cyan: #e8b94a;
    --cyan-strong: #c8912a;
    --cyan-dim: rgba(232, 185, 74, .16);
    --gold: #f7d774;
    --gold-dim: rgba(247, 215, 116, .16);
    --red: #ff7b6b;
    --green: #43e89a;
    --orange: #ffb066;
    --text: #f2ead2;
    --text-strong: #fffaf0;
    --text-dim: #b6a878;
    --input-bg: #171206;
    --input-border: #6b5216;
    --shadow: 0 2px 12px rgba(0, 0, 0, .55);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, .68);
    --font-num: 'Consolas', 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Segoe UI', sans-serif;
    background: var(--bg);
    background-image:
        radial-gradient(1100px 540px at 12% -8%, rgba(196, 148, 38, .30), transparent 62%),
        radial-gradient(900px 460px at 94% 4%, rgba(150, 112, 26, .34), transparent 60%),
        linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 46%);
    background-attachment: fixed;
    color: var(--text);
    font-size: 14px;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ---------- 顶栏（品牌 + 右上角菜单） ---------- */
.topbar {
    position: fixed;
    left: 0; right: 0; top: 0;
    height: 60px;
    background: rgba(26, 21, 8, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 20px;
    z-index: 40;
    box-shadow: 0 2px 14px rgba(8, 6, 2, .45);
}
.brand-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.logo-box {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--cyan), #fae6ab);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 12px rgba(232, 185, 74, .45);
    flex-shrink: 0;
}
.logo-box svg { width: 19px; height: 19px; fill: #2c2209; }
.brand {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .5px;
    color: var(--text-strong);
    white-space: nowrap;
}

/* ---------- 右上角菜单 ---------- */
.topnav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    min-width: 0;
}
.topnav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    color: var(--text-dim);
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
    transition: .18s;
}
.topnav a:hover { color: var(--cyan); background: var(--cyan-dim); }
.topnav a.active {
    color: #241a05;
    background: linear-gradient(135deg, var(--cyan), #f5d98f);
    border-color: var(--cyan);
    font-weight: 600;
    box-shadow: 0 3px 14px rgba(232, 185, 74, .42);
}
.topnav a.active:hover { background: #f5d98f; color: #241a05; }
.topnav svg { width: 16px; height: 16px; fill: currentColor; flex-shrink: 0; }
.topnav .badge {
    position: absolute;
    top: -3px; right: -2px;
    min-width: 16px; height: 16px; padding: 0 4px;
    background: var(--red); color: #fff;
    font-size: 10px; font-style: normal; line-height: 16px; text-align: center;
    border-radius: 9px; font-family: var(--font-num);
}
.topnav .badge-gray { background: #5d7ba6; }
.topnav-sep {
    width: 1px; height: 22px;
    background: var(--panel-border);
    margin: 0 8px;
    flex-shrink: 0;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.user { color: var(--text-dim); font-size: 13px; white-space: nowrap; }
.user strong { color: var(--cyan); }

/* ---------- 主内容区 ---------- */
.main-wrap {
    padding: 78px 20px 40px;
    position: relative;
    z-index: 1;
}
.container { max-width: 1440px; margin: 0 auto; }

/* ---------- 统计卡片 ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 18px;
}
.stat-card {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    padding: 18px 18px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: .2s;
}
.stat-card:hover { border-color: rgba(232, 185, 74, .50); box-shadow: 0 6px 22px rgba(8, 6, 2, .50); }
.stat-card.stat-warn   { border-left: 3px solid var(--orange); }
.stat-card.stat-danger { border-left: 3px solid var(--red); }
.stat-card.stat-gold   { border-left: 3px solid var(--gold); }
.stat-card:not(.stat-warn):not(.stat-danger):not(.stat-gold) { border-left: 3px solid var(--cyan); }

.stat-icon {
    position: absolute;
    top: 16px; right: 16px;
    width: 34px; height: 34px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: var(--cyan-dim);
    color: var(--cyan);
}
.stat-card.stat-warn .stat-icon   { background: rgba(255, 159, 67, .16); color: var(--orange); }
.stat-card.stat-danger .stat-icon { background: rgba(255, 107, 107, .16); color: var(--red); }
.stat-card.stat-gold .stat-icon   { background: var(--gold-dim); color: var(--gold); }
.stat-icon svg { width: 19px; height: 19px; fill: currentColor; }

.stat-label {
    color: var(--text-dim);
    font-size: 13px;
    margin-bottom: 6px;
}
.stat-value {
    font-family: var(--font-num);
    font-size: 30px;
    font-weight: 700;
    color: var(--text-strong);
}
.stat-card.stat-warn .stat-value   { color: var(--orange); }
.stat-card.stat-danger .stat-value { color: var(--red); }
.stat-card.stat-gold .stat-value   { color: var(--gold); }

/* ---------- 内容面板 ---------- */
.panel {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    padding: 18px;
    box-shadow: var(--shadow);
    position: relative;
}
.panel-title {\n    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-strong);
    margin-bottom: 12px;
    padding-left: 10px;
    border-left: 3px solid var(--cyan);
}
.panel-title.gold { border-left-color: var(--gold); }

/* ---------- 工具栏 ---------- */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.search-box { display: flex; gap: 8px; }
.search-box input {
    width: 240px;
    padding: 9px 13px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    color: var(--text);
    outline: none;
    font-size: 13px;
}
.search-box input::placeholder { color: #5a83b5; }
.search-box input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(232, 185, 74, .18); }

/* 表格/工具栏里的下拉框统一 */
select.sel, .data-table select {
    padding: 6px 9px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 6px;
    color: var(--text);
    font-size: 12px;
    outline: none;
}
select.sel:focus, .data-table select:focus { border-color: var(--cyan); }
select.sel option, .data-table select option { background: var(--panel); color: var(--text); }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    background: var(--panel-3);
    color: #c4ddf7;
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
    transition: .18s;
    line-height: 1.4;
}
.btn:hover { border-color: var(--cyan); color: var(--cyan); background: #01457e; }
.btn svg { width: 14px; height: 14px; fill: currentColor; }
.btn-primary {
    background: linear-gradient(135deg, var(--cyan), #f5d98f);
    color: #241a05;
    border-color: transparent;
    font-weight: 600;
}
.btn-primary:hover { background: #f5d98f; border-color: transparent; color: #241a05; }
.btn-danger {
    color: var(--red);
    border-color: rgba(255, 107, 107, .42);
    background: rgba(255, 107, 107, .10);
}
.btn-danger:hover { background: rgba(255, 107, 107, .20); border-color: var(--red); color: var(--red); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-block { width: 100%; }

/* ---------- 表格 ---------- */
.table-wrap {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
/* 表格超宽时只在表格内部横滚，不撑破卡片 */
.table-scroll { width: 100%; overflow-x: auto; }
.table-scroll::-webkit-scrollbar { height: 8px; }
.table-scroll::-webkit-scrollbar-thumb { background: #0d5a8f; border-radius: 4px; }
.table-scroll::-webkit-scrollbar-thumb:hover { background: #1378b8; }
.table-scroll::-webkit-scrollbar-track { background: #01204a; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
    padding: 11px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.data-table th {
    background: var(--panel-2);
    color: #e5c67e;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 1px solid var(--panel-border);
}
.data-table tr:hover td { background: rgba(232, 185, 74, .08); }
.data-table .empty { text-align: center; color: var(--text-dim); padding: 40px 0; white-space: normal; }
/* 备注列：最多两行，超出省略，不撑宽表格 */
.data-table td.wrap-ok {
    white-space: normal;
    max-width: 150px;
    min-width: 90px;
    line-height: 1.5;
    word-break: break-word;
}
/* 操作列：按钮不换行，右对齐贴边 */
.data-table td.op-cell { white-space: nowrap; text-align: right; }
.data-table td.op-cell .btn { margin-left: 4px; }

.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 11px;
    font-size: 12px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.tag-mt4 { background: rgba(232, 185, 74, .16); color: #f0cf87; border-color: rgba(232, 185, 74, .34); }
.tag-mt5 { background: rgba(46, 224, 138, .16);  color: #4fe6a0; border-color: rgba(46, 224, 138, .34); }
.tag-both { background: rgba(212, 175, 55, .18);  color: #e8c76a; border-color: rgba(212, 175, 55, .38); }
.tag-ok { background: rgba(46, 224, 138, .16);  color: #4fe6a0; border-color: rgba(46, 224, 138, .34); }
.tag-warn { background: rgba(255, 159, 67, .16); color: #ffb066; border-color: rgba(255, 159, 67, .34); }
.tag-expired { background: rgba(255, 107, 107, .16); color: #ff8a8a; border-color: rgba(255, 107, 107, .34); }
.tag-ea { background: rgba(224, 196, 122, .16); color: #ecd594; border-color: rgba(224, 196, 122, .30); }

.muted { color: var(--text-dim); }

/* 账户资金监控：盈利红 / 亏损绿（中国习惯） */
.profit-up { color: var(--red); font-weight: 700; }
.profit-down { color: var(--green); font-weight: 700; }

/* ---------- 弹窗 ---------- */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(12, 9, 3, .74);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.modal-mask[hidden] { display: none !important; }
.modal {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    width: 440px;
    max-width: calc(100vw - 32px);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    position: relative;
}
.modal h2 {
    font-size: 17px;
    margin-bottom: 18px;
    color: var(--text-strong);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* 续期时长 / 到期时间 档位按钮组（左对齐，五档平分） */
.ext-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}
.ext-opt, .exp-opt {
    padding: 8px 4px;
    font-size: 13px;
    white-space: nowrap;
}
.ext-opt:hover, .exp-opt:hover { border-color: var(--cyan); color: var(--gold); }
.ext-opt.on, .exp-opt.on {
    background: var(--cyan-dim);
    border-color: var(--cyan);
    color: var(--gold);
    box-shadow: inset 0 0 0 1px var(--cyan);
}
.modal-tip { color: var(--text-dim); font-size: 12px; margin-top: 6px; line-height: 1.6; }

/* ---------- 表格上方工具条 ---------- */
.tb-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 0 12px 2px;
    flex-wrap: wrap;
}

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 15px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #e5c67e;
    font-weight: 500;
    font-size: 13px;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    color: var(--text);
    font-size: 13px;
    outline: none;
    font-family: inherit;
}
.form-group textarea { resize: vertical; min-height: 78px; }
.form-group input::placeholder, .form-group textarea::placeholder { color: #5a83b5; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(232, 185, 74, .18);
}
.form-group input[readonly] { background: #011f4d; color: var(--cyan); }

/* ---------- 提示 ---------- */
.alert {
    padding: 11px 15px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 13px;
    border: 1px solid transparent;
}
.alert-error { background: rgba(255, 107, 107, .13); color: #ff9a9a; border-color: rgba(255, 107, 107, .32); }
.alert-success { background: rgba(46, 224, 138, .13); color: #4fe6a0; border-color: rgba(46, 224, 138, .32); }
.alert-warn { background: rgba(255, 159, 67, .13); color: #ffb066; border-color: rgba(255, 159, 67, .32); }

/* ---------- 登录页 ---------- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(900px 520px at 20% 10%, rgba(214, 164, 46, .34), transparent 60%),
        radial-gradient(760px 460px at 88% 88%, rgba(140, 104, 22, .38), transparent 60%),
        linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 55%);
}
.login-box {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 34px 32px;
    width: 380px;
    max-width: calc(100vw - 32px);
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.login-box h1 { font-size: 21px; color: var(--text-strong); margin-bottom: 6px; }
.login-sub { color: var(--text-dim); margin-bottom: 24px; font-size: 13px; }
.login-box .form-group { text-align: left; }

/* ---------- 响应式 ---------- */
@media (max-width: 1240px) {
    .topnav a span { display: none; }        /* 窄屏只留图标 */
    .topnav a { padding: 0 10px; }
}
@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
    .brand { display: none; }
    .user { display: none; }
    .main-wrap { padding: 74px 12px 32px; }
    .stats-grid { grid-template-columns: 1fr; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .search-box input { width: 100%; }
}
