:root {
  --bg: #0b1120;
  --panel: #0f172a;
  --card: #0b1220;
  --text: #e5e7eb;
  --muted: #98a2b3;
  --accent: #22d3ee;
  --accent-2: #a3e635;
  --danger: #f87171;
  --stroke: rgba(148, 163, 184, 0.2);
  --glass: rgba(15, 23, 42, 0.75);
  --shadow: 0 30px 80px rgba(8, 15, 30, 0.45);
  --card-border: #1f2937;
  --surface-1: #0b1220;
  --surface-2: rgba(15, 23, 42, 0.72);
  --link-bg: rgba(34, 211, 238, 0.1);
  --link-border: rgba(34, 211, 238, 0.35);
  --row-dirty-bg: rgba(34, 211, 238, 0.05);
  --row-dirty-border: rgba(34, 211, 238, 0.5);
  --focus-ring: rgba(34, 211, 238, 0.8);
}

html[data-theme="light"] {
  --bg: #eef3f9;
  --panel: #f7fbff;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #516075;
  --accent: #0ea5b7;
  --accent-2: #65a30d;
  --danger: #dc2626;
  --stroke: rgba(71, 85, 105, 0.22);
  --glass: rgba(255, 255, 255, 0.9);
  --shadow: 0 16px 42px rgba(15, 23, 42, 0.1);
  --card-border: #dbe3ee;
  --surface-1: #f8fbff;
  --surface-2: #ffffff;
  --link-bg: rgba(14, 165, 183, 0.11);
  --link-border: rgba(14, 165, 183, 0.35);
  --row-dirty-bg: rgba(14, 165, 183, 0.08);
  --row-dirty-border: rgba(14, 165, 183, 0.4);
  --focus-ring: rgba(14, 165, 183, 0.85);
}
* { box-sizing: border-box; }
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 15% -10%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 60%),
    radial-gradient(1000px 700px at 90% 0%, color-mix(in srgb, var(--accent-2) 26%, transparent), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 85%, #cbd5e1) 100%);
  min-height: 100vh;
  padding: 28px;
}
code, pre {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.page {
  width: min(1480px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-radius: 18px;
  border: 1px solid var(--stroke);
  background: var(--glass);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.brand-logo {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 6px 16px rgba(34, 211, 238, 0.35));
}
.brand-logo-light {
  display: none;
}
html[data-theme="light"] .brand-logo-dark {
  display: none;
}
html[data-theme="light"] .brand-logo-light {
  display: block;
  filter: drop-shadow(0 4px 10px rgba(15, 23, 42, 0.18));
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-text strong {
  font-size: 16px;
}
.brand-text span {
  font-size: 12px;
  color: var(--muted);
}
.topnav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-left: auto;
  min-width: 0;
  flex: 1 1 auto;
  transition: opacity 200ms ease, transform 200ms ease;
}
.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: var(--surface-2);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  padding: 0;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2.5px;
  background: var(--text);
  border-radius: 999px;
  transition: transform 180ms ease, opacity 180ms ease;
}
.topnav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  border: 1px solid var(--stroke);
  padding: 8px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.topnav a:hover {
  color: var(--text);
  border-color: rgba(148, 163, 184, 0.4);
}
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.topnav a.active {
  color: #061019;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.95), rgba(163, 230, 53, 0.95));
  border-color: transparent;
  font-weight: 600;
}
.topnav a.cta {
  color: #07121d;
  background: rgba(163, 230, 53, 0.95);
  border-color: transparent;
  font-weight: 600;
}
.content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: rgba(15, 23, 42, 0.6);
}
.footer-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
html[data-theme="light"] .footer {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(71, 85, 105, 0.28);
  color: #334155;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}
html[data-theme="light"] .footer strong {
  color: #0f172a;
}
html[data-theme="light"] .footer-meta {
  color: #475569;
}
.panel {
  width: 100%;
  background: linear-gradient(145deg, var(--panel), color-mix(in srgb, var(--panel) 85%, #0b1020));
  border: 1px solid var(--stroke);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0.5px;
}
.subtitle {
  color: var(--muted);
  font-size: 14px;
}
.meta {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.meta-item {
  border: 1px solid var(--card-border);
  background: var(--surface-1);
  padding: 4px 8px;
  border-radius: 999px;
}
.meta-primary {
  color: #bfdbfe;
  border-color: rgba(59, 130, 246, 0.52);
  background: rgba(30, 64, 175, 0.28);
}
.meta-success {
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(22, 101, 52, 0.28);
}
.meta-info {
  color: #a5f3fc;
  border-color: rgba(6, 182, 212, 0.55);
  background: rgba(14, 116, 144, 0.3);
}
.meta-warning {
  color: #fde68a;
  border-color: rgba(250, 204, 21, 0.54);
  background: rgba(146, 64, 14, 0.32);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  row-gap: 18px;
}
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: #334155;
  box-shadow: 0 10px 20px rgba(0,0,0,0.35);
}
.name {
  font-size: 18px;
  font-weight: 600;
}
.description {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.link {
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
  background: var(--link-bg);
  border: 1px solid var(--link-border);
  padding: 10px 12px;
  border-radius: 12px;
  text-align: center;
}
.link:hover {
  background: rgba(34, 211, 238, 0.18);
}
.url {
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}
.table {
  display: block;
}
.filter-form {
  margin-bottom: 14px;
}
.filter-row {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(170px, 1fr) minmax(190px, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.filter-field {
  min-width: 0;
}
.filter-field.filter-select .input {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
.filter-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sites-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
}
.sites-table th,
.sites-table td {
  text-align: left;
  vertical-align: middle;
}
.sites-table thead th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 0 10px;
}
.sites-table tbody td {
  background: var(--card);
  border: 1px solid var(--card-border);
  padding: 12px 14px;
}
.sites-table tbody td:first-child {
  border-right: none;
  border-radius: 14px 0 0 14px;
}
.sites-table tbody td:not(:first-child):not(:last-child) {
  border-left: none;
  border-right: none;
}
.sites-table tbody td:last-child {
  border-left: none;
  border-radius: 0 14px 14px 0;
}
.table-name {
  font-weight: 600;
}
.table-link {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}
.table-link:hover { text-decoration: underline; }
.table-link-missing {
  color: #f59e0b;
  text-decoration: none;
}
html[data-theme="light"] .table-link-missing {
  color: #b45309;
}
.template-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.template-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  border: 1px solid transparent;
}
.template-pill-managed {
  color: #d1fae5;
  background: rgba(22, 101, 52, 0.3);
  border-color: rgba(34, 197, 94, 0.42);
}
.template-pill-legacy {
  color: #fef3c7;
  background: rgba(146, 64, 14, 0.3);
  border-color: rgba(245, 158, 11, 0.4);
}
.template-pill-pending {
  color: #ddd6fe;
  background: rgba(76, 29, 149, 0.34);
  border-color: rgba(139, 92, 246, 0.42);
}

html[data-theme="light"] .meta-primary {
  color: #1d4ed8;
  border-color: rgba(29, 78, 216, 0.3);
  background: rgba(191, 219, 254, 0.82);
}
html[data-theme="light"] .meta-success {
  color: #166534;
  border-color: rgba(22, 101, 52, 0.3);
  background: rgba(187, 247, 208, 0.85);
}
html[data-theme="light"] .meta-info {
  color: #0f766e;
  border-color: rgba(15, 118, 110, 0.3);
  background: rgba(153, 246, 228, 0.82);
}
html[data-theme="light"] .meta-warning {
  color: #92400e;
  border-color: rgba(146, 64, 14, 0.32);
  background: rgba(254, 215, 170, 0.86);
}
html[data-theme="light"] .template-pill-managed {
  color: #166534;
  background: rgba(187, 247, 208, 0.9);
  border-color: rgba(22, 101, 52, 0.28);
}
html[data-theme="light"] .template-pill-legacy {
  color: #92400e;
  background: rgba(254, 215, 170, 0.88);
  border-color: rgba(146, 64, 14, 0.3);
}
html[data-theme="light"] .template-pill-pending {
  color: #5b21b6;
  background: rgba(221, 214, 254, 0.9);
  border-color: rgba(91, 33, 182, 0.32);
}
.template-hint {
  color: var(--muted);
  font-size: 11px;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.table-actions {
  text-align: center;
}
.table-actions-inner {
  display: flex;
  justify-content: center;
}

.panel-home .filter-form .input {
  border-color: color-mix(in srgb, var(--card-border) 70%, var(--accent) 30%);
  background: var(--surface-1);
}

.panel-home .sites-table {
  border-spacing: 0 12px;
}

.panel-home .sites-table tbody tr {
  box-shadow: 0 0 0 1px var(--card-border);
}

.panel-home .sites-table tbody td {
  background: color-mix(in srgb, var(--surface-1) 82%, transparent);
  border: 0 !important;
}

.panel-home .sites-table tbody td:first-child {
  border-top-left-radius: 14px;
  border-bottom-left-radius: 14px;
}

.panel-home .sites-table tbody td:not(:first-child):not(:last-child) {
  border-radius: 0;
}

.panel-home .sites-table tbody td:last-child {
  border-top-right-radius: 14px;
  border-bottom-right-radius: 14px;
}
.table-empty {
  border-radius: 14px !important;
  text-align: center !important;
  color: var(--muted);
}
.info-strip {
  margin-top: 18px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.pagination {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}
.pagination-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.badge {
  display: inline-block;
  font-size: 11px;
  color: #0b1220;
  background: var(--accent-2);
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.4px;
}
.nav {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  border: 1px solid var(--card-border);
  padding: 6px 10px;
  border-radius: 999px;
}
.nav a:hover { color: var(--text); }

.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.form-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(220px, 1.45fr) minmax(260px, 1.95fr) minmax(150px, 1fr) minmax(130px, 0.95fr) 72px minmax(144px, auto);
  gap: 10px;
  row-gap: 8px;
  align-items: center;
}
.form-row > * {
  min-width: 0;
}
.form-row .checkbox {
  justify-self: center;
}
.form-row .actions {
  justify-self: end;
}
.form-row.form-row-single {
  grid-template-columns: 1fr;
}
.form-row.row-dirty {
  border: 1px solid var(--row-dirty-border);
  border-radius: 12px;
  padding: 10px;
  background: var(--row-dirty-bg);
}
.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.inline-remove-form {
  margin: 0;
  display: inline-flex;
}
.actions .button {
  min-width: 40px;
  font-size: 12px;
  white-space: nowrap;
}
.checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--muted);
}
.checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.form-row-header {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.form-row-header .header-cell {
  padding: 0 4px;
}
.site-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.template-preview {
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: var(--card);
  padding: 12px;
}
.template-preview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.template-preview-body {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.template-preview-image {
  width: min(280px, 42vw);
  max-height: 180px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--surface-1);
}
.template-preview-copy {
  min-width: 0;
}
.template-preview-label {
  font-weight: 700;
}
.template-preview-description {
  margin: 6px 0 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.template-preview-id {
  display: inline-block;
  color: #cffafe;
  background: rgba(14, 116, 144, 0.34);
  border: 1px solid rgba(6, 182, 212, 0.5);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
}
html[data-theme="light"] .template-preview-id {
  color: #0f766e;
  background: rgba(153, 246, 228, 0.88);
  border-color: rgba(15, 118, 110, 0.32);
}
.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--surface-1);
  color: var(--text);
  font-family: inherit;
}
.button[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}
.help {
  margin-top: 6px;
}
.input:focus {
  outline: 2px solid color-mix(in srgb, var(--focus-ring) 50%, transparent);
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--link-border);
  background: var(--link-bg);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
}
.button.icon-only {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 10px;
}
.btn-ico {
  width: 16px;
  height: 16px;
  display: inline-block;
  flex: 0 0 16px;
}
.btn-ico svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.button:hover { background: color-mix(in srgb, var(--link-bg) 70%, var(--accent) 20%); }
.button-danger {
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.1);
}
.alert {
  border: 1px solid rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.12);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
}
.alert-success {
  border-color: rgba(163, 230, 53, 0.5);
  background: rgba(163, 230, 53, 0.12);
}
.help {
  font-size: 12px;
  color: var(--muted);
}
.alert {
  margin-bottom: 12px;
}
.form-row + .help {
  margin-bottom: 8px;
}
.form-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
@media (max-width: 720px) {
  body { padding: 16px; }
  .topbar { flex-direction: row; align-items: center; gap: 12px; flex-wrap: wrap; }
  .brand-logo { width: 24px; height: 24px; }
  .brand { order: 1; }
  .nav-toggle { display: inline-flex; margin-left: auto; order: 2; }
  .topnav {
    display: none;
    width: 100%;
    margin-left: 0;
    padding-top: 12px;
    border-top: 1px solid var(--stroke);
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    opacity: 0;
    transform: translateY(-6px);
    max-height: 0;
    overflow: hidden;
    transition: opacity 200ms ease, transform 200ms ease, max-height 240ms ease;
    order: 3;
  }
  .topbar.nav-open {
    flex-wrap: wrap;
  }
  .topbar.nav-open .topnav {
    display: flex;
    opacity: 1;
    transform: translateY(0);
    max-height: 320px;
  }
  .topnav a { flex: 1 1 auto; text-align: center; }
  .nav-toggle { display: inline-flex; margin-left: auto; }
  .topbar.nav-open .nav-toggle span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }
  .topbar.nav-open .nav-toggle span:nth-child(2) {
    opacity: 0;
  }
  .topbar.nav-open .nav-toggle span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }
  .footer { flex-direction: column; align-items: flex-start; }
  .form-row { grid-template-columns: 1fr; }
  .form-row-header { display: none; }
  .filter-row {
    grid-template-columns: 1fr;
  }
  .sites-table {
    border-spacing: 0;
  }
  .sites-table thead {
    display: none;
  }
  .sites-table tbody tr {
    display: block;
    margin-bottom: 10px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 10px 12px;
  }
  .template-preview-body {
    flex-direction: column;
  }
  .template-preview-image {
    width: 100%;
    max-height: 220px;
  }
  .sites-table tbody td {
    display: block;
    border: none;
    padding: 4px 0;
    font-size: 13px;
  }
  .sites-table tbody td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 2px;
  }
  .sites-table tbody td.table-actions::before {
    margin-bottom: 10px;
  }
  .sites-table tbody td.table-actions {
    padding-top: 8px;
    padding-bottom: 10px;
  }
  .table-actions-inner {
    justify-content: flex-start;
    padding-top: 0 !important;
    gap: 10px;
  }
  .table-actions-inner .button {
    margin-top: 2px;
  }
  .pagination { flex-direction: column; align-items: flex-start; }
  .info-strip { flex-direction: column; align-items: flex-start; }
  .nav { flex-wrap: wrap; }
  .form-actions {
    position: sticky;
    bottom: 8px;
    z-index: 10;
    background: rgba(11, 18, 32, 0.92);
    border: 1px solid var(--stroke);
    border-radius: 12px;
    padding: 10px;
    backdrop-filter: blur(8px);
  }
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--surface-2);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  flex: 0 0 auto;
}
.theme-toggle-ico {
  position: absolute;
  width: 16px;
  height: 16px;
  display: inline-flex;
  transition: transform 180ms ease, opacity 180ms ease;
}
.theme-toggle-ico-sun {
  opacity: 1;
  transform: translateY(0);
}
.theme-toggle-ico-moon {
  opacity: 0;
  transform: translateY(18px);
}
.theme-toggle-ico svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
html[data-theme="dark"] .theme-toggle-ico-sun {
  opacity: 1;
  transform: translateY(0);
}
html[data-theme="dark"] .theme-toggle-ico-moon {
  opacity: 0;
  transform: translateY(18px);
}
html[data-theme="light"] .theme-toggle-ico-sun {
  opacity: 0;
  transform: translateY(-18px);
}
html[data-theme="light"] .theme-toggle-ico-moon {
  opacity: 1;
  transform: translateY(0);
}

.panel-auth {
  max-width: 560px;
  margin: 10px auto;
}
.panel-auth .form {
  gap: 14px;
}
.panel-auth .form-row {
  grid-template-columns: 1fr;
  gap: 10px;
}
.panel-auth .form-actions {
  justify-content: flex-end;
}

@media (max-width: 1260px) {
  .panel {
    padding: 20px;
  }
  .form-row {
    grid-template-columns: minmax(130px, 1fr) minmax(180px, 1.2fr) minmax(220px, 1.5fr) minmax(140px, 1fr) 80px minmax(140px, auto);
  }
  .form-row .template-cell {
    grid-column: 4 / 5;
  }
}

@media (max-width: 1040px) {
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
  }
  .brand {
    order: 1;
  }
  .theme-toggle {
    order: 2;
    margin-left: auto;
  }
  .topnav {
    order: 3;
    width: 100%;
    margin-left: 0;
  }
  .table {
    overflow-x: auto;
  }
  .form-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: start;
  }
  .form-row > .input:nth-child(1),
  .form-row > .input:nth-child(2),
  .form-row > .input:nth-child(3),
  .form-row > .input:nth-child(4) {
    grid-column: span 1;
  }
  .form-row .template-cell,
  .form-row .checkbox,
  .form-row .actions {
    grid-column: span 1;
  }
  .form-row .actions {
    justify-self: start;
    margin-top: 2px;
  }
  .form-row-header {
    display: none;
  }
  .template-preview-body {
    flex-direction: column;
  }
  .template-preview-image {
    width: 100%;
    max-height: 240px;
  }
  .panel-auth {
    max-width: 640px;
    padding: 22px;
  }
}

@media (max-width: 860px) {
  .topbar {
    align-items: center;
  }
  .theme-toggle {
    margin-left: auto;
  }
  .nav-toggle {
    margin-left: 0;
  }
  .filter-actions,
  .form-actions,
  .actions {
    gap: 4px;
  }
  .panel-auth .form-actions {
    justify-content: stretch;
  }
  .panel-auth .form-actions .button {
    flex: 1 1 auto;
  }
}
