:root {
  color-scheme: light;
  --bg: #f6f8f7;
  --panel: #ffffff;
  --text: #17211c;
  --muted: #66736d;
  --line: #dde5e1;
  --primary: #166c4f;
  --primary-hover: #11563f;
  --accent: #0f6da3;
  --warning-bg: #fff8e5;
  --warning-text: #7a5500;
  --danger: #a3362b;
  --ok-bg: #eaf7ef;
  --ok-text: #23633c;
  --shadow: 0 12px 32px rgba(20, 38, 30, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter,
    "PingFang SC",
    "Microsoft YaHei",
    Arial,
    sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

a.button {
  text-decoration: none;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.15;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button,
.iconButton {
  border: 0;
  cursor: pointer;
  border-radius: 8px;
  min-height: 40px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  font-weight: 700;
  white-space: nowrap;
}

.button:disabled {
  cursor: progress;
  opacity: 0.65;
}

.button.primary {
  color: #fff;
  background: var(--primary);
}

.button.primary:hover {
  background: var(--primary-hover);
}

.button.secondary {
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
}

.button.secondary:hover {
  border-color: #b9c8c1;
}

.notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #efd98c;
  border-radius: 8px;
  color: var(--warning-text);
  background: var(--warning-bg);
  font-size: 14px;
  line-height: 1.5;
}

.notice.success {
  border-color: #b9dfc5;
  color: var(--ok-text);
  background: var(--ok-bg);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  min-height: 108px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
}

.metric strong {
  display: block;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: var(--panel);
}

.toolbar p {
  color: var(--muted);
  margin-top: 4px;
  font-size: 13px;
}

.tableWrap {
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  background: #fbfcfb;
}

td {
  font-size: 14px;
}

tr:last-child td {
  border-bottom: 0;
}

.money {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.accountName {
  display: grid;
  gap: 4px;
}

.accountName strong {
  font-size: 14px;
}

.accountName span {
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--ok-bg);
  color: var(--ok-text);
}

.badge.warn {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.rowActions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.operation {
  text-align: right;
}

.textButton {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
  cursor: pointer;
}

.textButton:hover {
  border-color: #b9c8c1;
}

.textButton.danger {
  color: var(--danger);
}

.empty {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 42px 16px;
  color: var(--muted);
  text-align: center;
}

.empty[hidden] {
  display: none;
}

.empty strong {
  color: var(--text);
}

.dialog {
  width: min(720px, calc(100% - 32px));
  max-height: min(86vh, 860px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(20, 38, 30, 0.24);
  overflow: auto;
}

.dialog::backdrop {
  background: rgba(11, 20, 16, 0.42);
}

.dialog form {
  padding: 18px;
}

.dialogLead {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.dialog header,
.dialog footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dialog footer {
  margin-top: 18px;
}

.iconButton {
  display: inline-grid;
  place-items: center;
  width: 36px;
  color: var(--muted);
  background: transparent;
  font-size: 26px;
  line-height: 1;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field textarea {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  resize: vertical;
}

.field textarea {
  min-height: 116px;
  padding: 10px 12px;
  font-family:
    "SFMono-Regular",
    Consolas,
    "Liberation Mono",
    Menlo,
    monospace;
  font-size: 12px;
  line-height: 1.45;
}

.field input:focus,
.field textarea:focus {
  outline: 2px solid rgba(22, 108, 79, 0.2);
  border-color: var(--primary);
}

.field.compact {
  margin-top: 12px;
}

.field.compact:first-child {
  margin-top: 0;
}

.dialogMessage {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #efd98c;
  border-radius: 8px;
  color: var(--warning-text);
  background: var(--warning-bg);
  font-size: 13px;
  line-height: 1.5;
}

.dialogMessage[hidden] {
  display: none;
}

.dialogMessage.success {
  border-color: #b9dfc5;
  color: var(--ok-text);
  background: var(--ok-bg);
}

.setupGuide {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.setupGuide .field {
  color: var(--text);
}

.setupGuide h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.setupIntro p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.setupIntro ul {
  margin: 10px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.setupIntro li {
  font-size: 13px;
  line-height: 1.45;
}

.setupIntro strong {
  color: var(--text);
}

.setupList {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}

.setupList li {
  line-height: 1.45;
}

.setupList li.is-active {
  padding: 8px 10px;
  border-radius: 8px;
  background: #eef7f2;
  outline: 1px solid rgba(22, 108, 79, 0.18);
}

.setupList strong {
  display: block;
  margin-bottom: 2px;
}

.setupList span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.setupNote {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.setupCode {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: #111827;
  color: #e5e7eb;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
}

.installShell {
  max-width: 760px;
}

.installPanel {
  display: grid;
  gap: 16px;
}

.installFooter {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 840px) {
  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    justify-content: stretch;
  }

  .actions .button,
  .toolbar .button {
    width: 100%;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 92px;
  }
}
