:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-2: #eef3f8;
    --text: #172033;
    --muted: #687386;
    --line: #dce4ee;
    --primary: #176b87;
    --primary-2: #0f5268;
    --accent: #c89b3c;
    --danger: #b42318;
    --success: #16805b;
    --shadow: 0 18px 45px rgba(25, 45, 80, .08);
    --radius: 8px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    font-size: 14px;
    letter-spacing: 0;
}
a { color: var(--primary); text-decoration: none; }
small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }

.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 16px;
    background: #132231;
    color: #fff;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; margin-bottom: 28px; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--accent), #efcf73);
    color: #1b2230;
    font-weight: 900;
}
.brand strong { display: block; font-size: 17px; }
.brand small { color: rgba(255,255,255,.72); }
.nav { display: grid; gap: 6px; }
.nav a {
    color: rgba(255,255,255,.78);
    padding: 12px 13px;
    border-radius: var(--radius);
    font-weight: 700;
}
.nav a:hover, .nav a.active { background: rgba(255,255,255,.1); color: #fff; }

.main { padding: 24px; min-width: 0; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}
.topbar h1 { margin: 0 0 4px; font-size: 26px; line-height: 1.2; }
.topbar p { margin: 0; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-chip { padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

.flash {
    padding: 12px 14px;
    border-radius: var(--radius);
    margin: 0 0 14px;
    border: 1px solid var(--line);
    background: #fff;
}
.flash.success { border-color: rgba(22,128,91,.25); color: var(--success); background: #eefaf5; }
.flash.error { border-color: rgba(180,35,24,.25); color: var(--danger); background: #fff1ef; }

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 12px; }
.btn.block { width: 100%; }

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}
.admin-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.metric, .panel, .auth-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.metric { padding: 17px; min-height: 118px; }
.metric span { color: var(--muted); font-weight: 700; }
.metric strong { display: block; margin: 10px 0 6px; font-size: 28px; line-height: 1; }
.panel { padding: 18px; margin-bottom: 16px; }
.panel.narrow, .auth-card { max-width: 760px; }
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.panel-head h2 { margin: 0; font-size: 18px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

.notice, .callout {
    border: 1px solid rgba(200,155,60,.35);
    background: #fff8e6;
    color: #674d12;
    padding: 12px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.callout { margin: 4px 0 10px; }

.responsive-table { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
th { color: var(--muted); font-size: 12px; background: var(--surface-2); }
td .btn, td form { margin: 2px 0; }
.muted { color: var(--muted); }
.mono { font-family: Consolas, "Courier New", monospace; word-break: break-all; }
.actions-cell { min-width: 260px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 99px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}
.status.active, .status.approved, .status.paid { background: #e8f7f1; color: var(--success); }
.status.pending, .status.paused { background: #fff8e6; color: #91660b; }
.status.rejected, .status.banned, .status.disabled { background: #fff1ef; color: var(--danger); }
.status.removed { background: #edf0f4; color: #4c5768; }

.auth-card {
    display: grid;
    grid-template-columns: .9fr 1.1fr;
    gap: 24px;
    padding: 28px;
}
.auth-copy h2 { margin: 0 0 10px; font-size: 28px; }
.auth-copy p { color: var(--muted); line-height: 1.7; }
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 7px; color: var(--muted); font-weight: 800; }
input, select, textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 9px 10px;
    color: var(--text);
    background: #fff;
    font: inherit;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(23,107,135,.2);
    border-color: var(--primary);
}
.form-hint { margin: 0; color: var(--muted); line-height: 1.6; }
.bulk-grid {
    grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(140px, .8fr)) auto;
    align-items: end;
}
.bulk-grid .bulk-note {
    grid-column: 1 / -1;
    margin-bottom: 0;
}
.generated-panel {
    border-color: rgba(23,107,135,.24);
    background: linear-gradient(135deg, rgba(23,107,135,.06), rgba(255,255,255,.95));
}
.deposit-address, .secret-box {
    padding: 14px;
    border-radius: var(--radius);
    background: #122232;
    color: #fff;
    word-break: break-all;
    font-family: Consolas, "Courier New", monospace;
    margin-bottom: 14px;
}
.summary-line, .list-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.summary-line span, .list-row span { color: var(--muted); }
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.settings-grid div {
    padding: 14px;
    background: var(--surface-2);
    border-radius: var(--radius);
}
.settings-grid span { display: block; color: var(--muted); margin-bottom: 6px; }
.empty-state { padding: 50px; text-align: center; background: #fff; border-radius: var(--radius); }
.mobile-tabbar { display: none; }

.insight-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 16px;
    margin-bottom: 16px;
}
.chart-panel {
    background:
        linear-gradient(135deg, rgba(23,107,135,.08), rgba(200,155,60,.08)),
        var(--surface);
}
.chart-head p {
    margin: 6px 0 0;
    color: var(--muted);
    line-height: 1.5;
}
.chart-total {
    min-width: 150px;
    padding: 12px 14px;
    border: 1px solid rgba(23,107,135,.18);
    border-radius: var(--radius);
    background: rgba(255,255,255,.76);
}
.chart-total span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}
.chart-total strong {
    display: block;
    margin-top: 5px;
    color: var(--primary-2);
    font-size: 20px;
}
.chart-wrap {
    position: relative;
    min-height: 260px;
    border-radius: var(--radius);
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(220,228,238,.75);
    overflow: hidden;
}
.chart-wrap canvas {
    display: block;
    width: 100%;
    height: 260px;
}
.live-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}
.live-stat-grid div {
    padding: 12px;
    border: 1px solid rgba(23,107,135,.12);
    border-radius: var(--radius);
    background: rgba(255,255,255,.72);
}
.live-stat-grid span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 6px;
}
.live-stat-grid strong {
    color: var(--primary-2);
    font-size: 18px;
}
.account-pulse {
    display: grid;
    align-content: start;
}
.pulse-ring {
    display: grid;
    place-items: center;
    align-content: center;
    width: 180px;
    height: 180px;
    margin: 8px auto 18px;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, #fff 0 58%, transparent 59%),
        conic-gradient(var(--primary) 0 var(--active-percent), #e3eaf2 0 100%);
    box-shadow: inset 0 0 0 1px rgba(23,107,135,.08), var(--shadow);
}
.pulse-ring strong {
    font-size: 42px;
    line-height: 1;
    color: var(--primary-2);
}
.pulse-ring span {
    margin-top: 6px;
    color: var(--muted);
    font-weight: 900;
}
.pulse-list {
    display: grid;
    gap: 10px;
}
.pulse-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--surface-2);
}
.pulse-list strong { margin-left: auto; }
.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--muted);
}
.dot.active { background: var(--success); }
.dot.paused { background: #d49a16; }
.dot.banned { background: var(--danger); }
.dot.removed { background: #7b8794; }

.legend-dashboard {
    --legend-bg: #120e10;
    --legend-panel: rgba(29, 24, 24, .94);
    --legend-panel-2: rgba(49, 37, 29, .92);
    --legend-gold: #f3c766;
    --legend-red: #8f261d;
    --legend-line: rgba(243, 199, 102, .22);
    --legend-text: #fff4d8;
    --legend-muted: rgba(255, 244, 216, .66);
    position: relative;
    display: grid;
    gap: 16px;
    padding: 16px;
    border-radius: var(--radius);
    color: var(--legend-text);
    background:
        linear-gradient(120deg, rgba(143,38,29,.18), transparent 34%),
        radial-gradient(circle at 85% 0, rgba(243,199,102,.22), transparent 26%),
        radial-gradient(circle at 12% 12%, rgba(143,38,29,.22), transparent 28%),
        var(--legend-bg);
    overflow: hidden;
}
.legend-dashboard::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.8), transparent 85%);
}
.legend-dashboard > * { position: relative; z-index: 1; }
.legend-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: stretch;
    min-height: 250px;
    padding: 24px;
    border: 1px solid var(--legend-line);
    border-radius: var(--radius);
    background:
        linear-gradient(135deg, rgba(255,244,216,.08), transparent 36%),
        radial-gradient(circle at 80% 50%, rgba(243,199,102,.2), transparent 34%),
        linear-gradient(135deg, rgba(55,36,25,.94), rgba(19,14,15,.96));
    box-shadow: 0 24px 70px rgba(0,0,0,.28);
}
.legend-kicker {
    margin: 0 0 12px;
    color: var(--legend-gold);
    font-weight: 900;
}
.legend-hero h2 {
    max-width: 760px;
    margin: 0;
    font-size: 44px;
    line-height: 1.05;
    color: #fff7e6;
}
.legend-lead {
    max-width: 620px;
    margin: 16px 0 0;
    color: var(--legend-muted);
    font-size: 15px;
    line-height: 1.8;
}
.legend-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}
.legend-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--legend-line);
    border-radius: var(--radius);
    color: var(--legend-text);
    background: rgba(255,255,255,.06);
    font-weight: 900;
}
.legend-btn.primary {
    color: #24170c;
    border-color: rgba(243,199,102,.8);
    background: linear-gradient(135deg, #ffe08a, #c9892d);
}
.legend-btn.small { min-height: 34px; padding: 0 11px; font-size: 12px; }
.legend-hero-core {
    display: grid;
    align-content: center;
    padding: 22px;
    border: 1px solid rgba(243,199,102,.32);
    border-radius: var(--radius);
    background:
        radial-gradient(circle at 50% 18%, rgba(243,199,102,.3), transparent 32%),
        rgba(10, 8, 8, .7);
}
.legend-hero-core span,
.legend-hero-core small {
    color: var(--legend-muted);
    font-weight: 800;
}
.legend-hero-core strong {
    display: block;
    margin: 12px 0 8px;
    color: var(--legend-gold);
    font-size: 34px;
    line-height: 1;
}
.legend-core-bars {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    gap: 8px;
    height: 54px;
    margin-top: 20px;
}
.legend-core-bars i {
    display: block;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(to top, var(--legend-red), var(--legend-gold));
}
.legend-core-bars i:nth-child(1) { height: 34%; }
.legend-core-bars i:nth-child(2) { height: 58%; }
.legend-core-bars i:nth-child(3) { height: 42%; }
.legend-core-bars i:nth-child(4) { height: 78%; }
.legend-core-bars i:nth-child(5) { height: 64%; }
.legend-notice,
.legend-panel,
.legend-stat {
    border: 1px solid var(--legend-line);
    border-radius: var(--radius);
    background: var(--legend-panel);
    box-shadow: 0 18px 45px rgba(0,0,0,.22);
}
.legend-notice {
    padding: 12px 14px;
    color: #ffe6a4;
    background: rgba(143,38,29,.28);
}
.legend-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.legend-stat {
    min-height: 126px;
    padding: 16px;
    background:
        linear-gradient(135deg, rgba(243,199,102,.09), transparent),
        var(--legend-panel);
}
.legend-stat span {
    display: block;
    color: var(--legend-muted);
    font-weight: 900;
}
.legend-stat strong {
    display: block;
    margin: 12px 0 8px;
    color: var(--legend-gold);
    font-size: 28px;
    line-height: 1;
}
.legend-stat small,
.legend-muted {
    color: var(--legend-muted);
}
.legend-main-grid,
.legend-bottom-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 16px;
}
.legend-bottom-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.legend-panel {
    padding: 18px;
}
.legend-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}
.legend-panel-head.compact {
    align-items: center;
}
.legend-panel-head h3 {
    margin: 0;
    color: #fff7e6;
    font-size: 20px;
}
.legend-panel-head p,
.legend-panel-head span {
    margin: 6px 0 0;
    color: var(--legend-muted);
}
.legend-chip {
    padding: 8px 10px;
    border: 1px solid var(--legend-line);
    border-radius: var(--radius);
    color: var(--legend-gold);
    background: rgba(255,255,255,.06);
    font-weight: 900;
    white-space: nowrap;
}
.legend-live-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}
.legend-live-stats div {
    padding: 12px;
    border: 1px solid rgba(243,199,102,.18);
    border-radius: var(--radius);
    background: rgba(255,255,255,.055);
}
.legend-live-stats span {
    display: block;
    color: var(--legend-muted);
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 7px;
}
.legend-live-stats strong {
    color: var(--legend-gold);
    font-size: 18px;
}
.legend-chart-wrap {
    min-height: 280px;
    border: 1px solid rgba(243,199,102,.18);
    border-radius: var(--radius);
    background: rgba(0,0,0,.2);
    overflow: hidden;
}
.legend-chart-wrap canvas {
    display: block;
    width: 100%;
    height: 280px;
}
.legend-ring {
    display: grid;
    place-items: center;
    align-content: center;
    width: 180px;
    height: 180px;
    margin: 10px auto 18px;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, #1a1110 0 58%, transparent 59%),
        conic-gradient(var(--legend-gold) 0 var(--active-percent), rgba(255,255,255,.12) 0 100%);
}
.legend-ring strong {
    font-size: 44px;
    line-height: 1;
    color: var(--legend-gold);
}
.legend-ring span {
    color: var(--legend-muted);
    font-weight: 900;
}
.legend-status-list {
    display: grid;
    gap: 10px;
}
.legend-status-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: rgba(255,255,255,.055);
}
.legend-account-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.legend-account-card,
.legend-empty {
    padding: 14px;
    border: 1px solid rgba(243,199,102,.18);
    border-radius: var(--radius);
    background: rgba(255,255,255,.055);
}
.legend-account-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}
.legend-server {
    color: var(--legend-gold);
    font-weight: 900;
}
.legend-account-card h4 {
    margin: 14px 0 12px;
    color: #fff7e6;
    font-size: 18px;
}
.legend-account-card dl {
    display: grid;
    gap: 8px;
    margin: 0 0 12px;
}
.legend-account-card dl div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.legend-account-card dt {
    color: var(--legend-muted);
}
.legend-account-card dd {
    margin: 0;
    color: var(--legend-text);
    text-align: right;
    word-break: break-all;
}
.legend-account-card small {
    color: var(--legend-muted);
}
.legend-empty {
    grid-column: 1 / -1;
    display: grid;
    gap: 10px;
    justify-items: start;
    color: var(--legend-muted);
}
.legend-empty strong {
    color: var(--legend-gold);
}
.legend-row,
.legend-ledger-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(243,199,102,.14);
}
.legend-row span,
.legend-ledger-row span {
    color: var(--legend-text);
}
.legend-row small,
.legend-ledger-row small {
    color: var(--legend-muted);
}
.legend-row strong,
.legend-ledger-row strong {
    color: var(--legend-gold);
}
.legend-ledger {
    display: grid;
}
.legend-ledger-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 130px minmax(160px, .8fr);
    align-items: start;
}
.legend-ledger-row em {
    color: var(--legend-muted);
    font-style: normal;
    text-align: right;
}

.ops-dashboard {
    --ops-gold: #c8922f;
    --ops-gold-2: #f4c96c;
    --ops-ink: #182232;
    --ops-muted: #718096;
    --ops-line: #dce3ee;
    --ops-panel: #ffffff;
    --ops-soft: #f7f4ec;
    display: grid;
    gap: 16px;
}
.ops-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 18px;
    padding: 22px;
    border: 1px solid #ead9b8;
    border-radius: var(--radius);
    background:
        radial-gradient(circle at 82% 18%, rgba(244,201,108,.24), transparent 26%),
        linear-gradient(135deg, #fffaf0, #f7fbff 62%, #f1f5fb);
    box-shadow: var(--shadow);
}
.ops-mark {
    display: inline-flex;
    margin-bottom: 10px;
    color: #8b5a14;
    font-weight: 900;
}
.ops-hero h2 {
    margin: 0;
    color: var(--ops-ink);
    font-size: 34px;
    line-height: 1.15;
}
.ops-hero p {
    max-width: 620px;
    margin: 10px 0 0;
    color: var(--ops-muted);
    line-height: 1.7;
}
.ops-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}
.ops-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 13px;
    border: 1px solid var(--ops-line);
    border-radius: var(--radius);
    color: var(--ops-ink);
    background: #fff;
    font-weight: 900;
}
.ops-btn.primary {
    border-color: #d09a36;
    color: #24170c;
    background: linear-gradient(135deg, #ffd66d, #d99932);
}
.ops-btn.small { min-height: 32px; padding: 0 10px; font-size: 12px; }
.ops-income-card {
    display: grid;
    align-content: center;
    min-height: 190px;
    padding: 18px;
    border: 1px solid rgba(200,146,47,.3);
    border-radius: var(--radius);
    background:
        radial-gradient(circle at 74% 24%, rgba(244,201,108,.28), transparent 30%),
        linear-gradient(135deg, #1f2734, #111827);
    color: #fff4d8;
}
.ops-income-card span,
.ops-income-card small {
    color: rgba(255,244,216,.72);
    font-weight: 800;
}
.ops-income-card strong {
    display: block;
    margin: 10px 0 6px;
    color: var(--ops-gold-2);
    font-size: 31px;
    line-height: 1;
}
.ops-spark {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    align-items: end;
    gap: 7px;
    height: 44px;
    margin-top: 18px;
}
.ops-spark i {
    display: block;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(to top, #8f3322, var(--ops-gold-2));
}
.ops-spark i:nth-child(1) { height: 30%; }
.ops-spark i:nth-child(2) { height: 56%; }
.ops-spark i:nth-child(3) { height: 42%; }
.ops-spark i:nth-child(4) { height: 78%; }
.ops-spark i:nth-child(5) { height: 62%; }
.ops-spark i:nth-child(6) { height: 88%; }
.ops-notice {
    padding: 12px 14px;
    border: 1px solid #ead9b8;
    border-radius: var(--radius);
    background: #fff8e6;
    color: #674d12;
}
.ops-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.ops-stat,
.ops-panel {
    border: 1px solid var(--ops-line);
    border-radius: var(--radius);
    background: var(--ops-panel);
    box-shadow: var(--shadow);
}
.ops-stat {
    min-height: 116px;
    padding: 16px;
}
.ops-stat span,
.ops-mini-stats span,
.ops-row small,
.ops-ledger-row small,
.ops-muted {
    color: var(--ops-muted);
}
.ops-stat span {
    font-weight: 800;
}
.ops-stat strong {
    display: block;
    margin: 10px 0 6px;
    color: var(--ops-ink);
    font-size: 26px;
    line-height: 1;
}
.ops-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 16px;
}
.ops-panel {
    padding: 18px;
}
.ops-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}
.ops-panel-head.compact {
    align-items: center;
}
.ops-panel-head h3 {
    margin: 0;
    color: var(--ops-ink);
    font-size: 18px;
}
.ops-panel-head p {
    margin: 6px 0 0;
    color: var(--ops-muted);
    line-height: 1.5;
}
.ops-chip {
    flex: 0 0 auto;
    padding: 8px 10px;
    border-radius: var(--radius);
    color: #8b5a14;
    background: #fff4d6;
    font-weight: 900;
}
.ops-mini-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}
.ops-mini-stats div {
    padding: 11px;
    border: 1px solid #ead9b8;
    border-radius: var(--radius);
    background: var(--ops-soft);
}
.ops-mini-stats span {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 800;
}
.ops-mini-stats strong {
    color: #8b5a14;
    font-size: 17px;
}
.ops-chart-wrap {
    min-height: 260px;
    border: 1px solid var(--ops-line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    overflow: hidden;
}
.ops-chart-wrap canvas {
    display: block;
    width: 100%;
    height: 260px;
}
.ops-ring {
    display: grid;
    place-items: center;
    align-content: center;
    width: 166px;
    height: 166px;
    margin: 10px auto 16px;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, #fff 0 58%, transparent 59%),
        conic-gradient(var(--ops-gold) 0 var(--active-percent), #e3eaf2 0 100%);
}
.ops-ring strong {
    color: #8b5a14;
    font-size: 40px;
    line-height: 1;
}
.ops-ring span {
    color: var(--ops-muted);
    font-weight: 900;
}
.ops-status-list {
    display: grid;
    gap: 9px;
}
.ops-status-list div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border-radius: var(--radius);
    background: #f6f8fb;
}
.ops-status-list strong { margin-left: auto; }
.ops-account-list {
    display: grid;
    gap: 10px;
}
.ops-account {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 13px;
    border: 1px solid var(--ops-line);
    border-radius: var(--radius);
    background: #fbfcfe;
}
.ops-server {
    color: #8b5a14;
    font-size: 12px;
    font-weight: 900;
}
.ops-account h4 {
    margin: 6px 0 3px;
    color: var(--ops-ink);
    font-size: 17px;
}
.ops-account small {
    color: var(--ops-muted);
}
.ops-account-meta {
    display: grid;
    justify-items: end;
    gap: 6px;
}
.ops-account-meta span {
    color: var(--ops-muted);
}
.ops-account-meta strong {
    color: #8b5a14;
}
.ops-account-meta em {
    font-style: normal;
}
.ops-empty {
    display: grid;
    justify-items: start;
    gap: 8px;
    padding: 16px;
    border: 1px dashed #d6deea;
    border-radius: var(--radius);
    color: var(--ops-muted);
    background: #fbfcfe;
}
.ops-empty strong {
    color: var(--ops-ink);
}
.ops-bottom {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.ops-row,
.ops-ledger-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--ops-line);
}
.ops-row strong,
.ops-ledger-row strong {
    color: #8b5a14;
}
.ops-ledger {
    display: grid;
}
.ops-ledger-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 130px minmax(160px, .8fr);
    align-items: start;
}
.ops-ledger-row em {
    color: var(--ops-muted);
    font-style: normal;
    text-align: right;
}

@media (max-width: 1180px) {
    .ops-hero,
    .ops-grid,
    .ops-bottom { grid-template-columns: 1fr; }
    .ops-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .ops-hero { padding: 16px; }
    .ops-hero h2 { font-size: 28px; }
    .ops-stats,
    .ops-mini-stats { grid-template-columns: 1fr; }
    .ops-panel-head { flex-direction: column; }
    .ops-account { grid-template-columns: 1fr; }
    .ops-account-meta { justify-items: start; }
    .ops-ledger-row { grid-template-columns: 1fr; }
    .ops-ledger-row em { text-align: left; }
}

@media (max-width: 1180px) {
    .legend-hero,
    .legend-main-grid,
    .legend-bottom-grid { grid-template-columns: 1fr; }
    .legend-stats,
    .legend-account-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .legend-dashboard { padding: 12px; }
    .legend-hero { padding: 16px; }
    .legend-hero h2 { font-size: 30px; }
    .legend-stats,
    .legend-live-stats,
    .legend-account-grid { grid-template-columns: 1fr; }
    .legend-panel-head { flex-direction: column; }
    .legend-hero-core strong { font-size: 28px; }
    .legend-ledger-row { grid-template-columns: 1fr; }
    .legend-ledger-row em { text-align: left; }
    .legend-chart-wrap,
    .legend-chart-wrap canvas { height: 240px; min-height: 240px; }
}

@media (max-width: 1180px) {
    .metric-grid, .admin-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .insight-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        height: auto;
        padding: 14px;
    }
    .brand { margin-bottom: 12px; }
    .nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .nav a { text-align: center; padding: 10px 8px; }
    .main { padding: 16px 14px 78px; }
    .topbar { align-items: flex-start; flex-direction: column; }
    .two-col, .auth-card { grid-template-columns: 1fr; }
    .bulk-grid { grid-template-columns: 1fr 1fr; }
    .bulk-grid .bulk-note,
    .bulk-grid .btn { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
    body { font-size: 13px; }
    .sidebar { display: none; }
    .topbar h1 { font-size: 22px; }
    .metric-grid, .admin-metrics, .settings-grid { grid-template-columns: 1fr; }
    .metric { min-height: auto; }
    .metric strong { font-size: 24px; }
    .panel, .auth-card { padding: 14px; }
    .panel-head { align-items: flex-start; flex-direction: column; }
    .chart-total { width: 100%; }
    .chart-wrap, .chart-wrap canvas { height: 230px; min-height: 230px; }
    .live-stat-grid { grid-template-columns: 1fr; }
    .pulse-ring { width: 150px; height: 150px; }
    .responsive-table { overflow: visible; }
    table { min-width: 0; }
    thead { display: none; }
    tr {
        display: grid;
        gap: 8px;
        padding: 12px 0;
        border-bottom: 1px solid var(--line);
    }
    td {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        padding: 0;
        border: 0;
    }
    td::before {
        content: attr(data-label);
        color: var(--muted);
        font-weight: 800;
        min-width: 86px;
    }
    .actions-cell, .inline-form { width: 100%; }
    .inline-form { display: grid; grid-template-columns: 1fr; }
    .bulk-grid { grid-template-columns: 1fr; }
    td.actions-cell { display: grid; justify-content: stretch; }
    td.actions-cell::before { display: none; }
    .mobile-tabbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 10;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        background: #fff;
        border-top: 1px solid var(--line);
        box-shadow: 0 -8px 24px rgba(25,45,80,.08);
    }
    .mobile-tabbar a {
        padding: 10px 4px;
        color: var(--muted);
        text-align: center;
        font-weight: 800;
        font-size: 12px;
    }
}
