/* ===== Panel admin ===== */
body.admin { font-size: 17px; }
body.admin .login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; position: relative; z-index: 2; }
.login-card { max-width: 420px; width: 100%; }
.login-card h1 { font-size: 1.9rem; }
.login-card label { margin-top: .9rem; }
.login-card .btn { margin-top: 1rem; width: 100%; }
.login-card .small { text-align: center; margin-top: 1rem; font-size: .95rem; }

.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem 1.2rem; background: var(--ink); color: var(--paper-2); border-bottom: 4px solid var(--pink-2); flex-wrap: wrap;
}
.topbar h1 { font-size: 1.3rem; margin: 0; color: var(--paper-2); }
.top-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.admin-wrap { position: relative; z-index: 2; width: min(1280px, 100% - 2rem); margin: 1.4rem auto 4rem; display: grid; gap: 1.4rem; }
.admin-wrap section { padding: 0; }
.admin-wrap .card { padding: 1.2rem 1.4rem; }
.admin-wrap h2 { font-size: 1.4rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.scard { background: var(--paper-2); border: 3px solid var(--ink); border-radius: 16px; padding: .9rem; text-align: center; box-shadow: 5px 5px 0 var(--ink); }
.scard b { display: block; font-family: var(--font-title); font-size: 2rem; line-height: 1.1; }
.scard span { color: var(--muted); font-size: .95rem; }
.scard.hot { background: var(--pink); }

.grid2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1.4rem; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

.checkin { display: flex; gap: .6rem; margin: .6rem 0; flex-wrap: wrap; }
.checkin input { flex: 1; min-width: 140px; text-transform: uppercase; letter-spacing: 2px; font-family: var(--font-title); }
.checkin-msg { min-height: 1.4em; font-size: 1.05rem; }
.checkin-msg.ok { color: #1a7f37; }
.checkin-msg.bad { color: var(--red); }
.doorstats { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .6rem; color: var(--muted); }

.table-card { overflow: hidden; }
.table-top { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.table-top h2 { margin: 0; }
.table-top input { flex: 1; min-width: 200px; }
.filters { display: flex; gap: 1rem; font-size: .95rem; color: var(--ink-soft); }
.filters label { display: flex; align-items: center; gap: .3rem; font-weight: normal; margin: 0; }
.filters input { width: auto; box-shadow: none; }
.table-scroll { overflow-x: auto; margin: 0 -1.4rem; padding: 0 1.4rem; }
table { width: 100%; border-collapse: collapse; font-size: .98rem; min-width: 860px; }
th { text-align: left; font-family: var(--font-title); font-weight: 400; font-size: .85rem; letter-spacing: 1px; text-transform: uppercase; padding: .5rem .6rem; border-bottom: 3px solid var(--ink); }
td { padding: .55rem .6rem; border-bottom: 1px dashed rgba(0,0,0,.25); vertical-align: top; }
tr.arrived { background: rgba(155, 226, 155, .25); }
td .name { font-weight: bold; font-size: 1.05rem; }
td .sub { color: var(--muted); font-size: .88rem; }
td .msg { font-style: italic; color: var(--ink-soft); font-size: .88rem; max-width: 220px; }
td a { color: inherit; }
.toggle {
  appearance: none; border: 2px solid var(--ink); background: #fff; border-radius: 999px; padding: .25rem .7rem;
  cursor: pointer; font: inherit; font-size: .9rem; box-shadow: 2px 2px 0 var(--ink); white-space: nowrap;
}
.toggle.on { background: #9be29b; }
.toggle.on.trajo { background: var(--yellow); }
.notes-input { min-width: 140px; width: 100%; font-size: .9rem; padding: .3rem .5rem; box-shadow: none; border-width: 2px; }
.del { background: none; border: none; cursor: pointer; font-size: 1.1rem; opacity: .5; }
.del:hover { opacity: 1; }
#tableFoot { margin: .8rem 0 0; }

/* ===== Correos ===== */
.mailstats { display: flex; gap: .6rem; flex-wrap: wrap; margin: .6rem 0; }
.mchip { border: 2px solid var(--ink); border-radius: 999px; padding: .25rem .8rem; background: #fff; font-size: .95rem; box-shadow: 2px 2px 0 var(--ink); }
.mchip.ok { background: #9be29b; }
.mchip.warn { background: var(--yellow); }
.mchip.bad { background: #ffb3ba; }
.mail-actions { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin-top: .4rem; }
td .mail { font-size: .9rem; white-space: nowrap; }
td .mail.ok { color: #1a7f37; }
td .mail.bad { color: var(--red); }
td .mail.warn { color: #a06a00; }
.linkbtn { background: none; border: none; padding: 0; font: inherit; font-size: .82rem; color: var(--muted); text-decoration: underline; cursor: pointer; }
.linkbtn:hover { color: var(--ink); }
.linkbtn[disabled] { opacity: .5; cursor: progress; }

/* ===== Escáner de QR ===== */
.scan-open { width: 100%; margin-bottom: .8rem; font-size: 1.15rem; }
.scanner-modal { position: fixed; inset: 0; z-index: 100; background: rgba(15,15,15,.9); display: grid; place-items: center; padding: 1rem; }
.scanner-modal[hidden] { display: none; }
.scanner-card { background: var(--paper-2); border: 4px solid var(--ink); border-radius: 22px; padding: 1.2rem; width: min(520px, 100%); max-height: 94dvh; overflow-y: auto; box-shadow: 10px 10px 0 var(--pink-2); }
.scanner-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.scanner-head h2 { margin: 0; font-size: 1.4rem; }
.scanner-video { position: relative; border: 3px solid var(--ink); border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.scanner-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 14% 14%; border: 4px dashed rgba(255,255,255,.85); border-radius: 18px; pointer-events: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.25); }
.scan-result { margin-top: .9rem; padding: .9rem 1rem; border: 3px solid var(--ink); border-radius: 14px; font-size: 1.1rem; line-height: 1.45; background: #fff; }
.scan-result span { font-size: .95rem; color: var(--ink-soft); }
.scan-result b { font-family: var(--font-title); font-weight: 400; font-size: 1.3rem; }
.scan-result.ok { background: #9be29b; }
.scan-result.warn { background: var(--yellow); }
.scan-result.bad { background: #ffb3ba; }
.scan-result.loading, .scan-result.idle { background: var(--paper-2); }
.scan-result .btn { margin-top: .6rem; }
.scanner-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .8rem; flex-wrap: wrap; }
.beep-lbl { display: flex; align-items: center; gap: .35rem; font-weight: normal; margin: 0; font-size: .95rem; color: var(--ink-soft); }
.beep-lbl input { width: auto; box-shadow: none; }
.scan-log { list-style: none; margin: .9rem 0 0; padding: .6rem 0 0; border-top: 2px dashed var(--ink); font-size: .9rem; max-height: 150px; overflow-y: auto; }
.scan-log li { padding: .18rem 0; color: var(--ink-soft); }
.scan-log li.bad { color: var(--red); }
.scan-log li b { font-family: var(--font-title); font-weight: 400; margin-right: .4rem; }
