:root {
  --ink: #181818;
  --muted: #777777;
  --line: #e7e7e7;
  --soft: #f7f7f7;
  --panel: #ffffff;
  --warning: #fff6df;
  --accent: #151515;
  --green: #18b981;
  --red: #e5484d;
  --blue: #2f7cf6;
  --purple: #8b5cf6;
  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: #ffffff;
}

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

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

button {
  cursor: pointer;
}

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

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: #f5f5f5;
}

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

.eyebrow,
.breadcrumb {
  margin: 0 0 8px;
  color: #8a8a8a;
  font-size: 12px;
}

.login-panel h1,
.console-topbar h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

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

.login-form,
.field-stack,
.card-grid,
.console-panel {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #282828;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid #dddddd;
  border-radius: 7px;
  outline: 0;
}

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

input:focus,
textarea:focus,
select:focus {
  border-color: #111111;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.login-form button,
.primary-action,
.secondary-action,
.small-action,
.danger-action,
.ghost-action,
.topbar-actions a,
.topbar-actions button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.login-form button,
.primary-action {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.danger-action {
  color: var(--red);
  background: #fff5f5;
  border-color: #ffd8d8;
}

.ghost-action {
  color: #777777;
  background: transparent;
}

.form-message,
.save-message,
.help-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.save-message {
  min-height: 20px;
  color: var(--red);
}

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

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

.console-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  padding: 22px 12px;
  background: #ffffff;
  border-right: 1px solid var(--line);
}

.console-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px 14px;
  font-size: 16px;
}

.console-brand span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  background: #ffdf55;
  border-radius: 5px;
  font-weight: 900;
}

.console-nav {
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 5px;
}

.nav-group {
  margin: 18px 14px 6px;
  color: #9a9a9a;
  font-size: 12px;
  font-weight: 800;
}

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

.console-nav button,
.collapse-button {
  min-height: 40px;
  padding: 0 14px;
  color: #555555;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 7px;
}

.console-nav button.is-active {
  color: #ffffff;
  background: #151515;
  font-weight: 900;
}

.collapse-button {
  color: #777777;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.console-main {
  min-width: 0;
  background: #ffffff;
}

.safety-strip {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 34px;
  padding: 0 18px;
  color: #4d3820;
  background: #fff2e9;
  border-bottom: 1px solid #f4ded1;
  font-size: 12px;
}

.safety-strip button {
  width: 28px;
  height: 28px;
  background: transparent;
  border: 0;
}

.console-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 66px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}

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

.console-panel {
  padding: 24px clamp(18px, 4vw, 64px) 54px;
}

.notice {
  padding: 13px 14px;
  background: var(--warning);
  border-radius: 10px;
  font-size: 13px;
}

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

.stat-card,
.section-panel,
.table-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.stat-card {
  display: grid;
  gap: 8px;
  min-height: 112px;
  padding: 16px;
}

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

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

.stat-card small {
  color: #8a8a8a;
}

.section-panel {
  padding: 18px;
}

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

.section-title h2 {
  margin: 0 0 5px;
  font-size: 18px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.toolbar input,
.toolbar select {
  width: auto;
  min-width: 170px;
}

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

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

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid #dddddd;
  border-radius: 7px;
}

.toggle-row input {
  width: 18px;
  min-height: 18px;
}

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

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

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

th {
  color: #9a9a9a;
  font-weight: 900;
}

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

.key-mask,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  background: #f6f6f6;
  border-radius: 7px;
  font-size: 12px;
}

.pill.green {
  color: #047857;
  background: #dcfce7;
}

.pill.red {
  color: #be123c;
  background: #ffe4e6;
}

.pill.blue {
  color: #1d4ed8;
  background: #dbeafe;
}

.pill.purple {
  color: #6d28d9;
  background: #ede9fe;
}

.row-actions {
  display: inline-flex;
  gap: 6px;
}

.row-actions button {
  min-width: 30px;
  min-height: 30px;
  padding: 0 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.editor-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

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

.result-box {
  min-height: 150px;
  max-height: 360px;
  overflow: auto;
  padding: 14px;
  color: #eaf2f0;
  background: #111111;
  border-radius: 10px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 13px;
  line-height: 1.55;
}

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

@media (max-width: 1100px) {
  .stat-grid,
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .login-panel,
  .console-shell,
  .stat-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

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

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