:root {
  color-scheme: light;
  --navy: #071b3b;
  --navy-2: #102a56;
  --blue: #147eea;
  --gold: #efc54c;
  --gold-dark: #8f6811;
  --green: #16815d;
  --teal: #0f766e;
  --coral: #d95d4f;
  --red: #c0392b;
  --ink: #101828;
  --muted: #667085;
  --line: #dce3ec;
  --surface: #ffffff;
  --canvas: #f4f7fb;
  --shadow: 0 12px 34px rgba(7, 27, 59, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); line-height: 1.5; }
a { color: #075eb8; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; letter-spacing: 0; }
button, .button, select { min-height: 42px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px max(24px, calc((100vw - 1200px) / 2));
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; background: var(--navy); color: var(--gold); font-weight: 900; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; }
.brand small { color: var(--muted); font-size: 11px; }
.topbar nav { display: flex; align-items: center; gap: 22px; }
.topbar nav form { margin: 0; }
.topbar nav a, .link-button { color: #344054; font-weight: 700; font-size: 14px; }
.topbar nav a.active { color: var(--blue); }
.link-button { border: 0; background: transparent; cursor: pointer; padding: 0; min-height: auto; }

.shell { width: min(1200px, calc(100% - 40px)); margin: 0 auto; padding: 38px 0 64px; }
.shell.narrow { max-width: 820px; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-title h1, .section-heading h2, .panel h2 { margin: 0; letter-spacing: 0; }
.page-title h1 { font-size: clamp(28px, 4vw, 42px); line-height: 1.12; }
.page-title p, .section-heading p, .panel > p { margin: 7px 0 0; color: var(--muted); }
.download-cluster { display: grid; justify-items: end; gap: 7px; max-width: 310px; text-align: right; }
.download-cluster small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.eyebrow { color: #0969c8; text-transform: uppercase; font-size: 12px; font-weight: 900; letter-spacing: .08em; margin-bottom: 8px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.button:hover { text-decoration: none; transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.button.primary { background: var(--blue); color: white; box-shadow: 0 7px 16px rgba(20,126,234,.2); }
.button.secondary { background: #fff; color: var(--navy); border-color: #cfd8e5; }
.button.danger { background: var(--red); color: white; }
.button.download { background: var(--gold); color: var(--navy); box-shadow: 0 7px 18px rgba(170,122,12,.18); }
.button.setup { width: 100%; background: var(--navy); color: white; }
.button.small { min-height: 34px; padding: 6px 10px; font-size: 12px; }

.notice { width: min(1200px, calc(100% - 40px)); margin: 14px auto 0; padding: 12px 16px; border: 1px solid; border-radius: 7px; font-weight: 700; }
.notice.success { color: #086044; border-color: #9ed8c1; background: #eefaf5; }
.notice.error { color: #8f251c; border-color: #efbbb5; background: #fff2f0; }
.notice.inline { width: 100%; margin: 0 0 20px; }

.auth-layout { min-height: 660px; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr); background: var(--navy); }
.auth-intro { padding: clamp(58px, 8vw, 108px) max(32px, calc((100vw - 1200px) / 2)); padding-right: 7vw; color: white; align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.auth-intro h1 { margin: 0; font-size: clamp(48px, 7vw, 86px); line-height: 1; max-width: 700px; }
.auth-intro p { max-width: 680px; color: #cfdbeb; font-size: 20px; line-height: 1.65; }
.auth-intro .eyebrow { color: var(--gold); }
.trust-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.trust-row span { border: 1px solid rgba(255,255,255,.22); padding: 8px 12px; border-radius: 6px; color: #e7edf5; font-size: 13px; font-weight: 700; }
.feature-list { margin: 16px 0 0; padding-left: 22px; color: #d9e3f0; }
.feature-list li { margin: 9px 0; }
.auth-panel { background: white; padding: clamp(34px, 6vw, 72px); display: flex; flex-direction: column; justify-content: center; }
.auth-panel h2 { margin: 0; font-size: 28px; }
.muted, .field-note { color: var(--muted); }
.form-foot { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); }
.field-error { color: var(--red); font-weight: 700; }

.form-stack { display: grid; gap: 16px; margin-top: 22px; }
.form-stack label, fieldset { display: grid; gap: 6px; color: #344054; font-size: 13px; font-weight: 800; }
.form-stack small { color: var(--muted); font-weight: 500; }
input, select { width: 100%; border: 1px solid #cdd7e4; background: white; color: var(--ink); border-radius: 7px; padding: 10px 12px; outline: none; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(20,126,234,.13); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { margin-bottom: 8px; }

.pricing-band { background: white; border-top: 1px solid var(--line); }
.pricing-band .shell { padding-top: 50px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.trial-chip { background: #fff5cc; color: var(--gold-dark); padding: 8px 12px; border-radius: 999px; font-size: 13px; font-weight: 900; }
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.plan-card { position: relative; display: grid; gap: 9px; min-height: 170px; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: white; cursor: pointer; box-shadow: 0 4px 20px rgba(7,27,59,.04); }
.plan-card.selected { border: 2px solid var(--blue); background: #f4f9ff; }
.plan-card input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.plan-name { font-size: 18px; font-weight: 900; color: var(--navy); }
.plan-price { color: var(--muted); }
.plan-price strong { color: var(--ink); font-size: 32px; }
.plan-grid.compact .plan-card { min-height: 116px; padding: 15px; }
.plan-grid.compact .plan-price strong { font-size: 24px; }

.subscription-bar { display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: 20px; padding: 18px 20px; margin-bottom: 24px; border-left: 4px solid var(--green); background: white; box-shadow: var(--shadow); }
.subscription-bar.blocked { border-left-color: var(--red); }
.subscription-bar div { display: grid; gap: 2px; }
.subscription-bar span { color: var(--muted); font-size: 12px; font-weight: 700; }
.subscription-bar strong { color: var(--navy); }

.dashboard-grid, .admin-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr); gap: 20px; align-items: start; }
.device-list { display: grid; gap: 14px; }
.device-card, .panel, .metric { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.device-card { position: relative; overflow: hidden; padding: 20px; border-top: 4px solid #98a2b3; }
.device-card.managed { border-top-color: var(--green); }
.device-card.basic { border-top-color: var(--gold); }
.device-card.setup { border-top-color: #98a2b3; }
.device-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.device-head > div { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; }
.device-head strong { color: var(--navy); font-size: 18px; }
.device-head small { grid-column: 2; color: var(--muted); }
.device-head.premium > div { display: flex; }
.child-identity { display: flex; align-items: center; gap: 11px; }
.child-identity > span:last-child { display: grid; }
.child-identity > span:last-child small { grid-column: auto; }
.child-avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #e8f2ff; color: #075fb8; font-weight: 900; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #98a2b3; }
.status-dot.online { background: #22a97a; box-shadow: 0 0 0 4px #dcf7ed; }
.badge { display: inline-flex; width: fit-content; padding: 4px 8px; border-radius: 999px; background: #f1f3f6; color: #475467; font-size: 11px; font-weight: 900; text-transform: capitalize; }
.badge.good { background: #e6f7f0; color: #08714f; }
.badge.warn { background: #fff3db; color: #855b00; }
.badge.info { background: #e8f2ff; color: #075fb8; }
.device-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 18px 0; background: var(--line); border: 1px solid var(--line); }
.device-metrics div { display: grid; gap: 4px; padding: 12px; background: #fbfcfe; }
.device-metrics span { color: var(--muted); font-size: 11px; }
.device-metrics strong { font-size: 14px; }
.learning-progress { display: grid; gap: 8px; margin: 18px 0; }
.progress-copy, .progress-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.progress-copy span, .progress-foot { color: var(--muted); font-size: 11px; }
.progress-copy > strong { color: var(--navy); font-size: 22px; }
.progress-copy strong small { color: var(--muted); font-size: 12px; font-weight: 700; }
.learning-progress progress { width: 100%; height: 10px; overflow: hidden; border: 0; border-radius: 5px; background: #e9eef5; }
.learning-progress progress::-webkit-progress-bar { background: #e9eef5; }
.learning-progress progress::-webkit-progress-value { background: var(--teal); border-radius: 5px; }
.learning-progress progress::-moz-progress-bar { background: var(--teal); border-radius: 5px; }
.device-policy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; padding: 14px 0; border-top: 1px solid var(--line); }
.device-policy-row > div { display: grid; align-content: start; gap: 7px; }
.device-policy-row > div > span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.app-tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.app-tag { display: inline-flex; padding: 4px 7px; border-radius: 5px; background: #eef7f5; color: #0a665e; font-size: 11px; font-weight: 800; }
.app-tag.muted-tag { background: #f1f3f6; color: var(--muted); }
.protection-label { font-size: 12px; }
.protection-label.managed { color: var(--green); }
.protection-label.basic { color: var(--gold-dark); }
.protection-label.setup { color: var(--muted); }
.pair-box { display: grid; gap: 6px; padding: 16px; background: #f1f7fe; border: 1px solid #cfe2f8; border-radius: 7px; }
.pair-box > span, .pair-box small { color: var(--muted); }
.pair-box > strong { color: var(--navy); font-size: 30px; letter-spacing: .16em; }
.pair-box form { margin-top: 7px; }
.managed-setup-form { margin: 12px 0 0; }
.device-actions { display: flex; gap: 10px; }
.device-actions > * { flex: 1; }
.device-actions .button { width: 100%; }
.device-card-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 13px; color: var(--muted); font-size: 10px; }
.policy-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px 0 14px; color: var(--muted); font-size: 12px; }
.policy-summary strong { color: var(--navy); white-space: nowrap; }
.panel { padding: 20px; margin-bottom: 18px; }
.panel.help { border-top: 4px solid var(--gold); }
.field-note { margin: 12px 0 0; font-size: 12px; }
.empty { padding: 38px; text-align: center; border: 1px dashed #bbc7d6; background: white; border-radius: 8px; }
.empty h1, .empty h2 { margin: 0; }
.empty p { color: var(--muted); }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.admin-metrics { grid-template-columns: repeat(6, 1fr); }
.metric { padding: 16px; display: grid; gap: 4px; }
.metric span { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric strong { color: var(--navy); font-size: 25px; }
.admin-grid { grid-template-columns: minmax(0, 3fr) minmax(250px, 1fr); }
.panel.wide { min-width: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: .06em; }
td strong, td small { display: block; }
td small { color: var(--muted); margin-top: 2px; }
.inline-form { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(105px, 1fr) auto; gap: 6px; min-width: 360px; }
.inline-form select { min-height: 34px; padding: 5px 8px; font-size: 12px; }
.city-list { display: grid; }
.city-list > div { display: grid; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.city-list span { font-weight: 800; }
.city-list strong { color: var(--muted); font-size: 11px; }
.compact-form { border-top: 1px solid var(--line); padding-top: 14px; }
.audit-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); }
.audit-list > div { display: grid; gap: 3px; padding: 12px; background: white; }
.audit-list span { color: #075fb8; font-size: 11px; font-weight: 900; text-transform: capitalize; }
.audit-list strong { font-size: 13px; }
.audit-list small { color: var(--muted); }
.warning-box { display: grid; gap: 3px; padding: 15px 17px; margin-bottom: 18px; border: 1px solid #efc7a2; border-left: 4px solid #d97706; border-radius: 7px; background: #fff8ed; color: #7a3d04; }
.warning-box span { color: #86531f; }
.enroll-layout { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr); gap: 20px; align-items: start; }
.qr-card { display: grid; justify-items: center; gap: 6px; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: var(--shadow); text-align: center; }
.qr-card img { display: block; width: min(100%, 420px); height: auto; aspect-ratio: 1; }
.qr-card strong { color: var(--navy); font-size: 18px; }
.qr-card span { color: var(--muted); font-size: 12px; }
.enroll-steps { margin: 0; }
.steps { display: grid; gap: 16px; padding: 0; margin: 20px 0 0; list-style: none; counter-reset: setup; }
.steps li { position: relative; display: grid; gap: 2px; min-height: 42px; padding-left: 52px; counter-increment: setup; }
.steps li::before { content: counter(setup); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: #e8f2ff; color: #075fb8; font-weight: 900; }
.steps li span { color: var(--muted); }
.code-box { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 22px; padding: 13px 15px; border: 1px dashed #aebdd0; border-radius: 7px; background: #f7f9fc; }
.code-box span { color: var(--muted); font-size: 12px; font-weight: 700; }
.code-box strong { color: var(--navy); font-size: 22px; letter-spacing: .14em; }
.basic-option { margin-top: 20px; }
.family-pulse { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(380px, .8fr); align-items: center; gap: 28px; margin-bottom: 16px; padding: 24px; border-radius: 8px; background: var(--navy); color: white; box-shadow: 0 18px 38px rgba(7,27,59,.15); }
.family-pulse h2 { margin: 3px 0; font-size: 25px; }
.family-pulse p { margin: 0; color: #cbd8e8; }
.pulse-kicker { color: var(--gold); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.pulse-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: rgba(255,255,255,.16); }
.pulse-metrics > div { display: grid; gap: 3px; padding: 13px; background: rgba(255,255,255,.07); }
.pulse-metrics span { color: #bdcbe0; font-size: 10px; text-transform: uppercase; }
.pulse-metrics strong { font-size: 18px; }
.add-child-panel { position: relative; overflow: hidden; }
.panel-number { position: absolute; top: 16px; right: 18px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #e8f2ff; color: #075fb8; font-weight: 900; }
.protection-guide { display: grid; gap: 12px; }
.guide-row { display: grid; grid-template-columns: 12px 1fr; align-items: center; gap: 10px; }
.guide-row > span:last-child { display: grid; }
.guide-row small { color: var(--muted); }
.guide-dot { width: 10px; height: 10px; border-radius: 50%; background: #98a2b3; }
.guide-dot.managed { background: var(--green); box-shadow: 0 0 0 4px #dcf7ed; }
.guide-dot.basic { background: var(--gold); box-shadow: 0 0 0 4px #fff5cc; }
.device-overview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-bottom: 20px; border: 1px solid var(--line); background: var(--line); box-shadow: var(--shadow); }
.device-overview > div { display: grid; gap: 3px; padding: 16px; background: white; }
.device-overview span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.device-overview strong { color: var(--navy); }
.control-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 20px; align-items: start; }
.control-panel { margin: 0; }
.form-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.app-choice-list { display: grid; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.app-choice { display: grid; grid-template-columns: 24px 1fr; align-items: center; gap: 10px; min-height: 66px; padding: 12px 14px; background: white; cursor: pointer; }
.app-choice + .app-choice { border-top: 1px solid var(--line); }
.app-choice input { width: 18px; height: 18px; accent-color: var(--blue); }
.app-choice span, .app-choice strong, .app-choice small { display: block; }
.app-choice strong { color: var(--navy); }
.app-choice small { margin-top: 2px; color: var(--muted); font-weight: 500; }
.quick-actions { display: grid; gap: 9px; margin-top: 16px; }
.quick-actions form, .quick-actions .button, .connection-panel .button { width: 100%; }
.connection-panel p { color: var(--muted); }
.usage-panel { margin-top: 20px; }

@media (max-width: 980px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-intro { min-height: 420px; padding: 60px 30px; }
  .auth-panel { padding: 40px max(24px, 8vw); }
  .dashboard-grid, .admin-grid { grid-template-columns: 1fr; }
  .control-grid { grid-template-columns: 1fr; }
  .family-pulse { grid-template-columns: 1fr; }
  .admin-metrics { grid-template-columns: repeat(3, 1fr); }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .topbar { position: static; padding: 10px 14px; align-items: flex-start; }
  .brand small { display: none; }
  .topbar nav { flex-wrap: wrap; justify-content: flex-end; gap: 10px 14px; }
  .shell { width: min(100% - 24px, 1200px); padding-top: 24px; }
  .page-title { align-items: flex-start; flex-direction: column; }
  .page-title .button { width: 100%; }
  .download-cluster { width: 100%; justify-items: stretch; max-width: none; text-align: left; }
  .plan-grid, .plan-grid.compact { grid-template-columns: 1fr; }
  .plan-card, .plan-grid.compact .plan-card { min-height: 104px; }
  .subscription-bar { grid-template-columns: 1fr 1fr; }
  .subscription-bar a { grid-column: 1 / -1; }
  .device-metrics { grid-template-columns: 1fr; }
  .device-actions { flex-direction: column; }
  .device-policy-row { grid-template-columns: 1fr; }
  .device-card-foot { flex-direction: column; gap: 2px; }
  .family-pulse { padding: 20px; }
  .pulse-metrics { grid-template-columns: 1fr 1fr 1fr; }
  .pulse-metrics > div { padding: 10px 8px; }
  .device-overview { grid-template-columns: repeat(2, 1fr); }
  .form-split { grid-template-columns: 1fr; }
  .policy-summary { align-items: flex-start; flex-direction: column; gap: 2px; }
  .admin-metrics { grid-template-columns: repeat(2, 1fr); }
  .audit-list { grid-template-columns: 1fr; }
  .enroll-layout { grid-template-columns: 1fr; }
  .auth-intro h1 { font-size: 48px; }
  .auth-intro p { font-size: 17px; }
}
