
:root {
  color-scheme: light;
  --bg: #eef1f4;
  --panel: #ffffff;
  --text: #18202a;
  --muted: #687483;
  --line: #d8dee7;
  --accent: #246bfe;
  --accent-dark: #184fc2;
  --good: #16794c;
  --good-bg: #e7f6ee;
  --warn: #9a6700;
  --warn-bg: #fff4d6;
  --danger: #c7352c;
  --danger-bg: #fde7e5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 72px;
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.top-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.page {
  display: grid;
  gap: 18px;
  margin: 0 auto;
  max-width: 1320px;
  padding: 24px;
}

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

.brand-block h1 {
  font-size: 22px;
  line-height: 1.1;
  margin: 0;
}

.brand-block p {
  color: var(--muted);
  margin: 4px 0 0;
}

.brand-block.compact h1 {
  font-size: 18px;
}

.brand-mark {
  align-items: center;
  background: #18202a;
  border-radius: 8px;
  color: #ffffff;
  display: grid;
  font-weight: 800;
  height: 42px;
  justify-items: center;
  width: 42px;
}

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

.login-shell {
  margin: 0 auto;
  max-width: 420px;
  width: 100%;
}

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

.login-panel {
  display: grid;
  gap: 24px;
  padding: 28px;
}

.login-identity {
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
}

.login-identity span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.login-identity strong {
  overflow-wrap: anywhere;
}

.panel {
  padding: 18px;
}

.panel-title {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-title h2 {
  font-size: 16px;
  margin: 0;
}

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

.metric {
  padding: 16px;
}

.metric span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  text-transform: uppercase;
}

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

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

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

.stack {
  display: grid;
  gap: 12px;
}

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

.form-actions {
  align-items: center;
  display: flex;
  justify-content: flex-end;
}

.database-form {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

label {
  color: var(--muted);
  display: grid;
  gap: 6px;
  min-width: 0;
}

label span {
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  min-height: 40px;
  padding: 9px 10px;
  width: 100%;
}

textarea {
  resize: vertical;
}

.checkline {
  align-items: center;
  display: flex;
  gap: 8px;
  min-height: 40px;
}

.checkline.top-gap {
  margin-top: 18px;
}

.checkline input {
  height: 16px;
  min-height: 16px;
  width: 16px;
}

button,
.link-button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.primary {
  background: var(--accent);
  color: #ffffff;
}

.primary:hover {
  background: var(--accent-dark);
}

.ghost {
  background: #ffffff;
  border-color: var(--line);
  color: var(--text);
}

.small {
  background: #f6f8fb;
  border-color: var(--line);
  color: var(--text);
  min-height: 34px;
  padding: 6px 10px;
}

.danger-button {
  color: var(--danger);
}

.alert {
  border-radius: 8px;
  padding: 12px 14px;
}

.good-bg {
  background: var(--good-bg);
  color: var(--good);
}

.warn-bg {
  background: var(--warn-bg);
  color: var(--warn);
}

.danger-bg {
  background: var(--danger-bg);
  color: var(--danger);
}

.list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.list-row {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 52px;
  padding-top: 10px;
}

.list-row strong,
td strong {
  display: block;
}

.list-row span,
td span {
  color: var(--muted);
  display: block;
  font-size: 12px;
}

.settings-subtitle {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 16px;
}

.settings-subtitle h3 {
  font-size: 14px;
  margin: 0;
}

.settings-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.settings-item {
  border-top: 1px solid var(--line);
  padding: 10px 0 0;
}

.settings-item:first-child {
  border-top: 0;
}

.settings-summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  list-style: none;
}

.settings-summary::-webkit-details-marker {
  display: none;
}

.settings-summary::before {
  color: var(--accent);
  content: "+";
  font-weight: 900;
}

.settings-item[open] .settings-summary::before {
  content: "-";
}

.settings-summary-text {
  display: block;
  flex: 1;
  min-width: 0;
}

.settings-summary strong {
  display: block;
  overflow-wrap: anywhere;
}

.settings-summary span:not(.pill):not(.status) {
  color: var(--muted);
  display: block;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.settings-edit {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 12px;
}

.settings-delete {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.pill,
.status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
  white-space: nowrap;
}

.pill {
  background: #edf2ff;
  color: var(--accent-dark);
}

.status.good {
  background: var(--good-bg);
  color: var(--good);
}

.status.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.status.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.status.muted {
  background: #eef1f4;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

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

.paths,
.detail-grid {
  display: grid;
  gap: 12px;
}

.paths {
  grid-template-columns: 120px minmax(0, 1fr);
}

.paths dt,
.kv span,
.detail-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.paths dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.detail-grid div {
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  padding: 12px;
}

.detail-grid strong {
  overflow-wrap: anywhere;
}

.kv {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

code,
.log {
  background: #101820;
  border-radius: 8px;
  color: #eef6ff;
  display: block;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  overflow-x: auto;
  padding: 12px;
}

.inline-code {
  display: inline-block;
  padding: 3px 6px;
}

.log {
  min-height: 220px;
  white-space: pre-wrap;
}

.wiki-page {
  max-width: 1120px;
}

.wiki-list {
  display: grid;
}

.wiki-block {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}

.wiki-block:first-child {
  border-top: 0;
  padding-top: 0;
}

.wiki-block:last-child {
  padding-bottom: 0;
}

.wiki-block summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  list-style: none;
}

.wiki-block summary::-webkit-details-marker {
  display: none;
}

.wiki-block summary::before {
  color: var(--accent);
  content: "+";
  font-weight: 900;
}

.wiki-block[open] summary::before {
  content: "-";
}

.wiki-block summary strong {
  flex: 1;
  overflow-wrap: anywhere;
}

.wiki-block summary span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.wiki-content {
  display: grid;
  gap: 10px;
  padding: 14px 0;
}

.wiki-content h2,
.wiki-content h3,
.wiki-content h4,
.wiki-content p,
.wiki-content ul {
  margin: 0;
}

.wiki-content h2 {
  font-size: 20px;
}

.wiki-content h3 {
  font-size: 17px;
}

.wiki-content h4 {
  font-size: 15px;
}

.wiki-content ul {
  padding-left: 20px;
}

.wiki-content pre {
  background: #101820;
  border-radius: 8px;
  color: #eef6ff;
  margin: 0;
  overflow-x: auto;
  padding: 12px;
}

.wiki-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.wiki-edit {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.wiki-delete {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

@media (max-width: 980px) {
  .metrics,
  .grid.two,
  .database-form,
  .detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar {
    align-items: flex-start;
    gap: 14px;
    padding: 14px;
  }

  .page {
    padding: 14px;
  }

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

  .top-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .settings-summary,
  .wiki-block summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .settings-summary span:not(.pill):not(.status),
  .wiki-block summary span {
    white-space: normal;
  }
}
