:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #20242a;
  --muted: #657080;
  --line: #d9dee7;
  --brand: #1769aa;
  --brand-dark: #0e4d82;
  --ok: #0f7b45;
  --warn: #a55300;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

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

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 0 24px;
  background: #101820;
  color: #fff;
}

.topbar span {
  margin-left: 12px;
  color: #b8c4d4;
  font-size: 13px;
}

.banner {
  padding: 10px 24px;
  background: #fff2cc;
  border-bottom: 1px solid #e2c66c;
  color: #5c4400;
  font-weight: 700;
}

.shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 56px);
}

.sidebar {
  padding: 18px;
  border-right: 1px solid var(--line);
  background: #fff;
}

.sidebar a {
  display: block;
  padding: 9px 10px;
  border-radius: 6px;
  color: #2f3947;
}

.sidebar a.active,
.sidebar a:hover {
  background: #e9f2fb;
  color: var(--brand-dark);
}

.content {
  padding: 24px;
  max-width: 1280px;
  width: 100%;
}

.page-head {
  margin-bottom: 18px;
}

.page-head h1 {
  margin: 0 0 4px;
  font-size: 26px;
}

.page-head p,
.hint {
  margin: 0;
  color: var(--muted);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

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

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

.metric {
  padding: 16px;
}

.metric span {
  display: block;
  color: var(--muted);
}

.metric strong {
  font-size: 28px;
}

.panel {
  padding: 18px;
  margin-bottom: 16px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
}

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

th {
  background: #eef2f6;
  font-size: 12px;
  text-transform: uppercase;
  color: #4b5563;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

pre {
  overflow: auto;
  max-height: 360px;
  padding: 12px;
  background: #111827;
  color: #e5e7eb;
  border-radius: 6px;
}

.form {
  display: grid;
  gap: 12px;
  max-width: 760px;
}

.form.compact {
  max-width: 900px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

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

textarea {
  resize: vertical;
}

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

.checkbox input {
  width: auto;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.button.secondary {
  background: #fff;
  color: var(--brand);
}

button.small,
.button.small {
  min-height: 30px;
  padding: 5px 9px;
}

.link-button {
  border: 0;
  background: transparent;
  color: #fff;
  padding: 0;
}

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

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

.pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf0f4;
  color: #4b5563;
  font-size: 12px;
  font-weight: 700;
}

.pill.ok {
  background: #e7f6ee;
  color: var(--ok);
}

.pill.warn {
  background: #fff2cc;
  color: var(--warn);
}

.hint-panel {
  padding: 12px 14px;
}

.hint-panel p {
  margin: 0;
}

.kv {
  display: grid;
  grid-template-columns: minmax(160px, 240px) 1fr;
  gap: 8px 16px;
}

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

.kv dd {
  margin: 0;
}

.event-row {
  margin-bottom: 10px;
  padding: 12px;
}

.event-row summary {
  cursor: pointer;
}

.event-row summary span {
  margin-left: 8px;
  color: var(--brand-dark);
}

.event-row time {
  float: right;
  color: var(--muted);
}

.error {
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid #f0b4ae;
  border-radius: 6px;
  background: #fff1f0;
  color: var(--danger);
}

.success {
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid #9dd7b0;
  border-radius: 6px;
  background: #ecfdf3;
  color: var(--ok);
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.login-box {
  width: min(420px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

  .sidebar {
    display: flex;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar a {
    white-space: nowrap;
  }

  .content {
    padding: 16px;
  }

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

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

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