:root {
  color-scheme: light;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: #172026;
  background: #f4f6f7;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f4f6f7; }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { margin: 4px 0 0; color: #68757d; font-size: 13px; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(380px, 100%); padding: 32px; border: 1px solid #d8dfe2; border-radius: 8px; background: #fff; box-shadow: 0 14px 35px rgba(25, 38, 45, .08); }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 20px; border-radius: 8px; color: #fff; background: #126e70; }
.brand-mark svg { width: 23px; height: 23px; }
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 23px; }
h2 { font-size: 19px; }
label { display: grid; gap: 7px; color: #435159; font-size: 13px; }
.login-panel label { margin: 24px 0 16px; }
input, select { min-width: 0; height: 38px; padding: 0 10px; border: 1px solid #cbd4d8; border-radius: 5px; color: #172026; background: #fff; outline: none; }
input:focus, select:focus { border-color: #126e70; box-shadow: 0 0 0 3px rgba(18, 110, 112, .12); }
.form-error { min-height: 18px; margin: 12px 0 0; color: #b72f35; font-size: 13px; text-align: center; }

button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 13px; border: 1px solid transparent; border-radius: 5px; font-weight: 600; }
button svg { width: 16px; height: 16px; }
button:disabled { cursor: not-allowed; opacity: .55; }
.wide { width: 100%; }
.primary { color: #fff; background: #126e70; }
.primary:hover { background: #0c5b5d; }
.secondary { color: #2e3a40; border-color: #cbd4d8; background: #fff; }
.secondary:hover { border-color: #87969d; background: #f8fafb; }
.danger { color: #fff; background: #b33a40; }
.danger:hover { background: #962e34; }
.icon-button { width: 36px; padding: 0; color: #445159; border-color: #d6dde0; background: #fff; }

.topbar { height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid #d7dee1; background: #fff; }
.brand, .topbar-actions, .command-row { display: flex; align-items: center; gap: 9px; }
.brand { color: #126e70; }
.brand strong { color: #172026; }
.brand svg { width: 21px; height: 21px; }
.status-dot { display: inline-flex; align-items: center; gap: 7px; margin-right: 4px; color: #536067; font-size: 12px; }
.status-dot i { width: 7px; height: 7px; border-radius: 50%; background: #2a8b57; }

.workspace { max-width: 1480px; margin: 0 auto; padding: 22px; }
.tabs { display: flex; gap: 2px; margin-bottom: 20px; border-bottom: 1px solid #d4dcdf; }
.tab { position: relative; min-height: 42px; color: #627078; border: 0; background: transparent; }
.tab::after { content: ""; position: absolute; right: 10px; bottom: -1px; left: 10px; height: 2px; background: transparent; }
.tab.active { color: #126e70; }
.tab.active::after { background: #126e70; }
.view { display: none; }
.view.active { display: block; }
.section-heading { min-height: 52px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 16px; }

.settings-band { display: grid; grid-template-columns: 170px 170px minmax(280px, 1fr) minmax(320px, 1.3fr); gap: 14px; margin-bottom: 18px; padding: 17px; border: 1px solid #d8dfe2; background: #fff; }
.switch-field { grid-template-columns: 1fr auto; align-items: center; align-content: end; height: 62px; }
.switch-field > span:first-child { grid-column: 1 / 3; }
.switch-field input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 38px; height: 22px; border-radius: 12px; background: #a8b2b7; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s ease; }
.switch-field input:checked + .switch { background: #126e70; }
.switch-field input:checked + .switch::after { transform: translateX(16px); }

.table-wrap { overflow-x: auto; border: 1px solid #d8dfe2; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 12px; border-bottom: 1px solid #e5eaec; text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: #56636a; background: #f8f9fa; font-size: 12px; font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfc; }
td input, td select { height: 34px; }
.path-input { width: min(420px, 35vw); }
.timeout-input { width: 94px; }
.endpoint-name { font-weight: 650; }
.endpoint-id { display: block; margin-top: 2px; color: #7b878d; font-size: 11px; }
.table-toggle { width: 17px; height: 17px; accent-color: #126e70; }
.align-right { text-align: right; }
.state-label { display: inline-flex; padding: 3px 7px; border-radius: 4px; color: #3f4d54; background: #edf1f2; font-size: 11px; font-weight: 700; }
.state-label.published { color: #14603c; background: #e4f2ea; }
.state-label.draft { color: #7b5c14; background: #fbf1d8; }
.small-button { min-height: 30px; padding: 0 9px; font-size: 12px; }

.result-strip { margin-bottom: 16px; padding: 12px 14px; border-left: 3px solid #126e70; background: #eaf3f3; font-size: 13px; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 10px; margin-bottom: 16px; }
.metric { min-height: 76px; padding: 13px 14px; border: 1px solid #d8dfe2; background: #fff; }
.metric strong { display: block; margin-top: 7px; font-size: 21px; }
.metric span { color: #69767d; font-size: 12px; }
.empty-row { height: 92px; color: #78858b; text-align: center; }

.toast { position: fixed; right: 22px; bottom: 22px; max-width: min(420px, calc(100vw - 44px)); padding: 11px 14px; border-radius: 5px; color: #fff; background: #253238; box-shadow: 0 9px 24px rgba(0,0,0,.18); opacity: 0; pointer-events: none; transform: translateY(8px); transition: .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #a63238; }

@media (max-width: 980px) {
  .settings-band { grid-template-columns: 1fr 1fr; }
  .wide-field { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 14px; }
  .workspace { padding: 16px 12px; }
  .status-dot { display: none; }
  .tabs { overflow-x: auto; }
  .tab { flex: 1 0 auto; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .command-row { display: grid; grid-template-columns: repeat(3, 1fr); }
  .command-row button { padding: 0 8px; }
  .settings-band { grid-template-columns: 1fr; padding: 14px; }
  .wide-field { grid-column: auto; }
  .login-panel { padding: 25px; }
}
