*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #1e1e2e;
  --surface: #252537;
  --surface-2: #2e2e45;
  --surface-3: #363655;
  --text: #cdd6f4;
  --text-sub: #a6adc8;
  --text-muted: #6c7086;
  --accent: #89b4fa;
  --accent-dim: rgba(137, 180, 250, 0.12);
  --accent-glow: rgba(137, 180, 250, 0.25);
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --good: #a6e3a1;
  --bad: #f38ba8;
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
}

html,
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: "DM Sans", sans-serif;
  font-weight: 400;
  line-height: 1.6;
}

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

.wordmark {
  font-family: "DM Sans", sans-serif;
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
  text-decoration: none;
}

.wordmark em {
  color: var(--accent);
  font-style: normal;
}

.wordmark-sm {
  font-family: "DM Sans", sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  text-decoration: none;
}

.wordmark-sm em {
  color: var(--accent);
  font-style: normal;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.mobile-topbar {
  display: none;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
}

.menu-toggle-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-nav {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
}

.side-link {
  position: relative;
  display: inline-block;
  width: fit-content;
  padding: 6px 2px;
  color: var(--text-sub);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.side-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.side-link:hover {
  color: var(--text);
}

.side-link:hover::after {
  transform: scaleX(1);
}

.side-link[aria-current="page"] {
  color: var(--accent);
}

.side-link[aria-current="page"]::after {
  transform: scaleX(1);
}

.sidebar-user {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-role {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.sidebar-username {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  width: fit-content;
}

.sidebar-username:hover {
  color: var(--accent);
}

.sidebar-logout {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  width: fit-content;
}

.sidebar-logout:hover {
  color: var(--bad);
}

.main-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.page {
  flex: 1;
  padding: 40px 24px;
}

.page-wide.container {
  max-width: 1320px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}

.page-title + .page-subtitle {
  margin-top: -16px;
  margin-bottom: 24px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  max-width: 640px;
}

.page-title + .tab-bar {
  margin-top: -16px;
}

.tab-bar {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-link {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  padding: 0 2px 12px;
  color: var(--text-sub);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.tab-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.tab-link:hover {
  color: var(--text);
}

.tab-link:hover::after {
  transform: scaleX(1);
}

.tab-link-active {
  color: var(--accent);
}

.tab-link-active::after {
  transform: scaleX(1);
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  column-gap: 40px;
  row-gap: 20px;
  margin-bottom: 32px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  animation-name: fade-in-up;
  animation-duration: 0.35s;
  animation-timing-function: ease;
  animation-fill-mode: both;
  animation-delay: calc(var(--stagger, 0) * 60ms);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
  transition: color 0.2s ease;
}

.stat-rule {
  display: block;
  width: 36px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.2s ease, background 0.2s ease;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.stat:hover .stat-rule {
  width: 54px;
}

.stat:hover .stat-label {
  color: var(--text-sub);
}

.stat-warn .stat-value {
  color: var(--bad);
}

.stat-warn .stat-rule {
  background: var(--bad);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  animation-name: fade-in-up;
  animation-duration: 0.35s;
  animation-timing-function: ease;
  animation-fill-mode: both;
  animation-delay: calc(var(--stagger, 0) * 60ms);
}

.card + .card {
  margin-top: 20px;
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .flash {
    animation: none;
  }
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.card-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.muted {
  color: var(--text-muted);
  font-size: 0.85rem;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  line-height: 1.2;
}

th {
  text-align: left;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
  transition: background 0.15s ease;
}

tr:hover td {
  background: var(--surface-2);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-active {
  background: rgba(166, 227, 161, 0.12);
  color: var(--good);
}

.badge-inactive {
  background: rgba(243, 139, 168, 0.12);
  color: var(--bad);
}

.badge-owner {
  background: var(--accent-dim);
  color: var(--accent);
}

.badge-user {
  background: var(--surface-3);
  color: var(--text-muted);
}

.badge-admin {
  background: var(--surface-3);
  color: var(--text-sub);
}

.page-actions {
  margin-bottom: 20px;
}

.card + .page-actions {
  margin-top: 20px;
}

.site-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.site-row:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.site-row-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}

.site-row-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-domain {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.site-row-maint {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.maint-chip {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(243, 139, 168, 0.08);
  border: 1px solid rgba(243, 139, 168, 0.25);
  color: var(--bad);
  font-size: 0.72rem;
  font-family: monospace;
}

.section-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--text-muted);
  margin: 28px 0 12px;
}

.section-title:first-child {
  margin-top: 0;
}

.browse-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.browse-row:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.browse-row-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  font-family: monospace;
}

.code-editor {
  display: block;
  width: 100%;
  min-height: 480px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  tab-size: 4;
  resize: vertical;
}

.code-editor:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.editor-path {
  font-family: monospace;
  color: var(--text-sub);
}

.editor-warning {
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(243, 139, 168, 0.3);
  background: rgba(243, 139, 168, 0.08);
  color: var(--bad);
  font-size: 0.82rem;
}

@media (max-width: 640px) {
  .code-editor {
    min-height: 360px;
    font-size: 0.78rem;
  }
}

.switch-row {
  flex-direction: row !important;
  align-items: center;
  gap: 12px !important;
}

.switch-row span {
  font-size: 0.9rem;
  color: var(--text-sub);
}

.textarea-sm {
  display: block;
  width: 100%;
  min-height: 90px;
  padding: 11px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
}

.textarea-sm:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.page-title + .breadcrumb {
  margin-top: -16px;
}

.breadcrumb a {
  color: var(--text-sub);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent);
}

.breadcrumb-sep {
  color: var(--text-muted);
}

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 10px 14px;
  border-left: 2px solid var(--accent);
  background: var(--surface-2);
  border-radius: var(--r-sm);
}

.history-summary {
  font-size: 0.85rem;
  color: var(--text);
}

.history-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
  white-space: nowrap;
}

.admin-post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.admin-post-grid > .card.post-row {
  margin-top: 0;
}

.post-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.post-row:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.post-row-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
}

.post-row-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.post-row-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: monospace;
  flex-shrink: 0;
}

.post-row-desc {
  font-size: 0.85rem;
  color: var(--text-sub);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-row-creator {
  margin-top: auto;
  padding-top: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .admin-post-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .admin-post-grid {
    grid-template-columns: 1fr;
  }
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.media-thumb {
  position: relative;
  min-width: 0;
  max-width: 100%;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
  aspect-ratio: 1 / 1;
}

.media-thumb img,
.media-thumb video {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  display: block;
}

.media-thumb-delete {
  position: absolute;
  right: 6px;
  bottom: 6px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.media-thumb:hover .media-thumb-delete,
.media-thumb:focus-within .media-thumb-delete {
  opacity: 1;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 20px;
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-sub);
  text-decoration: none;
  font-size: 0.85rem;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.pagination-link:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.pagination-link-active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

@media (max-width: 640px) {
  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
  }

  .media-thumb-delete {
    opacity: 1;
  }
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 42px;
  height: 24px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.switch-track {
  position: absolute;
  inset: 0;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background 0.2s, border-color 0.2s;
}

.switch-track::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-sub);
  transition: transform 0.2s, background 0.2s;
}

.switch input:checked + .switch-track {
  background: rgba(243, 139, 168, 0.16);
  border-color: rgba(243, 139, 168, 0.4);
}

.switch input:checked + .switch-track::before {
  transform: translateX(18px);
  background: var(--bad);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.result-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-item {
  padding: 10px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.result-ok {
  border-color: rgba(166, 227, 161, 0.3);
  background: rgba(166, 227, 161, 0.08);
}

.result-error {
  border-color: rgba(243, 139, 168, 0.3);
  background: rgba(243, 139, 168, 0.08);
}

.result-name {
  font-weight: 600;
}

.result-status {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.result-output {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  font-family: monospace;
  font-size: 0.78rem;
  color: var(--bad);
  white-space: pre-wrap;
  word-break: break-word;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.perm-site {
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.perm-site:first-of-type {
  border-top: none;
  padding-top: 0;
}

.perm-site-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.perm-page {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.perm-page + .perm-page {
  margin-top: 10px;
}

.perm-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.perm-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.perm-page-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.perm-check-sm {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-sub);
}

.perm-check-sm input {
  width: 14px;
  height: 14px;
}

label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-sub);
}

input[type="text"],
input[type="email"],
input[type="password"],
select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 11px 14px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

select {
  width: auto;
  padding: 7px 10px;
}

.field select {
  width: 100%;
  padding: 11px 14px;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

select:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 400;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: box-shadow 0.2s, border-color 0.2s, background 0.2s, transform 0.15s;
}

.btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1e1e2e;
}

.btn-primary:hover {
  background: #a5c4fb;
}

.btn-danger {
  border-color: rgba(243, 139, 168, 0.3);
  color: var(--bad);
  background: rgba(243, 139, 168, 0.08);
}

.btn-danger:hover {
  background: rgba(243, 139, 168, 0.16);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.btn-block {
  width: 100%;
}

.flash {
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 0.85rem;
  margin-bottom: 20px;
  border: 1px solid transparent;
  animation: fade-in-up 0.3s ease both;
}

.flash-success {
  background: rgba(166, 227, 161, 0.1);
  border-color: rgba(166, 227, 161, 0.3);
  color: var(--good);
}

.flash-error {
  background: rgba(243, 139, 168, 0.1);
  border-color: rgba(243, 139, 168, 0.3);
  color: var(--bad);
}

.flash-link {
  background: var(--accent-dim);
  border-color: rgba(137, 180, 250, 0.3);
  color: var(--accent);
}

.copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.copy-row code {
  flex: 1;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  word-break: break-all;
  color: var(--accent);
  font-family: monospace;
  font-size: 0.8rem;
}

.app-footer {
  border-top: 1px solid var(--border);
  padding: 22px 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 36px;
  box-shadow: var(--shadow-md);
}

.auth-sub {
  margin-top: 6px;
  margin-bottom: 24px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

@media (max-width: 860px) {
  .app-shell {
    flex-direction: column;
  }

  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
  }

  .menu-toggle {
    display: flex;
  }

  .sidebar {
    display: none;
    width: 100%;
    height: auto;
    position: static;
    flex-direction: column;
    align-items: stretch;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar.is-open {
    display: flex;
  }

  .sidebar-wordmark {
    display: none;
  }

  .side-nav {
    margin-top: 0;
    flex-direction: column;
  }

  .sidebar-bottom {
    margin-top: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .sidebar-divider {
    display: block;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 28px 16px;
  }

  .container {
    padding: 0 16px;
  }

  .card {
    padding: 18px;
  }

  .auth-shell {
    padding: 32px 16px;
  }

  .auth-card {
    padding: 26px;
  }

  .page-title {
    font-size: 1.3rem;
  }

  .stats-row {
    column-gap: 24px;
    row-gap: 18px;
  }

  .stat-value {
    font-size: 1.6rem;
  }

  .tab-bar {
    gap: 16px;
  }

  .copy-row {
    flex-direction: column;
    align-items: stretch;
  }

  .copy-row code {
    word-break: break-all;
  }

  .switch {
    width: 46px;
    height: 27px;
  }

  .switch-track::before {
    width: 21px;
    height: 21px;
  }

  .switch input:checked + .switch-track::before {
    transform: translateX(19px);
  }

  th,
  td {
    padding: 10px 10px;
  }

  .card-foot {
    justify-content: stretch;
  }

  .card-foot .btn {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .stats-row {
    column-gap: 20px;
    row-gap: 16px;
  }

  .site-row-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .actions .btn {
    width: 100%;
  }
}
