:root {
  --bg: #f3f6f4;
  --surface: #ffffff;
  --surface-2: #eef3ef;
  --text: #18211d;
  --muted: #64716b;
  --line: #dbe4df;
  --green: #116b4f;
  --green-2: #0e8f65;
  --red: #c73333;
  --red-bg: #fff0f0;
  --amber: #956700;
  --shadow: 0 18px 50px rgba(24, 33, 29, 0.08);
}

* {
  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;
}

button,
input {
  font: inherit;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 24px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(14px);
}

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

h1 {
  font-size: clamp(26px, 4vw, 38px);
}

h2 {
  font-size: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

.dashboard {
  width: min(1420px, 100%);
  margin: 0 auto;
  padding: 24px clamp(14px, 3vw, 32px) 48px;
}

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

.grid-main {
  grid-template-columns: 1.25fr 0.75fr;
}

.grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.metric-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.metric-list.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-list div {
  min-width: 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-2);
}

.metric-list .full {
  grid-column: 1 / -1;
}

dt {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

dd {
  margin: 0;
  font-size: 15px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pill.running {
  background: #e8fff6;
  color: var(--green);
}

.pill.error {
  background: var(--red-bg);
  color: var(--red);
}

.button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 750;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.button:hover {
  transform: translateY(-1px);
  border-color: #b7c7bf;
}

.button:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.button.primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

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

.button.ghost {
  background: transparent;
}

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

.levels-form button {
  grid-column: 1 / -1;
}

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

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
}

textarea {
  width: 100%;
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: var(--text);
  resize: vertical;
  font: inherit;
}

input:focus {
  outline: 2px solid rgba(17, 107, 79, 0.2);
  border-color: var(--green);
}

textarea:focus {
  outline: 2px solid rgba(17, 107, 79, 0.2);
  border-color: var(--green);
}

.support-form {
  display: grid;
  gap: 12px;
}

.active-levels {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.controls {
  margin-top: 18px;
}

.button-row,
.mode-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mode-toggle {
  align-items: center;
  margin-top: 14px;
}

.mode-toggle label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
}

.mode-toggle input {
  width: 18px;
  min-height: 18px;
}

.live-warning,
.alert,
.toast {
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.live-warning {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--red);
  color: #fff;
  box-shadow: var(--shadow);
}

.alert-danger {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid #ffd0d0;
}

.toast {
  background: #e8fff6;
  color: var(--green);
  border: 1px solid #bfead8;
}

.hidden {
  display: none !important;
}

.logs-card {
  margin-top: 18px;
}

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

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

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

th {
  color: var(--muted);
  font-weight: 800;
}

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

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

.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
  box-shadow: var(--shadow);
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

@media (max-width: 900px) {
  .grid-main,
  .grid-two,
  .metric-list,
  .metric-list.compact,
  .levels-form {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .topbar {
    position: static;
    flex-direction: column;
  }

  .button-row .button,
  .mode-toggle .button {
    width: 100%;
  }

  .live-warning {
    align-items: flex-start;
    flex-direction: column;
  }
}
