:root {
  color-scheme:light;
  --ink:#242824;
  --muted:#66705f;
  --line:#e7e9e2;
  --green:#386c45;
  --paper:#fcfcf8;
  --accent:#ecf2e6;
}

* {
  box-sizing:border-box;
}

body {
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  font-size:15px;
  -webkit-font-smoothing:antialiased;
}

.shell {
  width:min(100% - 64px,780px);
  margin-inline:auto;
}

header {
  height:112px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.brand {
  font-size:26px;
  font-weight:750;
  letter-spacing:-1.4px;
  text-decoration:none;
  color:var(--ink);
}

.brand span {
  color:var(--green);
}

a {
  color:inherit;
}

#admin-link {
  font-size:13px;
  text-decoration:none;
  color:var(--muted);
  padding:12px 0 12px 16px;
}

#admin-link:hover {
  color:var(--ink);
}

#admin-link span {
  margin-left:7px;
}

.preview {
  display:flex;
  align-items:center;
  gap:8px;
  font-size:12px;
  color:#777561;
  margin:14px 0 56px;
}

.preview>span {
  height:6px;
  width:6px;
  border-radius:50%;
  background:#b6ab80;
  flex-shrink:0;
}

h1 {
  font-size:44px;
  font-weight:550;
  letter-spacing:-1.9px;
  line-height:1.15;
  margin:0;
}

h2 {
  font-size:18px;
  font-weight:600;
  letter-spacing:-.3px;
  margin:0 0 18px;
}

.page-heading {
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:18px;
  padding-bottom:32px;
}

.column-label {
  font-size:12px;
  color:var(--muted);
}

ul {
  list-style:none;
  padding:0;
  margin:0;
}

.device-list {
  border-top:1px solid var(--line);
}

.device-row {
  display:flex;
  align-items:center;
  gap:20px;
  min-height:112px;
  padding:22px 0;
  border-bottom:1px solid var(--line);
}

.device-icon {
  width:44px;
  height:44px;
  color:#686f64;
  display:grid;
  place-items:center;
  flex-shrink:0;
}

.device-icon svg {
  height:29px;
  width:29px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.5;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.device-copy {
  min-width:0;
  flex:1;
}

.device-name {
  font-size:18px;
  font-weight:550;
  margin:0;
  overflow-wrap:anywhere;
  line-height:1.4;
}

.device-status {
  font-size:13px;
  color:var(--muted);
  margin:6px 0 0;
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
}

.connection-type {
  color:var(--muted);
}

.status-dot {
  height:5px;
  width:5px;
  border-radius:100%;
  background:#a6aaa2;
}

.device-status.on {
  color:var(--green);
}

.device-status.on .status-dot {
  background:var(--green);
}

button,input,select {
  font:inherit;
}

button {
  cursor:pointer;
  border:1px solid #daddd4;
  border-radius:9px;
  min-height:44px;
  padding:10px 17px;
  background:transparent;
  color:var(--ink);
  font-size:14px;
  font-weight:550;
  transition:background .12s;
}

button:hover {
  background:#f0f1e9;
}

button:disabled {
  opacity:.5;
  cursor:wait;
}

.access-button {
  min-width:106px;
  flex-shrink:0;
}

.primary {
  background:var(--green);
  border-color:var(--green);
  color:white;
}

.primary:hover {
  background:#2d5938;
}

.resume {
  background:var(--accent);
  color:#38633d;
  border-color:transparent;
}

.resume:hover {
  background:#dfead7;
}

.waiting-link {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  margin-top:28px;
  padding:17px 0;
  text-decoration:none;
  font-size:14px;
  color:var(--muted);
}

.waiting-link>span:last-child {
  color:var(--green);
  font-weight:600;
}

.waiting-link:hover {
  color:var(--ink);
}

.empty {
  color:var(--muted);
  padding:28px 0;
  line-height:1.6;
  font-size:14px;
}

.back-link {
  display:inline-block;
  font-size:13px;
  color:var(--muted);
  text-decoration:none;
  margin:0 0 22px;
}

.back-link:hover {
  color:var(--ink);
}

.admin-section {
  padding:27px 0;
  border-top:1px solid var(--line);
}

.admin-row {
  padding:18px 0;
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  gap:18px;
}

.admin-row:last-child {
  border-bottom:0;
}

.admin-name {
  flex:1;
  min-width:0;
}

.admin-name strong {
  display:block;
  overflow-wrap:anywhere;
}

.admin-meta {
  font-size:12px;
  color:var(--muted);
  margin:6px 0 0;
  overflow-wrap:anywhere;
}

.admin-actions {
  display:flex;
  align-items:center;
  gap:9px;
  flex-wrap:wrap;
}

.text-button {
  border:0;
  padding-inline:8px;
  color:var(--muted);
}

.danger {
  color:#965444;
}

.hint,details p {
  font-size:13px;
  color:var(--muted);
  line-height:1.65;
}

label {
  font-size:13px;
  display:block;
  margin:0 0 18px;
}

input,select {
  display:block;
  background:#fff;
  border:1px solid #d9ddd2;
  border-radius:8px;
  min-height:44px;
  padding:10px 12px;
  max-width:100%;
  color:var(--ink);
}

label input {
  width:100%;
  margin-top:8px;
}

select {
  font-size:13px;
}

input:focus-visible,button:focus-visible,a:focus-visible,summary:focus-visible,select:focus-visible {
  outline:3px solid #8aaa7c;
  outline-offset:4px;
}

h1:focus {
  outline:none;
}

.time-fields {
  display:flex;
  gap:20px;
}

.time-fields>label {
  flex:1;
  min-width:0;
}

#schedule-form {
  max-width:430px;
  margin-top:22px;
}

details {
  font-size:13px;
  color:var(--muted);
}

summary {
  cursor:pointer;
  padding:10px 0;
  color:var(--ink);
  min-height:40px;
}

#schedule-form details {
  margin-top:18px;
}

.events {
  padding:0;
  list-style:none;
}

.events li {
  font-size:13px;
  padding:12px 0;
  border-bottom:1px solid var(--line);
}

.events small {
  display:block;
  color:var(--muted);
  margin-top:5px;
}

#login {
  max-width:360px;
  margin:65px auto;
}

#login h1 {
  margin-bottom:40px;
  font-size:38px;
}

#login-form>input {
  width:100%;
  margin-bottom:24px;
}

#login-form>.primary {
  width:100%;
  display:flex;
  justify-content:space-between;
}

.login-help {
  margin-top:20px;
}

main {
  padding-bottom:80px;
}

.message {
  position:fixed;
  bottom:24px;
  left:50%;
  transform:translateX(-50%);
  width:max-content;
  max-width:calc(100% - 32px);
  margin:0;
  padding:14px 22px;
  border-radius:10px;
  background:var(--ink);
  color:#fff;
  box-shadow:0 6px 24px #24282415;
  font-size:14px;
  z-index:5;
}

.message.error {
  background:#893f35;
}

dialog {
  border:1px solid var(--line);
  border-radius:14px;
  padding:28px;
  width:min(420px,calc(100% - 32px));
  background:var(--paper);
  color:var(--ink);
}

dialog::backdrop {
  background:#24282455;
}

dialog input {
  width:100%;
  margin-bottom:22px;
}

.dialog-actions {
  display:flex;
  justify-content:flex-end;
  gap:10px;
}

[hidden] {
  display:none!important;
}

.header-tools { display:flex; align-items:center; gap:20px; }
.internet-status { display:flex; align-items:center; gap:7px; font-size:12px; color:#666e63; }
.internet-dot { width:8px; height:8px; border-radius:50%; background:#999e96; flex-shrink:0; }
.internet-status[data-state="online"] .internet-dot { background:#43804e; }
.internet-status[data-state="limited"] .internet-dot { background:#b67a16; }
.internet-status[data-state="unavailable"] .internet-dot { background:#b84e42; }
.person-group { margin-bottom:32px; }
.person-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:15px 0; }
.person-copy { min-width:0; }
.person-copy h2 { font-size:21px; margin:0; overflow-wrap:anywhere; }
.person-status { font-size:12px; color:var(--muted); margin:5px 0 0; }
.person-actions { display:flex; gap:8px; flex-shrink:0; }
.extra-button { color:var(--green); background:var(--accent); border-color:transparent; }
.people-list .device-row { min-height:78px; padding:14px 0 14px 14px; gap:14px; }
.people-list .device-name { font-size:16px; }
.people-list .device-icon { width:32px; height:32px; }
.people-list .device-icon svg { width:24px; height:24px; }
.people-list .device-status { font-size:12px; margin-top:3px; }
.add-person-form { margin-top:20px; max-width:340px; }
.add-person-form > div { display:flex; gap:8px; margin-top:8px; }
.add-person-form input { min-width:0; width:100%; }

.person-devices > summary {
  color:var(--muted);
  font-size:13px;
  min-height:48px;
  padding:14px 0;
}
.person-devices:not([open]) { border-bottom:1px solid var(--line); }
button,a,summary { touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
button:active { transform:translateY(1px); }
input,select { font-size:16px; }
summary,.back-link,.brand { min-height:44px; }
.brand,.back-link { display:inline-flex; align-items:center; }
.message { bottom:calc(24px + env(safe-area-inset-bottom)); }
main { padding-bottom:calc(80px + env(safe-area-inset-bottom)); }
dialog { max-height:calc(100dvh - 32px); overflow-y:auto; }
.admin-actions { min-width:0; }
.admin-actions select { min-width:0; }

@media (max-width:600px) {
  html { scroll-padding-top:112px; }
  .shell { width:calc(100% - 32px - env(safe-area-inset-left) - env(safe-area-inset-right)); }
  header.shell {
    position:sticky;
    top:0;
    z-index:3;
    width:100%;
    height:auto;
    padding:calc(8px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) 12px calc(16px + env(safe-area-inset-left));
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:0 16px;
    background:var(--paper);
    border-bottom:1px solid var(--line);
  }
  .brand { grid-column:1; grid-row:1; font-size:24px; min-height:48px; }
  .header-tools { display:contents; }
  #admin-link { grid-column:2; grid-row:1; display:flex; align-items:center; justify-content:flex-end; min-height:48px; padding:0 4px 0 12px; font-size:14px; }
  .internet-status { grid-column:1 / -1; grid-row:2; min-width:0; font-size:12px; line-height:1.5; }
  .preview { font-size:11px; line-height:1.5; margin:14px 0 24px; }
  h1 { font-size:32px; letter-spacing:-1.2px; }
  .page-heading { padding-bottom:12px; }
  .column-label { display:none; }
  .person-group { margin-bottom:20px; }
  .person-heading { display:block; padding:16px 0 8px; }
  .person-copy { display:flex; align-items:baseline; justify-content:space-between; flex-wrap:wrap; gap:4px 12px; }
  .person-copy h2 { font-size:20px; }
  .person-status { margin:0; line-height:1.5; }
  .person-actions { display:flex; width:100%; gap:10px; margin-top:14px; }
  .person-actions button { flex:1; min-width:0; padding-inline:12px; font-size:16px; }
  button,input,select { min-height:48px; }
  .people-list .device-row { min-height:80px; padding:12px 0; gap:10px; }
  .people-list .device-icon { width:26px; }
  .people-list .device-name { font-size:16px; }
  .people-list .device-status { font-size:12px; }
  .people-list .device-row .access-button { min-width:88px; max-width:116px; padding-inline:10px; font-size:14px; }
  .person-devices > summary { min-height:48px; padding-block:14px; }
  .waiting-link { font-size:14px; min-height:56px; gap:12px; margin-top:12px; }
  .waiting-link > span:last-child { flex-shrink:0; }
  .admin-row { align-items:stretch; flex-direction:column; gap:14px; }
  .admin-actions { display:grid; grid-template-columns:minmax(0,1fr) auto; width:100%; gap:10px; }
  .admin-actions select { width:100%; font-size:16px; }
  .admin-actions .danger { grid-column:1 / -1; justify-self:start; padding-left:0; }
  .admin-section { padding:24px 0; }
  .hint,details p { font-size:14px; }
  .back-link { min-height:48px; margin-bottom:8px; font-size:14px; }
  .time-fields { gap:12px; }
  .time-fields input { min-width:0; padding-inline:8px; }
  #schedule-form > button { width:100%; }
  label { font-size:14px; }
  summary { min-height:48px; }
  .add-person-form { max-width:none; }
  .add-person-form > label { margin-bottom:8px; }
  #login { margin:24px auto; }
  #login h1 { font-size:32px; margin-bottom:28px; }
  dialog { padding:22px; }
  .dialog-actions > button { flex:1; padding-inline:10px; }
}
@media (prefers-reduced-motion:reduce) {
  button { transition:none; }
  button:active { transform:none; }
}

.household-group,.type-group { margin-bottom:36px; }
.household-title { font-size:25px; margin:16px 0 14px; }
.household-group .person-group { margin-bottom:16px; }
.type-group > h2 { font-size:23px; margin:0 0 6px; }
.group-empty { margin:12px 0; font-size:13px; color:var(--muted); }
.admin-actions { max-width:460px; }
@media (max-width:600px) {
  .household-title { font-size:23px; margin-top:12px; }
  .household-group,.type-group { margin-bottom:28px; }
  .type-group > h2 { font-size:21px; }
  .admin-actions { max-width:none; }
}

.report-link { display:flex; justify-content:space-between; align-items:center; min-height:56px; padding:14px 0; text-decoration:none; color:var(--green); border-block:1px solid var(--line); }
.activity-link { display:inline-flex; align-items:center; min-height:48px; padding:10px; color:var(--green); }
.filter-row { flex-direction:row; align-items:center; }
.filter-switch { min-width:80px; min-height:48px; font-size:16px; }
.filter-switch[aria-checked="true"] { background:var(--green); color:white; border-color:var(--green); }
.sample-notice { color:#736043; background:#f4efdf; border-radius:8px; padding:12px 16px; font-size:14px; line-height:1.5; margin:0 0 24px; }
.report-filters { display:grid; grid-template-columns:1fr 1fr; gap:0 18px; }
.report-filters select { width:100%; margin-top:8px; min-height:48px; }
.report-filters button { grid-column:1 / -1; justify-self:start; min-height:48px; margin-bottom:8px; }
.report-filters label { min-width:0; }
.report-summary { font-size:14px; margin:26px 0 12px; color:var(--muted); }
.activity-row { padding:18px 0; border-top:1px solid var(--line); }
.activity-heading { display:flex; justify-content:space-between; align-items:baseline; gap:12px; }
.activity-heading strong { overflow-wrap:anywhere; min-width:0; font-weight:600; }
.activity-result { font-size:12px; flex-shrink:0; color:var(--green); }
.activity-result.blocked { color:#965444; }
.activity-row .admin-meta { overflow-wrap:anywhere; }
@media (max-width:600px) {
  .report-filters { gap:0 12px; }
  .report-filters button { width:100%; }
  .activity-heading { font-size:15px; }
}

.ai-review { border-block:1px solid var(--line); padding:24px 0; margin-top:22px; }
.ai-review h2 { margin-bottom:8px; }
.review-actions { display:flex; flex-wrap:wrap; gap:8px; margin:16px 0 8px; }
.review-actions button { min-height:48px; }
.review-finding { border-left:3px solid #b6ab80; padding:4px 0 4px 18px; margin:24px 0 8px; }
.review-finding h3 { font-size:17px; margin:0 0 10px; }
.review-finding p { font-size:14px; line-height:1.6; overflow-wrap:anywhere; }
.review-suggestion { color:var(--green); }
.review-evidence li { padding:12px 0; border-top:1px solid var(--line); overflow-wrap:anywhere; }
code { overflow-wrap:anywhere; }
@media(max-width:600px) {
  .review-actions { flex-direction:column; }
  .review-actions button { width:100%; }
}

.network-grid {display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px;}
#network-form label {display:flex; flex-direction:column; gap:8px; min-width:0; margin-bottom:16px;}
#network-form input, #network-form select {width:100%; min-width:0; min-height:48px; font-size:16px;}
.forward-editor {min-width:0; margin:0 0 20px; padding:16px; border:1px solid var(--line); border-radius:12px;}
.forward-editor legend {padding:0 6px; font-weight:600;}
.network-actions {display:flex; flex-wrap:wrap; gap:12px;}
.network-actions button, #network-add-forward {min-height:48px;}
@media(max-width:600px) {.network-grid {grid-template-columns:1fr; gap:0;} .network-actions {flex-direction:column;} .network-actions button {width:100%;}}

#lan-screen .admin-name {min-width:0; overflow-wrap:anywhere;}
#lan-screen button, #lan-form button, #lan-form select, #lan-form input {min-height:48px;}
#lan-form label {display:grid; gap:8px; margin:12px 0;}
#lan-form select, #lan-form input {width:100%; min-width:0; font-size:16px;}
#lan-form .dialog-actions {flex-wrap:wrap;}
#lan-policy-status:empty {display:none;}
#lan-form #lan-key-verify, #lan-form #lan-gaming-membership {display:flex; align-items:center; min-height:48px; font-weight:400;}
#lan-form #lan-key-verified, #lan-form #lan-gaming-device {width:20px; height:20px; min-height:0;}
#lan-client {margin:16px 0;}
#lan-client dt {font-size:13px; color:var(--muted); margin-top:8px;}
#lan-client dd {margin:4px 0; overflow-wrap:anywhere; user-select:all;}

#gaming-form {margin-top:16px;}
#gaming-form input {font-size:16px; min-height:48px; min-width:0; width:100%;}
#gaming-form button, #gaming-editor summary {min-height:48px;}
#gaming-editor summary {align-content:center;}

#lan-view {font-size:16px; min-height:48px; max-width:100%; margin-bottom:12px;}

#passkey-sign-in, #passkey-enroll-form input, #passkey-enroll-form button {width:100%; min-height:48px;}
#passkey-enroll-form {margin-top:16px;}
#passkey-invite {font-size:16px; margin-bottom:16px;}
#passkey-setup summary {min-height:48px; padding-block:12px;}
#signin-status:empty {display:none;}

#appliance-screen { padding-top:24px; }
#appliance-screen .page-heading { align-items:center; padding-bottom:0; }
#appliance-status { margin:8px 0 28px; }
.live-group { margin:0 0 28px; }
.live-group h2 { margin:0 0 10px; }
.live-device { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:14px; padding:15px 0; border-bottom:1px solid var(--line); }
.live-device strong { font-weight:550; overflow-wrap:anywhere; }
.live-status { font-size:13px; color:var(--muted); }
.live-status.allowed { color:var(--green); }
