:root {
  --bg: #f8f4e8;
  --bg-soft: #fffaf0;
  --ink: #1f2a30;
  --muted: #5f6e74;
  --primary: #00717f;
  --primary-2: #05a2b3;
  --accent: #d55d2a;
  --card: rgba(255, 255, 255, 0.88);
  --line: rgba(31, 42, 48, 0.14);
  --ok: #1f8f4f;
  --warn: #c27b17;
  --err: #bc2f2f;
  --radius: 18px;
  --shadow: 0 14px 35px rgba(31, 42, 48, 0.08);
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 10% 10%, #fef8e6, #f8f4e8 38%), linear-gradient(160deg, #f8f4e8, #f3efe2 70%);
}

.bg-orb {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(60px);
  opacity: 0.35;
  animation: float 8s ease-in-out infinite;
}

.orb-a {
  width: 320px;
  height: 320px;
  background: #23a6b6;
  top: -80px;
  right: -90px;
}

.orb-b {
  width: 260px;
  height: 260px;
  background: #f18a5d;
  left: -70px;
  bottom: -80px;
  animation-delay: 0.7s;
}

.page {
  width: min(1180px, 96vw);
  margin: 28px auto 44px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  backdrop-filter: blur(7px);
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  color: var(--primary);
}

h1,
h2 {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(28px, 5vw, 44px);
  margin-top: 6px;
}

h2 {
  font-size: 18px;
  margin-bottom: 14px;
}

.subtitle {
  max-width: 680px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.health {
  align-self: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 13px;
  padding: 8px 14px;
  background: #fff;
}

.health.ok {
  color: var(--ok);
  border-color: color-mix(in oklab, var(--ok) 40%, white);
}

.health.error {
  color: var(--err);
  border-color: color-mix(in oklab, var(--err) 40%, white);
}

.layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.card-wide {
  grid-column: span 2;
}

.dropzone {
  display: grid;
  gap: 8px;
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  transition: 180ms ease;
  margin-bottom: 14px;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  transform: translateY(-1px);
  background: color-mix(in oklab, white 85%, var(--primary));
}

.dropzone input {
  display: none;
}

.dropzone span {
  font-weight: 600;
}

.dropzone small {
  color: var(--muted);
}

.category-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.category-head p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.switch-actions {
  display: flex;
  gap: 6px;
}

.switch-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.switch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: #fff;
  gap: 10px;
}

.switch-item span {
  font-size: 13px;
}

.switch-toggle {
  position: relative;
  width: 44px;
  height: 25px;
  display: inline-flex;
}

.switch-toggle input {
  appearance: none;
  margin: 0;
  width: 44px;
  height: 25px;
  border-radius: 999px;
  border: 1px solid color-mix(in oklab, var(--line) 80%, white);
  background: #d6dfdf;
  cursor: pointer;
  transition: 160ms ease;
}

.switch-toggle input::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 17px;
  height: 17px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
  transition: 160ms ease;
}

.switch-toggle input:checked {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: color-mix(in oklab, var(--primary) 60%, white);
}

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

.hint {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
}

.hint.pending {
  margin: 0 0 14px;
}

.file-note {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 9px 10px;
  font-size: 13px;
  color: var(--muted);
}

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

.actions.compact {
  margin-bottom: 12px;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  cursor: pointer;
  transition: 140ms ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  filter: saturate(0.6);
}

.btn-small {
  padding: 6px 9px;
  font-size: 12px;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.btn-secondary {
  color: var(--ink);
  border: 1px solid var(--line);
  background: #fff;
}

.status {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.status.ok {
  color: var(--ok);
}

.status.warn {
  color: var(--warn);
}

.status.err {
  color: var(--err);
}

.stats {
  display: flex;
  gap: 16px;
  margin-bottom: 10px;
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
}

.entities-wrap {
  overflow: visible;
}

.table-wrap-small {
  max-height: 300px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 10px;
  font-size: 13px;
  border-bottom: 1px solid color-mix(in oklab, var(--line) 70%, white);
  vertical-align: top;
}

th {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.th-inline {
  white-space: nowrap;
}

.help-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--primary);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  line-height: 1;
  cursor: help;
}

.help-tip::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 4;
  left: 50%;
  top: calc(100% + 7px);
  transform: translateX(-50%);
  display: block;
  width: min(240px, 74vw);
  max-width: 320px;
  min-height: 56px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid color-mix(in oklab, var(--ink) 65%, white);
  background: #1f2a30;
  color: #ffffff;
  text-transform: none;
  letter-spacing: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 12px;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: 0 12px 22px rgba(20, 20, 20, 0.26);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.help-tip:hover::after,
.help-tip:focus-visible::after {
  opacity: 1;
}

.muted {
  color: var(--muted);
  text-align: center;
}

.entity-row td {
  transition: background-color 140ms ease, color 140ms ease;
}

.entity-value {
  transition: filter 140ms ease, opacity 140ms ease;
}

.entity-row.will-mask td {
  background: color-mix(in oklab, var(--accent) 14%, white);
}

.entity-row.will-mask .entity-value {
  filter: blur(2.4px);
  opacity: 0.92;
}

.entity-row.will-mask td:first-child {
  font-weight: 700;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.field span {
  font-size: 13px;
  color: var(--muted);
}

input[type="text"],
input[type="file"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 170px;
  resize: vertical;
  line-height: 1.45;
}

@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(15px);
  }
  100% {
    transform: translateY(0px);
  }
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .card-wide {
    grid-column: span 1;
  }
}

@media (max-width: 720px) {
  .page {
    width: min(100%, 100vw);
    margin: 0;
    padding: 12px;
  }

  .hero {
    flex-direction: column;
  }

  .health {
    align-self: flex-start;
  }

  h2 {
    font-size: 17px;
  }

  .btn {
    flex: 1;
    min-height: 42px;
  }

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

  .switch-item {
    padding: 10px;
  }

  .switch-item span {
    font-size: 14px;
  }

  .switch-toggle {
    width: 48px;
    height: 28px;
  }

  .switch-toggle input {
    width: 48px;
    height: 28px;
  }

  .switch-toggle input::before {
    width: 20px;
    height: 20px;
  }

  .switch-toggle input:checked::before {
    transform: translateX(20px);
  }

  .category-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .actions .btn:only-child {
    grid-column: 1 / -1;
  }

  th,
  td {
    padding: 8px;
    font-size: 12px;
  }

  textarea {
    min-height: 150px;
  }
}
