/* [hidden] always wins (2026-11-11): a class with display:flex/grid/block used to beat the
   hidden attribute, so fields that should be gone still showed (setup guide, Repeats picker).
   One rule for every page; never give [hidden] a display of its own. */
[hidden]{display:none!important}
/* FamilyGuard web UI — clean, simple, mobile-first.
   One stylesheet, no framework. Designed to look fine on a phone first,
   then widen a little on larger screens. */

:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f3f4f6;
  --card: #ffffff;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--blue);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.2px;
}
.logout-form { margin: 0; }

/* Layout */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

h1 { font-size: 1.5rem; margin: 0.4em 0 0.2em; }
h2 { font-size: 1.15rem; margin: 0 0 0.4em; }
h3 { font-size: 0.95rem; margin: 0.8em 0 0.3em; }
.section-label { text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); font-size: 0.75rem; }
.muted { color: var(--muted); font-size: 0.9rem; }
.back { color: var(--blue); text-decoration: none; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 14px 0;
}
.card.narrow { max-width: 420px; margin: 32px auto; }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row input[type="text"] { flex: 1 1 180px; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; font-weight: 600; }
input[type="email"], input[type="password"], input[type="text"] {
  padding: 11px 12px;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 100%;
  background: #fff;
}
input:focus { outline: 2px solid var(--blue); border-color: var(--blue); }

/* Buttons */
.btn {
  display: inline-block;
  padding: 11px 16px;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn:hover { background: #f9fafb; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.small { padding: 7px 12px; font-size: 0.85rem; }
.link-btn {
  background: none;
  border: none;
  color: #fff;
  font: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.copy-btn { color: var(--blue); }

/* Flash messages */
.flash {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.92rem;
}
.flash-error { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; }
.flash-success { background: #f0fdf4; color: var(--green); border: 1px solid #bbf7d0; }
.flash-info { background: #eff6ff; color: var(--blue-dark); border: 1px solid #bfdbfe; }

/* Children + devices */
.child-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.child-head h2 a { color: var(--ink); text-decoration: none; }
.devices { list-style: none; padding: 0; margin: 0 0 10px; }
.device { padding: 8px 0; border-top: 1px solid var(--line); }
.device:first-child { border-top: none; }
.device-main { display: flex; align-items: center; gap: 8px; }
.device-label { font-weight: 600; }
.device-sub { margin-top: 2px; font-size: 0.85rem; }

.pill { font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.pill-ok { background: #dcfce7; color: var(--green); }
.pill-wait { background: #fef9c3; color: #a16207; }

.token-box { margin-top: 6px; }
.token { background: #f3f4f6; padding: 2px 6px; border-radius: 6px; font-size: 0.85rem; word-break: break-all; }

/* Search box above the reported-apps list (mobile-first: full width). */
.search-box {
  width: 100%;
  padding: 11px 12px;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 4px 0 12px;
  background: #fff;
}
.search-box:focus { outline: 2px solid var(--blue); border-color: var(--blue); }

/* Controls row: view filters + whole-list actions. Wraps on narrow screens. */
.apps-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0 10px;
}

/* Segmented All / Allowed / Blocked filter. */
.filter-group { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.filter-btn {
  border: none;
  background: #fff;
  padding: 7px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.filter-btn + .filter-btn { border-left: 1px solid var(--line); }
.filter-btn.active { background: var(--blue); color: #fff; }

/* "Allow all" / "Block all" buttons. */
.list-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Multi-select toolbar + batch action bar */
.apps-toolbar { display: flex; align-items: center; margin: 2px 0 8px; }
.select-all-label { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.select-all-label input { width: 18px; height: 18px; }

.batch-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
}
.batch-count { font-weight: 600; font-size: 0.9rem; color: var(--blue-dark); }
/* Flex container with auto-left margin so actions sit on the right and more
   buttons can be added later without touching the layout. */
.batch-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

.row-check { width: 18px; height: 18px; flex-shrink: 0; }

/* App rule list */
.app-list { list-style: none; padding: 0; margin: 0; }
/* Two class selectors beat the single-class `.app-row { display:flex }`, so this
   reliably hides a filtered-out row. */
.app-row.hidden-row { display: none; }

/* Transient confirmation toast (e.g. "Blocked 5 apps"). */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  z-index: 100;
  opacity: 1;
  transition: opacity 0.4s ease;
}
.toast-out { opacity: 0; }
.app-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.app-row:first-child { border-top: none; }
.app-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-info { display: flex; flex-direction: column; min-width: 0; }
.app-label { font-weight: 600; word-break: break-word; }
.app-pkg { font-size: 0.78rem; word-break: break-all; }
/* Per-app "applied on device" confirmation, under the package name. */
.apply-status { display: inline-block; align-self: flex-start; margin-top: 3px; padding: 1px 8px;
                border-radius: 999px; font-size: 0.72rem; font-weight: 600; line-height: 1.5; }
.apply-applied   { background: #dcfce7; color: #15803d; }
.apply-pending   { background: #f3f4f6; color: var(--muted); }
.apply-protected { background: #e0e7ff; color: #3730a3; }
.apply-failed    { background: #fef3c7; color: #b45309; }

/* App icon (or a neutral placeholder square when none was reported). */
.app-icon { width: 40px; height: 40px; border-radius: 9px; flex-shrink: 0; object-fit: cover; background: #fff; }
.app-icon-placeholder { display: inline-block; background: #e5e7eb; border: 1px solid var(--line); }

/* Segmented Allowed/Blocked toggle */
.toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; flex-shrink: 0; }
.seg {
  border: none;
  background: #fff;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.seg + .seg { border-left: 1px solid var(--line); }
.seg.seg-allowed.on { background: var(--green); color: #fff; }
.seg.seg-blocked.on { background: var(--red); color: #fff; }
.seg:disabled { opacity: 0.6; cursor: default; }

@media (min-width: 560px) {
  h1 { font-size: 1.8rem; }
}

/* Sign-in extras (2026-11-04): Google button, "or", Forgot password line. */
.auth-or { text-align: center; color: var(--muted); margin: 14px 0 8px; font-size: 0.9rem; }
.btn.google-btn { width: 100%; background: #fff; border: 1px solid #c7ccd4; color: #1f1f1f; font-weight: 600; }
.btn.google-btn:hover { background: #f5f6f8; }
.auth-forgot { margin-top: 16px; }

/* Privacy Policy / Terms (2026-11-07): footer links and the "I agree" tick
   on the sign-up pages, and the "please agree" notice. */
.legal-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; margin: 24px 0 16px; font-size: 14px; color: #6b7280; }
.legal-foot a { color: #4b5563; }
.legal-notice { border: 2px solid #2563eb; border-radius: 12px; padding: 14px 16px; margin: 12px 0; background: #fff; }
.legal-notice h2 { font-size: 1.1rem; margin: 0 0 6px; }
.legal-notice p { margin: 0 0 10px; }
.legal-agree { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; line-height: 1.45; }
.legal-agree input[type="checkbox"] { width: 22px; height: 22px; flex: none; margin: 1px 0 0; }

/* "Continue setting up the phone" banner (setup guide, 2026-11-22; same look as theme.css) */
.setup-banner{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:0 0 14px;padding:10px 14px;border-radius:10px;background:#fff4dc;border:1px solid #e9c46a;color:#1f3a33;font-weight:600;text-decoration:none}
.setup-banner-c{font-weight:500;opacity:.8}
.setup-banner-go{margin-left:auto}
