:root {
  --bg: #f4f5f7; --surface: #fff; --text: #1b1f24; --muted: #5d6673; --border: #d8dce2;
  --accent: #1f6feb; --accent-text: #fff; --danger: #c62828; --ok: #1b7f3b; --chip: #eef2f8;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1216; --surface: #191d23; --text: #e8eaed; --muted: #9aa3ae; --border: #2c323a;
    --accent: #4c8dff; --accent-text: #0b0d10; --danger: #ff6b6b; --ok: #4cc777; --chip: #232932; }
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
h1 { font-size: 1.4rem; margin: 0 0 1rem; }
h2 { font-size: 1.05rem; margin: 0; }
p { margin: 0 0 1rem; }
label { display: block; font-weight: 600; margin-bottom: .35rem; }
input { width: 100%; padding: .8rem; font-size: 1.1rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); margin-bottom: .9rem; }
input:focus-visible, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 2px; }
button { font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 10px; padding: .8rem 1.1rem;
  background: var(--accent); color: var(--accent-text); width: 100%; }
button:disabled { opacity: .55; cursor: not-allowed; }
button.secondary { background: var(--chip); color: var(--text); width: auto; padding: .5rem .85rem; font-size: .9rem; }
button.link { background: none; color: var(--accent); width: auto; padding: .5rem 0; font-weight: 500; }
button.link.danger { color: var(--danger); }
a.secondary { display: inline-block; background: var(--chip); color: var(--text); border-radius: 10px; padding: .5rem .85rem;
  font-size: .9rem; font-weight: 600; text-decoration: none; }
.muted { color: var(--muted); }
.meta { color: var(--muted); font-size: .85rem; }
.fine { color: var(--muted); font-size: .85rem; margin-top: 1rem; }
.error { color: var(--danger); min-height: 1.5em; margin: 1rem 0 0; }
.row { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* Visitante */
.card { max-width: 420px; margin: 0 auto; padding: 2.5rem 1.25rem; text-align: center; }
.card form { text-align: left; }
.bell { font-size: 3rem; line-height: 1; margin-bottom: .5rem; }
.ring { font-size: 1.35rem; padding: 2.2rem 1rem; border-radius: 999px; margin: 1rem 0; box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 35%, transparent); }
.status { color: var(--ok); font-weight: 600; min-height: 1.5em; }

/* Dono */
.owner { max-width: 720px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.topbar h1 { margin: 0; }
.sub { color: var(--muted); font-size: .85rem; margin: .1rem 0 0; }
.power { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; padding: .9rem 1rem; margin-bottom: 1rem; }
.power strong { display: block; }
.power.off { border-color: var(--danger); }
.power.off strong { color: var(--danger); }
.switch { position: relative; flex: none; width: 52px; height: 30px; }
.switch input { appearance: none; position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0;
  border: 0; border-radius: 999px; background: var(--border); cursor: pointer; transition: background .15s; }
.switch input::before { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .15s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::before { transform: translateX(22px); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tabs button { width: auto; background: none; color: var(--muted); border-radius: 0; padding: .6rem .9rem; border-bottom: 2px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.list li { display: flex; align-items: center; gap: .75rem; padding: .8rem 1rem; border-top: 1px solid var(--border); }
.list li:first-child { border-top: 0; }
.list .who { flex: 1; min-width: 0; }
.list .who strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li.fresh { animation: flash 2.5s ease-out; }
@keyframes flash { from { background: color-mix(in srgb, var(--accent) 22%, transparent); } }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; background: var(--chip); color: var(--muted); margin-left: .35rem; vertical-align: middle; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }
.alert { background: var(--accent); color: var(--accent-text); padding: .9rem 1rem; border-radius: 12px; margin-bottom: 1rem; font-weight: 600; }
dialog { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); width: min(92vw, 380px); padding: 1.25rem; }
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog .row { justify-content: flex-end; }
dialog .row button { width: auto; }
.qr { text-align: center; }
.qr img { width: 100%; max-width: 280px; background: #fff; border-radius: 8px; }
.qr-url { color: var(--muted); font-size: .8rem; word-break: break-all; }
.qr .row { align-items: center; }
