:root {
  --page: #c8dcea;
  --navy: #123a52;
  --navy-soft: #1e5570;
  --ink: #163445;
  --muted: rgba(18, 58, 82, .62);
  --white: #fff;
  --line: rgba(18, 58, 82, .12);
  --ok: #2f9e6a;
  --warn: #c9842a;
  --glass: rgba(255, 255, 255, .72);
  --shadow: 0 18px 48px rgba(120, 150, 175, .16);
  --radius: 22px;
  --font: "Montserrat", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; }
body {
  font-family: var(--font);
  font-weight: 300;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #e8f4fa, transparent 50%),
    var(--page);
}

h1, h2, h3 { font-weight: 400; letter-spacing: .04em; margin: 0 0 .4em; }
p { margin: 0 0 1em; line-height: 1.55; }
button, input, select { font: inherit; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 64px 24px 80px; }
.landing h1 { font-size: clamp(36px, 6vw, 64px); font-weight: 200; letter-spacing: .08em; text-transform: uppercase; color: #fff; }
.eyebrow { color: rgba(255,255,255,.8); letter-spacing: .22em; text-transform: uppercase; font-size: 11px; }
.lead { max-width: 720px; color: rgba(255,255,255,.88); font-size: 16px; }
.landing { background:
  linear-gradient(180deg, rgba(18,58,82,.28), transparent 42%),
  radial-gradient(900px 400px at 80% 0%, #9ec4d8, transparent 45%),
  var(--page);
}

.roles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 36px; }
.role-card, .family-card, .panel, .child-card {
  background: var(--glass);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.role-card {
  display: block;
  text-align: left;
  padding: 22px 24px;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.7);
}
.role-card:hover { transform: translateY(-2px); }
.role-card small { display: block; color: var(--muted); margin-top: 8px; }
.role-card strong { font-weight: 500; font-size: 20px; }

.families { margin-top: 36px; }
.families h2 { color: #fff; font-weight: 300; }
.muted { color: rgba(255,255,255,.8); }
.family-list { display: flex; flex-wrap: wrap; gap: 10px; }
.family-card {
  padding: 12px 16px;
  cursor: pointer;
  border: 0;
}
.family-card.is-on { outline: 2px solid var(--navy); }
.hidden { display: none !important; }

.top {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 22px;
  background: rgba(255,255,255,.55);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
  flex-wrap: wrap;
}
.logo {
  color: var(--navy);
  text-decoration: none;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.logo span { display: block; font-size: 10px; letter-spacing: .28em; font-weight: 300; opacity: .7; }
.top-meta { flex: 1; font-size: 13px; color: var(--muted); }
.tabs { display: flex; gap: 8px; }
.tabs button, .btn, .switch {
  border: 0;
  background: var(--navy);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 400;
  font-size: 13px;
}
.tabs button.is-off, .btn.ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.btn.danger { background: #c62828; color: #fff; }
.undo-btn {
  margin-left: auto;
  margin-right: 8px;
  white-space: nowrap;
  font-size: 12px;
  padding: 8px 12px;
}
.lk-toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(120%);
  background: var(--navy);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 100;
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
  pointer-events: none;
  max-width: min(92vw, 420px);
  text-align: center;
}
.lk-toast.is-on { transform: translateX(-50%) translateY(0); opacity: 1; }
.confirm-on {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 16px;
}
.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 40, 55, .45);
}
.confirm-card {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  background: #fff;
  border-radius: 18px;
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}
.confirm-card h3 { margin: 0; font-size: 17px; font-weight: 500; }
.confirm-card p { margin: 0; color: var(--ink); font-size: 14px; line-height: 1.45; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.switch { background: #fff; color: var(--navy); }

.app {
  --app-max: 1400px;
  --app-pad: 22px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 22px;
  max-width: var(--app-max);
  width: 100%;
  margin: 0 auto;
  padding: var(--app-pad);
  padding-bottom: 40px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  min-width: 0;
  overflow-x: visible;
}

/* Сброс «слипшихся» внешних margin у прямых детей — отступы даёт gap */
.app > h2,
.app > .hint,
.app > .note,
.app > .search-input,
.app > .subtabs,
.app > .list-cards,
.app > .branch-grid,
.app > .ath-list,
.app > .center-row,
.app > .btn,
.app > .add-bar,
.app > .month-grid {
  margin-top: 0;
  margin-bottom: 0;
}

.app > h2 {
  margin-top: 4px;
  margin-bottom: 0;
  font-size: 22px;
}

.app > .btn.ghost:first-child,
.app > .subtabs + .btn.ghost {
  align-self: flex-start;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}
.note {
  background: rgba(255,255,255,.5);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

label.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.grid-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
  background: rgba(255,255,255,.78);
  border-radius: 18px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 180px);
  width: calc(100vw - (100vw - min(100vw, var(--app-max))) / 2 - var(--app-pad));
  max-width: none;
  border-radius: 18px 0 0 18px;
}
table.sheet {
  border-collapse: collapse;
  min-width: 100%;
  font-size: 13px;
}
.sheet th, .sheet td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  white-space: nowrap;
  text-align: center;
}
.sheet th { background: #e7f2f7; font-weight: 500; position: sticky; top: 0; z-index: 2; }
.sheet td.sticky, .sheet th.sticky {
  position: sticky;
  left: 0;
  background: #f7fbfc;
  text-align: left;
  z-index: 1;
  min-width: 190px;
}
.sheet th.sticky { z-index: 3; left: 0; }
.sheet tr.group td {
  background: var(--navy);
  color: #fff;
  text-align: left;
  font-weight: 400;
  letter-spacing: .04em;
}
.sheet td.sched { background: rgba(47, 158, 106, .08); }
.sheet td.mark { cursor: pointer; min-width: 36px; }
.sheet td.mark.present { color: var(--ok); font-weight: 600; }
.sheet td.mark.excused { color: var(--warn); font-weight: 600; }
.sheet td.num { color: var(--muted); min-width: 36px; }
.money { font-variant-numeric: tabular-nums; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.legend b.present { color: var(--ok); }
.legend b.excused { color: var(--warn); }

input, select {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  color: var(--ink);
}

.child-grid { display: grid; gap: 16px; }
.parent-pay { max-width: 720px; margin: 20px auto 0; display: grid; gap: 12px; }
.child-card {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm, 12px);
}
.child-card > h2 { margin: 0; }
.child-card > .hint,
.child-card > p { margin: 0; }
.pay {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 0;
}
.pay div { min-width: 140px; }
.pay strong { display: block; font-size: 22px; font-weight: 500; }
.pay span { font-size: 12px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }

.form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.warn-text { color: #b42318; font-size: 13px; }

.sheet td.mark.trial { color: var(--navy); font-weight: 700; }
.name-trial { font-weight: 700 !important; }
.row-trial td { background: rgba(18, 58, 82, .04); }
.row-paid td { box-shadow: inset 3px 0 0 var(--ok); }

.cal-week { margin: 0 0 28px; }
.cal-week h3 {
  margin: 0 0 8px;
  font-size: 15px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--navy);
  font-weight: 500;
}
.cal-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-chips span {
  min-width: 36px;
  text-align: center;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.7);
  font-weight: 500;
  font-size: 13px;
}
.cal-wrap { max-height: none; }

.legend b.trial { color: var(--navy); }
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  padding: 0;
  margin: 0;
}
.check input { min-width: auto; width: auto; }

.pay-how { margin-top: 0; }
.pay-how .field { margin-top: 4px; }
.pay-how .pay-btn,
.pay-how .btn { margin-top: 4px; align-self: flex-start; }
.qr-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 160px));
  gap: 18px;
  margin: 4px 0;
}
.qr-row figure { margin: 0; text-align: center; }
.qr-row img {
  width: 100%;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line);
  display: block;
}
.qr-row figcaption { font-size: 12px; color: var(--muted); margin-top: 6px; }

.pay-btn.is-paid,
.btn.is-paid {
  background: var(--ok);
  color: #fff;
  border: 0;
}
.pay-btn { min-width: 120px; }

.gcal {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm, 12px);
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.gcal > h2,
.gcal > h3 { margin: 4px 0 0; }
.gcal > .btn { align-self: flex-start; }
.gcal > .hint { margin: 0; }
.gcal.gcal-table { max-width: 100%; }

/* Таблицы посещений: гориз. скролл + липкий 1-й столбец (ФИО) */
.att-wrap {
  display: block;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  background: rgba(255,255,255,.86);
  border-radius: 16px;
  margin: 0;
}
.att-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  font-size: 13px;
}
.att-table th, .att-table td {
  border: 1px solid var(--line);
  padding: 8px 6px;
  text-align: center;
  min-width: 40px;
  background: #fff;
}
.att-table th.sticky, .att-table td.sticky {
  position: sticky;
  left: 0;
  z-index: 3;
  text-align: left;
  min-width: 148px;
  max-width: min(220px, 42vw);
  background: #f4fafc;
  white-space: normal;
  word-break: break-word;
  box-shadow: 4px 0 8px -4px rgba(15, 40, 55, .18);
}
.att-table thead th { background: #e7f2f7; font-weight: 500; position: relative; z-index: 1; }
.att-table thead th.sticky { z-index: 5; background: #e7f2f7; }
.att-table tbody th.sticky,
.att-table tbody td.sticky { z-index: 3; background: #f4fafc; }
.att-table th small { display: block; font-size: 10px; color: var(--muted); font-weight: 400; }
.att-table th.is-on { background: var(--navy); color: #fff; }
.att-table th.is-on small { color: rgba(255,255,255,.8); }
.att-table th.is-today, .att-table td.is-now { box-shadow: inset 0 -3px 0 #d64545; }
.att-table td.is-train, .att-table th.is-train { background: rgba(47, 158, 106, .08); }
.att-table td.mark { cursor: pointer; font-weight: 600; }
.att-table td.mark.present { color: var(--ok); }
.att-table td.mark.trial { color: var(--navy); }
.att-table td.mark.excused { color: var(--warn); }
.att-table .year-cell { min-width: 48px; font-weight: 500; }
.att-table .year-cell.has-marks { color: var(--navy); cursor: pointer; }
.att-table .year-cell.is-out { color: var(--muted); }
.att-table th[data-pick-month] { cursor: pointer; }
.att-table .icon-del { padding: 0 4px; }
.att-table .name-row { display: inline; }
.att-table .name-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}
.btn-enroll {
  border: 0;
  background: var(--navy);
  color: #fff;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 11px;
  letter-spacing: .02em;
  cursor: pointer;
  white-space: nowrap;
}
.gcal-bar { display: flex; gap: 8px; align-items: center; margin: 0; }
.gcal-modes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  flex: 1;
  background: rgba(255,255,255,.7);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.gcal-modes button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 8px 4px;
  font-size: 12px;
  color: var(--navy);
  cursor: pointer;
}
.gcal-modes button.is-on { background: var(--navy); color: #fff; }
.today-btn { white-space: nowrap; padding: 8px 12px; }
.gcal-title {
  font-size: 22px;
  font-weight: 400;
  letter-spacing: .04em;
  margin: 2px 0 4px;
}

.group-pick {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--ink);
  cursor: pointer;
  margin: 0;
}
.group-pick span { display: block; white-space: normal; word-break: break-word; font-size: 14px; }

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin: 0;
}
.week-day, .m-cell {
  border: 0;
  background: rgba(255,255,255,.72);
  border-radius: 12px;
  padding: 8px 0 6px;
  cursor: pointer;
  color: var(--ink);
  min-width: 0;
}
.week-day small { display: block; font-size: 10px; color: var(--muted); }
.week-day strong { display: block; font-size: 16px; font-weight: 500; }
.week-day.is-on, .m-cell.is-on { background: var(--navy); color: #fff; }
.week-day.is-on small { color: rgba(255,255,255,.8); }
.week-day.is-today strong, .m-cell.is-today span:first-child {
  width: 26px;
  height: 26px;
  margin: 0 auto;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #d64545;
  color: #fff;
}
.week-day.is-out, .m-cell.is-out { opacity: .28; pointer-events: none; background: transparent; }
.m-cell.is-train { box-shadow: inset 0 0 0 1px rgba(47, 158, 106, .35); }

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.dow { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0; }
.m-cell { min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.mini-dots { display: flex; gap: 3px; height: 8px; justify-content: center; margin-top: 2px; }
.mini-dots i { width: 5px; height: 5px; border-radius: 50%; display: block; }
.d-present { background: var(--ok); }
.d-trial { background: var(--navy); }
.d-excused { background: var(--warn); }

.year-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.y-month {
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.75);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
}
.y-month.is-on { outline: 2px solid var(--navy); }
.y-month span { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.y-month:disabled { opacity: .5; cursor: default; }

.day-agenda h2 { font-size: 18px; margin: 8px 0 10px; }
.hint { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.45; }

.add-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0;
  padding: 12px 14px;
  background: rgba(255,255,255,.55);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.add-bar input,
.add-bar select { flex: 1; min-width: 140px; }
.add-bar .check { padding: 0; }
.add-bar .btn { flex-shrink: 0; }
.add-bar.stack-form {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 16px;
}
.add-bar.stack-form .hint {
  margin: 0;
  font-weight: 500;
  color: var(--navy);
}
.add-bar.stack-form .btn {
  align-self: flex-start;
  margin-top: 4px;
}

.person-list { display: flex; flex-direction: column; gap: 8px; }
.person {
  display: flex;
  align-items: stretch;
  background: rgba(255,255,255,.82);
  border-radius: 14px;
  overflow: hidden;
}
.person-main {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.person-name { font-size: 15px; word-break: break-word; }
.person-mark {
  flex-shrink: 0;
  min-width: 44px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
}
.person-mark.present { color: var(--ok); }
.person-mark.trial { color: var(--navy); }
.person-mark.excused { color: var(--warn); }
.icon-del {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  font-size: 22px;
  cursor: pointer;
}

.bill-cards { display: grid; gap: 10px; }
.bill-card {
  background: rgba(255,255,255,.82);
  border-radius: 16px;
  padding: 14px 16px;
}
.bill-card h3 { font-size: 16px; margin: 0 0 6px; }
.bill-card .money { font-size: 22px; font-weight: 500; margin: 6px 0 10px; }
.is-paid-row { box-shadow: inset 4px 0 0 var(--ok); }

#overlay { display: none; }
#overlay.overlay-on {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(18, 58, 82, .35);
  z-index: 20;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  width: min(520px, 100%);
  max-height: 85vh;
  overflow: auto;
  background: #fff;
  border-radius: 22px 22px 0 0;
  padding: 20px 18px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sheet > p,
.sheet > .hint { margin: 0; }
.sheet-kicker { font-weight: 500; margin: 0; }
.sheet-search { margin: 0; }
.sheet-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  overflow: auto;
  margin: 0;
}
.sheet-item {
  text-align: left;
  border: 1px solid var(--line);
  background: #f7fbfc;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  white-space: normal;
  word-break: break-word;
  margin: 0;
}
.sheet-item.is-on {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.sheet-item.is-on .sheet-item-branch {
  color: rgba(255,255,255,.75);
}
.sheet-item-branch {
  display: block;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 500;
}
.sheet-item-title { display: block; }
.sheet-item.is-static { cursor: default; }
.sheet-item.contact-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.sheet-item.contact-card strong { font-weight: 500; }
.sheet-item.contact-card span { font-size: 13px; color: var(--muted); }
.sheet-section {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .04em;
}
.sheet-back {
  align-self: flex-start;
  border: 0;
  background: transparent;
  color: var(--navy);
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
}
.cred-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 14px;
  background: #f4fafc;
  border-radius: 12px;
}
.cred-block span {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 4px;
}
.cred-block b { font-weight: 500; word-break: break-all; }
.warn-btn { color: #b42318 !important; border-color: rgba(180, 35, 24, .3) !important; }
.sheet-cancel { width: 100%; margin: 0; }
.sheet form,
.sheet #fam-edit {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
}
.sheet .btn { margin: 0; }
.sheet select { margin: 0; }

@media (max-width: 800px) {
  .roles { grid-template-columns: 1fr; }
  .top {
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
  }
  .top-meta { flex: 1 1 auto; font-size: 12px; min-width: 0; }
  .tabs { width: 100%; order: 5; display: flex; }
  .tabs button { flex: 1; }
  .switch { font-size: 12px; padding: 6px 10px; }
  .app { --app-pad: 12px; padding: var(--app-pad); }
  .qr-row { grid-template-columns: 1fr 1fr; }
  .gcal-modes button { font-size: 11px; padding: 8px 2px; }
  .today-btn { font-size: 12px; }
}

@media (min-width: 801px) {
  #overlay.overlay-on { align-items: center; }
  .sheet { border-radius: 22px; }
}

.login-box {
  max-width: 420px;
  display: grid;
  gap: 12px;
  margin-top: 28px;
  background: var(--glass);
  padding: 22px;
  border-radius: var(--radius);
}
.landing-wrap { max-width: 720px; }

.top-slim {
  flex-wrap: nowrap;
  gap: 10px;
  padding: 8px max(12px, calc((100vw - 1400px) / 2 + 12px));
}
.logo-mark { font-size: 18px; letter-spacing: .14em; }
.icon-btn {
  border: 0;
  background: #fff;
  color: var(--navy);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.top-slim .tabs { flex: 1; }

.branch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.branch-card {
  text-align: left;
  border: 1px solid rgba(255,255,255,.7);
  background: var(--glass);
  border-radius: var(--radius);
  padding: 22px 20px;
  cursor: pointer;
  color: inherit;
  box-shadow: var(--shadow);
}
.branch-card strong {
  display: block;
  font-size: 18px;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 500;
}
.branch-card small { display: block; margin-top: 8px; color: var(--muted); }
.center-row { display: flex; justify-content: center; margin: 8px 0 0; }
.backup-card { margin-top: 18px; }
.backup-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.backup-actions .file-btn { margin-top: 0; cursor: pointer; }
.family-help {
  margin: 0;
  padding: 10px 12px;
  background: #f4fafc;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.family-help summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--navy);
}
.family-help-list {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--muted);
  display: grid;
  gap: 6px;
}
.family-help-list b { color: var(--ink); font-weight: 500; }
.trainer-list-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.trainer-list-card strong { font-weight: 500; }
.search-input { width: 100%; margin: 0; }
.ath-list { display: grid; gap: 12px; margin: 0; }
.ath-card {
  background: rgba(255,255,255,.86);
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ath-card > strong { margin: 0; }
.ath-card > .hint { margin: 0; }
.ath-card.is-trial-card { outline: 2px solid var(--navy); }
.ath-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0; }
.ath-meta,
.ath-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  align-items: center;
}
.ath-card .add-bar {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.ath-card .add-bar .field { flex: 1; min-width: 120px; }
.ath-card .add-bar .price-hint {
  flex: 1 1 100%;
  margin: 0;
}
.price-groups {
  display: grid;
  gap: 12px;
  margin-top: 4px;
}
.price-group {
  background: #f7fbfc;
}
.price-branch .sheet-section { margin-top: 8px; }
.discount-field {
  margin: 0;
  max-width: 280px;
}
.discount-field select {
  margin-top: 4px;
}
.period-banner {
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #eef6f8, #f7fbfc);
  border: 1px solid rgba(20, 60, 80, .08);
}
.period-banner-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.period-banner-meta {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.period-banner.period-closed {
  background: linear-gradient(135deg, #f3f4f2, #eef1ea);
}
.period-banner.period-closed .period-banner-title::after {
  content: "";
}
.period-banner.period-current {
  background: linear-gradient(135deg, #e8f5ef, #f4fbf8);
}
.card-period-tag {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.parent-child-card .child-open-btn {
  margin-top: 8px;
  align-self: flex-start;
}
.period-tabs { flex-wrap: wrap; }
.group-lines {
  display: grid;
  gap: 8px;
  margin: 4px 0 0;
  text-align: left;
}
.group-line {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  background: #f4fafc;
  border-radius: 10px;
}
.group-line-main { font-size: 13px; font-weight: 500; }
.group-line-meta { font-size: 12px; color: var(--muted); }
.group-sum-grid {
  display: grid;
  gap: 10px;
}
.group-sum-card {
  background: rgba(255,255,255,.86);
  border-radius: 14px;
  padding: 14px 16px;
}
.group-sum-card > p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.parent-child {
  width: 100%;
  min-width: 0;
  max-width: none;
}
.parent-child > .child-card { margin: 0; }
.parent-child > .note { margin: 0; }
.trial-tag {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  margin-left: 6px;
}
.trial-check {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff3cd;
  border: 1px solid #e6d089;
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 500;
}
.big-mark { font-size: 18px; font-weight: 700; line-height: 1; }
.att-table td.mark.trial0, .person-mark.trial0 { color: #c62828; }
.att-table td.mark.trial500, .person-mark.trial500 { color: var(--navy); }
.att-table td.mark.sick, .person-mark.sick, .big-mark.sick { color: var(--warn); }
.m-cell.is-sick { background: #fff4d6; }
.formula {
  background: #f4fafc;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13px;
  margin: 0;
}
.formula h3 { font-size: 14px; margin: 14px 0 8px; font-weight: 500; }
.formula h3:first-child { margin-top: 0; }
.formula-steps { margin: 0; padding-left: 18px; }
.formula-steps li { margin: 6px 0; }
.formula-child { margin: 10px 0 0; background: #fff; border-radius: 10px; padding: 10px 12px; }
.formula-child summary { cursor: pointer; }
.formula-child ul { margin: 8px 0 0; padding-left: 18px; }
.f-adv { color: var(--navy); }
.f-visit { color: var(--ink); }
.tap-card { cursor: pointer; text-align: left; width: 100%; border: 0; }
.subtabs {
  display: flex;
  gap: 8px;
  margin: 0;
  flex-wrap: wrap;
}
.subtabs + .subtabs { margin-top: -4px; }
.subtabs button {
  border: 0;
  background: var(--navy);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.subtabs button.is-off { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.pay-row {
  background: rgba(255,255,255,.86);
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pay-row.status-red { background: #fde8e8; }
.pay-row.status-yellow { background: #fff6d9; }
.pay-row.status-green { background: #e7f6ee; }
.pay-row.status-green.is-white { background: #fff; }
.pay-row-main { display: flex; justify-content: space-between; align-items: center; margin: 0; }
.ball { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.ball-red { background: #c62828; }
.ball-yellow { background: #e0a100; }
.ball-green { background: var(--ok); }
.cred { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 13px; }
.pay-nums { display: flex; flex-wrap: wrap; gap: 16px; margin: 0; }
.pay-nums span { display: block; font-size: 11px; text-transform: uppercase; color: var(--muted); }
.pay-row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.pay-row .formula { margin-top: 4px; }
.opening-edit {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  background: rgba(255,255,255,.55);
  border-radius: 12px;
}
.opening-edit-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.opening-hint { margin: 0; font-size: 12px; }
.multi {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  margin: 0;
  padding: 10px 12px;
  background: #f7fbfc;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.multi-pick {
  max-height: 360px;
  padding: 8px;
  background: transparent;
  border: none;
}
.day-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  background: #f7fbfc;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.stack-form { flex-direction: column; align-items: stretch; }
.parent-shell {
  display: flex;
  flex-direction: column;
  gap: var(--space-md, 16px);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.parent-shell > .parent-child {
  margin: 0;
  min-width: 0;
  max-width: 100%;
}
.parent-child-card.is-open-child {
  outline: 2px solid var(--navy);
}
.parent-home {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}
.file-btn { margin-top: 8px; display: inline-block; }
.muted-inline { font-size: 12px; color: var(--muted); }

.branch-grid { margin: 0; }
.app > .child-card { margin: 0; }

@media (max-width: 800px) {
  .top-slim .tabs { width: auto; order: 0; overflow: auto; }
  .att-table td.mark { font-size: 16px; min-width: 36px; }
}

/* DEV-only: расчёты (убрать перед продом или DEV_CALC=0) */
.dev-calc-fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 80;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(15, 40, 70, 0.28);
  cursor: pointer;
}
.dev-calc-fab:hover { filter: brightness(1.06); }
.dev-calc-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #f2f6f9;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dev-calc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  background: #fff;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.dev-calc-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.dev-calc-head .badge-dev {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8a5a00;
  background: #fff3cd;
  border-radius: 6px;
  padding: 2px 8px;
  margin-left: 8px;
  font-weight: 500;
}
.dev-calc-body {
  flex: 1;
  overflow: auto;
  padding: 16px max(16px, env(safe-area-inset-right)) 32px max(16px, env(safe-area-inset-left));
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}
.dev-calc-ref {
  background: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.45;
}
.dev-calc-ref code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  background: #eef3f7;
  padding: 1px 5px;
  border-radius: 4px;
}
.dev-calc-ref ul { margin: 8px 0 0; padding-left: 18px; }
.dev-calc-packs {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
}
.dev-calc-pack {
  background: #f7fafc;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}
.dev-calc-family {
  margin-top: 12px;
}
.dev-calc-family summary {
  cursor: pointer;
  font-weight: 500;
  padding: 10px 0;
}

