:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #f0f5f3;
  --ink: #19202a;
  --muted: #687282;
  --line: #dfe5ea;
  --accent: #247a5a;
  --accent-2: #a85f12;
  --danger: #b42318;
  --ok: #1f7a3f;
  --shadow: 0 14px 34px rgba(20, 27, 38, 0.08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  min-height: 36px;
  padding: 0 12px;
}

button:hover {
  border-color: #b6c3cd;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin-top: 18px;
  padding: 0 14px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

.link-button.secondary {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  margin-left: 8px;
}

button.warn {
  color: var(--accent-2);
}

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

textarea {
  min-height: 180px;
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

pre {
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: #121922;
  color: #e9f0f2;
  border-radius: 8px;
  padding: 14px;
  font-size: 13px;
  line-height: 1.5;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 30px;
}

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

h1,
h2,
h3,
h4 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 16px;
}

h4 {
  font-size: 15px;
}

.form-stack {
  display: grid;
  gap: 14px;
  margin-top: 26px;
}

label span,
.field-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.error-text {
  color: var(--danger);
  min-height: 20px;
  margin: 0;
}

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

.sidebar {
  background: #18222e;
  color: #eef5f3;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
}

.brand {
  padding: 8px 10px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand strong {
  display: block;
  font-size: 18px;
  margin-bottom: 6px;
}

.brand span {
  color: #aebbc7;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 6px;
  padding: 18px 0;
}

.nav button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  background: transparent;
  color: #dce6ea;
  border-color: transparent;
}

.nav button.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  color: #aebbc7;
  font-size: 13px;
  padding: 12px 10px;
}

.content {
  min-width: 0;
  padding: 22px;
}

.topbar {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar p {
  color: var(--muted);
  margin: 6px 0 0;
}

.public-docs {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.public-docs-header {
  min-height: 72px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.public-docs-header h1 {
  font-size: 26px;
}

.public-docs-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.public-docs-actions .link-button {
  margin-top: 0;
}

.public-docs-content {
  min-width: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.doc-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 14px;
}

.doc-block p {
  margin: 10px 0 0;
}

.constant-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 12px;
}

.constant-tabs button.active {
  background: var(--panel-2);
  border-color: #9db7aa;
  color: #164834;
}

.constant-controls {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(220px, 1fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.constant-scope-note {
  color: var(--muted);
  font-size: 13px;
  min-height: 36px;
  display: flex;
  align-items: center;
}

.constant-count,
.constant-pagination {
  color: var(--muted);
  font-size: 13px;
}

.constant-count {
  margin: 0 0 10px;
}

.constant-pagination {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 12px;
}

.field-list {
  display: grid;
  gap: 6px;
}

.field-list span {
  display: block;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  font-size: 28px;
  margin-top: 8px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin-bottom: 16px;
}

.toolbar label {
  min-width: 180px;
  flex: 1;
}

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

.table-wrap.compact table {
  min-width: 520px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: #fff;
}

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

th {
  background: #f4f6f7;
  color: #485463;
  font-weight: 700;
}

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

.status-ok {
  color: var(--ok);
  font-weight: 700;
}

.status-bad {
  color: var(--danger);
  font-weight: 700;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tabs button {
  background: #fff;
}

.tabs button.active {
  background: var(--panel-2);
  border-color: #9db7aa;
  color: #164834;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  margin: 8px 0 0;
}

.secret-box {
  border: 1px solid #d6b37f;
  background: #fff8eb;
  border-radius: 8px;
  padding: 12px;
  color: #5f3b07;
  margin: 12px 0;
  word-break: break-all;
}

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

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

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .public-docs-header {
    display: grid;
  }

  .public-docs-actions {
    justify-content: flex-start;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid.two,
  .grid.three,
  .doc-grid,
  .split,
  .constant-controls {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff;
  }

  button,
  .public-docs-actions,
  .constant-controls,
  .constant-tabs,
  .constant-pagination {
    display: none !important;
  }

  .public-docs {
    width: 100%;
    padding: 0;
  }

  .public-docs-header,
  .panel,
  .doc-block,
  .table-wrap {
    box-shadow: none;
  }

  .public-docs-header {
    border-bottom: 1px solid #cfd6dd;
    margin-bottom: 12px;
    padding-bottom: 12px;
  }

  .panel {
    break-inside: avoid;
  }

  pre {
    white-space: pre-wrap;
    color: #111;
    background: #f4f6f7;
  }
}
