/* @tag:parent-console */
:root {
  --bg: #f3f4f7;
  --card: #ffffff;
  --text: #151924;
  --muted: #5e6475;
  --line: #dde0e7;
  --accent: #2c5bd8;
  --accent-text: #ffffff;
  --warn: #c9820a;
  --warn-bg: #fbf1de;
  --chip: #eceef3;
  --ok: #1e8a5a;
  --closed: #6b5bd2;
  --deny: #c2412d;
  --switch-off: #b9bdc8;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218;
    --card: #181c25;
    --text: #e8eaf0;
    --muted: #9aa1b2;
    --line: #2a303c;
    --accent: #7c98ff;
    --accent-text: #0f1218;
    --warn: #e7a93a;
    --warn-bg: #2e2514;
    --chip: #232835;
    --ok: #47c28a;
    --closed: #9c8ff0;
    --deny: #ee7a64;
    --switch-off: #4a5162;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); }
h1 { font-size: 1.25rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0; }
h3 { font-size: .95rem; margin: 1rem 0 .25rem; }
.page { max-width: 40rem; margin: 0 auto; padding: 12px 16px calc(84px + env(safe-area-inset-bottom)); }
.top {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.top .who { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.account { overflow-wrap: anywhere; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 0 0 10px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--chip); border-radius: 999px; padding: 2px 10px; font-size: .85rem; }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.remaining { font-weight: 600; white-space: nowrap; }
button {
  font: inherit; color: var(--text); background: var(--chip); border: 1px solid var(--line);
  border-radius: 10px; min-height: 44px; min-width: 44px; padding: 6px 14px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  touch-action: manipulation;
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.wide { width: 100%; margin-bottom: 10px; }
button.link { background: none; border: none; color: var(--accent); padding: 4px 6px; min-height: 32px; min-width: 0; }
button.link.small { font-size: .85rem; }
button:disabled { opacity: .55; cursor: default; }
button.pressed, .check.pressed { opacity: .7; }
button[aria-pressed="true"], [role="tab"][aria-selected="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.grants button { min-width: 64px; font-weight: 600; }
.day { min-width: 44px; padding: 6px 8px; }
.segmented { display: flex; gap: 4px; overflow-x: auto; }
progress { width: 100%; height: 8px; margin: 8px 0 2px; accent-color: var(--accent); }
.checks { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0; }
.check { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.switch { display: flex; align-items: center; gap: 12px; margin: 0; min-height: 48px; cursor: pointer; }
.chips .switch { display: inline-flex; }
.switch input {
  appearance: none; flex: none; width: 52px; height: 32px; border-radius: 999px; margin: 0; padding: 0; cursor: pointer;
  background: var(--switch-off); border: none; position: relative; transition: background .15s;
}
.switch input::after {
  content: ''; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .35); transition: transform .15s;
}
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(20px); }
.switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled { cursor: default; }
.switch.pressed { opacity: .7; }
@media (prefers-reduced-motion: reduce) { .switch input, .switch input::after { transition: none; } }
label { display: block; margin: 8px 0; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0; flex-wrap: wrap; }
input, textarea, select {
  font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px;
}
label > input:not([type=checkbox]), label > textarea, label > select { display: block; width: 100%; margin-top: 4px; }
label.inline > input { display: inline-block; width: 6rem; margin: 0; }
textarea { font-family: ui-monospace, Menlo, monospace; font-size: .9rem; }
code { font-size: .85em; background: var(--chip); padding: 0 4px; border-radius: 4px; }
.error { color: var(--warn); background: var(--warn-bg); border-radius: 10px; padding: 8px 10px; margin: 8px 0; }
.banner { background: var(--warn-bg); color: var(--warn); padding: 8px 16px; font-size: .9rem; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 4px 10px 4px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.apps { padding-left: 18px; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; overflow-wrap: anywhere; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 3;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a { flex: 1; text-align: center; padding: 12px 2px; text-decoration: none; color: var(--muted); font-size: .85rem; }
.tabs a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(62px + env(safe-area-inset-bottom)); z-index: 4;
  max-width: 38rem; margin: 0 auto; display: flex; align-items: center; gap: 6px;
  background: var(--text); color: var(--bg); border-radius: 12px; padding: 8px 8px 8px 14px;
}
.toast.error { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn); }
.toast .muted { color: inherit; opacity: .8; font-size: .85rem; }
.toast-text { flex: 1; }
.toast button.link { color: inherit; font-weight: 600; }
.spinner {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.signin { max-width: 26rem; }
.signin h1 { margin: 24px 0 12px; }
.google { margin: 16px 0; min-height: 44px; }
.device-code { font-size: 1.6rem; font-weight: 700; line-height: 1.3; letter-spacing: .02em; text-align: center; margin: 12px 0; overflow-wrap: anywhere; user-select: all; }
.device-qr { width: min(240px, 70vw); margin: 12px auto 0; }
.device-qr svg { display: block; width: 100%; height: auto; }
.steps { padding-left: 20px; margin: 8px 0; }
.steps li { margin: 4px 0; }
ul.plain { list-style: none; padding: 0; margin: 6px 0 10px; }

/* @tag:child-request @tag:parent-code — шапка нового интерфейса: ребёнок, код родителя, колокольчик */
.top { justify-content: flex-start; }
.top .who { flex: 1; }
.code { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.code small { display: block; font-size: .7rem; color: var(--muted); line-height: 1; }
.code .digits { font-weight: 700; font-size: 1.6rem; letter-spacing: .06em; }
.code-menu { position: relative; }
.code-popup { position: absolute; right: 0; top: 48px; width: min(16rem, 80vw); z-index: 5; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.code-popup p { margin: 6px 0 0; }
.scrim.clear { background: transparent; }
.ring { width: 28px; height: 28px; }
.ring circle { fill: none; stroke-width: 3; }
.ring .track { stroke: var(--line); }
.ring .arc { stroke: var(--accent); stroke-linecap: round; }
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; border-radius: 12px; color: var(--text); }
.bell.open { background: var(--chip); }
.bell svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.bell .count { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--deny); color: #fff; font-size: .72rem; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; min-width: 36px; min-height: 44px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; color: var(--muted); }
.menu summary::-webkit-details-marker { display: none; }
.menu .card { position: absolute; right: 0; top: 44px; width: min(18rem, 80vw); z-index: 3; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.hero { margin: 4px 2px 12px; }
.hero .big { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.mode b { font-weight: 600; }
.mode.closed { border-color: var(--closed); }
.mode.closed b { color: var(--closed); }
button.closer { color: var(--closed); border-color: var(--closed); }
h2.section { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 14px 2px 8px; }
.request h3 { margin: 0; font-size: 1.05rem; }
.quote { margin: 8px 0; padding: 8px 10px; background: var(--chip); border-radius: 10px; font-style: italic; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 8px 0; font-size: .9rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.scope { margin: 8px 0; }
.durations { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: 6px; margin: 6px 0 10px; }
.durations button { flex-direction: column; gap: 0; }
.durations small { color: var(--muted); font-size: .75rem; }
button.deny { color: var(--deny); background: none; }
.past li { padding: 4px 0; }
.durations b { white-space: nowrap; }

/* @tag:app-usage @tag:new-app @tag:device-state — «Сегодня», приложения, карточка, планшеты, панель просьб */
.hero .big small { font-size: .9rem; font-weight: 400; margin-left: 6px; }
.app-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin: 0 0 6px; color: var(--text); text-decoration: none; }
.app-row .grow, .device-line .grow { flex: 1; min-width: 0; }
.switch .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-row .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-row .value { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.app-row.new { border-color: var(--accent); align-items: flex-start; }
.app-icon { flex: none; width: 32px; height: 32px; border-radius: 9px; background: var(--chip); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; vertical-align: middle; }
img.app-icon { object-fit: cover; background: none; }
.bar { height: 6px; border-radius: 3px; background: var(--chip); margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.tag { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; padding: 1px 6px; border-radius: 6px; background: var(--accent); color: var(--accent-text); vertical-align: middle; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 140px; margin-top: 12px; }
.day-bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.day-bar i { display: block; width: 70%; min-height: 2px; background: var(--accent); border-radius: 4px 4px 0 0; }
.device-line { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.dot.on { background: var(--ok); }
ul.plain.card { padding: 6px 12px; }
.site-add { display: flex; gap: 6px; flex-wrap: wrap; }
.site-add input { flex: 1 1 12rem; min-height: 44px; }
.segmented button { flex: 1; }
.scrim { position: fixed; inset: 0; background: rgba(10, 12, 20, .35); z-index: 4; }
.panel { position: fixed; z-index: 5; background: var(--bg); overflow-y: auto; padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  inset: 0; padding-top: calc(12px + env(safe-area-inset-top)); }
@media (min-width: 900px) {
  .page { max-width: 72rem; padding-left: calc(12rem + 24px); padding-right: 24px; padding-bottom: 24px; }
  .columns { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 24px; align-items: start; }
  .tabs { top: 64px; bottom: 0; left: 0; right: auto; width: 12rem; flex-direction: column; justify-content: flex-start; border-top: none; border-right: 1px solid var(--line); padding: 12px 8px; }
  .tabs a { flex: none; text-align: left; padding: 10px 12px; border-radius: 10px; font-size: .95rem; }
  .tabs a[aria-current="page"] { background: var(--chip); }
  .panel { inset: 0 0 0 auto; width: min(28rem, 100vw); box-shadow: -8px 0 32px rgba(0, 0, 0, .2); }
}

/* @tag:category-limits @tag:ban-schedule — лимит на строке категории, «Режимы» и шкала недели */
.limit-line { margin-top: 8px; }
.limit-line .chips button { min-height: 36px; padding: 4px 10px; }
.big-time { font-size: 1.3rem; font-weight: 700; margin: 6px 0; font-variant-numeric: tabular-nums; }
.days button.day { min-width: 40px; min-height: 36px; padding: 4px 6px; }
.schedule h2 .muted { font-weight: 400; margin-left: 6px; }
details.others { margin: 12px 0; }
details.others > summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; gap: 8px; list-style: none; color: var(--accent); }
details.others > summary::-webkit-details-marker { display: none; }
details.others > summary::before { content: '▸'; }
details.others[open] > summary::before { content: '▾'; }
.warn-card { border-color: var(--warn); }
.warn-card ul { margin: 6px 0 0; padding-left: 18px; }
.week-scale { display: none; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; margin: 0 4px 0 10px; }
.swatch.sleep, .scale-track i.sleep { background: var(--closed); }
.swatch.study, .scale-track i.study { background: var(--accent); }
.scale-hours { position: relative; height: 18px; margin: 8px 0 2px 32px; font-size: .75rem; color: var(--muted); }
.scale-hours span { position: absolute; transform: translateX(-50%); }
.scale-row { display: grid; grid-template-columns: 32px 1fr; align-items: center; margin: 3px 0; }
.scale-track { position: relative; height: 16px; background: var(--chip); border-radius: 4px; }
.scale-track i { position: absolute; top: 0; bottom: 0; opacity: .85; }
.scale-track .now { position: absolute; top: -5px; bottom: -5px; width: 3px; margin-left: -1px; background: var(--deny); border-radius: 2px; z-index: 1; }
@media (min-width: 900px) {
  .week-scale { display: block; }
}
.menu .card button { display: block; width: 100%; text-align: left; min-height: 44px; }
.search { width: 100%; box-sizing: border-box; margin: 0 0 12px; }

/* @tag:category-tree — главный экран: вкладки «Приложения · Категории», строки с меню ⋮, дерево категорий */
.hero.row { align-items: flex-end; flex-wrap: nowrap; }
.hero button.link.on { font-weight: 600; }
.view-tabs { display: flex; border-bottom: 1px solid var(--line); margin: 6px 0 10px; }
.view-tabs button { flex: 1; background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); font-weight: 500; margin-bottom: -1px; }
.view-tabs button[aria-selected="true"] { background: none; color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.view-tabs.small button { min-height: 36px; font-size: .85rem; padding: 4px 8px; }
.filter { margin: 0 0 8px; }
.chip.on { background: color-mix(in srgb, var(--accent) 14%, var(--card)); color: var(--accent); }
.chip.on button.link { min-height: 24px; padding: 0 2px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 0 0 10px; }
.line { display: flex; align-items: center; border-top: 1px solid var(--line); }
.list > .line:first-child { border-top: none; }
.line-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 4px 8px 12px; color: var(--text); text-decoration: none;
  background: none; border: none; border-radius: 0; min-height: 52px; text-align: left; justify-content: flex-start; font: inherit; }
.line-main .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.line-main .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-main .value { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.line-main .value small { display: block; font-weight: 400; font-size: .75rem; }
.line.chosen { background: color-mix(in srgb, var(--accent) 10%, var(--card)); }
button.line-main[aria-pressed="true"] { background: none; color: var(--text); }
.line .bar { display: block; height: 5px; margin-top: 5px; }
.bar.ok i { background: var(--ok); } .bar.warn i { background: var(--warn); } .bar.closed i { background: var(--closed); }
.state.ok { color: var(--muted); } .state.warn { color: var(--warn); } .state.closed { color: var(--closed); }
button.foot { width: 100%; justify-content: space-between; background: none; border: none; border-top: 1px solid var(--line); border-radius: 0; color: var(--accent); font-size: .9rem; }
button.foot span { color: var(--muted); }
.row-menu { flex: none; }
button.more { background: none; border: none; color: var(--muted); font-size: 1.3rem; min-width: 40px; padding: 0; }
button.more.on { color: var(--accent); }
.menu-scrim { z-index: 6; }
.menu-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; background: var(--card); border-radius: 18px 18px 0 0;
  padding: 10px 0 calc(14px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 32px rgba(0,0,0,.25); max-height: 80vh; overflow-y: auto; }
.menu-head { padding: 4px 18px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-sheet .item { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 18px; min-height: 48px;
  background: none; border: none; border-radius: 0; color: var(--text); text-decoration: none; text-align: left; font: inherit; }
.menu-sheet .item.closer { color: var(--closed); }
.menu-sheet .item-label { padding: 8px 18px 0; font-size: .85rem; color: var(--muted); }
.menu-sheet .chips { padding: 0 18px 8px; }
@media (min-width: 900px) {
  .row-menu { position: relative; }
  .menu-scrim { background: transparent; }
  .menu-sheet { position: absolute; left: auto; right: 4px; bottom: auto; top: 40px; width: 18rem; border-radius: 12px; border: 1px solid var(--line); padding: 6px 0; box-shadow: 0 10px 28px rgba(0,0,0,.2); }
  .line:hover { background: color-mix(in srgb, var(--text) 3%, var(--card)); }
}
/* дерево: заголовки категорий с линиями к потомкам; приложения открытой категории — на своей подложке */
.tree .line.category { position: relative; }
.tree .line.category .line-main { padding-left: calc(8px + var(--depth) * 26px); }
.tree .line.category .name { font-weight: 600; }
.tree .chev { flex: none; width: 18px; color: var(--muted); font-size: 1.2rem; line-height: 1; transition: transform .12s; }
.tree .line.open .chev { transform: rotate(90deg); color: var(--accent); }
.tree .line.open { background: color-mix(in srgb, var(--accent) 9%, var(--card)); }
.tree .line.branch::before { content: ''; position: absolute; left: calc(var(--depth) * 26px - 9px); top: 0; height: 50%; width: 12px;
  border-left: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); border-bottom-left-radius: 5px; opacity: .55; }
.tree .line.branch:not(.last)::after { content: ''; position: absolute; left: calc(var(--depth) * 26px - 9px); top: 50%; bottom: 0; border-left: 1.5px solid var(--muted); opacity: .55; }
.tree .line.branch { border-top-color: transparent; }
.category-apps { background: var(--bg); margin: 0 10px 10px; border: 1px solid var(--line); border-radius: 10px; padding: 0 0 4px; }
.category-apps .view-tabs { margin: 0 0 4px; background: var(--card); border-radius: 10px 10px 0 0; }
.category-apps .line { border-top-color: var(--line); background: none; }
.category-apps .limit-line, .category-apps > p { padding: 0 12px; }
.category-apps .line-main { min-height: 44px; }
.category-apps .app-icon { width: 26px; height: 26px; font-size: .8rem; }
.plain li > .app-icon, .request h3 > .app-icon { width: 24px; height: 24px; font-size: .75rem; margin-right: 6px; }

/* @tag:adult-role — a member only looks: no action buttons, no forms, switches show state only */
body.read-only .act:not(.own), body.read-only main form:not(.own), body.read-only .panel form { display: none; }
body.read-only .switch, body.read-only .check { pointer-events: none; }
body.read-only .switch input, body.read-only .check input { opacity: .6; }
fieldset.roles { border: none; padding: 0; margin: 8px 0; display: grid; gap: 2px; }
button.danger { background: var(--danger, #c62828); border-color: var(--danger, #c62828); color: #fff; }

/* @tag:family-join-link */
.confirm-by-code { margin: 8px 0; }
.confirm-by-code .help { width: 22px; height: 22px; min-height: 0; padding: 0; border-radius: 50%; border: 1px solid var(--muted); background: none; color: var(--text); font-size: 13px; line-height: 1; cursor: pointer; }
.confirm-by-code p { margin: 4px 0 0 26px; }
.confirm-code { margin-top: 6px; align-items: flex-end; }
.confirm-code input { width: 6em; letter-spacing: 0.2em; }
.big-code { font-size: 40px; font-weight: 700; letter-spacing: 0.3em; margin: 8px 0; }
