:root {
  color-scheme: light;
  --ink: #132238;
  --muted: #66758a;
  --line: #dce4ee;
  --surface: #ffffff;
  --canvas: #f3f6fa;
  --accent: #245be7;
  --accent-dark: #1747bf;
  --good: #197642;
  --bad: #a93434;
  --shadow: 0 18px 50px rgba(31, 49, 79, .10);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 12% -20%, rgba(53, 107, 235, .14), transparent 32rem),
    var(--canvas);
  color: var(--ink);
  font: 15px/1.55 "Segoe UI", "Microsoft YaHei", sans-serif;
}
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.shell { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 40px 0 64px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 26px;
}
h1, h2 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: clamp(28px, 3vw, 42px); }
h2 { font-size: 22px; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 12px; font-weight: 750; letter-spacing: .14em; }
.subtle { margin: 7px 0 0; color: var(--muted); }
.environment { display: flex; align-items: center; gap: 10px; }
#environmentBadge {
  display: inline-flex;
  border: 1px solid #b9d9c7;
  border-radius: 999px;
  background: #ecf8f0;
  color: var(--good);
  padding: 8px 13px;
  font-weight: 700;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow);
  padding: 26px;
}
.login-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(420px, 1.35fr);
  gap: 36px;
  align-items: end;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid.compact { grid-template-columns: 1fr 1fr auto; align-items: end; }
.form-grid label { display: grid; gap: 7px; color: #31435a; font-weight: 650; }
.form-grid .full { grid-column: 1 / -1; }
input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cbd6e3;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 9px 12px;
  outline: none;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(36, 91, 231, .13); }
button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 15px;
  font-weight: 700;
}
.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-dark); }
.quiet { border-color: #cbd6e3; background: #fff; color: var(--ink); }
.tabs { display: flex; gap: 8px; margin: 0 0 14px; }
.tab { border-color: var(--line); background: #fff; color: var(--muted); }
.tab.active { border-color: var(--accent); background: #edf3ff; color: var(--accent); }
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
}
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; min-width: 980px; border-collapse: collapse; }
th, td { border-bottom: 1px solid #e7edf4; padding: 13px 14px; text-align: left; white-space: nowrap; }
th { background: #f7f9fc; color: #4c5c71; font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
.status { display: inline-flex; border-radius: 999px; padding: 4px 9px; font-size: 13px; font-weight: 750; }
.status.enabled { background: #eaf8ef; color: var(--good); }
.status.disabled { background: #fbeeee; color: var(--bad); }
.row-actions { display: flex; gap: 8px; }
.row-actions button { min-height: 34px; padding: 5px 9px; font-size: 13px; }
.empty { padding: 32px; text-align: center; color: var(--muted); }
.audit-list { display: grid; gap: 10px; }
.audit-item { display: grid; grid-template-columns: 180px 220px 1fr; gap: 18px; border-bottom: 1px solid var(--line); padding: 12px 2px; }
.audit-item:last-child { border-bottom: 0; }
dialog { width: min(720px, calc(100% - 32px)); border: 0; border-radius: 18px; padding: 0; box-shadow: 0 28px 100px rgba(12, 24, 45, .35); }
dialog::backdrop { background: rgba(17, 29, 48, .52); backdrop-filter: blur(2px); }
.dialog-form { padding: 26px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
.icon-button { width: 42px; padding: 0; border-color: var(--line); background: #fff; font-size: 27px; line-height: 1; }
.notice { border-radius: 10px; background: #f3f6fb; color: var(--muted); padding: 12px 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 440px; border-radius: 12px; background: #15243a; color: #fff; padding: 13px 16px; box-shadow: var(--shadow); }

@media (max-width: 820px) {
  .shell { width: min(100% - 24px, 1440px); padding-top: 22px; }
  .topbar, .section-heading { flex-direction: column; }
  .login-panel { grid-template-columns: 1fr; }
  .form-grid, .form-grid.compact { grid-template-columns: 1fr; }
  .audit-item { grid-template-columns: 1fr; gap: 2px; }
}
