:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #64748b;
  --line: #dbe3ef;
  --primary: #1769e0;
  --primary-dark: #0d55bd;
  --danger: #c83e3e;
  --ok-bg: #e7f7ee;
  --ok: #14733b;
  --bad-bg: #fdecec;
  --bad: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px;
  background: #101827;
  color: white;
}

.topbar h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.topbar p {
  margin: 0;
  color: #b9c3d4;
}

main {
  width: min(1180px, calc(100vw - 32px));
  margin: 24px auto 56px;
}

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

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

.panel h3 {
  margin: 18px 0 8px;
  color: var(--muted);
  font-size: 14px;
}

.notice {
  padding: 12px 14px;
  border-radius: 6px;
  background: #eaf2ff;
  border: 1px solid #bfd7ff;
  margin-bottom: 16px;
}

.grid-form,
.mini-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.mini-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-top: 14px;
}

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

input,
select {
  width: 100%;
  height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--text);
  font-size: 14px;
}

input[readonly] {
  background: #f8fafc;
  color: var(--muted);
  cursor: default;
}

button {
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
}

button:hover {
  border-color: #aab8cc;
}

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

button.primary:hover {
  background: var(--primary-dark);
}

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

.grid-form button {
  align-self: end;
}

.wide {
  grid-column: span 2;
}

.mirror-list {
  margin-top: 16px;
}

.mirror-edit-grid {
  grid-template-columns: 1fr 3fr 120px;
}

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.list-search {
  max-width: 520px;
}

.subscriptions {
  display: grid;
  gap: 14px;
}

.subscription {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.subscription-head,
.actions,
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.name-input {
  height: 42px;
  border: 0;
  padding: 0;
  font-size: 18px;
  font-weight: 700;
}

.muted,
.empty {
  margin: 4px 0 0;
  color: var(--muted);
}

.switch {
  display: flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 8px;
}

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

.links {
  display: grid;
  gap: 6px;
  margin: 14px 0;
  padding: 12px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.links a {
  color: var(--primary);
  text-decoration: none;
}

.copy-button {
  width: 62px;
  padding: 0 10px;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 13px;
}

.badge.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.badge.bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.status-row {
  justify-content: flex-start;
  color: var(--muted);
  font-size: 13px;
}

.message {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.actions {
  justify-content: flex-start;
  margin-top: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

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

@media (max-width: 900px) {
  .topbar,
  .list-toolbar,
  .subscription-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .link-row {
    grid-template-columns: 1fr;
  }

  .copy-button {
    width: fit-content;
  }

  .wide {
    grid-column: auto;
  }
}
