/* Dad Alert app styles. Large targets and high contrast on purpose. */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #eef1f5; --card: #fff; --ink: #24313f; --muted: #5a6b7d;
  --line: #e2e8f0; --accent: #b3261e; --accent-dark: #8c1d17;
  --blue: #2e5a88; --ok: #2e7d32; --warn: #e08700;
  --shadow: 0 1px 2px rgba(20,30,45,.05), 0 6px 18px rgba(20,30,45,.06);
}
body {
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); min-height: 100vh;
}
.center-page { display: flex; align-items: center; justify-content: center; padding: 24px; }
.logo { font-weight: 800; font-size: 1.25rem; letter-spacing: .3px; color: var(--accent); }
.sandbox-badge { font-size: .68rem; font-weight: 800; letter-spacing: 1px; vertical-align: middle;
  background: #fff3cd; color: #7a5d00; border: 1px solid #e6cf7a; border-radius: 6px;
  padding: 3px 8px; margin-left: 10px; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; background: var(--card);
  border-bottom: 3px solid var(--accent); box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 5;
}
.device-chip { background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; font-size: .9rem; }
/* minmax(0,1fr): without it the grid track grows to the widest table's
   intrinsic width and every card overflows on phones. */
.dash { max-width: 980px; margin: 0 auto; padding: 20px 16px 60px;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.card { min-width: 0; max-width: 100%; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 24px; box-shadow: var(--shadow); }
.card h2 { font-size: 1.12rem; margin: 0 0 14px; padding-bottom: 12px;
  border-bottom: 2px solid var(--bg);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card h3 { margin: 16px 0 6px; font-size: .82rem; text-transform: uppercase;
  letter-spacing: 1px; color: var(--muted); }
.card ul { padding-left: 20px; }
.card li { padding: 2px 0; }
.register-card { max-width: 430px; width: 100%; }
.register-card h1 { font-size: 1.4rem; margin: 10px 0 6px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.error { color: var(--accent); font-weight: 600; margin: 10px 0; }
.hidden { display: none; }
label { display: block; margin: 14px 0 4px; font-weight: 600; font-size: .95rem; }
input[type=text], input[type=password], textarea {
  width: 100%; padding: 12px 14px; margin-top: 6px; font: inherit;
  border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; margin: 14px 0; }
.check input { width: 20px; height: 20px; }
.btn {
  font: inherit; font-weight: 700; padding: 11px 18px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer;
  transition: background .12s, box-shadow .12s;
}
.btn:hover { box-shadow: var(--shadow); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; width: 100%; margin-top: 16px; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.danger { color: var(--accent); border-color: var(--accent); }
.lock-tag { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  background: #fdeceb; color: var(--accent); border-radius: 999px; padding: 3px 10px; }
.tripwires { list-style: none; margin: 12px 0; display: grid; gap: 8px; }
.tripwires li { background: #fdf5f5; border: 1px solid #f3d9d7; border-left: 4px solid var(--accent);
  border-radius: 8px 10px 10px 8px; padding: 10px 14px; }
.status-row { display: flex; gap: 22px; flex-wrap: wrap; margin: 8px 0; }
.stat { display: flex; align-items: center; gap: 8px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); }
.table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: .95rem; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.table .wrap { max-width: 380px; overflow-wrap: anywhere; }
.table.small { font-size: .85rem; }
tr.revoked { opacity: .45; }
.prompt-row { border-top: 1px solid var(--line); padding: 14px 0; }
.prompt-row:first-child { border-top: 0; }
.row-actions { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.row-actions .btn { padding: 8px 14px; }
.modal { position: fixed; inset: 0; background: rgba(20, 28, 38, .55);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
/* Must come after .modal: same specificity, so source order decides. */
.modal.hidden { display: none; }
.modal-card { max-width: 380px; width: 100%; }
@media (max-width: 640px) {
  body { font-size: 16px; }
  .dash { padding: 12px 8px 50px; }
  .card { padding: 14px 12px; border-radius: 10px; }
  .card h2 { font-size: 1.05rem; }
  .table { display: block; overflow-x: auto; white-space: nowrap; }
  .table .wrap { max-width: 220px; white-space: normal; }
  .topbar { padding: 10px 12px; }
  .device-chip { font-size: .8rem; padding: 4px 10px; max-width: 45vw;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .status-row { flex-direction: column; gap: 8px; }
  .row-actions { flex-wrap: wrap; }
  .row-actions .btn { flex: 1; min-width: 110px; }
  .tripwires li { padding: 8px 10px; font-size: .92rem; }
}

/* v6: episode page + status polish */
.live-tag { font-size: .72rem; font-weight: 800; letter-spacing: 1px; color: #fff;
  background: var(--ok); border-radius: 999px; padding: 4px 11px;
  animation: livepulse 2s ease-in-out infinite; }
@keyframes livepulse { 50% { opacity: .55; } }
.stat strong { font-weight: 700; }
.status-row .stat { background: var(--bg); border-radius: 10px; padding: 8px 14px; }

/* v6.1: inbox status badges */
.badge { font-size: .72rem; font-weight: 700; letter-spacing: .5px; border-radius: 999px;
  padding: 3px 10px; text-transform: uppercase; background: var(--bg); color: var(--muted); }
.badge-applied { background: #e9f4ea; color: var(--ok); }
.badge-quarantined { background: #fdf3e3; color: #9a6200; }
.badge-dismissed { background: #f0f2f5; color: #98a3b0; text-decoration: line-through; }
.badge-filed { background: #eaf1f8; color: var(--blue); }
.badge-self { background: #f0f2f5; color: #98a3b0; }

/* Compact vitals chips (episodes table) — tiers match the timeline pills */
.bp-chip{display:inline-block;padding:2px 10px;border-radius:9px;font-weight:700;font-size:12.5px;white-space:nowrap;}
.bp-ok{background:#e9f4ea;color:#2e7d32;}
.bp-near{background:#fdf3e3;color:#9a6200;}
.bp-floor{background:#fdecea;color:#c62828;}
.table .oneline { max-width: 380px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }

/* Mode + contradiction guard */
.live-badge { background:#e9f4ea; color:#2e7d32; font-size:.6em; font-weight:800; letter-spacing:2px; padding:3px 10px; border-radius:8px; vertical-align:middle; margin-left:8px; }
.contra-list { margin:10px 0; padding-left:22px; }
.contra-list li { padding:4px 0; color:#9a6200; font-weight:600; }
.badge-contradiction { background:#fdf3e3; color:#9a6200; }

/* v10: tabbed dashboard */
.tabbar {
  display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 4px 2px 8px; scrollbar-width: none;
  position: sticky; top: 62px; z-index: 4;
  background: var(--bg); margin: -6px 0;
}
.tabbar::-webkit-scrollbar { display: none; }
.tabbar button {
  font: inherit; font-weight: 700; font-size: .92rem; white-space: nowrap;
  padding: 10px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  transition: background .12s, color .12s;
}
.tabbar button:hover { color: var(--ink); box-shadow: var(--shadow); }
.tabbar button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tab-count { display: inline-block; min-width: 20px; text-align: center; margin-left: 6px;
  background: #fff3cd; color: #7a5d00; border-radius: 999px; padding: 1px 6px; font-size: .78rem; }
.tabbar button.active .tab-count { background: rgba(255,255,255,.25); color: #fff; }
.tabpane { display: none; }
.tabpane.active { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }

/* Episode focal point in the status card */
.ep-focus {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  flex-wrap: wrap; background: var(--bg); border-radius: 12px;
  padding: 14px 16px; margin: 4px 0 14px;
}
.ep-focus.ep-live { background: #e9f4ea; border: 1px solid #bcd9bf; }
.ep-focus .btn.ep-open { width: auto; margin: 0; }
.ep-older { margin-top: 12px; }
.ep-older summary { cursor: pointer; font-weight: 700; color: var(--muted); padding: 6px 0; }
.fld-help { display: block; font-weight: 400; margin-top: 2px; }
input[type=number] {
  width: 130px; padding: 12px 14px; margin-top: 6px; font: inherit;
  border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe;
}
select { font: inherit; }
.settings-form select {
  display: block; width: 130px; padding: 12px 14px; margin-top: 6px;
  border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe;
}
@media (max-width: 640px) {
  .tabbar { top: 54px; }
  .sandbox-badge, .live-badge { white-space: nowrap; font-size: .58rem; padding: 2px 6px; margin-left: 6px; }
  .ep-focus { padding: 10px 12px; }
  .ep-focus .btn.ep-open { width: 100%; text-align: center; }
}
