:root {
  --bg: #f4f6fb;
  --card: rgba(255, 255, 255, 0.95);
  --text: #132239;
  --muted: #5c6f8a;
  --line: #d6deec;
  --primary: #1f6dff;
  --primary-dark: #154db6;
  --success: #0e8a5a;
  --danger: #c23a3a;
  --shadow: 0 20px 45px rgba(15, 45, 95, 0.12);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 15% 10%, #dce7ff 0, transparent 42%), radial-gradient(circle at 82% 14%, #ffe9d8 0, transparent 45%), var(--bg);
  min-height: 100vh;
}

.bg-glow {
  position: fixed;
  z-index: 0;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.35;
  pointer-events: none;
}

.bg-glow-left {
  background: #93b4ff;
  top: -90px;
  left: -60px;
}

.bg-glow-right {
  background: #ffc48f;
  top: -110px;
  right: -60px;
}

.topbar,
.page {
  position: relative;
  z-index: 1;
}

.topbar {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1f6dff, #ff8b4d);
  box-shadow: 0 0 0 4px rgba(31, 109, 255, 0.16);
}

.brand-title {
  font-family: "Space Grotesk", sans-serif;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.brand-subtitle {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page {
  max-width: 1180px;
  margin: 16px auto 40px;
  padding: 0 18px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

h1,
h2 {
  margin: 0 0 8px;
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 18px;
}

.muted {
  color: var(--muted);
  margin: 0;
}

.tiny {
  margin-top: 8px;
  font-size: 12px;
}

.required {
  color: var(--danger);
  font-style: normal;
}

.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 14px;
  backdrop-filter: blur(8px);
}

.auth-card {
  max-width: 460px;
  margin: 50px auto;
}

.form-grid {
  display: grid;
  gap: 18px;
}

.form-grid.single {
  max-width: 640px;
}

.form-section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fcfdff;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfd9ea;
  border-radius: 10px;
  background: #fff;
  font: inherit;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(31, 109, 255, 0.15);
}

textarea {
  resize: vertical;
}

.inline-row,
.inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-actions.end {
  justify-content: flex-end;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 9px 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  border-color: var(--primary);
  background: linear-gradient(135deg, #2b7dff, #1f6dff);
  color: #fff;
}

.btn.primary:hover {
  background: linear-gradient(135deg, #3b87ff, #2a76ff);
}

.btn.ghost {
  background: #eef3ff;
  border-color: #cad8f5;
  color: #23406f;
}

.btn.ghost:hover {
  background: #e4edff;
}

.btn.danger {
  border-color: #e3b6b6;
  color: #a82d2d;
  background: #fff7f7;
}

.btn.small {
  padding: 7px 10px;
  font-size: 12px;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.switch-label input {
  width: auto;
}

.security-col {
  display: grid;
  gap: 10px;
}

.captcha-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.captcha-card {
  border: 1px solid #dbe4f5;
  border-radius: 12px;
  padding: 12px;
  background: #f7faff;
}

.captcha-card h3 {
  margin: 0 0 10px;
  font-size: 14px;
  color: #2a436e;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 10px;
  font-size: 14px;
}

th {
  color: #405777;
}

.truncate {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 29, 52, 0.52);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-mask[hidden] {
  display: none !important;
}

.modal-card {
  width: min(900px, 96vw);
  max-height: 86vh;
  background: #fff;
  border: 1px solid #dce5f5;
  border-radius: 14px;
  box-shadow: 0 22px 48px rgba(7, 23, 49, 0.22);
  display: grid;
  grid-template-rows: auto 1fr;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #e2e9f6;
}

.modal-pre {
  margin: 0;
  padding: 16px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f7faff;
  border-radius: 0 0 14px 14px;
}

.pill {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.pill.success {
  color: var(--success);
  background: #d8f5e8;
}

.pill.muted-pill {
  color: #53657f;
  background: #e8eef8;
}

.pill.danger-pill {
  color: var(--danger);
  background: #ffe3e3;
}

.flash-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.flash {
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid transparent;
}

.flash.success {
  color: #0d6845;
  background: #dff9ec;
  border-color: #9fe4bf;
}

.flash.error {
  color: #8f2525;
  background: #ffe9e9;
  border-color: #f0b7b7;
}

.field-editor {
  display: grid;
  gap: 8px;
}

.field-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 0.8fr 0.8fr 1fr 1fr 1fr auto;
  gap: 8px;
  padding: 10px;
  background: #f5f8ff;
  border: 1px solid #dbe4f5;
  border-radius: 10px;
}

.field-row input,
.field-row select {
  min-width: 0;
}

.field-options-input.is-hidden {
  display: none;
}

.kv-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.kv-list li {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 8px;
}

.kv-list span {
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 18px;
}

code {
  font-family: "JetBrains Mono", "SFMono-Regular", Menlo, monospace;
  background: #edf2fb;
  padding: 2px 6px;
  border-radius: 6px;
}

code.block {
  display: block;
  margin: 6px 0 14px;
  padding: 10px;
  overflow-wrap: anywhere;
}

.empty {
  text-align: center;
  padding: 30px 10px;
}

@media (max-width: 980px) {
  h1 {
    font-size: 24px;
  }

  .grid-2,
  .detail-grid,
  .field-row,
  .captcha-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    flex-direction: column;
  }

  .inline-actions.end {
    justify-content: flex-start;
  }

  .truncate {
    max-width: 220px;
  }
}
