:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #18212f;
  --muted: #657184;
  --line: #dbe2ea;
  --accent: #0969da;
  --accent-2: #0f766e;
  --danger: #b42318;
  --warn: #a15c00;
  --ok: #147a3d;
  --shadow: 0 16px 40px rgba(24, 33, 47, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

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

button {
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 600;
}

button.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

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

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

.app-shell {
  min-height: 100vh;
}

.login-panel {
  width: min(420px, calc(100vw - 32px));
  margin: 12vh auto 0;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin: 0 0 24px;
  font-size: 24px;
  line-height: 1.1;
}

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

label {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

textarea {
  min-height: 112px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.form-error {
  color: var(--danger);
  margin: 12px 0 0;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--text);
  color: #fff;
}

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 64px);
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 16px;
}

.nav-button {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  margin-bottom: 6px;
  background: transparent;
  color: var(--text);
  border-color: transparent;
  justify-content: flex-start;
}

.nav-button.active {
  background: var(--surface-2);
  border-color: var(--line);
  box-shadow: inset 3px 0 0 var(--accent);
}

.content {
  padding: 24px;
  display: grid;
  gap: 20px;
  align-content: start;
}

.screen-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.screen-header h1 {
  margin: 0 0 4px;
  font-size: 26px;
  line-height: 1.15;
}

.screen-header p {
  margin: 0;
  color: var(--muted);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
}

.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(24, 33, 47, 0.05);
}

.metric {
  padding: 16px;
}

.metric strong {
  display: block;
  font-size: 24px;
}

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

.panel {
  padding: 18px;
  display: grid;
  gap: 14px;
}

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

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

.two-col {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 16px;
}

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

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

.inline-form select,
.inline-form input {
  width: auto;
  min-width: 116px;
}

.inline-form input {
  min-width: 160px;
}

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

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

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

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

pre {
  overflow: auto;
  max-height: 420px;
  margin: 0;
  padding: 14px;
  background: #101828;
  color: #e6edf7;
  border-radius: 8px;
  font-size: 12px;
}

.status {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-2);
}

.status.error,
.status.failed {
  color: var(--danger);
}

.status.warn,
.status.running,
.status.queued,
.status.visible,
.status.open,
.status.in_review,
.status.high,
.status.urgent {
  color: var(--warn);
}

.status.ok,
.status.succeeded,
.status.active,
.status.enabled,
.status.resolved {
  color: var(--ok);
}

.status.neutral,
.status.hidden,
.status.closed,
.status.low,
.status.normal {
  color: var(--muted);
}

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

.message {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-2);
}

.message.error {
  color: var(--danger);
}

@media (max-width: 960px) {
  .layout,
  .two-col,
  .three-col {
    grid-template-columns: 1fr;
  }

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

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

  .nav-button {
    width: auto;
    white-space: nowrap;
  }
}
