:root {
  /* Paleta base (branding IMC Toys) */
  --bg: #ffffff;
  --bg-muted: #f6f7f9;
  --card: #ffffff;
  --text: #222220;
  --muted: #5e6570;
  --border: rgba(34, 34, 32, 0.14);

  /* Colores corporativos extraídos del logo oficial */
  --imc-blue: #004898;
  --imc-blue-rgb: 0, 72, 152;
  --imc-red: #e00000;
  --imc-red-rgb: 224, 0, 0;
  --imc-green: #70c800;
  --imc-green-rgb: 112, 200, 0;
  --imc-orange: #f89000;
  --imc-orange-rgb: 248, 144, 0;

  --primary: var(--imc-blue);
  --primary-rgb: var(--imc-blue-rgb);
  --primary-dark: #003b7a;
  --primary-light: #1e6bc0;

  --success: var(--imc-green);
  --success-rgb: var(--imc-green-rgb);

  --warning: var(--imc-orange);
  --warning-rgb: var(--imc-orange-rgb);

  --danger: var(--imc-red);
  --danger-rgb: var(--imc-red-rgb);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 18% 0%, rgba(var(--primary-rgb), 0.09), transparent 60%),
    radial-gradient(900px 520px at 82% 12%, rgba(var(--warning-rgb), 0.1), transparent 55%),
    radial-gradient(1000px 560px at 66% 70%, rgba(var(--success-rgb), 0.07), transparent 58%), var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
}

a {
  color: inherit;
}

.link {
  text-decoration: none;
  border-bottom: 1px dashed rgba(34, 34, 32, 0.28);
}
.link:hover {
  border-bottom-color: rgba(var(--primary-rgb), 0.7);
}
.link--strong {
  font-weight: 800;
  border-bottom-color: rgba(34, 34, 32, 0.34);
}

.icon-svg {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  vertical-align: -3px;
  color: var(--muted);
}

.public-url {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 10px;
}

.public-url__link {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.qr-thumb {
  display: inline-flex;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
}

.qr-thumb img {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  image-rendering: pixelated;
}

.qr-thumb:focus {
  outline: none;
  border-color: rgba(var(--primary-rgb), 0.6);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.modal__panel {
  position: relative;
  width: min(920px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.18);
}

.modal__content {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  gap: 16px;
  align-items: start;
}

.modal__aside {
  min-width: 0;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

.qr-preview--modal {
  margin-top: 0;
  width: 100%;
  display: flex;
  justify-content: center;
}

.qr-preview--modal img {
  width: 360px;
  height: 360px;
  max-width: 100%;
  max-height: 70vh;
  image-rendering: pixelated;
}

.container {
  max-width: 1100px;
  padding: 20px;
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

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

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.nav__link {
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-muted);
  color: var(--text);
  font-weight: 700;
}

.nav__link:hover {
  border-color: rgba(var(--primary-rgb), 0.45);
}

.crisis {
  background: rgba(var(--danger-rgb), 0.08);
  border-bottom: 1px solid rgba(var(--danger-rgb), 0.25);
  color: var(--text);
  padding: 10px 0;
}

.crisis strong {
  color: var(--danger);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand__logo {
  width: 34px;
  height: 34px;
}

.brand__meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand__title {
  font-weight: 700;
}

.brand__subtitle {
  font-size: 12px;
  color: var(--muted);
}

.h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

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

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.row {
  display: flex;
}
.row--gap {
  gap: 12px;
}
.row--between {
  justify-content: space-between;
}
.row--center {
  align-items: center;
}
.row--wrap {
  flex-wrap: wrap;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin: 14px 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.card--sub {
  flex: 1;
  min-width: 320px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.input {
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}

.input:focus {
  border-color: rgba(var(--primary-rgb), 0.55);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

textarea.input {
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--primary-light), var(--primary));
  border: 1px solid rgba(var(--primary-rgb), 0.45);
  color: white;
  border-radius: 10px;
  padding: 10px 12px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
}

.btn--ghost {
  background: var(--bg-muted);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn--danger {
  background: linear-gradient(180deg, rgba(217, 27, 48, 0.92), rgba(179, 18, 36, 0.92));
  border: 1px solid rgba(var(--danger-rgb), 0.4);
}

.btn--small {
  padding: 8px 10px;
  font-weight: 600;
}

.alert {
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
}
.alert--error {
  border-color: rgba(var(--danger-rgb), 0.45);
  background: rgba(var(--danger-rgb), 0.08);
}

.badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border);
}
.badge--ok {
  background: rgba(var(--success-rgb), 0.18);
  border-color: rgba(var(--success-rgb), 0.35);
}
.badge--off {
  background: var(--bg-muted);
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table {
  display: grid;
  gap: 10px;
}

.table__row {
  display: grid;
  grid-template-columns: 160px 90px 1fr 240px 160px;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.table__header {
  color: var(--muted);
  font-weight: 700;
  background: var(--bg-muted);
}

.table__row--sub {
  background: rgba(34, 34, 32, 0.02);
}

.actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.qr-preview {
  margin-top: 10px;
  background: white;
  border-radius: 12px;
  padding: 10px;
  width: fit-content;
  border: 1px solid var(--border);
}

.qr-preview img {
  display: block;
  width: 240px;
  height: 240px;
  image-rendering: pixelated;
}

.footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  padding: 18px 0;
  margin-top: 30px;
}

.footer__inner {
  display: flex;
  justify-content: space-between;
}

@media (max-width: 900px) {
  .table__row {
    grid-template-columns: 1fr;
  }
  .actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .modal__panel {
    width: min(620px, 100%);
  }
  .modal__content {
    grid-template-columns: 1fr;
  }
  .modal__aside {
    padding-left: 0;
    border-left: none;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }
}

.public-hero {
  max-width: 860px;
  margin: 26px auto 0;
}

.public-hero__brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.public-hero__logo {
  width: 92px;
  height: auto;
}

.public-hero__card {
  margin-top: 14px;
}

.public-state {
  max-width: 680px;
  margin: 38px auto 0;
  padding: 14px 0;
  text-align: center;
}

.public-state__logo {
  width: 130px;
  height: auto;
}
