:root {
  color-scheme: light;
  --ink: #19211f;
  --muted: #71807a;
  --line: #e5ebe7;
  --canvas: #f5f7f5;
  --panel: #ffffff;
  --green: #0e815d;
  --green-soft: #e6f4ee;
  --orange: #c56d18;
  --orange-soft: #fff1de;
  --red: #bd4e49;
  --red-soft: #fde9e6;
  --shadow: 0 18px 45px rgba(26, 56, 43, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.sidebar { min-width: 0; background: #102a22; color: #dceee6; padding: 25px 18px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 3px 9px 34px; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: #102a22; background: #d8f1e5; font-weight: 800; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 14px; letter-spacing: 0; }
.brand span { margin-top: 3px; color: #8fb4a4; font-size: 11px; }
nav { display: grid; gap: 5px; }
.nav-item { text-align: left; border: 0; border-radius: 7px; color: #9ebeb1; background: transparent; padding: 12px 12px; font-weight: 650; }
.nav-item:hover, .nav-item.active { color: #102a22; background: #d9f0e5; }
.sidebar-foot { margin-top: auto; padding: 18px 10px 3px; color: #86a99b; font-size: 12px; display: flex; align-items: center; gap: 7px; }
.status-dot { width: 7px; height: 7px; background: #5de0a7; border-radius: 50%; }
.main { min-width: 0; padding: 30px 42px 60px; }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: 0.12em; }
h1 { margin: 0; font-size: 28px; letter-spacing: 0; }
h2 { margin: 0; font-size: 17px; }
.topbar-actions { display: flex; gap: 9px; align-items: center; }
.ghost-button, .icon-button, .primary-button, .danger-button { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 7px; padding: 9px 13px; text-decoration: none; font-weight: 700; }
.icon-button { width: 38px; height: 38px; padding: 0; font-size: 21px; }
.primary-button { border-color: var(--green); color: #fff; background: var(--green); }
.danger-button { border-color: var(--red-soft); color: var(--red); background: var(--red-soft); }
.view { display: none; }
.view.active { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.metric, .panel { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.metric { padding: 18px; }
.metric-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-value { margin-top: 10px; font-size: 27px; font-weight: 780; }
.metric-note { margin-top: 6px; color: var(--green); font-size: 12px; }
.panel { padding: 20px; margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.split { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 18px; }
.event-list { display: grid; gap: 10px; }
.event-row { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.event-row:last-child { border-bottom: 0; }
.event-title { font-weight: 750; }
.event-meta { margin-top: 5px; color: var(--muted); font-size: 12px; }
.heat { color: var(--orange); background: var(--orange-soft); border-radius: 999px; padding: 5px 8px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; padding: 0 10px 11px; white-space: nowrap; }
td { padding: 13px 10px; border-top: 1px solid var(--line); vertical-align: top; }
td strong { font-size: 13px; }
.action-stack { display: flex; flex-wrap: wrap; gap: 7px; min-width: 150px; }
.risk-controls { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.risk-controls select, .risk-reason { min-width: 132px; border: 1px solid var(--line); border-radius: 6px; padding: 8px 9px; background: #fff; color: var(--ink); }
.risk-reason { width: min(240px, 100%); }
.risk-limit-grid { display: grid; grid-template-columns: repeat(3, minmax(105px, 1fr)); gap: 6px; min-width: 335px; }
.risk-limit-field { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.risk-limit-field input, .wallet-risk-control input { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 8px 9px; background: #fff; color: var(--ink); }
.wallet-risk-control { display: grid; gap: 7px; min-width: 210px; margin-top: 9px; }
.wallet-risk-control > div { display: grid; grid-template-columns: minmax(110px, 1fr) auto; gap: 6px; align-items: center; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 8px; font-size: 11px; font-weight: 800; }
.badge-green { color: var(--green); background: var(--green-soft); }
.badge-orange { color: var(--orange); background: var(--orange-soft); }
.badge-red { color: var(--red); background: var(--red-soft); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--muted); font-size: 12px; font-weight: 700; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 10px 11px; background: #fff; color: var(--ink); }
.field select[multiple] { min-height: 112px; }
.field textarea { min-height: 88px; resize: vertical; }
.fee-setting-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.empty { color: var(--muted); padding: 26px 0; text-align: center; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 340px; padding: 12px 15px; border-radius: 7px; background: #142b23; color: #fff; opacity: 0; transform: translateY(8px); pointer-events: none; transition: 160ms ease; }
.toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 1050px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { padding: 15px 18px; }
  .brand { padding-bottom: 16px; }
  nav { max-width: 100%; display: flex; overflow-x: auto; }
  .nav-item { flex: 0 0 auto; white-space: nowrap; }
  .sidebar-foot { display: none; }
  .main { padding: 25px 20px 45px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topbar { align-items: start; flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .table-wrap table { min-width: 680px; }
  .risk-limit-grid { grid-template-columns: 1fr; min-width: 150px; }
}
