:root {
  color-scheme: dark;
  --bg: #07100d;
  --panel: rgba(12, 28, 23, .86);
  --panel-strong: #102820;
  --line: rgba(155, 211, 181, .13);
  --text: #effbf4;
  --muted: #8ba99b;
  --green: #58e89b;
  --green-2: #9cf5bf;
  --amber: #ffbd63;
  --red: #ff766f;
  --shadow: 0 24px 80px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    linear-gradient(rgba(255,255,255,.014) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.014) 1px, transparent 1px),
    var(--bg);
  background-size: 42px 42px;
}

button, textarea, input { font: inherit; }
button { color: inherit; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  opacity: .14;
}
.ambient-a { top: -240px; left: -150px; background: #1bff95; }
.ambient-b { right: -260px; bottom: -270px; background: #2b8bff; }

.shell { width: min(1480px, calc(100% - 48px)); margin: 0 auto; padding: 30px 0 48px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  position: relative;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(88,232,155,.4);
  border-radius: 15px;
  background: linear-gradient(145deg, rgba(88,232,155,.18), rgba(88,232,155,.03));
  box-shadow: inset 0 0 20px rgba(88,232,155,.07), 0 0 34px rgba(88,232,155,.08);
}
.brand-mark::before, .brand-mark::after, .brand-mark span {
  content: "";
  position: absolute;
  border: 1px solid var(--green);
  border-radius: 50%;
}
.brand-mark::before { inset: 10px; opacity: .35; }
.brand-mark::after { inset: 16px; background: var(--green); box-shadow: 0 0 15px var(--green); }
.brand-mark span { inset: 4px; border-color: rgba(88,232,155,.14); }
.eyebrow { margin: 0 0 4px; color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .19em; }
h1, h2 { margin: 0; letter-spacing: -.025em; }
h1 { font-size: clamp(20px, 2vw, 26px); font-weight: 720; }
h2 { font-size: 18px; font-weight: 680; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.updated { margin-right: 6px; color: var(--muted); font-size: 12px; }
.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
  cursor: pointer;
  transition: .2s ease;
}
.icon-button:hover { border-color: rgba(88,232,155,.4); transform: translateY(-1px); }
.icon-button.loading { animation: spin .8s linear infinite; }
.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(88,232,155,.24);
  border-radius: 12px;
  background: rgba(88,232,155,.08);
  font-size: 12px;
}
.status-pill span, .live-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 13px var(--green);
}
.status-pill.offline { color: #ffc4c0; border-color: rgba(255,118,111,.28); background: rgba(255,118,111,.08); }
.status-pill.offline span { background: var(--red); box-shadow: 0 0 12px var(--red); }
.status-pill.pending span { background: var(--amber); box-shadow: none; }
.logout-link { color: var(--muted); font-size: 11px; text-decoration: none; transition: color .2s ease; }
.logout-link:hover { color: var(--green-2); }

.login-body { display: grid; place-items: center; }
.login-shell { width: min(440px, calc(100% - 32px)); padding: 40px 0; }
.login-card {
  padding: 34px;
  border: 1px solid rgba(88,232,155,.2);
  border-radius: 26px;
  background: linear-gradient(145deg, rgba(16,40,32,.96), rgba(8,22,17,.94));
  box-shadow: 0 32px 100px rgba(0,0,0,.5), inset 0 1px rgba(255,255,255,.035);
  backdrop-filter: blur(20px);
}
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-intro { margin: 25px 0 22px; color: var(--muted); font-size: 12px; }
.login-form { display: grid; gap: 15px; }
.login-form label span { display: block; margin: 0 2px 7px; color: #bfd5ca; font-size: 11px; font-weight: 650; }
.login-form input {
  width: 100%; height: 46px; padding: 0 13px; border: 1px solid rgba(155,211,181,.16);
  border-radius: 12px; outline: none; color: #e8f8ef; background: rgba(1,9,6,.5); transition: .2s ease;
}
.login-form input:focus { border-color: rgba(88,232,155,.5); box-shadow: 0 0 0 3px rgba(88,232,155,.08); }
.login-form .primary-button { margin-top: 2px; height: 46px; }
.login-error { min-height: 15px; margin: -3px 1px -3px; color: #ffaaa5; font-size: 11px; }
.login-foot { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 24px; color: #6f9282; font-size: 10px; }
.login-foot span { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }

.hero-grid { display: grid; grid-template-columns: 1.45fr repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.hero-card, .metric-card, .panel {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(16,40,32,.92), rgba(9,24,19,.86));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.hero-card, .metric-card { min-height: 154px; border-radius: 20px; }
.primary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  padding: 24px;
  border-color: rgba(88,232,155,.24);
  background: linear-gradient(135deg, rgba(22,70,50,.84), rgba(11,28,22,.9));
}
.card-label { margin: 0 0 15px; color: var(--muted); font-size: 12px; font-weight: 620; }
.metric-line { display: flex; align-items: baseline; gap: 9px; }
.metric-line strong, .metric-card strong { font-size: 42px; line-height: 1; letter-spacing: -.05em; }
.metric-line span { color: var(--green-2); font-size: 14px; }
.card-note { margin: 15px 0 0; color: var(--muted); font-size: 11px; }
.radar { position: relative; width: 102px; height: 102px; flex: 0 0 auto; }
.radar::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: conic-gradient(from 15deg, rgba(88,232,155,.5), transparent 25%, transparent 100%);
  animation: spin 3s linear infinite;
  mask: radial-gradient(circle, transparent 0 47%, #000 48%);
}
.radar i { position: absolute; border: 1px solid rgba(88,232,155,.18); border-radius: 50%; }
.radar i:nth-child(1) { inset: 4px; }
.radar i:nth-child(2) { inset: 21px; }
.radar i:nth-child(3) { inset: 38px; }
.radar b { position: absolute; top: 34%; left: 66%; width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
@keyframes spin { to { transform: rotate(360deg); } }

.metric-card { display: flex; flex-direction: column; justify-content: space-between; padding: 23px; }
.metric-card strong { font-size: 36px; }
.trend { width: fit-content; padding: 5px 8px; border-radius: 8px; font-size: 10px; }
.trend.neutral { color: #b9d4c6; background: rgba(255,255,255,.05); }
.trend.success { color: var(--green-2); background: rgba(88,232,155,.09); }
.trend.danger { color: #ffb4af; background: rgba(255,118,111,.08); }
.success-card { border-color: rgba(88,232,155,.18); }
.danger-card { border-color: rgba(255,118,111,.17); }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(340px, .7fr); gap: 14px; }
.panel { border-radius: 22px; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px 24px 18px; }
.panel-head.compact { padding-bottom: 11px; }
.live-indicator { display: flex; align-items: center; gap: 7px; color: var(--green); font: 750 10px/1 ui-monospace, SFMono-Regular, monospace; letter-spacing: .13em; }
.live-indicator span { animation: pulse 1.5s ease-in-out infinite; }
.parallel-note { margin: -7px 24px 17px; color: #78998a; font-size: 10px; line-height: 1.6; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.76); } }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th, td { padding: 14px 18px; text-align: left; border-bottom: 1px solid rgba(155,211,181,.075); }
th { color: #6f9282; background: rgba(0,0,0,.08); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.request-head span { display: block; margin-bottom: 4px; color: var(--green); font-size: 9px; letter-spacing: .05em; }
.request-head b { color: #c3dbcf; font-size: 11px; letter-spacing: .08em; }
td { color: #c8ddd2; font-size: 12px; }
tbody tr { transition: background .16s ease; }
tbody tr:hover { background: rgba(88,232,155,.035); }
.address-cell { display: flex; flex-direction: column; gap: 4px; }
.address-cell b { color: var(--text); font: 600 12px/1.2 ui-monospace, SFMono-Regular, monospace; }
.address-cell small { color: #698878; font: 10px/1.2 ui-monospace, SFMono-Regular, monospace; }
.result-chip, .provider-chip { display: inline-flex; align-items: center; width: fit-content; border-radius: 8px; font-size: 10px; font-weight: 720; }
.result-chip { padding: 6px 8px; }
.result-reason { display: block; margin-top: 6px; color: #78998a; font-size: 9px; white-space: nowrap; }
.amount-cell { color: #d8eee3; font: 600 11px/1.3 ui-monospace, SFMono-Regular, monospace; white-space: nowrap; }
.result-chip.allowed { color: var(--green-2); background: rgba(88,232,155,.1); }
.result-chip.blocked, .result-chip.error { color: #ffc0bc; background: rgba(255,118,111,.1); }
.provider-chip { padding: 4px 7px; color: #b8cfc4; background: rgba(255,255,255,.045); }
.provider-chip.false, .provider-chip.error { color: #ffaaa5; background: rgba(255,118,111,.08); }
.empty { height: 250px; color: var(--muted); text-align: center; }

.control-panel { padding-bottom: 20px; }
.dirty-badge { padding: 5px 8px; border-radius: 8px; color: #9fb9ad; background: rgba(255,255,255,.045); font-size: 10px; }
.dirty-badge.unsaved { color: var(--amber); background: rgba(255,189,99,.08); }
.helper { margin: 0 24px 18px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.amount-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 0 24px 8px; }
.amount-grid label span { display: block; margin: 0 1px 7px; color: #bfd5ca; font-size: 10px; font-weight: 650; }
.amount-grid input {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid rgba(155,211,181,.15);
  border-radius: 11px;
  outline: none;
  color: #dff7e9;
  background: rgba(1,9,6,.44);
  transition: .2s ease;
}
.amount-grid input:focus { border-color: rgba(88,232,155,.46); box-shadow: 0 0 0 3px rgba(88,232,155,.07); }
.range-hint { margin: 0 24px 17px; color: #6f9282; font-size: 9px; line-height: 1.55; }
.field-label { display: block; margin: 0 24px 8px; color: #bfd5ca; font-size: 11px; font-weight: 650; }
textarea {
  display: block;
  width: calc(100% - 48px);
  margin: 0 24px;
  resize: vertical;
  min-height: 164px;
  padding: 14px;
  border: 1px solid rgba(155,211,181,.15);
  border-radius: 14px;
  outline: none;
  color: #dff7e9;
  background: rgba(1,9,6,.44);
  font: 11px/1.75 ui-monospace, SFMono-Regular, Menlo, monospace;
  transition: .2s ease;
}
textarea:focus { border-color: rgba(88,232,155,.46); box-shadow: 0 0 0 3px rgba(88,232,155,.07); }
.editor-meta { display: flex; justify-content: space-between; margin: 8px 25px 16px; color: #688778; font-size: 10px; }
.control-actions { display: grid; grid-template-columns: 1.3fr 1fr; gap: 9px; margin: 0 24px 22px; }
.primary-button, .secondary-button {
  min-height: 42px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: .2s ease;
}
.primary-button { border: 1px solid #58e89b; color: #062016; background: linear-gradient(135deg, #79f0ad, #43d98b); }
.secondary-button { border: 1px solid var(--line); color: #bed3c8; background: rgba(255,255,255,.03); }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); filter: brightness(1.05); }
button:disabled { cursor: wait; opacity: .5; transform: none !important; }
.provider-stack { margin: 0 24px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.provider-row { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 11px; padding: 12px; }
.provider-row + .provider-row { border-top: 1px solid var(--line); }
.provider-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font-weight: 800; }
.provider-icon.abre { color: #a6ffcb; background: rgba(88,232,155,.11); }
.provider-icon.fanyu { color: #a7cbff; background: rgba(75,145,255,.12); }
.provider-row b { display: block; font-size: 11px; }
.provider-row small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.mini-state { color: var(--green); font-size: 9px; }
.service-details { margin: 18px 24px 0; }
.service-details div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px dashed rgba(155,211,181,.1); }
.service-details dt, .service-details dd { margin: 0; color: var(--muted); font-size: 10px; }
.service-details dd { max-width: 68%; overflow: hidden; color: #b9cec4; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 10; max-width: min(430px, calc(100vw - 48px)); padding: 13px 16px; border: 1px solid rgba(88,232,155,.26); border-radius: 13px; opacity: 0; transform: translateY(14px); pointer-events: none; color: #dff8e9; background: #102a21; box-shadow: var(--shadow); font-size: 12px; transition: .24s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255,118,111,.32); color: #ffd0cd; background: #331916; }

@media (max-width: 1080px) {
  .hero-grid { grid-template-columns: repeat(3, 1fr); }
  .primary-card { grid-column: 1 / -1; }
  .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .shell { width: min(100% - 24px, 1480px); padding-top: 18px; }
  .topbar { align-items: flex-start; }
  .updated, .icon-button { display: none; }
  .hero-grid { grid-template-columns: 1fr 1fr; }
  .primary-card { min-height: 140px; }
  .metric-card { min-height: 130px; padding: 18px; }
  .metric-card strong { font-size: 30px; }
  .radar { width: 82px; height: 82px; }
  .panel-head { padding-left: 18px; padding-right: 18px; }
  .helper, .amount-grid, .range-hint, .field-label, textarea, .control-actions, .provider-stack, .service-details { margin-left: 18px; margin-right: 18px; }
  textarea { width: calc(100% - 36px); }
  .editor-meta { margin-left: 19px; margin-right: 19px; }
}
