/* ============================================================
   总后台 · layui 主题（蓝色）
   合伙人后台加载同一份结构样式后，由 partner.css 覆盖 --theme 等变量
   ============================================================ */

* { box-sizing: border-box; }

:root {
    --theme: #1e9fff;
    --theme-dark: #1677cc;
    --theme-soft: #e8f4ff;
    --theme-line: #b8dcff;
    --danger: #ff5722;
    --warning: #ffb800;
    --success: #16b777;
    --text: #333;
    --muted: #8c8c8c;
    --line: #e6e6e6;
    --bg: #f2f6fa;
    --side-bg: #0f2740;
    --side-soft: #17395c;
    --radius: 6px;
}

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

a { color: var(--theme-dark); text-decoration: none; }
a:hover { text-decoration: none; }

/* ---------- 登录页 ---------- */
.admin-login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0b2540 0%, #14548f 55%, #1e9fff 100%);
}

.admin-login-wrap { width: 100%; max-width: 430px; padding: 24px; }

.admin-login-card {
    border-radius: 10px;
    box-shadow: 0 24px 60px rgba(8, 30, 55, .38);
    border: none;
}
.admin-login-card .layui-card-body { padding: 36px 34px 26px; }

.admin-login-brand { text-align: center; margin-bottom: 26px; }
.admin-login-logo {
    width: 54px; height: 54px; margin: 0 auto 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--theme-dark), var(--theme));
    color: #fff; font-size: 25px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.admin-login-brand h1 { margin: 0 0 6px; font-size: 19px; color: var(--text); }
.admin-login-brand p { margin: 0; color: var(--muted); font-size: 13px; }

.admin-login-form { display: flex; flex-direction: column; gap: 16px; }
.admin-form-item { display: flex; flex-direction: column; gap: 6px; }
.admin-form-item label { color: #5c6673; font-size: 13px; }
.admin-form-item .layui-input { height: 42px; line-height: 42px; border-radius: var(--radius); }
.admin-login-error { min-height: 18px; color: var(--danger); font-size: 13px; }
.admin-login-foot { margin: 20px 0 0; text-align: center; color: #a6adb5; font-size: 12px; }

/* ---------- 框架外壳 ---------- */
.admin-header {
    height: 60px;
    background: linear-gradient(90deg, var(--theme-dark), var(--theme));
    box-shadow: 0 1px 6px rgba(8, 30, 55, .18);
}
.admin-header .layui-nav { background: transparent; }
.admin-header .layui-nav-item > a { color: #fff; }
.admin-header .layui-nav-item > a:hover { opacity: .85; }
.admin-header .layui-nav-bar { display: none; }

.admin-brand {
    position: absolute; left: 0; top: 0;
    height: 60px; width: 220px;
    display: flex; align-items: center; gap: 10px;
    padding: 0 16px; color: #fff;
    background: rgba(0, 0, 0, .12);
}
.admin-brand-mark {
    width: 36px; height: 36px; border-radius: 10px;
    background: rgba(255, 255, 255, .18);
    color: #fff; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.admin-brand strong { display: block; font-size: 14px; color: #fff; }
.admin-brand small { display: block; color: rgba(255, 255, 255, .75); font-size: 12px; margin-top: 2px; }

.admin-side {
    top: 60px; bottom: 0; width: 220px;
    background: var(--side-bg);
}
.admin-nav.layui-nav { background: var(--side-bg); padding: 10px 0 30px; }
.admin-nav.layui-nav-tree .layui-nav-item > a {
    color: #c6d8ea; height: 42px; line-height: 42px; font-size: 13.5px;
}
.admin-nav.layui-nav-tree .layui-nav-item > a:hover { background: var(--side-soft); color: #fff; }
.admin-nav.layui-nav-tree .layui-nav-child > dd > a {
    color: #a9c1d8; padding-left: 42px; font-size: 13px;
}
.admin-nav.layui-nav-tree .layui-nav-child > dd > a:hover { background: var(--side-soft); color: #fff; }
.admin-nav.layui-nav-tree .layui-nav-child > dd.layui-this > a,
.admin-nav.layui-nav-tree .layui-nav-child > dd.layui-this > a:hover,
.admin-nav.layui-nav-tree .layui-nav-item.layui-this > a {
    background: var(--theme); color: #fff;
}
.admin-nav.layui-nav-tree .layui-nav-bar { background: var(--theme); }
.admin-nav.layui-nav-tree .layui-nav-more { border-top-color: #8fb0cd; }
.admin-nav.layui-nav-tree .layui-nav-itemed > a .layui-nav-more { border-bottom-color: #8fb0cd; }

.admin-body { left: 220px; background: var(--bg); }
.admin-page { padding: 18px 20px 44px; }
.admin-page-title { font-size: 18px; font-weight: 600; margin: 2px 0 16px; color: #26374a; }
.admin-loading { padding: 48px 0; text-align: center; color: var(--muted); }

/* ---------- 卡片与工具栏 ---------- */
.card {
    background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius); padding: 18px;
    margin-bottom: 16px;
}
.card-title { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.card-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px; gap: 12px; flex-wrap: wrap;
}
.card-head h3 { margin: 0; font-size: 15px; font-weight: 600; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.toolbar .field { margin: 0; }
.toolbar-right { margin-left: auto; display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }

/* ---------- 表单控件（layui 风格） ---------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 130px; }
.field > span { color: var(--muted); font-size: 12px; }
.field input, .field select, .field textarea {
    border: 1px solid #d9d9d9; border-radius: 2px; padding: 0 10px;
    font-size: 13px; color: var(--text); background: #fff; outline: none;
    height: 36px; min-height: 36px; line-height: 34px;
}
.field textarea { height: 86px; min-height: 86px; line-height: 1.6; padding: 8px 10px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--theme); box-shadow: 0 0 0 3px rgba(30, 159, 255, .12);
}
.field input[readonly] { background: #f7f8fa; color: var(--muted); }
.field-wide { min-width: 200px; flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { margin-top: 18px; display: flex; gap: 10px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- 缩略图上传与裁剪 ---------- */
.thumb-uploader { display: flex; gap: 14px; align-items: flex-start; }
.thumb-preview {
    width: 96px; height: 96px; flex: 0 0 96px;
    border: 1px dashed #d9d9d9; border-radius: 4px; background: #fafbfc;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.thumb-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-preview .hint { padding: 0 6px; text-align: center; line-height: 1.5; }
.thumb-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.thumb-actions .hint { margin: 0; }
.crop-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.crop-stage {
    position: relative; overflow: hidden; background: #111;
    user-select: none; touch-action: none;
}
.crop-stage img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    display: block; pointer-events: none;
}
.crop-box {
    position: absolute; box-sizing: border-box;
    border: 2px solid #fff; cursor: move;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55), 0 0 0 1px rgba(0, 0, 0, .25) inset;
}
.crop-handle {
    position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px;
    background: #fff; border: 2px solid var(--theme); border-radius: 2px;
    cursor: nwse-resize;
}
.crop-wrap .hint { margin: 0; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    border: 1px solid #d9d9d9; border-radius: 2px; padding: 0 15px; height: 36px;
    font-size: 13px; cursor: pointer; background: #fff; color: var(--text);
    line-height: 34px; white-space: nowrap; vertical-align: middle;
    transition: all .15s ease;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--theme); border-color: var(--theme); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--theme-dark); border-color: var(--theme-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #e64a19; border-color: #e64a19; }
.btn-outline { border-color: #d9d9d9; color: var(--text); }
.btn-outline:hover:not(:disabled) { border-color: var(--theme); color: var(--theme-dark); }
.btn-ghost { border-color: transparent; color: var(--muted); background: transparent; }
.btn-ghost:hover { color: var(--theme-dark); }
.btn-sm { height: 30px; line-height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; height: 42px; font-size: 15px; }
.btn-link { border: none; background: none; padding: 0 6px; color: var(--theme-dark); cursor: pointer; font-size: 13px; line-height: inherit; height: auto; }
.btn-link.danger { color: var(--danger); }
.btn-link:hover { color: var(--theme); }
.link { color: var(--theme-dark); cursor: pointer; }
.link:hover { color: var(--theme); text-decoration: underline; }
.btn[disabled] { pointer-events: none; }

/* ---------- 表格（layui-table 基础上补齐） ---------- */
.table-wrap {
    overflow-x: auto; border-radius: var(--radius);
}
.table-wrap .layui-table { margin: 0; }
.table-wrap .layui-table th, .table-wrap .layui-table td { white-space: nowrap; }
.table-wrap .layui-table th { background: #f7f9fb; color: #3b4a5a; font-weight: 600; }
.table-wrap .layui-table tbody tr:hover { background: #f2f9ff; }
.table-wrap .layui-table td.wrap, .table-wrap .layui-table th.wrap { white-space: normal; min-width: 180px; }
.table-empty { padding: 48px 0; text-align: center; color: var(--muted); }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.table th, table.table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.table th { background: #f9fafb; color: #374151; font-weight: 600; }
table.table tbody tr:hover { background: #f8fafc; }
table.table tbody tr:last-child td { border-bottom: none; }
table.table td.wrap, table.table th.wrap { white-space: normal; min-width: 180px; }

/* ---------- 标签 ---------- */
.badge {
    display: inline-block; padding: 0 8px; border-radius: 2px;
    font-size: 12px; line-height: 20px; background: var(--theme-soft); color: var(--theme-dark);
}
.badge-green { background: #e8faf1; color: #0f9d63; }
.badge-red { background: #ffefe9; color: #e64a19; }
.badge-amber { background: #fff8e3; color: #b98600; }
.badge-gray { background: #f2f2f2; color: #757575; }
.badge-blue { background: #e8f4ff; color: #1677cc; }
.layui-badge { border-radius: 2px; }
.type-1 { color: #1677cc; } .type-2 { color: #0f9d63; } .type-3 { color: #16b777; }
.type-4 { color: #0284c7; } .type-5 { color: #b98700; }

/* ---------- 选项卡 ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab {
    padding: 9px 16px; cursor: pointer; border: none; background: none;
    color: var(--muted); font-size: 13.5px; border-bottom: 2px solid transparent;
}
.tab.active { color: var(--theme-dark); border-bottom-color: var(--theme); font-weight: 600; }

/* ---------- 分页（laypage） ---------- */
.admin-pager { display: flex; justify-content: flex-end; padding: 14px 0 2px; }
.admin-pager .layui-laypage { margin: 0; }
.admin-pager .layui-laypage a,
.admin-pager .layui-laypage span,
.admin-pager .layui-laypage input,
.admin-pager .layui-laypage select { border-radius: 2px; }
.admin-pager .layui-laypage .layui-laypage-curr .layui-laypage-em { background: var(--theme); }

/* ---------- 数据看板 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat-card .label { color: var(--muted); font-size: 12.5px; }
.stat-card .value { margin-top: 8px; font-size: 23px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-card .sub { margin-top: 4px; color: #a6adb5; font-size: 12px; }
.stat-card.accent .value { color: var(--theme-dark); }
.stat-card.success .value { color: var(--success); }
.stat-card.warn .value { color: var(--warning); }
.stat-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* 工作台：返现 7 列与趋势/提现两栏 */
.ret-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.ret-cell { background: #f7f9fb; border-radius: 4px; padding: 12px 10px; text-align: center; }
.ret-cell .label { color: var(--muted); font-size: 12px; }
.ret-cell .value { margin-top: 6px; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ret-cell .value.success { color: var(--success); }
.ret-cell .value.accent { color: var(--theme-dark); }
.ret-cell .value.warn { color: var(--warning); }
.ret-cell .value.muted { color: #6b7280; }

.dash-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.dash-row > .card { margin-bottom: 16px; }
.settle-block { margin-bottom: 14px; }
.settle-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; color: #5c6673; font-size: 13px; line-height: 2; }
.settle-line b { color: #26374a; font-size: 16px; font-variant-numeric: tabular-nums; }
.settle-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.team-names { color: #26374a; font-size: 14px; line-height: 1.9; word-break: break-all; }

/* 提现页：余额卡片、停用横幅 */
.bal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.bal-card { margin-bottom: 0; }
.bal-card .lab { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.bal-card .num { margin-top: 10px; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bal-card .num.accent { color: var(--theme-dark); }
.bal-card .note { margin-top: 6px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.api-tag { display: inline-block; padding: 0 6px; border-radius: 2px; background: #f2f2f2; color: #8c8c8c; font-size: 11px; line-height: 18px; font-weight: 400; }
.warn-banner { margin: 0 0 12px; padding: 10px 14px; background: #fff7e6; border: 1px solid #ffd591; border-radius: 4px; font-size: 13px; line-height: 1.7; color: #ad6800; }
.alert-banner { margin: 0 0 16px; padding: 10px 14px; background: #fff1f0; border: 1px solid #ffccc7; border-radius: 4px; font-size: 13px; line-height: 1.7; color: #cf1322; }
.alert-banner a { color: #cf1322; font-weight: 600; text-decoration: underline; }

@media (max-width: 860px) {
    .bal-grid { grid-template-columns: minmax(0, 1fr); }
}
.text-danger { color: var(--danger); }
.text-muted { color: var(--muted); }

@media (max-width: 1100px) {
    .stat-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ret-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .dash-row { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
    .stat-grid.four, .ret-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.chart { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding: 10px 4px 0; }
.chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart .bar { width: 100%; max-width: 42px; background: linear-gradient(180deg, #7cc6ff, var(--theme)); border-radius: 3px 3px 0 0; min-height: 2px; }
.chart .bar-label { color: var(--muted); font-size: 11px; white-space: nowrap; }

/* ---------- 弹层（layui layer） ---------- */
.layui-layer.admin-layer { border-radius: 8px; overflow: hidden; }
.layui-layer.admin-layer .layui-layer-title { background: #fff; border-bottom: 1px solid var(--line); color: #26374a; font-weight: 600; }
.admin-layer-body { padding: 18px 20px; max-height: 68vh; overflow-y: auto; }
.admin-layer-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: #fff; }
.admin-layer-foot .btn { min-width: 72px; }
.modal-text { margin: 0; color: var(--text); line-height: 1.7; }

.json-box {
    background: #0f172a; color: #e2e8f0; border-radius: 6px;
    padding: 16px; font-family: Consolas, Monaco, monospace; font-size: 12.5px;
    line-height: 1.6; white-space: pre-wrap; word-break: break-all; max-height: 50vh; overflow: auto;
}
.sn-list { display: flex; flex-wrap: wrap; gap: 6px; }
.sn-list code { background: #f3f4f6; border: 1px solid var(--line); border-radius: 4px; padding: 2px 7px; font-size: 12.5px; }

/* ---------- 其他 ---------- */
.loading { padding: 50px 0; text-align: center; color: var(--muted); }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.mono { font-family: Consolas, Monaco, monospace; }
.nowrap { white-space: nowrap; }
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; }
.hidden-input { display: none; }
.ti-sns { height: 140px; min-height: 140px; font-family: Consolas, Monaco, monospace; }
.row-actions { display: flex; gap: 2px; flex-wrap: wrap; }
.row-actions .hint { margin-left: 6px; }
.cell-ellipsis { display: inline-block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.checkbox-line { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.checkbox-line input { width: 15px; height: 15px; accent-color: var(--theme); }
.weekdays { display: flex; flex-wrap: wrap; gap: 12px; }
.detail-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.detail-head .back { color: var(--muted); cursor: pointer; font-size: 13px; }
.section-title { font-size: 14px; font-weight: 600; margin: 20px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.kv { background: #f7f9fb; border-radius: 4px; padding: 10px 12px; }
.kv .k { color: var(--muted); font-size: 12px; }
.kv .v { margin-top: 4px; font-size: 13.5px; word-break: break-all; }
.radio-line { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.secret-status { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.secret-status:last-child { border-bottom: none; }
.third-service-table input,
.third-service-table select { width: 100%; min-width: 130px; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--text); font-size: 13px; }
.third-service-table input:focus,
.third-service-table select:focus { border-color: var(--theme); outline: none; }
.third-service-table [data-third-field="name"] { margin-bottom: 4px; font-weight: 600; }

@media (max-width: 860px) {
    .admin-brand { width: 190px; }
    .admin-side { width: 190px; }
    .admin-body { left: 190px; }
    .admin-page { padding: 14px; }
    .form-grid { grid-template-columns: 1fr 1fr; }
}
