/* Shared shell and controls: retain the existing admin palette and components. */
html { color-scheme: dark; }
body { margin: 0; }
.admin-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  background: #0d0f17;
}
.admin-brand { width: fit-content; white-space: nowrap; }
.admin-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text-primary);
  background: var(--bg-secondary);
}
.admin-menu-toggle svg { width: 18px; height: 18px; }
.admin-nav { display: none; grid-column: 1 / -1; gap: 4px; }
.admin-nav.is-open { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-nav a { display: flex; align-items: center; min-height: 44px; padding: 10px 12px; }
.admin-account { grid-column: 1 / -1; justify-self: start; flex-wrap: wrap; min-height: 44px; }
.admin-account strong { overflow-wrap: anywhere; }
.admin-account button { min-height: 44px; }
.admin-main { width: 100%; min-width: 0; padding: 24px 16px max(32px, env(safe-area-inset-bottom)); }
.admin-main .grid > *, .admin-main .flex > * { min-width: 0; }
.admin-main h1 { overflow-wrap: anywhere; text-wrap: balance; }
.admin-main svg { flex-shrink: 0; }
.admin-main canvas, .admin-main img { max-width: 100%; }
.admin-main p, .admin-main code, .admin-main td, .admin-main [id^="msg-"], #log { overflow-wrap: anywhere; }
.page-heading { display: flex; flex-direction: column; align-items: stretch; gap: 16px; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex-shrink: 0; }
.page-actions a, .page-actions button, .admin-main button, .admin-main a.bg-accent {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; max-width: 100%;
}
.admin-main button { min-width: 44px; }
.page-actions > a, .page-actions > button { white-space: nowrap; }
.page-actions form { display: inline-flex; }
.admin-main input:not([type="hidden"]), .admin-main select, .admin-main textarea { min-width: 0; max-width: 100%; font-size: 16px; }
.admin-main input:not([type="hidden"]), .admin-main select { min-height: 44px; }
.admin-main .overflow-x-auto { max-width: 100%; overscroll-behavior-x: contain; }
.admin-main .truncate-max { max-width: min(280px, 100%); }
.set-title { flex-wrap: wrap; }
.table-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.table-actions a, .table-actions button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; }
.record-table td a[class*="bg-"] { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; }
.table-actions form { display: inline-flex; }
:where(a, button, input, select, textarea, [tabindex]):focus-visible { outline: 2px solid #a5b4fc; outline-offset: 3px; }
@media (min-width: 640px) {
  .admin-main { padding: 28px 24px 40px; }
  .admin-header { grid-template-columns: minmax(0, 1fr) auto auto; padding-inline: 24px; }
  .admin-account { grid-column: 2; grid-row: 1; }
  .admin-menu-toggle { grid-column: 3; grid-row: 1; }
}
@media (min-width: 1024px) {
  .admin-menu-toggle { display: none; }
  .admin-header { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; }
  .admin-nav, .admin-nav.is-open { display: flex; flex-wrap: wrap; grid-column: 1 / -1; }
  .admin-account { justify-self: end; }
  .page-heading { flex-direction: row; align-items: center; justify-content: space-between; }
  .page-heading > :first-child { flex: 1; }
  .page-heading > .page-actions { max-width: 55%; justify-content: flex-end; }
  .record-table { min-width: 960px; }
}
@media (max-width: 1023px) {
  .admin-main .record-table, .record-table tbody, .record-table tr, .record-table td { display: block; width: 100%; }
  .record-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .record-table tr { padding: 12px 16px; }
  .record-table td:not([colspan]) {
    padding: 8px 0; max-width: none; white-space: normal; text-align: left; font-size: 13px;
  }
  .record-table td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 4px; color: var(--text-secondary);
    font-family: 'Outfit', sans-serif; font-size: 11px; font-weight: 600;
  }
  .record-table .table-actions { justify-content: flex-start; }
  .record-table td[colspan] { padding: 24px 0; }
  .record-table tr + tr { border-top: 1px solid var(--panel-border); }
}
@media (min-width: 640px) and (max-width: 1023px) {
  .admin-main .record-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
  .record-table td[data-label="Actions"], .record-table td[colspan] { grid-column: 1 / -1; }
}
@media (max-width: 639px) {
  .admin-main .bg-panel.p-6, .admin-main .bg-panel.p-5 { padding: 16px; }
  .page-actions > a.bg-accent, .page-actions > button.bg-accent { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
