:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #202423;
  background: #f4f6f4;
  letter-spacing: 0;
  --border: #d7ddd9;
  --muted: #68716c;
  --green: #16744a;
  --blue: #245aa5;
  --red: #b4232d;
  --amber: #9a6412;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f4f6f4; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, .primary {
  min-height: 38px; padding: 8px 14px; border: 1px solid #b9c1bc; border-radius: 5px;
  color: #242826; background: #fff; cursor: pointer;
}
button:hover { border-color: #87928b; background: #f8faf8; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary, .primary { color: #fff; border-color: var(--green); background: var(--green); }
button.danger { color: var(--red); border-color: #e4b8bc; }
input, select, textarea {
  width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid #cbd2ce;
  border-radius: 4px; color: #202423; background: #fff;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9fbfe6; outline-offset: 1px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; min-width: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 24px 16px; color: #eef3ef; background: #232a27;
}
.brand { display: inline-block; color: #f7faf8; font-size: 19px; font-weight: 700; }
.brand span { color: #86d5aa; font-weight: 500; }
.sidebar nav { display: grid; gap: 4px; margin-top: 30px; }
.sidebar nav a { padding: 10px 12px; border-radius: 4px; color: #ced7d1; }
.sidebar nav a:hover { color: #fff; background: #343e39; text-decoration: none; }
.sidebar-foot { margin-top: auto; }
.text-button { width: 100%; color: #cbd3ce; border-color: #49534e; background: transparent; }
.main-content { min-width: 0; width: 100%; max-width: 1440px; padding: 32px 38px 60px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-head h1 { margin: 4px 0 5px; font-size: 28px; line-height: 1.2; }
.page-head p { margin: 0; color: var(--muted); }
.back { display: inline-block; margin-bottom: 8px; font-size: 14px; }
.status-dot { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-size: 13px; }
.status-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #8b9490; }
.status-dot.ok::before { background: #1b985f; }
.status-dot.warn::before { background: #d18a1b; }
.status-dot.bad::before { background: #cc3541; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); border-block: 1px solid var(--border); margin-bottom: 34px; }
.metrics div { padding: 20px 24px; border-right: 1px solid var(--border); }
.metrics div:last-child { border-right: 0; }
.metrics strong { display: block; font-size: 28px; font-variant-numeric: tabular-nums; }
.metrics span { color: var(--muted); font-size: 13px; }
.section { min-width: 0; padding: 22px 0 30px; border-bottom: 1px solid var(--border); }
.section:last-child { border-bottom: 0; }
.section h2, .detail-grid h2 { margin: 0 0 16px; font-size: 17px; }
.section-head { display: flex; justify-content: space-between; align-items: center; }
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 5px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 13px; border-bottom: 1px solid #e5e9e6; text-align: left; white-space: nowrap; }
th { color: #59625d; background: #f8faf8; font-size: 12px; font-weight: 650; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafcfb; }
.empty { padding: 32px; color: var(--muted); text-align: center; }
.mono { max-width: 340px; overflow-wrap: anywhere; white-space: normal; font-family: Consolas, monospace; font-size: 12px; }
.search-row { display: grid; grid-template-columns: minmax(220px, 460px) auto; gap: 8px; margin-bottom: 18px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 42px; padding-bottom: 30px; border-bottom: 1px solid var(--border); }
dl { display: grid; grid-template-columns: 90px 1fr; gap: 10px 16px; margin: 0 0 20px; }
dt { color: var(--muted); }
dd { margin: 0; }
.actions, .inline-form, .checks { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form > input, .inline-form > select { width: auto; min-width: 140px; }
.provider-add { display: grid; grid-template-columns: 140px minmax(180px, .7fr) minmax(260px, 1.3fr) auto; gap: 12px; align-items: end; }
.provider-add button { min-height: 42px; }
.checks label { display: flex; gap: 7px; align-items: center; }
.checks input, .toggle input { width: 17px; min-height: 17px; }
.subhead { margin-top: 26px !important; }
.wallets { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: 10px; margin-bottom: 18px; }
.wallets > div { padding: 16px; border-left: 3px solid #64a37e; background: #fff; }
.wallets span, .wallets small { display: block; color: var(--muted); }
.wallets strong { display: block; margin: 3px 0; font-size: 25px; font-variant-numeric: tabular-nums; }
.wallet-adjust input[name="reason"] { min-width: 240px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 16px; align-items: end; }
label { display: grid; gap: 6px; color: #4d5651; font-size: 13px; }
.stack-form { display: grid; gap: 15px; }
.settings-form > .primary { margin-top: 22px; }
.toggle { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.hint, .small { color: var(--muted); font-size: 13px; }
.flash { margin: 0 0 16px; padding: 10px 13px; border-left: 3px solid var(--blue); background: #eaf1fa; }
.flash.error, .warning { color: #861b24; border-color: var(--red); background: #fff0f1; }
.flash.success { color: #155c3d; border-color: var(--green); background: #eaf7ef; }
.public-content { min-height: 100vh; }
.login-panel { width: min(420px, calc(100% - 32px)); margin: 9vh auto 0; padding: 28px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.login-brand { color: #1f2823; }
.login-brand span { color: var(--green); }
.login-panel h1 { margin: 24px 0 18px; font-size: 23px; }
.public-page { min-height: 100vh; color: #f3f6f4; background: #202724; }
.public-page header { display: flex; justify-content: space-between; align-items: center; max-width: 1120px; margin: auto; padding: 25px 28px; }
.public-page nav { display: flex; gap: 20px; }
.public-page nav a { color: #c6d2cb; font-size: 14px; }
.status-main { max-width: 1120px; margin: 0 auto; padding: 18vh 28px 80px; }
.eyebrow { color: #88d5aa; font-size: 13px; text-transform: uppercase; }
.status-main h1 { max-width: 760px; margin: 12px 0 18px; font-size: 48px; line-height: 1.1; }
.status-main > p { max-width: 680px; color: #b8c4bd; font-size: 17px; line-height: 1.7; }
.service-line { display: inline-flex; align-items: center; gap: 9px; margin-top: 36px; color: #dce5df; }
.service-line span { width: 9px; height: 9px; border-radius: 50%; background: #42b77b; }
.legal { width: min(760px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 80px; }
.legal h1 { margin: 42px 0 24px; font-size: 34px; }
.legal p { color: #4e5853; line-height: 1.85; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 16px; }
  .sidebar nav { display: flex; min-width: 0; width: 100%; max-width: 100%; overflow-x: auto; margin-top: 14px; }
  .sidebar nav a { white-space: nowrap; }
  .sidebar-foot { position: absolute; top: 11px; right: 16px; }
  .sidebar-foot button { width: auto; }
  .main-content { padding: 24px 18px 50px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics div:nth-child(2) { border-right: 0; }
  .metrics div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .detail-grid, .form-grid { grid-template-columns: 1fr; gap: 22px; }
  .provider-add { grid-template-columns: 1fr 1fr; }
  .wallets { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .page-head { display: block; }
  .page-head .status-dot { margin-top: 12px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics div { padding: 15px; }
  .search-row { grid-template-columns: 1fr; }
  .provider-add { grid-template-columns: 1fr; }
  .public-page header { align-items: flex-start; }
  .public-page nav { display: grid; gap: 7px; text-align: right; }
  .status-main { padding-top: 12vh; }
  .status-main h1 { font-size: 36px; }
}
