:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #18202a;
  --muted: #697586;
  --line: #d8dee8;
  --accent: #146ef5;
  --danger: #c2352b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  display: grid;
  grid-template-columns: 220px 1fr;
}

body.login-body {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 24px;
}

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

.login-shell {
  width: min(420px, 100%);
}

.login-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  display: grid;
  gap: 16px;
  box-shadow: 0 16px 40px rgb(24 32 42 / 8%);
}

.login-brand {
  color: var(--text);
  margin-bottom: 0;
}

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

.warn {
  color: #a15c00;
  font-weight: 700;
}

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

.sidebar {
  background: #101720;
  color: #fff;
  min-height: 100vh;
  padding: 22px 16px;
}

.brand {
  font-weight: 800;
  font-size: 22px;
  margin-bottom: 28px;
}

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

nav a {
  color: #c9d2df;
  padding: 10px 12px;
  border-radius: 6px;
}

nav a.active,
nav a:hover {
  background: #223044;
  color: #fff;
}

.logout-form {
  margin-top: 24px;
}

.logout-form button {
  width: 100%;
  background: #344254;
}

.main {
  padding: 28px;
  max-width: 1280px;
  width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

h1 {
  font-size: 28px;
  margin: 0;
}

.eyebrow {
  color: var(--muted);
  margin: 0 0 4px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

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

.metric {
  padding: 18px;
  display: grid;
  gap: 12px;
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.metric:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

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

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

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

.grid-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

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

textarea {
  resize: vertical;
  min-height: 110px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  line-height: 1.45;
}

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

.form-note {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.check input {
  width: auto;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  padding: 10px 14px;
  cursor: pointer;
  min-height: 40px;
}

.form-actions,
.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-weight: 700;
  padding: 9px 13px;
}

.button-link.small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

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

.table-wrap {
  overflow: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  background: #fbfcfe;
}

td {
  font-size: 14px;
}

code {
  font-size: 12px;
  word-break: break-all;
}

.docker-command,
.renew-command,
.agent-command {
  display: block;
  max-width: 360px;
  color: var(--text);
}

.renew-command {
  max-width: 520px;
}

.agent-command {
  max-width: 520px;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.status-up {
  background: #e7f7ed;
  color: #137333;
}

.status-down {
  background: #fff1f0;
  color: var(--danger);
}

.status-stale,
.status-waiting {
  background: #fff7df;
  color: #8a5a00;
}

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

.empty {
  color: var(--muted);
  text-align: center;
  padding: 28px;
}

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

  .sidebar {
    min-height: auto;
  }

  nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .main {
    padding: 18px;
  }

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