/* PixelLoop · base: tokens, tipografía, controles y piezas compartidas. */

:root {
  color-scheme: dark;
  --bg: #0e0d13;
  --panel: #17151f;
  --panel-2: #201d2b;
  --panel-3: #2a2637;
  --line: #312c40;
  --ink: #f4f1ea;
  --muted: #a39fb0;
  --faint: #6f6a7e;
  --accent: #ffcc4d;
  --accent-ink: #1d1600;
  --danger: #ff5f6a;
  --ok: #4fd18b;
  --info: #5bb8ff;
  --warn: #ff9f43;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.15; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pixelated { image-rendering: pixelated; }
.fine { color: var(--faint); font-size: 12px; margin: 12px 0 0; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--ink); font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--panel-3); border-color: #463f5a; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, .swatch:focus-visible, .frame-tab:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn--primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn--primary:hover { background: #ffd970; border-color: #ffd970; }
.btn--danger { background: var(--danger); color: #1f0003; border-color: var(--danger); }
.btn--danger:hover { background: #ff7a83; }
.btn--ghost { background: transparent; }
.btn--sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn--icon { width: 40px; padding: 0; }
.btn--big { min-height: 52px; font-size: 16px; }
.btn--provider { background: #fff; color: #17151f; border-color: #fff; justify-content: flex-start; width: 100%; }
.btn--provider:hover { background: #ece9f5; border-color: #ece9f5; }
.provider-mark {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px;
  background: #5b3df5; color: #fff; font-weight: 800; font-size: 14px;
}

.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button {
  border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--muted);
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.seg--sm button { padding: 4px 10px; font-size: 13px; }

.input {
  width: 100%; min-height: 40px; padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.input--sm { min-height: 32px; padding: 4px 8px; font-size: 13px; }
.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-error { color: var(--danger); min-height: 1em; margin: 8px 0 0; font-size: 14px; }

.badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: var(--panel-3); color: var(--ink); white-space: nowrap;
}
.badge--open { background: rgba(79, 209, 139, .16); color: var(--ok); }
.badge--final_hours { background: rgba(255, 159, 67, .18); color: var(--warn); }
.badge--frozen { background: rgba(91, 184, 255, .16); color: var(--info); }
.badge--published { background: rgba(255, 204, 77, .18); color: var(--accent); }
.badge--draft { background: var(--panel-3); color: var(--muted); }
.badge--urgent { background: var(--danger); color: #1f0003; }

/* Marca */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; letter-spacing: -.01em; font-size: 18px; }
.brand__mark {
  width: 22px; height: 22px; border-radius: 4px;
  background:
    linear-gradient(90deg, var(--accent) 0 50%, #ff5f6a 50%) top / 100% 50% no-repeat,
    linear-gradient(90deg, #5bb8ff 0 50%, #4fd18b 50%) bottom / 100% 50% no-repeat;
  animation: brand-loop 2s steps(4) infinite;
}
@keyframes brand-loop { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .brand__mark { animation: none; } }

/* Hoja inferior */
.sheet { position: fixed; inset: 0; z-index: 50; display: grid; align-items: end; justify-items: center; pointer-events: none; }
.sheet__scrim { position: absolute; inset: 0; background: rgba(5, 4, 9, .55); opacity: 0; transition: opacity .2s; pointer-events: auto; }
.sheet__panel {
  position: relative; width: min(520px, 100%); max-height: 88vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 18px 18px 0 0; padding: 18px 20px 24px; box-shadow: var(--shadow);
  transform: translateY(24px); opacity: 0; transition: transform .2s, opacity .2s; pointer-events: auto;
}
.sheet.is-open .sheet__scrim { opacity: 1; }
.sheet.is-open .sheet__panel { transform: none; opacity: 1; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sheet__title { font-size: 20px; }
@media (min-width: 700px) {
  .sheet { align-items: center; }
  .sheet__panel { border-radius: 18px; border-bottom: 1px solid var(--line); }
}

.login__intro { margin: 0 0 14px; color: var(--muted); }
.login__providers { display: grid; gap: 8px; }
.login__other { margin-top: 14px; color: var(--muted); }
.login__other summary { cursor: pointer; }
.login__other .row { margin-top: 10px; flex-wrap: nowrap; }

.report__zone { display: grid; gap: 6px; justify-items: center; margin-bottom: 12px; }
.region-picker { position: relative; max-width: 100%; cursor: crosshair; touch-action: none; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.region-picker__canvas { display: block; }
.region-picker__selection { position: absolute; border: 2px solid var(--accent); background: rgba(255, 204, 77, .18); box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35); pointer-events: none; }
.region-label { margin: 0; text-align: center; }
.report__reasons { border: 0; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.report__reasons legend { font-weight: 700; margin-bottom: 6px; }
.radio { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--panel-2); cursor: pointer; }
.radio input { accent-color: var(--accent); }
.radio--urgent { border: 1px solid rgba(255, 95, 106, .5); }
.report textarea { margin-bottom: 4px; resize: vertical; }
.report .btn { width: 100%; margin-top: 8px; }

/* Avisos */
.toasts { position: fixed; left: 50%; top: 68px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); pointer-events: none; }
.toast {
  background: var(--panel-3); border: 1px solid var(--line); border-left: 4px solid var(--info);
  padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-8px); transition: opacity .25s, transform .25s;
}
.toast.is-in { opacity: 1; transform: none; }
.toast--ok { border-left-color: var(--ok); }
.toast--warn { border-left-color: var(--warn); }

/* Arranque */
.boot {
  position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 14px;
  background: var(--bg); transition: opacity .35s;
}
.boot .brand { font-size: 28px; }
.boot .brand__mark { width: 34px; height: 34px; }
.boot p { margin: 0; color: var(--muted); }
.boot.is-done { opacity: 0; pointer-events: none; }
.boot.is-error p { color: var(--danger); max-width: 40ch; text-align: center; }

/* Simulación local */
.sim {
  position: fixed; left: 12px; bottom: 12px; z-index: 40; max-width: min(360px, calc(100% - 24px));
  background: rgba(23, 21, 31, .96); border: 1px dashed #4b4460; border-radius: var(--radius-sm); font-size: 13px;
}
.sim summary { cursor: pointer; padding: 6px 10px; color: var(--muted); font-weight: 600; }
.sim__body { display: grid; gap: 8px; padding: 4px 10px 10px; }
.sim__out { margin: 0; max-height: 220px; overflow: auto; font: 11px/1.45 var(--mono); color: var(--muted); white-space: pre; }
.sim .field { grid-template-columns: 110px 1fr; align-items: center; }

/* Panel genérico */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card__title { font-size: 15px; font-weight: 700; margin: 0 0 12px; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; }
.empty { color: var(--faint); font-size: 14px; padding: 8px 0; }
