/* The hidden attribute always wins (a .btn{display:...} rule was showing hidden buttons). */
[hidden] { display: none !important; }
/* The grown-up app in Homey's look (handoff #2 §C, "Parent" tier): paper cards with a
   2 px ink outline and a solid 3 px drop shadow, Fredoka headings, green primary /
   tomato danger buttons, a sidebar on wide screens and a tab bar on phones.
   Loaded after style.css + hs.css. style.css stays the family app's file (it arrives
   with every family merge); this file re-points its tokens and restyles its pieces
   so every page picks the look up at once. Light only for v1 (index.html pins
   data-theme="light"). */

/* ---- Tokens: style.css names, Homey values. html:root[data-theme] outranks both
   :root[data-theme="light"] and the OS-dark media block in style.css. ---------- */
html:root[data-theme] {
  --bg: #F6F1E4; --bg-sheen: none;
  --panel: #FFFDF6; --panel-2: #F6F1E4;
  --line: #D9D4C7; --line-strong: #2B3138;
  --text: #2B3138; --muted: #5F666D; --dim: #5F666D;
  --accent: #3D7C4A; --accent-2: #4C9A5C; --accent-ink: #FFFFFF; --accent-soft: #DCEFD9; --accent-text: #2A5C36;
  --tape: transparent; --tape-solid: #F6E7B4;
  --ok: #3D7C4A; --ok-ink: #2A5C36; --ok-soft: #DCEFD9;
  --warn: #FFCB57; --warn-ink: #7E5410; --warn-soft: #FFF1C7;
  --bad: #E8634A; --bad-ink: #B23E27; --bad-soft: #FBE1DA;
  --paused: #9B7BD8; --paused-ink: #5B3FA0; --paused-soft: #ECE4F8;
  --radius: 20px; --radius-sm: 12px; --radius-pill: 999px;
  --shadow: inset 0 0 0 2px #2B3138, 0 3px 0 #2B3138;
  --shadow-lift: inset 0 0 0 2px #2B3138, 0 5px 0 #2B3138;
  --shadow-press: inset 0 0 0 2px #2B3138, 0 1px 0 #2B3138;
  --font-hand: "Fredoka", "Figtree", system-ui, sans-serif;
  color-scheme: light;
}
html:root[data-theme] body { background: #F6F1E4; background-image: none; }

/* ---- Type ------------------------------------------------------------------------ */
.hsp h1 { font: 700 36px/1.1 var(--display); margin: 0 0 4px; }
.hsp h2 { font: 600 22px/1.2 var(--display); margin: 26px 0 10px; }
.hsp .sub { font: 500 16px/1.5 var(--text-font); color: #5F666D; margin: 0 0 20px; }
.hsp .hint { font-size: 14px; color: #5F666D; }
.hsp .brand, .hsp .device-name, .hsp .kid-name { font-family: var(--display); }

/* ---- Buttons (parent tier: 44 px, Figtree 700 16, radius 12) -------------------------- */
.btn { border: 0; border-radius: 12px; min-height: 44px; padding: 0 18px; font: 700 15px var(--text-font);
  background: #FFFDF6; color: #2B3138; box-shadow: inset 0 0 0 2px #2B3138, 0 3px 0 #2B3138; gap: 8px; text-decoration: none; }
.btn:hover { background: #F6F1E4; text-decoration: none; color: #2B3138; }
.btn:active { transform: translateY(2px); box-shadow: inset 0 0 0 2px #2B3138, 0 1px 0 #2B3138; }
.btn.primary { background: #3D7C4A; color: #fff; box-shadow: inset 0 0 0 2px #2B3138, 0 3px 0 #2B3138; }
.btn.primary:hover { background: #4C9A5C; color: #fff; }
.btn.primary:active { transform: translateY(2px); box-shadow: inset 0 0 0 2px #2B3138, 0 1px 0 #2B3138; }
.btn.danger { background: #E8634A; color: #fff; box-shadow: inset 0 0 0 2px #2B3138, 0 3px 0 #2B3138; }
.btn.danger:hover { background: #d9573f; color: #fff; }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn:disabled, .btn[disabled] { background: #F6F1E4; color: #8A9096; box-shadow: inset 0 0 0 2px #B9B4A8; }
.btn .hs-i { font-size: 1.15em; }
.hs-linkbtn { border: 0; background: none; padding: 4px 0; font: 700 14px var(--text-font); color: #3D7C4A; cursor: pointer; }

/* ---- Cards: flat paper, ink outline, no tilt, no tape ------------------------------- */
.card { border-radius: 20px; box-shadow: var(--shadow); background: #FFFDF6; }
.grid > .card:nth-child(n) { transform: none; }
.device-card { padding-top: 20px; }
.device-card::before, .taped::before, .reqbar::before { display: none !important; }
.grid > .device-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }

/* ---- Fields -------------------------------------------------------------------------- */
.hsp input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), .hsp select, .hsp textarea,
.modal input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), .modal select, .modal textarea {
  border: 0; border-radius: 12px; background: #fff; color: #2B3138; min-height: 44px; box-shadow: inset 0 0 0 2px #2B3138; font: 500 16px var(--text-font); }
.hsp input:focus, .hsp select:focus, .hsp textarea:focus, .modal input:focus, .modal select:focus, .modal textarea:focus {
  outline: none; box-shadow: inset 0 0 0 3px #3D7C4A, 0 0 0 5px #DCEFD9; }
.hsp label, .modal label { font: 700 14px var(--text-font); color: #2B3138; }
.hsp input[type="checkbox"], .modal input[type="checkbox"] { accent-color: #3D7C4A; }

/* ---- Chips, pills, badges ------------------------------------------------------------- */
.chip, .pill, .badge, .mseg-b { border-radius: 999px; }
.chip { box-shadow: inset 0 0 0 2px #2B3138; border: 0; }
.chip.on { background: #FFCB57; color: #2B3138; box-shadow: inset 0 0 0 2px #2B3138; }
.famnav .btn.primary { background: #FFCB57; color: #2B3138; }

/* ---- Pop-ups: ink backdrop, paper card, buttons in one row ----------------------------- */
.backdrop { background: rgba(43, 49, 56, .55); backdrop-filter: none; }
.modal { border: 0; border-radius: 20px; background: #FFFDF6; box-shadow: inset 0 0 0 2px #2B3138, 0 4px 0 #2B3138; }
.modal .m-head { border-bottom: 1.5px solid #D9D4C7; }
.modal .m-head h1 { font: 700 26px var(--display); margin: 0; }
.modal .m-foot { border-top: 1.5px solid #D9D4C7; display: flex; gap: 10px; align-items: center; }
.hsp-more { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hsp-more .btn { min-height: 56px; justify-content: flex-start; font-size: 16px; }

/* ---- Toasts and banners ---------------------------------------------------------------- */
.toast { background: #2B3138; color: #FFFDF6; border-radius: 14px; border: 0; box-shadow: 0 3px 0 #11151A; font: 700 15px var(--text-font); }
.reqbar, .notifybar { background: #FFF1C7; border: 0; border-radius: 20px; box-shadow: inset 0 0 0 2px #2B3138, 0 3px 0 #2B3138;
  font-family: var(--text-font); transform: none; }

/* ---- The frame: sidebar (wide) / tab bar (phones) ---------------------------------------- */
.hsp { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.hsp-side { position: sticky; top: 0; height: 100vh; box-sizing: border-box; background: #FFFDF6; box-shadow: inset -2px 0 0 #2B3138;
  display: flex; flex-direction: column; gap: 6px; padding: 20px 16px; overflow-y: auto; }
.hsp-logo { display: flex; align-items: center; gap: 10px; font: 700 26px var(--display); padding: 0 6px 14px; }
.hsp-nav { display: flex; flex-direction: column; gap: 4px; }
.hsp-nav a { height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border-radius: 12px; color: #2B3138;
  font: 600 16px var(--text-font); text-decoration: none; }
.hsp-nav a .hs-i { font-size: 22px; }
.hsp-nav a:hover { background: #F6F1E4; text-decoration: none; }
.hsp-nav a.active { background: #FFCB57; box-shadow: inset 0 0 0 2px #2B3138; font-weight: 700; }
.hsp-badge { margin-left: auto; min-width: 24px; height: 24px; border-radius: 999px; background: #E8634A; color: #fff; font: 700 13px var(--text-font);
  display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; box-shadow: inset 0 0 0 2px #2B3138; }
.hsp-badge[hidden] { display: none; }
.hsp-board { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 16px; }
.hsp-board .btn { width: 100%; justify-content: flex-start; }
.hsp-me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px 6px 0; border-top: 1.5px solid #D9D4C7; }
.hsp-board + .hsp-me { margin-top: 12px; }
.hsp-av { width: 36px; height: 36px; flex: none; border-radius: 50%; background: #5AA9E6; color: #fff; box-shadow: inset 0 0 0 2px #2B3138;
  display: flex; align-items: center; justify-content: center; font: 700 18px var(--display); }
.hsp-who { flex: 1; min-width: 0; font: 600 14px var(--text-font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hsp-foot { font: 600 12px var(--text-font); color: #8A9096; padding: 10px 6px 0; }
.hsp-main { min-width: 0; }
.hsp-top { display: flex; align-items: center; gap: 12px; padding: 18px 32px 0; }
.hsp-mark { display: none; }
.hsp .wrap { max-width: none; padding: 8px 32px 48px; }
.hsp #reqbanner, .hsp #notifybanner, .hsp #swbanner { padding: 0 32px; }
.hsp .tabbar { display: none; }

/* Grids of cards use the whole width (Settings and friends). */
/* Packed columns (masonry): tall and short cards stack without gaps; reading order runs
   down each column, so the most-used card goes first. */
/* Cards share the width in a grid: 1 card = full width, 2 = halves, 3+ = up to three
   across. (Column-balanced masonry kept stacking cards in one column.) */
.hs-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 20px; align-items: start; }
.hs-cards:has(> div:nth-of-type(3)) { grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr)); }
.hs-cards > .hs-extras { grid-column: 1 / -1; margin-top: 0; }
@media (min-width: 900px) { .hs-cards:has(> .hs-extras):not(:has(> div:nth-of-type(3))) { grid-template-columns: 1fr 1fr; } }
.hs-cards .card select, .hs-cards .card input:not([type=checkbox]):not([type=radio]) { max-width: 100%; }
.hs-cards > .card { margin: 0 !important; max-width: none !important; width: 100%; box-sizing: border-box; }
.hs-cards .card h2 { margin-top: 0; display: flex; align-items: center; gap: 10px; }
.hs-cards .card h2 .hs-i { font-size: 26px; }
.hs-cards .card.wide { grid-column: 1 / -1; }
.card.hs-wide { margin: 0 0 20px; }

/* ---- Add a screen ----------------------------------------------------------------------- */
.modal .hs-kicker { font: 700 13px var(--text-font); color: #5F666D; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 4px; }
.hs-tiles3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.hs-tile3 { border: 0; border-radius: 18px; background: #FFFDF6; color: #2B3138; padding: 16px; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 8px; box-shadow: inset 0 0 0 2px #2B3138, 0 3px 0 #2B3138; }
.hs-tile3 b { font: 600 18px/1.15 var(--display); }
.hs-tile3 > span:last-child { font: 500 14px/1.35 var(--text-font); color: #5F666D; }
.hs-tile3 .hs-sticker.sm { width: 52px; height: 52px; font-size: 28px; }
.hs-tile3.on { background: #DCEFD9; box-shadow: inset 0 0 0 3px #3D7C4A, 0 3px 0 #3D7C4A; }
.modal .chip { border: 0; cursor: pointer; padding: 8px 14px; font: 700 15px var(--text-font); background: #FFFDF6; color: #2B3138; display: inline-flex; align-items: center; gap: 8px; }
.modal .chip.on { background: #FFCB57; }
.hs-dot { width: 26px; height: 26px; border-radius: 50%; color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font: 700 14px var(--display); box-shadow: inset 0 0 0 2px #2B3138; }
.hs-code { font: 700 34px/1 ui-monospace, Consolas, monospace; letter-spacing: .12em; text-align: center; padding: 16px; margin: 14px 0; border-radius: 16px;
  background: #fff; box-shadow: inset 0 0 0 2px #2B3138; }
.hs-qrrow.sm .hs-qr { width: 220px; height: 220px; padding: 14px; border-radius: 20px; }
.hs-qrrow.sm { gap: 24px; }
.modal .hs-note, .modal .hs-msg { font-size: 15px; line-height: 1.45; }
.modal:has(.hs-qrrow), .modal:has(.hs-tiles3) { max-width: 780px; }
.modal .hs-num { font-size: 17px; gap: 12px; }
.modal .hs-num > span:first-child { width: 34px; height: 34px; font-size: 18px; }
.modal .hs-steps { gap: 12px; }
.hs-wait { display: flex; align-items: center; gap: 14px; margin-top: 18px; padding: 10px 16px; border-radius: 16px; background: #F6F1E4;
  font: 600 16px var(--text-font); }
.hs-wait.ok { background: #DCEFD9; box-shadow: inset 0 0 0 2px #3D7C4A; }
@media (max-width: 899px) { .hs-tiles3 { grid-template-columns: 1fr; } .hs-qrrow.sm { flex-direction: column; } }

/* Rarely used, technical cards live behind one closed section (Hick / Pareto). */
.hs-extras { margin-top: 12px; }
.hs-extras > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-radius: 16px;
  background: #FFFDF6; box-shadow: inset 0 0 0 1.5px #D9D4C7; font: 600 20px var(--display); }
.hs-extras > summary::-webkit-details-marker { display: none; }
.hs-extras > summary span { font: 500 14px var(--text-font); color: #5F666D; }
.hs-extras > summary b { font: inherit; }
.hs-extras > summary .hs-i { transition: transform .15s; }
.hs-extras[open] > summary .hs-i { transform: rotate(90deg); }
.hs-extras > .hs-cards { margin-top: 20px; }

/* Phones: header with the mark + pause, content, tab bar at the bottom. */
@media (max-width: 899px) {
  .hsp { display: block; }
  .hsp-side { display: none; }
  .hsp-top { padding: calc(10px + var(--sat)) 16px 0; }
  .hsp-mark { display: inline-block; }
  .hsp-top .btn { min-height: 40px; padding: 0 14px; font-size: 14px; }
  .hsp .wrap { padding: 8px 16px calc(96px + var(--sab)); }
  .hsp #reqbanner, .hsp #notifybanner, .hsp #swbanner { padding: 0 16px; }
  .hsp h1 { font-size: 30px; }
  .hsp .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: #FFFDF6; border: 0;
    box-shadow: inset 0 2px 0 #2B3138; padding: 6px 8px calc(6px + var(--sab)); gap: 4px; justify-content: space-around; }
  .hsp .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 14px;
    color: #2B3138; font: 600 12px var(--text-font); text-decoration: none; }
  .hsp .tabbar a .ico { font-size: 24px; }
  .hsp .tabbar a.active { background: #FFCB57; box-shadow: inset 0 0 0 2px #2B3138; }
  .hs-cards { grid-template-columns: 1fr; }
}

/* ---- On the Board (⚙ + PIN): same app, sized for fingers (Fitts). ---------------------- */
html.hb-board .hsp, html.hb-board .backdrop { zoom: 1.25; }
html.hb-board .modal { max-height: 72vh; }
html.hb-board .hsp-side, html.hb-board .hsp { min-height: 80vh; }
html.hb-board .hsp-side { height: 80vh; }

/* Kid page: first-then card (app.js kpFirstThen) */
.kp-ft-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kp-ft-side { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 14px; background: #F6F1E4; }
.kp-ft-side img { width: 40px; height: 40px; object-fit: contain; }
.kp-ft-arrow { font-size: 22px; font-weight: 900; color: #8f6bff; }

/* Picture picker (app.js picturePicker) */
#picpick { z-index: 80; }
.pp-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.pp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; max-height: 56vh; overflow: auto; padding: 2px; }
.pp-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border: 0; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 2px #E4DECF; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.pp-item img { width: 56px; height: 56px; object-fit: contain; }
.pp-item.on { box-shadow: inset 0 0 0 3px #2B3138; background: #FFF4D2; }

/* Settings → Special care → Two homes (app.js loadTwoHomes): the whole width, the
   schedule on the left and its month preview on the right. */
#twohomes, #sensory { grid-column: 1 / -1; }
.ss-check { display: flex; align-items: flex-start; gap: 10px; margin: 10px 0 0; font-weight: 600; }
.ss-check input { width: 20px; height: 20px; margin-top: 1px; flex: none; }
.th-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 32px; align-items: start; }
@media (max-width: 860px) { .th-edit { grid-template-columns: minmax(0, 1fr); } }
.th-home { padding: 12px 14px; border-radius: 16px; background: #F6F1E4; margin: 0 0 10px; }
.th-home-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.th-label { display: block; font-weight: 800; margin: 14px 0 6px; }
.th-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.th-chips .chip { padding: 8px 14px; font: inherit; font-weight: 700; background: #fff; cursor: pointer; }
.th-chips .chip.on { background: #FFCB57; }
.th-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; max-width: 520px; margin-top: 10px; }
.th-grid:empty { display: none; }
.th-gday { font: inherit; font-weight: 800; padding: 6px 0; border: 0; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 2px #D9D3C3; cursor: pointer; }
.th-gday small { display: block; font-size: 11px; font-weight: 600; color: #5F666D; }
.th-gday.on { background: #CFE0F7; box-shadow: inset 0 0 0 2px #3B5A99; }
.th-month-nav { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; }
.th-month-nav b { min-width: 150px; text-align: center; }
.th-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; max-width: 420px; }
.th-wd { text-align: center; font-size: 12px; font-weight: 700; color: #5F666D; }
.th-day { position: relative; font: inherit; font-weight: 700; aspect-ratio: 1; border: 0; border-radius: 10px; background: #fff; box-shadow: inset 0 0 0 1px #E4DECF; cursor: pointer; }
.th-day.away { background: #CFE0F7; color: #2B4C8C; box-shadow: inset 0 0 0 2px #3B5A99; }
.th-day.today { outline: 3px solid #FFCB57; outline-offset: 1px; }
.th-day.changed::after { content: ''; position: absolute; right: 5px; top: 5px; width: 7px; height: 7px; border-radius: 50%; background: #E0674B; }

/* TV warnings (a Roku's device window, tvWarnings). */
.tv-status { padding: 10px 12px; border-radius: 12px; background: var(--hs-soft, #f4f1ea); font-weight: 600; }
.tv-status.ok { background: #e6f5e9; }
.tv-status.warn { background: #fff1c7; }
.tv-status.bad { background: #fde3dc; }
.tv-status small { display: block; font-weight: 500; opacity: .7; margin-top: 2px; }
.tv-steps { margin: 10px 0 0 18px; padding: 0; }
.tv-steps li { margin: 4px 0; }

/* A console's Xbox section (xboxSection): how it's stopped. */
.xb-opt { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; margin: 6px 0; }
.xb-opt input { margin-top: 3px; }
