:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1d2733;
  --muted: #687385;
  --line: #dce1e8;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --warn: #b45309;
  --danger: #b42318;
  --shadow: 0 12px 30px rgba(25, 35, 50, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  min-height: 42px;
  padding: 0 16px;
  font-weight: 700;
}

button.primary,
.auth-form button {
  background: var(--accent);
  color: white;
}

button.primary:hover,
.auth-form button:hover {
  background: var(--accent-dark);
}

button.ghost {
  background: #eef2f5;
  color: var(--ink);
}

button.ghost:hover {
  background: #e2e8ef;
}

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

button.icon {
  width: 42px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

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

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.15;
}

h2 {
  font-size: 18px;
}

.status {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  padding: 8px 13px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

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

.auth-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  align-items: center;
  gap: 18px;
  padding: 22px;
}

.auth-panel p,
.section-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

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

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--ink);
  outline: none;
  padding: 11px 12px;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.workspace {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
}

.is-hidden {
  display: none;
}

.form-panel,
.table-panel {
  padding: 18px;
}

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

.mirror-form {
  display: grid;
  gap: 13px;
}

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

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

.switch input {
  width: 18px;
  height: 18px;
}

.switch span {
  margin: 0;
  color: var(--ink);
}

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

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

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

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

td {
  font-size: 14px;
}

.route-link {
  display: inline-block;
  color: var(--accent-dark);
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.route-link:hover {
  text-decoration: underline;
}

.source {
  max-width: 420px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.badge.enabled {
  background: #def7ec;
  color: #03543f;
}

.badge.disabled {
  background: #f3f4f6;
  color: #4b5563;
}

.actions {
  display: flex;
  justify-content: end;
  gap: 8px;
  min-width: 160px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(440px, calc(100vw - 44px));
  border-radius: 8px;
  background: #172033;
  color: white;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 820px) {
  .shell {
    width: min(100vw - 22px, 1180px);
    padding: 18px 0;
  }

  .topbar,
  .auth-panel,
  .auth-form,
  .workspace {
    grid-template-columns: 1fr;
  }

  .topbar,
  .auth-form {
    display: grid;
    align-items: stretch;
  }

  .status {
    width: fit-content;
  }

  h1 {
    font-size: 28px;
  }
}
