:root {
  color-scheme: light;
  --ink: #17201d;
  --muted: #61706a;
  --line: #d9e1dc;
  --paper: #f7f6ef;
  --panel: #ffffff;
  --soft: #eef7f2;
  --teal: #0f9b8e;
  --yellow: #f1df6f;
  --danger: #c94c43;
  --blue: #4078c0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.is-hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(15, 155, 142, 0.16), transparent 42%),
    linear-gradient(300deg, rgba(241, 223, 111, 0.28), transparent 46%),
    var(--paper);
}

.login-panel {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 32px;
  width: min(920px, 100%);
  padding: 34px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(23, 32, 29, 0.14);
}

.login-panel h1,
.admin-topbar h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
}

.login-panel p {
  color: var(--muted);
  line-height: 1.7;
}

.login-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: #31413b;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fffef8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

input.is-invalid,
textarea.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(201, 76, 67, 0.12);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.login-form button,
.primary-action,
.secondary-action,
.small-action,
.danger-action {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 900;
  cursor: pointer;
}

.login-form button,
.primary-action {
  color: var(--ink);
  background: var(--yellow);
}

.secondary-action,
.small-action {
  color: var(--ink);
  background: var(--panel);
  border-color: var(--line);
}

.danger-action {
  color: var(--danger);
  background: #fff7f6;
  border-color: #f1c7c3;
}

.form-message,
.save-message {
  min-height: 24px;
  margin: 0;
  color: var(--danger);
}

.save-message.is-ok {
  color: var(--teal);
}

.admin-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 22px;
  color: #e8f1ed;
  background: var(--ink);
}

.admin-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 26px;
}

.admin-brand span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--ink);
  background: var(--yellow);
  border-radius: 8px;
  font-weight: 900;
}

.admin-nav {
  display: grid;
  gap: 6px;
}

.nav-group {
  margin: 18px 0 4px;
  color: rgba(255, 255, 255, 0.42);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}

.nav-group:first-child {
  margin-top: 0;
}

.admin-nav button {
  min-height: 36px;
  padding: 0 12px;
  color: rgba(255, 255, 255, 0.72);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.admin-nav button.is-active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.12);
}

.admin-workspace {
  padding: 26px clamp(20px, 4vw, 54px) 54px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.editor-panel {
  display: grid;
  gap: 16px;
}

.section-heading {
  margin-bottom: 14px;
}

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

.wide-field {
  grid-column: 1 / -1;
}

.section-panel,
.repeat-item {
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(23, 32, 29, 0.07);
}

.section-panel h2,
.repeat-item h3 {
  margin: 0;
}

.repeat-list {
  display: grid;
  gap: 12px;
}

.repeat-item {
  display: grid;
  gap: 14px;
  box-shadow: none;
}

.checkbox-field {
  align-content: start;
  grid-template-columns: 1fr auto;
  min-height: 42px;
  align-items: center;
  padding: 10px 12px;
  background: #fffef8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.checkbox-field input {
  width: 18px;
  min-height: 18px;
}

.item-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.help-text {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.raw-json {
  min-height: 540px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 13px;
  line-height: 1.5;
}

.playground-form {
  display: grid;
  gap: 14px;
}

.password-form {
  display: grid;
  gap: 14px;
}

.password-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.password-message {
  flex: 1 1 260px;
}

.result-box {
  min-height: 170px;
  max-height: 360px;
  margin: 0;
  overflow: auto;
  padding: 14px;
  color: #dfeee8;
  background: #101916;
  border-radius: 8px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 13px;
  line-height: 1.55;
}

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

.stat-card {
  display: grid;
  gap: 6px;
  min-height: 112px;
  padding: 18px;
  background: #fffef8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat-card span,
.stat-card small {
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  font-size: 30px;
  line-height: 1;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: #fffef8;
}

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

th {
  color: #31413b;
  background: #f4f7f1;
  font-weight: 900;
}

tr:last-child td {
  border-bottom: 0;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

@media (max-width: 920px) {
  .login-panel,
  .admin-shell,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    height: auto;
  }

  .admin-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }
}
