:root {
  --bg: #0f1419;
  --panel: #171e27;
  --ink: #f2f5f8;
  --muted: #8b9aab;
  --line: #2a3542;
  --accent: #3dd68c;
  --warn: #f0a35a;
  --danger: #ff7a6e;
  --blue: #6aa8ff;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(1200px 600px at 10% -10%, #1a2836 0%, var(--bg) 55%);
  color: var(--ink);
  font-family: var(--font);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 18px 64px;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.kicker {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
}

h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.02em;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.badge.ok { border-color: #2f6b4f; color: var(--accent); }
.badge.warn { border-color: #7a5530; color: var(--warn); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.card {
  background: color-mix(in srgb, var(--panel) 92%, black);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}

.card h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.card p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.45;
  font-size: 14px;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #062416;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 16px;
  cursor: pointer;
  width: 100%;
}

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

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input, textarea, select {
  width: 100%;
  background: #0c1117;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 10px;
  padding: 12px 12px;
  font: inherit;
  margin-bottom: 12px;
}

textarea { min-height: 88px; resize: vertical; }

.scan {
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: 0.04em;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 640px) {
  .row { grid-template-columns: 1fr; }
  h1 { font-size: 22px; }
}

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.check input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
}

.check label {
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  font-size: 15px;
  margin: 0;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #121820;
}

.item .meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.pill.ok { background: #163628; color: var(--accent); }
.pill.bad { background: #3a1d1c; color: var(--danger); }
.pill.mid { background: #2d2418; color: var(--warn); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: #101820;
  border: 1px solid var(--line);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 20;
}
.toast.show { opacity: 1; }

.note {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* --- Siguiente kiosk --- */
.stations {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.station-tab {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 12px;
  background: #121820;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.station-tab:hover { border-color: var(--muted); }
.station-tab.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, #121820);
}
.station-tab .name {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.station-tab .num {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 2px;
}
.station-tab.active .num { color: var(--accent); }

.next-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 96%, black), #0e141b);
  min-height: 260px;
  display: flex;
  flex-direction: column;
}
.next-card .eyebrow {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}
.next-card .ref {
  font-family: var(--mono);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.05;
  word-break: break-word;
}
.next-card .sub {
  color: var(--muted);
  font-size: 16px;
  margin: 10px 0 4px;
}
.next-card .flags {
  margin: 14px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.next-card .actions {
  margin-top: auto;
  padding-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn.big { padding: 18px 16px; font-size: 18px; border-radius: 14px; }
.btn.ghost {
  background: transparent;
  color: var(--danger);
  border: 1px solid #4a2a28;
}
.btn.blue { background: var(--blue); color: #061426; }
.empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
}
.empty .big { font-size: 46px; margin-bottom: 8px; }
.age {
  font-size: 13px;
  color: var(--warn);
  margin-top: 8px;
}

.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 12px;
}
.thumb {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .rm {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
input[type="file"] {
  padding: 10px;
  background: #0c1117;
}

/* Logout link (top-right) */
.logout-link {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
}
.logout-link:hover { color: var(--ink); text-decoration: none; border-color: var(--muted); }

/* Login page */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 26px;
  text-align: center;
}
.login-mark {
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--accent);
  font-size: 13px;
  margin-bottom: 14px;
}
.ms-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  color: #1b1b1b;
}
.ms-btn:hover { text-decoration: none; }

/* Home = fast checklist launcher */
.wrap-tight { max-width: 640px; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.stat-chip {
  border: 1px solid var(--line);
  background: #121820;
  border-radius: 12px;
  padding: 10px 12px;
}
.stat-chip .n { font-family: var(--mono); font-size: 24px; font-weight: 800; }
.stat-chip .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stat-chip.alert .n { color: var(--danger); }

.cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--accent);
  color: #062416;
  border-radius: 14px;
  padding: 16px 18px;
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 18px;
}
.cta:hover { text-decoration: none; filter: brightness(1.05); }
.cta-sub { font-size: 13px; font-weight: 600; opacity: 0.8; }

.clist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.clist-head span {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.clist-head input {
  width: 190px;
  margin: 0;
  padding: 8px 12px;
  font-size: 14px;
}
.clist { list-style: none; margin: 0 0 20px; padding: 0; }
.clist li { margin: 0; }
.clist a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 8px;
  background: #121820;
  color: var(--ink);
}
.clist a:hover { text-decoration: none; border-color: var(--muted); }
.clist .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--blue); flex: 0 0 auto;
}
.clist .dot.mid { background: var(--warn); }
.clist .dot.bad { background: var(--danger); }
.clist .dot.ok { background: var(--accent); }
.clist .body { flex: 1; min-width: 0; }
.clist .r { font-weight: 700; }
.clist .s { font-size: 12px; color: var(--muted); }
.clist .chev { color: var(--muted); font-size: 18px; }
.clist .badge-nov {
  font-size: 10px; font-weight: 700; color: var(--danger);
  border: 1px solid #4a2a28; border-radius: 999px; padding: 2px 7px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.chips a, .chips button {
  border: 1px solid var(--line);
  background: #121820;
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}
.chips a:hover, .chips button:hover { border-color: var(--muted); text-decoration: none; }
.chips button:disabled { opacity: 0.5; cursor: default; }
.mini { font-size: 12px; color: var(--muted); margin: 0; }

/* Avisos inbox */
.msg {
  border-left: 3px solid var(--line);
  background: #121820;
  border-radius: 0 10px 10px 0;
  padding: 10px 14px;
  margin-bottom: 8px;
}
.msg.info { border-color: var(--blue); }
.msg.warn { border-color: var(--warn); }
.msg.danger { border-color: var(--danger); }
.msg.read { opacity: 0.5; }
.msg .m-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.badge.dot { position: relative; }
.badge .count {
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
}

/* Identity */
.userchip {
  border: 1px solid var(--line);
  background: #121820;
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.userchip .dotg { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.id-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 14, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 18px;
}
.id-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  width: 100%;
  max-width: 380px;
}
.offline-banner {
  background: #2d2418;
  color: var(--warn);
  border: 1px solid #7a5530;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.offline-banner.show { display: block; }

/* Timeline */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li {
  position: relative;
  padding: 0 0 16px 22px;
  border-left: 2px solid var(--line);
}
.tl li:last-child { border-left-color: transparent; }
.tl li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}
.tl .t-when { font-size: 12px; color: var(--muted); }
.tl .t-what { font-weight: 600; }
.tl .t-who { font-size: 12px; color: var(--blue); }
.gallery { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.gallery a { width: 96px; height: 96px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Per-item glosa photo button */
.check .cam {
  margin-left: auto;
  border: 1px solid var(--line);
  background: #0c1117;
  color: var(--muted);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.check .cam.has { color: var(--accent); border-color: #2f6b4f; }
