:root {
  color-scheme: dark;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  background: oklch(15% 0.035 265);
  color: oklch(94% 0.018 250);
  --ink: oklch(94% 0.018 250);
  --muted: oklch(72% 0.035 250);
  --dim: oklch(56% 0.04 250);
  --surface: oklch(20% 0.045 268);
  --surface-2: oklch(24% 0.055 268);
  --surface-3: oklch(29% 0.06 268);
  --line: oklch(40% 0.055 268);
  --accent: oklch(79% 0.16 156);
  --accent-2: oklch(82% 0.18 78);
  --danger: oklch(65% 0.19 28);
  --focus: oklch(79% 0.16 156 / 42%);
  --shadow: oklch(8% 0.025 265 / 68%);
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% -10%, oklch(56% 0.16 156 / 28%), transparent 34rem),
    radial-gradient(circle at 100% 15%, oklch(78% 0.18 78 / 18%), transparent 28rem),
    linear-gradient(135deg, oklch(13% 0.04 268), oklch(18% 0.05 248) 56%, oklch(12% 0.035 275));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(oklch(92% 0.01 250 / 5%) 1px, transparent 1px),
    linear-gradient(90deg, oklch(92% 0.01 250 / 5%) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, oklch(0% 0 0), transparent 75%);
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  width: min(900px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  align-items: center;
  padding: 56px 0;
}

.admin-shell {
  width: min(1220px, calc(100vw - 32px));
  align-items: start;
}

.panel {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, oklch(22% 0.052 268 / 96%), oklch(16% 0.038 265 / 98%));
  border: 1px solid oklch(48% 0.07 170 / 56%);
  border-radius: 8px;
  box-shadow: 0 26px 90px var(--shadow), inset 0 1px 0 oklch(100% 0 0 / 9%);
  padding: 34px;
}

.panel::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 34%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2));
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
  font-weight: 760;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 28px;
  max-width: 11ch;
  color: var(--ink);
  font-size: 3.4rem;
  line-height: 0.98;
  letter-spacing: 0;
}

label {
  display: grid;
  gap: 9px;
  color: oklch(84% 0.03 250);
  font-weight: 720;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: oklch(13% 0.03 265 / 82%);
  color: var(--ink);
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 5%);
}

input {
  min-height: 48px;
  padding: 0 14px;
}

input[type="file"] {
  min-height: 54px;
  padding: 10px;
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  min-height: 34px;
  margin-right: 12px;
  border: 1px solid oklch(83% 0.14 156 / 48%);
  border-radius: 8px;
  padding: 0 12px;
  background: linear-gradient(180deg, oklch(78% 0.16 156), oklch(61% 0.16 160));
  color: oklch(16% 0.035 165);
  font: inherit;
  font-weight: 830;
  cursor: pointer;
}

textarea {
  min-height: 154px;
  padding: 14px;
  resize: vertical;
  line-height: 1.55;
}

input::placeholder,
textarea::placeholder {
  color: oklch(62% 0.035 250);
}

input:focus,
textarea:focus {
  outline: 3px solid var(--focus);
  border-color: var(--accent);
}

button,
.button-link {
  min-height: 46px;
  border: 1px solid oklch(83% 0.14 156 / 48%);
  border-radius: 8px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(180deg, oklch(78% 0.16 156), oklch(61% 0.16 160));
  color: oklch(16% 0.035 165);
  font-weight: 830;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 14px 30px oklch(10% 0.04 160 / 32%);
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.18s cubic-bezier(0.16, 1, 0.3, 1), background 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

button:hover,
.button-link:hover {
  transform: translateY(-1px);
  border-color: oklch(88% 0.15 156 / 80%);
}

button.secondary {
  background: oklch(27% 0.055 268);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: none;
}

button.danger {
  background: oklch(27% 0.055 268);
  color: oklch(88% 0.08 28);
  border-color: oklch(60% 0.16 28 / 52%);
  box-shadow: none;
}

button.small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.84rem;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

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

.batch-actions {
  margin-top: 16px;
}

.stack-form,
.lookup-form {
  display: grid;
  gap: 18px;
}

.upload-form {
  max-width: 520px;
}

.file-field {
  gap: 10px;
}

.upload-actions {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 520px;
}

.upload-actions button {
  width: 100%;
}

.message {
  min-height: 24px;
  margin-top: 18px;
  color: var(--muted);
}

.message[data-tone="error"] {
  color: oklch(80% 0.13 28);
}

.message[data-tone="success"] {
  color: var(--accent);
}

.result {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.hash-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: oklch(88% 0.12 78);
  font-weight: 780;
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.section-header h2 {
  margin: 0 0 6px;
  font-size: 1.45rem;
  letter-spacing: 0;
}

.section-header p {
  margin: 0;
  color: var(--muted);
  max-width: 70ch;
}

.message.compact {
  margin: 8px 0 12px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: oklch(14% 0.032 265 / 72%);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.admin-panel table {
  min-width: 1040px;
}

th,
td {
  border-bottom: 1px solid oklch(35% 0.05 268 / 72%);
  padding: 13px 12px;
  text-align: left;
  vertical-align: middle;
}

tbody tr {
  transition: background 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

tbody tr:hover {
  background: oklch(28% 0.055 268 / 52%);
}

th {
  color: oklch(78% 0.035 250);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: oklch(18% 0.042 268);
}

td {
  overflow-wrap: anywhere;
}

td a,
.format-link {
  color: oklch(17% 0.04 156);
  background: var(--accent);
  border: 1px solid oklch(86% 0.13 156 / 72%);
  border-radius: 999px;
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 11px;
  font-size: 0.82rem;
  font-weight: 830;
  text-decoration: none;
  white-space: nowrap;
}

.format-link svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.row-check {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.status-ok {
  color: var(--accent);
  font-weight: 820;
}

.status-muted {
  color: var(--dim);
  font-weight: 720;
}

.switch {
  width: 50px;
  height: 28px;
  display: inline-flex;
  position: relative;
}

.switch input {
  opacity: 0;
  width: 0;
  min-height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: oklch(32% 0.045 268);
  cursor: pointer;
  transition: background 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.switch-slider::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: oklch(90% 0.018 250);
  box-shadow: 0 2px 8px oklch(5% 0.02 265 / 40%);
  transition: transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), background 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.switch input:checked + .switch-slider {
  background: oklch(62% 0.15 156);
}

.switch input:checked + .switch-slider::before {
  background: oklch(96% 0.04 156);
  transform: translateX(22px);
}

.action-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pager {
  justify-content: flex-end;
  margin-top: 14px;
}

.page-indicator {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
}

.icon-button {
  width: 36px;
  min-height: 36px;
  padding: 0;
}

.icon-button svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.copy-dialog {
  width: min(640px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  color: var(--ink);
  background: linear-gradient(145deg, oklch(22% 0.052 268), oklch(16% 0.038 265));
  box-shadow: 0 26px 90px var(--shadow);
}

.copy-dialog::backdrop {
  background: oklch(7% 0.025 265 / 72%);
}

.copy-dialog form {
  display: grid;
  gap: 14px;
}

.copy-dialog textarea {
  min-height: 220px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dialog-header h2 {
  margin: 0;
  font-size: 1.35rem;
}

@media (max-width: 700px) {
  .shell {
    width: min(100% - 24px, 900px);
    padding: 24px 0;
  }

  .panel {
    padding: 22px;
  }

  h1 {
    font-size: 2.3rem;
  }

  .admin-header,
  .section-header,
  .dialog-header {
    display: grid;
  }

  button,
  .button-link {
    width: 100%;
  }

  .action-cell button,
  .action-cell a,
  .dialog-header button {
    width: auto;
  }
}
