/* ==========================================================================
   机主收益看板 · 设计系统
   轻量、无外部依赖：纯 CSS + 内联 SVG（图表由后端生成）
   ========================================================================== */
:root {
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e6ecf5;
  --line-soft: #eef2f8;
  --bg: #f3f6fb;
  --card: #ffffff;
  --brand: #2563eb;
  --brand-2: #4f46e5;
  --brand-soft: #eef4ff;
  --row-alt: #fafcff;
  --row-hover: #f8fbff;
  --ok: #10b981;
  --ok-soft: #e7f8f1;
  --warn: #f59e0b;
  --warn-soft: #fff6e5;
  --danger: #ef4444;
  --danger-soft: #fdecec;
  --side: #0b1224;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 12px rgba(15, 23, 42, .04);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: none; }

/* ---------------------------------------------------------------- 布局 */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; right: auto; width: 244px;
  display: flex; flex-direction: column;
  padding: 22px 16px 16px;
  background:
    radial-gradient(1200px 400px at -10% -20%, rgba(37, 99, 235, .38), transparent 60%),
    radial-gradient(700px 300px at 120% 110%, rgba(99, 102, 241, .28), transparent 60%),
    var(--side);
  color: #cbd5e1;
  border-right: 1px solid rgba(148, 163, 184, .12);
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(140deg, #3b82f6, #6366f1 60%, #8b5cf6);
  color: #fff; font-weight: 700; font-size: 17px;
  box-shadow: 0 8px 18px rgba(59, 130, 246, .35);
}
.brand-name { color: #fff; font-size: 15px; font-weight: 600; letter-spacing: .2px; }
.brand-sub { color: #7c8db3; font-size: 10.5px; letter-spacing: 1.6px; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.nav-label {
  color: #5b6b8c; font-size: 11px; letter-spacing: 1.4px;
  text-transform: uppercase; padding: 12px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 11px;
  color: #b9c6dd; font-size: 13.5px; font-weight: 500;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav-item:hover { background: rgba(148, 163, 184, .1); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, .3), rgba(37, 99, 235, .12));
  color: #fff; box-shadow: inset 0 0 0 1px rgba(96, 165, 250, .28);
}
.nav-item .ico { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav-item.active .ico { opacity: 1; }

.side-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(148, 163, 184, .14); }
.who { display: flex; align-items: center; gap: 10px; padding: 6px 6px 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 13px; font-weight: 600; color: #fff;
  background: linear-gradient(140deg, #64748b, #334155);
}
.who-name { color: #fff; font-size: 13px; font-weight: 600; }
.who-role { color: #7c8db3; font-size: 11px; }
.side-links { display: flex; gap: 8px; }
.side-links a, .side-links button {
  flex: 1; text-align: center; padding: 8px 6px; border-radius: 9px;
  background: rgba(148, 163, 184, .1); color: #c7d3e8; font-size: 12px;
  border: 0; cursor: pointer; font-family: inherit;
}
.side-links a:hover, .side-links button:hover { background: rgba(148, 163, 184, .2); color: #fff; }

.main { flex: 1; margin-left: 244px; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px 30px;
  background: rgba(243, 246, 251, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar h1 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.2px; }
.topbar .sub { color: var(--muted); font-size: 12.5px; }
.topbar .spacer { flex: 1; }

.content { padding: 24px 30px 40px; }

/* ---------------------------------------------------------------- 通用件 */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 550; line-height: 1.5;
  background: var(--brand-soft); color: var(--brand);
}
.pill.on { background: var(--ok-soft); color: #047857; }
.pill.off { background: #f1f5f9; color: var(--muted); }
.pill.warn { background: var(--warn-soft); color: #b45309; }
.pill.danger { background: var(--danger-soft); color: #b91c1c; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.panel { padding: 20px 22px; }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 650; }
.panel-head .hint { color: var(--muted); font-size: 12px; }
.panel-head .spacer { flex: 1; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }

/* ---------------------------------------------------------------- KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.kpi {
  position: relative; overflow: hidden;
  padding: 18px 20px 16px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.kpi-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi-value {
  margin-top: 8px; font-size: 27px; font-weight: 680; letter-spacing: -.6px;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.kpi-value .unit { font-size: 15px; font-weight: 600; margin-right: 2px; color: var(--muted); }
.kpi-foot { margin-top: 6px; font-size: 12px; color: var(--muted-2); display: flex; gap: 10px; flex-wrap: wrap; }
.kpi .spark { display: block; width: 100%; height: 52px; margin-top: 10px; }

.kpi.hero {
  background: linear-gradient(135deg, #1d4ed8 0%, #4338ca 55%, #6d28d9 100%);
  border-color: transparent; color: #fff; box-shadow: 0 14px 32px rgba(37, 99, 235, .28);
}
.kpi.hero .kpi-label { color: rgba(255, 255, 255, .82); }
.kpi.hero .kpi-value { color: #fff; font-size: 32px; }
.kpi.hero .kpi-value .unit { color: rgba(255, 255, 255, .8); }
.kpi.hero .kpi-foot { color: rgba(255, 255, 255, .74); }
.kpi.hero::after {
  content: ""; position: absolute; right: -40px; top: -60px; width: 180px; height: 180px;
  border-radius: 50%; background: rgba(255, 255, 255, .12);
}
.kpi.hero > * { position: relative; z-index: 1; }

.kpi-flex { display: flex; align-items: center; justify-content: space-between; gap: 14px; }

/* ---------------------------------------------------------------- 图表 */
.chart { display: block; width: 100%; height: auto; }
.c-grid { stroke: var(--line-soft); stroke-width: 1; }
.c-axis { fill: var(--muted-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.c-bar { fill: url(#bg2563eb); opacity: .55; transition: opacity .2s; }
.c-bar:hover { opacity: 1; }
.c-bar-hi { opacity: 1; }
.ring { display: block; }
.ring-bg { stroke: #e8eef8; }
.ring-fg { transition: stroke-dasharray .6s ease; }
.ring-txt { fill: var(--ink); font-size: 17px; font-weight: 660; font-variant-numeric: tabular-nums; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

/* ---------------------------------------------------------------- 表格 */
.table-wrap { overflow-x: auto; margin: 0 -22px -20px; padding: 0 22px 6px; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.data th {
  text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: .4px;
  text-transform: uppercase; color: var(--muted-2);
  padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #f8fbff; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
table.data .muted { color: var(--muted); font-weight: 500; }

.mname { font-weight: 600; color: var(--ink); }
.mid { color: var(--muted-2); font-size: 11.5px; letter-spacing: .4px; font-variant-numeric: tabular-nums; }

.bar-line { position: relative; width: 96px; height: 7px; border-radius: 999px; background: #edf2fa; overflow: hidden; }
.bar-line > span { position: absolute; top: 0; bottom: 0; left: 0; right: auto; border-radius: 999px;
  background: linear-gradient(90deg, #3b82f6, #6366f1); }
.bar-line.full > span { background: linear-gradient(90deg, #10b981, #059669); }
.bar-cap { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }

/* 总收益看板：百万净利润进度条 */
.meter { height: 10px; border-radius: 999px; background: #edf2fa; overflow: hidden; margin: 10px 0 6px; }
.meter > i { display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #7c3aed); }
.meter-cap { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
html[data-theme="dark"] .meter { background: #1f2a3d; }

/* ---------------------------------------------------------------- 机主端卡片 */
.machine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.machine {
  position: relative; padding: 18px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.machine:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #d8e3f6; }
.machine-top { display: flex; align-items: flex-start; gap: 12px; }
.machine-title { min-width: 0; }
.machine-title h3 { margin: 0; font-size: 14.5px; font-weight: 640; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.machine-title .meta { color: var(--muted-2); font-size: 11.5px; letter-spacing: .5px; margin-top: 2px; }
.machine-money { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.money-box { background: #f7faff; border: 1px solid var(--line-soft); border-radius: 12px; padding: 10px 12px; }
.money-box .lb { color: var(--muted); font-size: 11.5px; }
.money-box .vl { font-size: 19px; font-weight: 660; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.money-box .vl small { font-size: 12px; font-weight: 600; color: var(--muted); margin-right: 2px; }
.money-box.today .vl { color: var(--brand); }
.machine-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted);
}
.gpu-track { height: 7px; border-radius: 999px; background: #edf2fa; overflow: hidden; margin-top: 10px; }
.gpu-track > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #3b82f6, #22d3ee); }
.gpu-track.full > span { background: linear-gradient(90deg, #10b981, #34d399); }

/* ---------------------------------------------------------------- 表单/按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 15px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: 13px; font-weight: 550;
  font-family: inherit; cursor: pointer; transition: all .16s ease;
}
.btn:hover { border-color: #cfdcf0; background: #f8fbff; }
.btn.primary {
  background: linear-gradient(135deg, #2563eb, #4f46e5); color: #fff;
  border-color: transparent; box-shadow: 0 6px 16px rgba(37, 99, 235, .26);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger { color: #b91c1c; border-color: #f4cccc; background: #fff7f7; }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn.ack { background: #10b981; border-color: #10b981; color: #fff; }
.btn.ack:hover { filter: brightness(1.06); background: #10b981; }
.btn.done { background: #e2e8f0; border-color: #e2e8f0; color: #94a3b8; cursor: default; }
html[data-theme="dark"] .btn.done { background: #1f2a3d; border-color: #2a3550; color: #64748b; }
.ack-note { margin: 16px 0 0; padding: 10px 14px; border-radius: 10px; font-size: 13px;
  color: #b45309; background: var(--warn-soft); border-left: 3px solid #f59e0b; }
html[data-theme="dark"] .ack-note { color: #fbbf24; }
.ack-table td.mach { min-width: 132px; }
.mach-line { line-height: 1.25; }
.mach-spec { color: var(--muted-2); font-size: 11.5px; line-height: 1.35; letter-spacing: .2px; }
.ack-table td.reason { min-width: 168px; }
.ack-table td.status { min-width: 108px; white-space: nowrap; }
.ack-table td.nowrap { white-space: nowrap; }
.ack-table td { word-break: normal; overflow-wrap: anywhere; }
.ack-banner { display: flex; align-items: center; gap: 14px; justify-content: space-between;
  padding: 12px 18px; margin: 18px 0; border-left: 3px solid #f59e0b;
  background: linear-gradient(90deg, rgba(245,158,11,.10), transparent 60%); }
.ack-banner .ack-text { min-width: 0; }
.ack-text strong { display: block; font-size: 13.5px; line-height: 1.35; color: var(--ink); margin-bottom: 2px; }
.ack-text span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.ack-banner .btn { flex: none; }
@media (max-width: 640px) {
  .ack-banner { flex-direction: row; align-items: center; padding: 11px 13px; gap: 10px; margin: 14px 0; }
  .ack-banner .btn { padding: 6px 12px; }
}
button.btn-link {
  background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-family: inherit; font-size: 13.5px; outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.input:focus { border-color: #9dbcf5; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form-row > .field { flex: 1; min-width: 140px; }
.help { color: var(--muted-2); font-size: 11.5px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.switch input { width: 16px; height: 16px; accent-color: var(--brand); }

/* ---------------------------------------------------------------- 提示 */
.flash { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.flash-item {
  padding: 10px 14px; border-radius: 11px; font-size: 13px;
  background: var(--brand-soft); color: #1e40af; border: 1px solid #d7e5ff;
}
.flash-item.err { background: var(--danger-soft); color: #b91c1c; border-color: #f6d3d3; }
.flash-item.ok { background: var(--ok-soft); color: #047857; border-color: #cdeee1; }
.notice-inline { padding: 10px 14px; border-radius: 11px; font-size: 13px; margin-bottom: 16px; }
.notice-inline.ok { background: var(--ok-soft); color: #047857; }
.notice-inline.err { background: var(--danger-soft); color: #b91c1c; }
.notice-inline.info { background: var(--brand-soft); color: #1e40af; }

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; background: #f4f7fc; border: 1px solid var(--line);
  border-radius: 8px; padding: 2px 7px; color: #334155;
}

.empty {
  text-align: center; padding: 46px 20px; color: var(--muted);
  border: 1px dashed #d9e3f2; border-radius: var(--radius); background: #fbfdff;
}
.empty strong { display: block; color: var(--ink-2); font-size: 14px; margin-bottom: 6px; }
.empty .btn { margin-top: 14px; }

/* ---------------------------------------------------------------- 登录 */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: #fff; }
.auth-brand {
  position: relative; overflow: hidden; padding: 56px 60px;
  display: flex; flex-direction: column; justify-content: center;
  background:
    radial-gradient(900px 500px at 10% 0%, rgba(59, 130, 246, .55), transparent 62%),
    radial-gradient(700px 500px at 100% 100%, rgba(139, 92, 246, .5), transparent 60%),
    linear-gradient(150deg, #0b1224, #111d3a 60%, #172554);
  color: #dbe6f7;
}
.auth-brand .glow { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5; }
.auth-brand h2 { font-size: 30px; line-height: 1.3; margin: 22px 0 12px; color: #fff; letter-spacing: -.6px; }
.auth-brand p.lead { margin: 0; color: #a8bad6; font-size: 14px; max-width: 430px; }
.feature-list { list-style: none; padding: 0; margin: 34px 0 0; display: flex; flex-direction: column; gap: 14px; }
.feature-list li { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; color: #c8d6ec; }
.feature-list .tick {
  width: 22px; height: 22px; border-radius: 7px; flex: none; display: grid; place-items: center;
  background: rgba(96, 165, 250, .18); color: #93c5fd; font-size: 12px; font-weight: 700;
}
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #fff; }
.auth-card { width: 100%; max-width: 372px; }
.auth-card h3 { margin: 0 0 6px; font-size: 21px; letter-spacing: -.3px; }
.auth-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.auth-card .field + .field { margin-top: 14px; }
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row .input { flex: 1; }
.captcha-img {
  height: 44px; width: 118px; border-radius: 10px; border: 1px solid var(--line);
  object-fit: cover; cursor: pointer; background: #f7fafc; flex: none;
}
.auth-submit { margin-top: 22px; padding: 12px; font-size: 14px; }
.auth-foot { margin-top: 24px; text-align: center; color: var(--muted-2); font-size: 12px; }

/* ---------------------------------------------------------------- 页脚/杂项 */
.foot-note { color: var(--muted-2); font-size: 11.5px; margin-top: 18px; line-height: 1.7; }
.stat-list { display: flex; flex-direction: column; gap: 12px; }
.stat-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.stat-row .k { color: var(--muted); }
.stat-row .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--line-soft); margin: 14px 0; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px;
  background: #f1f5f9; border: 1px solid var(--line); color: var(--ink-2);
  font-size: 12px; font-weight: 560; text-decoration: none; }
.chip:hover { border-color: #c7d7f2; color: var(--ink); }
.chip.active { background: #2563eb; border-color: #2563eb; color: #fff; }
html[data-theme="dark"] .chip { background: #1f2a3d; border-color: #2a3550; color: #c8d3e3; }
html[data-theme="dark"] .chip.active { background: #2563eb; border-color: #2563eb; color: #fff; }
.owner-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.owner-row:last-child { border-bottom: 0; }
.owner-row .rk {
  width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 700; flex: none;
}
.owner-row .nm { flex: 1; min-width: 0; font-weight: 550; }
.owner-row .nm small { display: block; color: var(--muted-2); font-size: 11.5px; font-weight: 500; }
.owner-row .amt { text-align: right; font-variant-numeric: tabular-nums; font-weight: 640; }
.owner-row .amt small { display: block; color: var(--muted-2); font-size: 11px; font-weight: 500; }
.owner-row .amt { min-width: 96px; }
.owner-row .amt.prev { color: var(--ink-2); }
.owner-row.owner-head { padding: 4px 0 8px; border-bottom: 1px solid var(--line); }
.owner-row.owner-head .nm,
.owner-row.owner-head .amt { color: var(--muted-2); font-size: 11.5px; font-weight: 600; letter-spacing: .2px; }
.pill.down { background: #fdecec; color: #b91c1c; }
.pwd-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 10px 14px; border-radius: 12px;
  background: var(--warn-soft); color: #a16207; font-size: 12.5px;
  border: 1px solid rgba(245, 158, 11, .22);
}
.pwd-banner a { color: #b45309; font-weight: 600; text-decoration: underline; }

.section-title { display: flex; align-items: baseline; gap: 10px; margin: 26px 0 14px; }
.section-title h2 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -.2px; }
.section-title span { color: var(--muted); font-size: 12.5px; }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 1180px) {
  .kpi-grid, .kpi-grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar {
    position: static; width: auto; flex-direction: column; padding: 14px 14px 10px;
    border-right: 0; border-bottom: 1px solid rgba(148, 163, 184, .16);
  }
  .brand { padding: 2px 4px 12px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .nav-label { display: none; }
  .nav-item { white-space: nowrap; padding: 8px 12px; font-size: 13px; }
  .side-foot {
    display: flex; align-items: center; gap: 10px; padding-top: 10px;
    border-top: 1px solid rgba(148, 163, 184, .14);
  }
  .who { padding: 0; flex: 1; }
  .side-links { flex: none; }
  .side-links a, .side-links button { padding: 7px 10px; }
  .main { margin-left: 0; }
  .topbar { padding: 12px 16px; position: static; }
  .content { padding: 16px 16px 32px; }
  .kpi-grid, .kpi-grid.cols-3, .kpi-grid.cols-5 { grid-template-columns: minmax(0, 1fr); }
  .machine-grid { grid-template-columns: minmax(0, 1fr); }
  .auth-wrap { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { padding: 34px 24px; }
  .auth-brand h2 { font-size: 23px; }
  .feature-list { display: none; }
  .table-wrap { margin: 0 -16px; padding: 0 16px 6px; }
}

@media print {
  .sidebar, .topbar { display: none; }
  .main { margin: 0; }
  body { background: #fff; }
}
/* ---------------------------------------------------------------- 头像 */
.avatar-wrap { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex: none;
  box-shadow: 0 0 0 2px rgba(148, 163, 184, .35); }
.avatar-svg, .avatar-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; flex: none;
  box-shadow: 0 0 0 2px var(--line); }
.owner-cell { display: flex; align-items: center; gap: 10px; }
.side-foot .who { text-decoration: none; }

/* ---------------------------------------------------------------- 账号设置 */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.avatar-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 10px; }
.avatar-opt { position: relative; border-radius: 50%; padding: 0; border: 2px solid transparent;
  background: none; cursor: pointer; line-height: 0; transition: transform .15s ease, border-color .15s ease; }
.avatar-opt:hover { transform: translateY(-2px); }
.avatar-opt.is-active { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }
.avatar-opt svg, .avatar-opt img { width: 100%; height: auto; border-radius: 50%; display: block; }

/* ---------------------------------------------------------------- 上机申请 / 审批 */
.host-list { display: flex; flex-direction: column; gap: 16px; }
.host-card { padding: 18px 20px; }
.host-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.host-title { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 650; flex-wrap: wrap; }
.host-sub { color: var(--muted); font-size: 12px; margin-top: 3px; word-break: break-all; }
.host-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }

.spec-table { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.spec-row { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 10px;
  padding: 9px 14px; font-size: 12.8px; border-bottom: 1px solid var(--line-soft); }
.spec-row:last-child { border-bottom: 0; }
.spec-row:nth-child(odd) { background: var(--row-alt); }
.spec-row .sk { color: var(--muted); }
.spec-row .sv { color: var(--ink-2); font-variant-numeric: tabular-nums; word-break: break-word; }

/* 罚没机器选择：深色面一体的勾选列表 */
.pick-list { border: 1px solid var(--line); border-radius: 12px; overflow: auto;
  max-height: 330px; background: var(--card); }
.pick-row { position: relative; display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 13px; cursor: pointer; border-bottom: 1px solid var(--line-soft);
  transition: background .14s ease, box-shadow .14s ease; }
.pick-row:last-child { border-bottom: 0; }
.pick-row:hover { background: var(--row-hover); }
.pick-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.pick-box { flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 5px;
  border: 1.5px solid #cbd5e1; background: #fff; display: inline-flex;
  align-items: center; justify-content: center; transition: background .14s ease, border-color .14s ease; }
.pick-box::after { content: ""; width: 9px; height: 5px; margin-top: -2px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(0); transition: transform .12s ease; }
.pick-row.is-on { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.pick-row.is-on .pick-box { background: var(--brand); border-color: var(--brand); }
.pick-row.is-on .pick-box::after { transform: rotate(-45deg) scale(1); }
.pick-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pick-id { font-size: 12.5px; font-weight: 650; color: var(--ink); letter-spacing: .2px;
  white-space: nowrap; font-variant-numeric: tabular-nums; }
.pick-spec { font-size: 11.8px; color: var(--muted); line-height: 1.4; word-break: break-word; }
html[data-theme="dark"] .pick-box { background: #121a29; border-color: #31405b; }

@media (max-width: 860px) {
  .pick-row { padding: 10px 11px; gap: 9px; }
  .pick-list { max-height: 300px; }
}

@media (max-width: 860px) {
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .spec-row { grid-template-columns: 88px minmax(0, 1fr); padding: 8px 10px; }
}

/* ---------------------------------------------------------------- Logo 与图表交互 */
.brand-logo svg { width: 21px; height: 21px; display: block; color: #fff; }
.brand-logo-lg { width: 46px; height: 46px; border-radius: 14px; }
.brand-logo-lg svg { width: 27px; height: 27px; }
.auth-card h3 { margin-bottom: 18px; }

.ring-box { width: 72px; height: 72px; flex: none; }
.ring-box .ring { width: 100%; height: 100%; }
.ring-box .ring-txt { font-size: 15px; }

.chart .pt { cursor: pointer; }
.chart .pt:hover { opacity: .85; }
.chart-tip {
  position: fixed; z-index: 80; pointer-events: none;
  background: rgba(15, 23, 42, .94); color: #fff;
  padding: 7px 11px; border-radius: 9px; font-size: 12px; line-height: 1.5;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .28); white-space: nowrap;
  transform: translate(-50%, -130%); opacity: 0; transition: opacity .12s ease;
}
.chart-tip.show { opacity: 1; }
.chart-tip b { font-variant-numeric: tabular-nums; }

.avatar-picker.sm { grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 8px; }
.avatar-picker.sm .avatar-opt { border-width: 2px; }
.avatar-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.avatar-opt:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }

/* ---------------------------------------------------------------- 机器级租约 */
.lease-range { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 12.5px; white-space: nowrap; }
.lease-tag { display: inline-block; margin-top: 5px; padding: 1px 8px; border-radius: 999px;
  font-size: 11.5px; background: #eef4ff; color: #1e40af; }
.lease-tag.soon { background: #fff4e5; color: #a35b00; }
.lease-tag.off { background: #f3f4f6; color: #6b7280; }

/* ---------------------------------------------------------------- 机主客服 */
.kefu-fab {
  position: fixed; right: 0; bottom: 72px; z-index: 70;
  display: inline-flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 12px 8px 13px; border-radius: 12px 0 0 12px;
  border: 1px solid rgba(255, 255, 255, .22); border-right: 0;
  background: linear-gradient(160deg, #2563eb, #7c3aed); color: #fff;
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  box-shadow: -8px 12px 28px rgba(37, 99, 235, .30); cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.kefu-fab:hover { transform: translateX(-2px); box-shadow: -12px 14px 32px rgba(37, 99, 235, .36); }
.kefu-fab .ico { width: 18px; height: 18px; flex: none; }
.kefu-fab .label { writing-mode: vertical-rl; letter-spacing: 3px; line-height: 1; }
.kefu-pop {
  position: fixed; right: 48px; bottom: 72px; z-index: 71; width: 196px;
  padding: 12px 13px 11px; text-align: center;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, .20);
}
.kefu-pop[hidden] { display: none; }
.kefu-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.kefu-title { font-size: 13.5px; font-weight: 650; color: var(--ink-2); }
.kefu-close {
  border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1;
  padding: 2px 4px; cursor: pointer;
}
.kefu-close:hover { color: var(--ink-2); }
.kefu-pop img {
  width: 136px; height: 136px; border-radius: 10px; background: #fff;
  border: 1px solid var(--line-soft); display: block; margin: 0 auto;
}
.kefu-note { margin-top: 7px; font-size: 11.5px; color: var(--muted); line-height: 1.5; }

/* ---------------------------------------------------------------- 机主须知 */
.notice-mask {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  width: 100%; height: 100%; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(15, 23, 42, .58);
}
.notice-card {
  width: 100%; max-width: 380px; padding: 22px 22px 18px;
  background: #fff; border-radius: 18px; box-shadow: 0 24px 60px rgba(15, 23, 42, .35);
  max-height: calc(100vh - 40px); overflow: auto;
}
.notice-badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: #fff4e5; color: #a35b00; font-size: 12px; font-weight: 650;
}
.notice-card h3 { margin: 12px 0 8px; font-size: 18px; color: var(--ink); }
.notice-card p { margin: 0 0 16px; font-size: 13.5px; line-height: 1.75; color: var(--ink-2); }
.notice-card .btn { width: 100%; }
body.notice-open { overflow: hidden; }
@media (max-width: 860px) {
  .kefu-fab { right: 0; bottom: 84px; }
  .kefu-pop { right: 44px; bottom: 84px; }
}
@media print { .kefu-fab, .kefu-pop, .notice-mask { display: none !important; } }

/* ---------------------------------------------------------------- 登录信息 */
.login-meta {
  display: flex; flex-direction: column; gap: 7px; padding: 13px 18px; margin-bottom: 16px;
  border-left: 3px solid #2563eb;
}
.lm-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.lm-label { min-width: 86px; font-size: 12px; color: var(--muted); letter-spacing: .3px; }
.lm-value { font-size: 13.5px; color: var(--ink-2); font-weight: 620; }
.lm-value.mono { font-variant-numeric: tabular-nums; letter-spacing: .3px; }
@media (max-width: 860px) {
  .login-meta { padding: 12px 14px; }
}


/* ---------------------------------------------------------------- 利润看板 */
.profit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 2px 0 14px; }
.profit-item {
  background: linear-gradient(160deg, #f8fafc, #eef4ff);
  border: 1px solid var(--line-soft); border-radius: 12px; padding: 10px 12px;
}
.profit-item .pl { font-size: 12px; color: var(--muted); }
.profit-item .pv { font-size: 20px; font-weight: 700; color: #0f172a;
  font-variant-numeric: tabular-nums; margin: 2px 0 3px; }
.profit-item .ps { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
@media (max-width: 860px) {
  .profit-grid { grid-template-columns: 1fr 1fr; }
  .profit-item .ps { white-space: normal; }
}

/* ---------------------------------------------------------------- 上架服务须知 */
.listing-mask {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  width: 100%; height: 100%; z-index: 95;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(15, 23, 42, .58);
}
.listing-mask[hidden] { display: none; }
.listing-card {
  width: 100%; max-width: 460px; padding: 22px 22px 18px; background: #fff;
  border-radius: 18px; box-shadow: 0 24px 60px rgba(15, 23, 42, .35);
  max-height: calc(100vh - 40px); overflow: auto;
}
.listing-card h3 { margin: 12px 0 10px; font-size: 18px; color: var(--ink); }
.listing-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 9px; }
.listing-list li {
  display: grid; grid-template-columns: 74px 1fr; gap: 8px;
  font-size: 13px; line-height: 1.65; color: var(--ink-2);
}
.listing-list li b { color: var(--ink); font-weight: 650; }
.listing-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------------------------------------------------------------- 主题切换 */
.theme-switch {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
}
.theme-switch button {
  display: grid; place-items: center; width: 30px; height: 26px;
  border: 0; border-radius: 7px; background: transparent; color: var(--muted);
  cursor: pointer; transition: background .15s ease, color .15s ease;
}
.theme-switch button svg { width: 15px; height: 15px; }
.theme-switch button:hover { background: var(--brand-soft); color: var(--ink); }
.theme-switch button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }

/* ---------------------------------------------------------------- 机主列表 · 最后登录 */
.login-cell { white-space: nowrap; line-height: 1.42; }
.lc-time { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.lc-region { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.lc-ip { font-size: 11.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- 深色模式
   保留原有版式与配色关系，只把白色/浅色面换成浅黑与浅灰，文字整体提亮 */
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e9eef8; --ink-2: #c8d3e3; --muted: #94a4bc; --muted-2: #7d8ca4;
  --line: #26314a; --line-soft: #1e2739;
  --bg: #0f1523; --card: #161e2e;
  --brand: #5b9bf8; --brand-2: #8b93f8; --brand-soft: #1a2740;
  --row-alt: #131b29; --row-hover: #1a2333;
  --ok-soft: #102a20; --warn-soft: #2a2113; --danger-soft: #2b1a1e;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45), 0 6px 16px rgba(0, 0, 0, .3);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, .5);
}
html[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
html[data-theme="dark"] .topbar { background: rgba(15, 21, 35, .86); }
html[data-theme="dark"] .theme-switch button[aria-pressed="true"] { background: #1e2b45; color: #93c5fd; }
html[data-theme="dark"] .btn { background: #1b2437; border-color: var(--line); color: var(--ink-2); }
html[data-theme="dark"] .btn:hover { background: #212c42; border-color: #31405b; }
html[data-theme="dark"] .btn.ghost { background: transparent; }
html[data-theme="dark"] .btn.danger { background: #2a1a1e; color: #fca5a5; border-color: #48272d; }
html[data-theme="dark"] .input,
html[data-theme="dark"] select.input,
html[data-theme="dark"] textarea.input { background: #121a29; border-color: var(--line); color: var(--ink); }
html[data-theme="dark"] .input:focus { border-color: #3b62a8; box-shadow: 0 0 0 3px rgba(59, 130, 246, .18); }
html[data-theme="dark"] table.data tbody tr:hover { background: #1a2333; }
html[data-theme="dark"] .money-box { background: #182233; border-color: var(--line-soft); }
html[data-theme="dark"] .bar-line,
html[data-theme="dark"] .gpu-track { background: #1e2739; }
html[data-theme="dark"] .profit-item { background: linear-gradient(160deg, #182233, #17233a); }
html[data-theme="dark"] .profit-item .pv { color: var(--ink); }
html[data-theme="dark"] .empty { background: #131b29; border-color: #26314a; }
html[data-theme="dark"] .notice-card,
html[data-theme="dark"] .listing-card,
html[data-theme="dark"] .kefu-pop { background: #161e2e; }
html[data-theme="dark"] .kefu-qr { background: #fff; }   /* 二维码必须留白才可扫 */
html[data-theme="dark"] .notice-badge,
html[data-theme="dark"] .lease-tag.soon { background: #2c2312; color: #fbbf24; }
html[data-theme="dark"] .flash-item { background: #14233b; color: #93c5fd; border-color: #243a5c; }
html[data-theme="dark"] .flash-item.err { background: #2a1a1e; color: #fca5a5; border-color: #48272d; }
html[data-theme="dark"] .flash-item.ok { background: #102a20; color: #6ee7b7; border-color: #1d4633; }
html[data-theme="dark"] .notice-inline.ok { background: #102a20; color: #6ee7b7; }
html[data-theme="dark"] .notice-inline.err { background: #2a1a1e; color: #fca5a5; }
html[data-theme="dark"] .pill.on { background: #102a20; color: #6ee7b7; }
html[data-theme="dark"] .pill.off { background: #1d2739; color: var(--muted); }
html[data-theme="dark"] .pill.warn { background: #2a2113; color: #fbbf24; }
html[data-theme="dark"] .pill.danger { background: #2a1a1e; color: #fca5a5; }
html[data-theme="dark"] .pill.down { background: #2a1a1e; color: #fca5a5; }
html[data-theme="dark"] .machine:hover { border-color: #2c3b55; }
html[data-theme="dark"] .chart-tip { background: rgba(8, 13, 22, .95); }
html[data-theme="dark"] .auth-wrap,
html[data-theme="dark"] .auth-form { background: var(--bg); }
html[data-theme="dark"] .login-meta { border-left-color: #3b82f6; }
