@import url("https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600;700&family=Fira+Sans:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: dark;
  font-family: "Fira Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: #070a10;
  color: #f8fafc;
  --ink: #f8fafc;
  --muted: #a8b3c7;
  --dim: #6f7d94;
  --canvas: #070a10;
  --surface: #0d121b;
  --surface-2: #111a26;
  --surface-3: #172231;
  --line: #263346;
  --line-strong: #3f526d;
  --accent: #32d583;
  --accent-strong: #12b76a;
  --cyan: #38bdf8;
  --amber: #f5c451;
  --danger: #ff6b6b;
  --danger-bg: #2b1518;
  --focus: rgba(50, 213, 131, 0.34);
  --shadow: rgba(0, 0, 0, 0.44);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, #0a0f17 0%, #070a10 48%, #0a0d13 100%);
  background-size: 44px 44px, 44px 44px, 100% 100%;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(50, 213, 131, 0.12), transparent 30%),
    linear-gradient(90deg, rgba(56, 189, 248, 0.08), transparent 45%, rgba(245, 196, 81, 0.06));
  mask-image: linear-gradient(to bottom, #000 0%, transparent 70%);
}

button,
input,
textarea {
  font: inherit;
}

button svg,
a svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: currentColor;
}

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

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

.lookup-shell {
  width: min(1120px, calc(100vw - 32px));
}

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

.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 120px),
    linear-gradient(135deg, rgba(17, 26, 38, 0.98), rgba(9, 13, 20, 0.98));
  box-shadow: 0 28px 80px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  padding: 30px;
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--cyan) 48%, var(--amber));
}

.panel-topline,
.admin-header,
.section-header,
.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.panel-topline {
  margin-bottom: 34px;
}

.brand-mark,
.ghost-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font: 700 0.88rem "Fira Code", ui-monospace, monospace;
  text-decoration: none;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(50, 213, 131, 0.7);
}

.ghost-link {
  min-width: 72px;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 18, 27, 0.74);
  color: var(--muted);
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.ghost-link:hover {
  border-color: var(--accent);
  color: var(--ink);
  background: rgba(50, 213, 131, 0.1);
}

.lookup-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.78fr) minmax(360px, 1fr);
  gap: 28px;
  align-items: stretch;
}

.lookup-copy {
  display: grid;
  align-content: space-between;
  min-height: 330px;
  padding: 4px 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font: 700 0.75rem "Fira Code", ui-monospace, monospace;
  text-transform: uppercase;
}

h1 {
  max-width: 9ch;
  margin: 0 0 20px;
  color: var(--ink);
  font-size: clamp(2.4rem, 7vw, 5rem);
  line-height: 0.94;
}

.login-panel h1 {
  font-size: clamp(2rem, 5vw, 3.8rem);
}

.lede {
  max-width: 26rem;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.signal-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

.signal-strip span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font: 700 0.78rem "Fira Code", ui-monospace, monospace;
}

.query-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 10, 16, 0.62);
  padding: 18px;
}

label {
  display: grid;
  gap: 9px;
  color: #dbe4f0;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #080c13;
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

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

textarea {
  min-height: 178px;
  padding: 14px;
  resize: vertical;
  line-height: 1.56;
}

input::placeholder,
textarea::placeholder {
  color: #738199;
}

input:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  background: #070b11;
}

button,
.button-link {
  min-height: 46px;
  border: 1px solid rgba(50, 213, 131, 0.62);
  border-radius: 8px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(180deg, #52e59a, #12b76a);
  color: #04120c;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(18, 183, 106, 0.2);
  transition: transform 180ms ease, border-color 180ms ease, filter 180ms ease, background 180ms ease;
}

button:hover,
.button-link:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

button.secondary {
  background: #101824;
  color: var(--ink);
  border-color: var(--line);
  box-shadow: none;
}

button.secondary:hover {
  border-color: var(--line-strong);
  background: #152233;
}

button.danger {
  background: var(--danger-bg);
  color: #ffd4d4;
  border-color: rgba(255, 107, 107, 0.48);
  box-shadow: none;
}

button.danger:hover {
  border-color: rgba(255, 107, 107, 0.78);
  background: #35191d;
}

button.small {
  min-height: 36px;
  padding: 0 11px;
  font-size: 0.86rem;
}

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

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

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

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

.upload-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.file-field {
  position: relative;
  min-height: 92px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 15px;
  background:
    linear-gradient(90deg, rgba(50, 213, 131, 0.08), transparent 55%),
    rgba(7, 10, 16, 0.48);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease;
}

.file-field:hover {
  border-color: var(--accent);
  background:
    linear-gradient(90deg, rgba(50, 213, 131, 0.12), transparent 55%),
    rgba(7, 10, 16, 0.7);
}

.file-field input[type="file"] {
  min-height: 38px;
  padding: 7px 0 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

.file-field input[type="file"]::file-selector-button {
  min-height: 36px;
  margin-right: 12px;
  border: 1px solid rgba(56, 189, 248, 0.55);
  border-radius: 8px;
  padding: 0 12px;
  background: #0d2231;
  color: #d9f3ff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.file-summary {
  color: var(--dim);
  font: 600 0.86rem "Fira Code", ui-monospace, monospace;
}

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

.message[data-tone="error"] {
  color: #ffb3b3;
}

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

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

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

.admin-header {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.icon-text {
  white-space: nowrap;
}

.hash-value {
  color: var(--amber);
  font: 700 0.92rem "Fira Code", ui-monospace, monospace;
}

.section-header {
  margin-bottom: 14px;
}

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

.section-header p {
  max-width: 54ch;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.batch-actions {
  position: sticky;
  top: 0;
  z-index: 2;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 18, 27, 0.92);
  backdrop-filter: blur(12px);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 10, 16, 0.58);
}

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

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

th,
td {
  border-bottom: 1px solid rgba(38, 51, 70, 0.74);
  padding: 13px 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #b8c3d6;
  background: #0e1520;
  font: 700 0.72rem "Fira Code", ui-monospace, monospace;
  text-transform: uppercase;
}

td {
  color: #dce6f3;
  overflow-wrap: anywhere;
}

tbody tr {
  transition: background 160ms ease;
}

tbody tr:hover {
  background: rgba(50, 213, 131, 0.055);
}

td a,
.format-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(50, 213, 131, 0.64);
  border-radius: 8px;
  padding: 0 11px;
  background: rgba(50, 213, 131, 0.13);
  color: #c9ffe3;
  font: 800 0.82rem "Fira Sans", ui-sans-serif, sans-serif;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.format-link:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: rgba(50, 213, 131, 0.2);
}

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

.status-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 0 9px;
  font-weight: 800;
  white-space: nowrap;
}

.status-ok {
  border: 1px solid rgba(50, 213, 131, 0.42);
  background: rgba(50, 213, 131, 0.1);
  color: #8ff0bd;
}

.status-muted {
  border: 1px solid rgba(168, 179, 199, 0.22);
  background: rgba(168, 179, 199, 0.06);
  color: #8c98aa;
}

.switch {
  width: 52px;
  height: 30px;
  display: inline-flex;
  position: relative;
}

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

.switch-slider {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #1b2533;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.switch-slider::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #d4ddeb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.38);
  transition: transform 160ms ease, background 160ms ease;
}

.switch input:checked + .switch-slider {
  border-color: rgba(50, 213, 131, 0.72);
  background: rgba(18, 183, 106, 0.72);
}

.switch input:checked + .switch-slider::before {
  background: #f4fff8;
  transform: translateX(22px);
}

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

.action-button {
  white-space: nowrap;
}

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

.page-indicator {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font: 600 0.86rem "Fira Code", ui-monospace, monospace;
}

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

.copy-dialog {
  width: min(640px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  color: var(--ink);
  background: linear-gradient(135deg, #111a26, #080c13);
  box-shadow: 0 28px 80px var(--shadow);
}

.copy-dialog::backdrop {
  background: rgba(2, 5, 10, 0.76);
  backdrop-filter: blur(4px);
}

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

.copy-dialog textarea {
  min-height: 220px;
  font-family: "Fira Code", ui-monospace, monospace;
}

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

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

  .panel {
    padding: 20px;
  }

  .lookup-grid {
    grid-template-columns: 1fr;
  }

  .lookup-copy {
    min-height: auto;
  }

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

  h1 {
    font-size: clamp(2.35rem, 13vw, 4.1rem);
  }

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

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

  .batch-actions {
    position: static;
  }
}

@media (max-width: 460px) {
  .panel {
    padding: 16px;
  }

  .query-card {
    padding: 14px;
  }

  textarea {
    min-height: 150px;
  }

  .actions,
  .pager {
    display: grid;
    grid-template-columns: 1fr;
  }

  .page-indicator {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
