:root {
  --bg: #f4f1ea;
  --ink: #1d2521;
  --muted: #6d756f;
  --line: #d8d1c3;
  --panel: #fffdf8;
  --accent: #0b6b5d;
  --accent-ink: #ffffff;
  --warn: #9b341f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #f8f4ec 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: "Segoe UI", "Noto Sans", sans-serif;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 28px 32px;
  border-bottom: 1px solid var(--line);
}

.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

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

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

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
  margin-bottom: 16px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(280px, 1fr);
  gap: 18px;
  padding: 24px 32px 40px;
}

.single {
  padding: 24px 32px 40px;
}

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

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

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 14px;
}

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

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

input,
select,
button,
.button-link {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 8px 10px;
  background: #fff;
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}

.button-link.ghost {
  background: transparent;
  color: var(--accent);
}

.run-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.run-form input {
  width: 150px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(90px, 1fr));
  gap: 10px;
}

.status-grid.optional {
  grid-template-columns: minmax(140px, 1fr);
  margin-top: 10px;
}

.cache-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

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

.cache-actions input {
  width: 150px;
}

.feed-box {
  margin-top: 14px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.feed-box p {
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}

.feed-box p:last-child {
  margin-bottom: 0;
}

.error-text {
  color: var(--warn);
}

.inline-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.inline-section h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.status {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fff;
}

.status span,
.status strong {
  display: block;
}

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

.status.ok strong {
  color: var(--accent);
}

.status.off strong {
  color: var(--warn);
}

.hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.group-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.group-column {
  display: grid;
  gap: 8px;
  align-content: start;
}

.group-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.group-row input {
  min-height: auto;
}

.group-row small {
  color: var(--muted);
}

.section-hint {
  margin-top: -6px;
  margin-bottom: 16px;
}

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

.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}

.alert {
  margin: 16px 32px 0;
  padding: 12px 14px;
  color: var(--warn);
  background: #fff3ed;
  border: 1px solid #efc7b5;
  border-radius: 8px;
}

.compact {
  margin: 12px 0;
}

.action {
  margin-bottom: 14px;
}

.action header {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 12px;
  align-items: center;
}

pre {
  overflow: auto;
  padding: 12px;
  background: #17201c;
  color: #e8f4ed;
  border-radius: 6px;
}

@media (max-width: 900px) {
  .topbar,
  .topbar-actions,
  .run-form {
    align-items: stretch;
    flex-direction: column;
  }

  .layout,
  .group-columns,
  .settings-grid,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .layout,
  .single {
    padding-left: 16px;
    padding-right: 16px;
  }
}
