/* Material Design 3, зелёная схема. Иконки встроены в HTML, внешних шрифтов нет. */
:root {
  --primary: #006c4c; --on-primary: #fff;
  --primary-container: #89f8c7; --on-primary-container: #002114;
  --secondary-container: #cde9d8; --on-secondary-container: #082015;
  --bg: #eef3ec; --card: #fff; --surface-container: #e6ede4; --surface-low: #f2f7f0;
  --on-surface: #191c1a; --on-variant: #404943;
  --outline: #707973; --outline-variant: #c0c9c2;
  --error: #ba1a1a; --success: #0b7a3e; --scrim: rgba(0, 0, 0, .4);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 3px 1px rgba(0, 0, 0, .15);
  --shadow-3: 0 1px 3px rgba(0, 0, 0, .3), 0 4px 8px 3px rgba(0, 0, 0, .15);
  --ease: cubic-bezier(.2, 0, 0, 1);
  --t0: #a8672f; --t1: #7d8890; --t2: #c4900f; --t3: #2f6d8c;
  --ink-rgb: 25, 28, 26; --track: #dbe4dc; --switch-track: #e0e4de; --info: #1565c0;
  --snack-bg: #2e312f; --snack-fg: #f0f1ed;
  --font: Roboto, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--on-surface); font: 400 16px/24px var(--font); letter-spacing: .15px; }
a { color: var(--primary); }
h1 { margin: 0 0 16px; font: 400 24px/32px var(--font); letter-spacing: 0; overflow-wrap: anywhere; }
h2 { margin: 0 0 12px; font: 400 22px/28px var(--font); letter-spacing: 0; }
h3 { margin: 16px 0 4px; font: 500 14px/20px var(--font); color: var(--on-variant); letter-spacing: .1px; }
p { margin: 0 0 12px; }
small, .muted { color: var(--on-variant); }
.icon { width: 24px; height: 24px; fill: currentColor; flex: none; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

/* ---------- верхняя панель и меню ---------- */
.appbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  min-height: 64px; padding: 0 16px; background: var(--surface-container);
}
.brand { font: 400 22px/28px var(--font); letter-spacing: 0; color: var(--on-surface); text-decoration: none; }
#menu-btn { display: none; margin-left: -8px; }
.iconbtn {
  position: relative; overflow: hidden; display: inline-grid; place-items: center; width: 48px; height: 48px;
  border: 0; border-radius: 50%; background: none; color: var(--on-variant); cursor: pointer;
}
.iconbtn:hover { background: rgba(var(--ink-rgb), .08); }
/* меню лежит вне шапки, чтобы не попадать в её слой и не оказываться под затемнением */
nav { position: fixed; top: 0; right: 16px; z-index: 21; height: 64px; display: flex; align-items: center; gap: 4px; }
nav form { margin: 0; }
.nav-head, .nav-divider { display: none; }
.nav-icon { display: none; }
.navlink {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 12px; height: 40px; padding: 0 16px;
  border: 0; border-radius: 20px; background: none; color: var(--on-variant); text-decoration: none; cursor: pointer;
  font: 500 14px/20px var(--font); letter-spacing: .1px;
}
.navlink:hover { background: rgba(var(--ink-rgb), .08); }
.navlink[aria-current="page"] { background: var(--secondary-container); color: var(--on-secondary-container); }
.navlink.admin { color: var(--primary); }
.scrim { position: fixed; inset: 0; z-index: 29; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); }
.scrim.show { opacity: 1; pointer-events: auto; }

main { max-width: 1120px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 32px) 96px; }

/* ---------- кнопки (state layer + ripple) ---------- */
.btn {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 24px; border: 0; border-radius: 20px; cursor: pointer; text-decoration: none;
  background: var(--primary); color: var(--on-primary); font: 500 14px/20px var(--font); letter-spacing: .1px;
  transition: box-shadow .2s var(--ease);
}
.btn::after { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity .15s; pointer-events: none; }
.btn:hover { box-shadow: var(--shadow-1); }
.btn:hover::after { opacity: .08; }
.btn:active::after { opacity: .12; }
.btn.lg { height: 48px; border-radius: 24px; font-size: 15px; }
.btn.block { display: flex; width: 100%; }
.btn.tonal { background: var(--secondary-container); color: var(--on-secondary-container); }
.btn.outlined { background: transparent; color: var(--primary); box-shadow: inset 0 0 0 1px var(--outline); }
.btn.text { background: transparent; color: var(--primary); padding: 0 12px; }
.btn.outlined:hover, .btn.text:hover { box-shadow: inset 0 0 0 1px var(--outline); }
.btn.text:hover { box-shadow: none; }
.btn:disabled { opacity: .38; cursor: default; box-shadow: none; }
.ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .16; transform: scale(0); animation: ripple .6s var(--ease) forwards; pointer-events: none; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

/* ---------- карточки ---------- */
.card { background: var(--card); border-radius: 16px; box-shadow: var(--shadow-1); padding: 24px; margin-bottom: 16px; }
.card.narrow { max-width: 440px; margin-inline: auto; }
.card > :last-child { margin-bottom: 0; }
.alt { margin: 20px 0 0; text-align: center; }
.alt + .alt { margin-top: 8px; }
.resend { margin-top: 12px; }

/* ---------- поля ввода: outlined + плавающая подпись ---------- */
.field { position: relative; margin-bottom: 24px; }
.field input, .field textarea {
  display: block; width: 100%; height: 56px; padding: 16px; border: 1px solid var(--outline); border-radius: 4px; outline: 0;
  background: transparent; color: var(--on-surface); font: 400 16px/24px var(--font); letter-spacing: .5px;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: auto; min-height: 112px; resize: vertical; }
.field input:hover, .field textarea:hover { border-color: var(--on-surface); }
.field input:focus, .field textarea:focus { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.field label {
  position: absolute; left: 12px; top: 16px; max-width: calc(100% - 24px); padding: 0 4px; overflow: hidden;
  background: var(--card); color: var(--on-variant); font: 400 16px/24px var(--font); letter-spacing: .5px;
  white-space: nowrap; text-overflow: ellipsis; pointer-events: none;
  transition: top .15s var(--ease), font-size .15s var(--ease), line-height .15s var(--ease), color .15s;
}
.field input:focus + label, .field textarea:focus + label,
.field input:not(:placeholder-shown) + label, .field textarea:not(:placeholder-shown) + label,
.field input[type="date"] + label, .field input[type="datetime-local"] + label, .field select + label { top: -9px; font-size: 12px; line-height: 16px; letter-spacing: .4px; }
.field input:focus + label, .field textarea:focus + label { color: var(--primary); }
.support { margin: 4px 16px 0; color: var(--on-variant); font-size: 12px; line-height: 16px; letter-spacing: .4px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.search.row { display: flex; gap: 12px; align-items: flex-start; }
.search.row .field { flex: 1; margin-bottom: 16px; }
.search.row .btn { height: 56px; border-radius: 28px; }

/* сегментированные кнопки */
.group { margin-bottom: 24px; }
.group-label { margin: 0 0 8px; color: var(--on-variant); font: 500 14px/20px var(--font); letter-spacing: .1px; }
.segmented { display: flex; border: 1px solid var(--outline); border-radius: 20px; overflow: hidden; }
.segmented label { position: relative; flex: 1; }
.segmented input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.segmented span {
  display: flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 12px; border-left: 1px solid var(--outline);
  color: var(--on-surface); font: 500 14px/20px var(--font); letter-spacing: .1px; text-align: center; transition: background-color .2s;
}
.segmented label:first-child span { border-left: 0; }
.segmented label:hover span { background: rgba(var(--ink-rgb), .06); }
.segmented input:checked + span { background: var(--secondary-container); color: var(--on-secondary-container); }
.segmented input:checked + span::before { content: "\2713"; }
.segmented input:focus-visible + span { outline: 3px solid var(--primary); outline-offset: -3px; }

.hint { margin: -12px 0 20px; color: var(--on-variant); font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; }
.preview { min-height: 24px; margin: 0 0 16px; font-weight: 500; color: var(--primary); }
.preview.bad { color: var(--error); }
#repair-fields[hidden], #comment-field[hidden] { display: none; }

/* ---------- главная ---------- */
.home { display: grid; grid-template-columns: minmax(260px, 400px) 1fr; gap: 24px; align-items: start; }
.tag { background: var(--card); border-radius: 24px; box-shadow: var(--shadow-1); padding: 24px; text-align: center; }
.tag img { display: block; width: 100%; height: auto; }
.tag p { margin: 12px 0 0; color: var(--on-variant); font-size: 14px; }
.tag.guest { padding: 0; background: none; box-shadow: none; }
.levels.guest img { display: block; width: 100%; height: auto; }
.levels.card { margin-bottom: 0; }
.cta { grid-column: 1 / -1; display: flex; gap: 12px; flex-wrap: wrap; margin: 0; }

.period { margin: 0 0 20px; font-size: 16px; }
.period b { color: var(--primary); font-variant-numeric: tabular-nums; }
.meter { margin: 0 0 24px; }
.meter h2 { margin: 0; font: 500 16px/24px var(--font); letter-spacing: .15px; }
.meter .tier { margin: 0 0 12px; color: var(--on-variant); font-size: 14px; }
.meter .tier strong { font-weight: 500; }
.meter .tier strong.t0 { color: var(--t0); } .meter .tier strong.t1 { color: var(--t1); }
.meter .tier strong.t2 { color: var(--t2); } .meter .tier strong.t3 { color: var(--t3); }
.track { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.seg .bar { height: 8px; overflow: hidden; border-radius: 4px; background: var(--track); }
.seg .bar i { display: block; height: 100%; border-radius: 4px; transition: width .6s var(--ease); }
.seg.t0 .bar i { background: var(--t0); } .seg.t1 .bar i { background: var(--t1); }
.seg.t2 .bar i { background: var(--t2); } .seg.t3 .bar i { background: var(--t3); }
.seg .lbl { display: flex; flex-direction: column; margin-top: 6px; color: var(--on-variant); font-size: 12px; line-height: 16px; letter-spacing: .4px; }
.seg .lbl b { color: var(--on-surface); font-weight: 500; }
.seg.on .lbl b { color: var(--primary); }
.meter .sum { margin: 12px 0 0; font-size: 14px; }
.balance { margin: 0 0 16px; font-size: 16px; }
.levels .balance { margin: 0; }
.balance b { color: var(--primary); }

/* ---------- список гарантий и диалог ---------- */
.list { margin: 0 -8px; padding: 0; list-style: none; }
.list li + li { border-top: 1px solid var(--outline-variant); }
.item {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 16px; width: 100%; min-height: 72px; padding: 12px 8px;
  border: 0; border-radius: 12px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.item:hover { background: rgba(var(--ink-rgb), .06); }
.item .lead { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--primary-container); color: var(--on-primary-container); }
.item .txt { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.item .name { overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.item .sub { color: var(--on-variant); font-size: 14px; }
.status { font: 500 14px/20px var(--font); letter-spacing: .1px; text-align: right; }
.status.ok { color: var(--success); } .status.bad { color: var(--error); }
.item .status { max-width: 42%; }

dialog.md-dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 28px;
  background: var(--card); color: var(--on-surface); box-shadow: var(--shadow-3);
}
dialog.md-dialog::backdrop { background: var(--scrim); }
.md-dialog .inner { padding: 24px; }
.md-dialog h2 { margin-bottom: 8px; font-size: 24px; line-height: 32px; overflow-wrap: anywhere; }
.md-dialog h3 + p { margin-bottom: 0; }
.works { margin: 4px 0 0; padding-left: 20px; }
.works li { margin-bottom: 4px; overflow-wrap: anywhere; }
.actions { display: flex; justify-content: flex-end; margin-top: 24px; }
dialog.md-dialog[open] { animation: dialog-in .32s var(--ease); }
dialog.md-dialog[open]::backdrop { animation: fade-in .32s var(--ease); }
dialog.md-dialog.closing { animation: dialog-out .2s var(--ease) forwards; }
dialog.md-dialog.closing::backdrop { animation: fade-out .2s var(--ease) forwards; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(40px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes dialog-out { to { opacity: 0; transform: translateY(24px) scale(.94); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

/* ---------- таблицы ---------- */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 8px; border-bottom: 1px solid var(--outline-variant); text-align: left; vertical-align: top; }
th { color: var(--on-variant); font: 500 14px/20px var(--font); }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
#reader { width: 100%; max-width: 420px; margin: 0 auto 16px; }

/* ---------- snackbar ---------- */
.snackbars { position: fixed; left: 0; right: 0; bottom: 16px; z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px; pointer-events: none; }
.snackbar {
  display: flex; align-items: center; gap: 16px; width: 100%; max-width: 560px; min-height: 48px; padding: 8px 8px 8px 16px;
  border-radius: 4px; background: var(--snack-bg); color: var(--snack-fg); box-shadow: var(--shadow-3); font: 400 14px/20px var(--font);
  letter-spacing: .25px; pointer-events: auto; animation: snack-in .3s var(--ease);
}
.snackbar.error { background: #7f1d1d; color: #ffdad6; }
.snackbar .msg { flex: 1; padding: 4px 0; }
.snackbar button { height: 36px; padding: 0 12px; border: 0; border-radius: 18px; background: none; color: #7ee0b2; font: 500 14px var(--font); cursor: pointer; }
.snackbar.error button { color: #ffb4ab; }
.snackbar button:hover { background: rgba(255, 255, 255, .1); }
.snackbar.hide { animation: snack-out .2s var(--ease) forwards; }
@keyframes snack-in { from { opacity: 0; transform: translateY(24px); } }
@keyframes snack-out { to { opacity: 0; transform: translateY(16px); } }

/* ---------- боковое меню (на узких экранах и всегда у вошедших) ---------- */
html.drawer #menu-btn { display: inline-grid; }
html.drawer nav {
  top: 0; bottom: 0; left: 0; right: auto; z-index: 30; width: min(320px, 86vw); height: auto; padding: 12px;
  flex-direction: column; align-items: stretch; gap: 0; overflow-y: auto; border-radius: 0 16px 16px 0;
  background: var(--surface-low); visibility: hidden; transform: translateX(-104%);
  transition: transform .3s var(--ease), visibility 0s linear .3s;
}
html.drawer nav.open { visibility: visible; transform: none; box-shadow: var(--shadow-3); transition-delay: 0s; }
html.drawer .nav-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 4px 12px 16px; }
html.drawer .nav-title { font: 500 16px/24px var(--font); }
html.drawer .nav-sub { color: var(--on-variant); font-size: 14px; overflow-wrap: anywhere; }
html.drawer .nav-icon { display: inline-flex; }
html.drawer nav form { display: block; }
html.drawer .navlink { width: 100%; height: 56px; padding: 0 16px; border-radius: 28px; font-size: 14px; }
html.drawer .nav-divider { display: block; height: 1px; margin: 8px 16px; background: var(--outline-variant); }
@media (max-width: 840px) {
  .home { grid-template-columns: 1fr; gap: 16px; }
  .tag { width: 100%; max-width: 400px; margin-inline: auto; }
  .seg .lbl span { font-size: 11px; }
}
@media (max-width: 520px) {
  .two { grid-template-columns: 1fr; gap: 0; }
  .card { padding: 20px 16px; }
  .item .status { max-width: 50%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}

/* ---------- ремонты, статусы, операции ---------- */
.status.info { color: var(--info); }
.status.neutral { color: var(--on-variant); }
.field select {
  display: block; width: 100%; height: 56px; padding: 0 44px 0 16px; border: 1px solid var(--outline); border-radius: 4px; outline: 0;
  appearance: none; -webkit-appearance: none; color: var(--on-surface); font: 400 16px/24px var(--font); letter-spacing: .5px;
  background: transparent url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23404943'><path d='M7 10l5 5 5-5z'/></svg>") no-repeat right 12px center;
  transition: border-color .15s, box-shadow .15s;
}
.field select:hover { border-color: var(--on-surface); }
.field select:focus { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.field select:focus + label { color: var(--primary); }
.field input[type="datetime-local"], .field input[type="date"] { min-height: 56px; }
#amount-both[hidden], #items-box[hidden], .custom-box[hidden] { display: none; }
.md-dialog .inner { max-height: calc(100vh - 48px); overflow-y: auto; }
.timeline { margin: 4px 0 0; padding: 0; list-style: none; }
.timeline li { margin-bottom: 6px; }
.timeline .when { color: var(--on-variant); font-variant-numeric: tabular-nums; }
.timeline .dash { color: var(--outline); }
.admin-box { margin-top: 20px; padding-top: 4px; border-top: 1px solid var(--outline-variant); }
.admin-box form { margin-bottom: 12px; }
.admin-box .issue { margin: 0; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; margin: 4px 0 0; }
.kv dt { color: var(--on-variant); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.item .name, .item .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- телефон с кодом страны ---------- */
.phone { display: flex; gap: 8px; align-items: flex-start; }
.phone .field { flex: 1; min-width: 0; }
.cc { position: relative; flex: none; }
.cc-btn {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 6px; height: 56px; padding: 0 8px 0 14px;
  border: 1px solid var(--outline); border-radius: 4px; background: transparent; color: var(--on-surface); cursor: pointer;
  font: 400 16px/24px var(--font); transition: border-color .15s, box-shadow .15s;
}
.cc-btn:hover { border-color: var(--on-surface); }
.cc-btn[aria-expanded="true"] { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.cc-flag { font-size: 22px; line-height: 1; }
.cc-arrow { width: 20px; height: 20px; color: var(--on-variant); transition: transform .25s var(--ease); }
.cc-btn[aria-expanded="true"] .cc-arrow { transform: rotate(180deg); }
.cc-menu {
  position: absolute; z-index: 40; top: 60px; left: 0; width: min(320px, calc(100vw - 48px)); overflow: hidden;
  border-radius: 12px; background: var(--card); box-shadow: var(--shadow-3);
  visibility: hidden; opacity: 0; transform: scale(.94) translateY(-6px); transform-origin: top left;
  transition: opacity .18s var(--ease), transform .22s var(--ease), visibility 0s linear .22s;
}
.cc-menu.open { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
.cc-search { padding: 8px; border-bottom: 1px solid var(--outline-variant); }
.cc-search input {
  width: 100%; height: 40px; padding: 0 12px; border: 0; border-radius: 20px; outline: 0; background: var(--surface-container);
  color: var(--on-surface); font: 400 15px/24px var(--font);
}
.cc-search input:focus { box-shadow: inset 0 0 0 2px var(--primary); }
.cc-menu ul { max-height: 280px; margin: 0; padding: 4px 0; overflow-y: auto; list-style: none; }
.cc-menu li {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 16px; cursor: pointer;
  transition: background-color .12s;
}
.cc-menu li:hover, .cc-menu li:focus { background: rgba(var(--ink-rgb), .08); outline: 0; }
.cc-menu li[aria-selected="true"] { background: var(--secondary-container); color: var(--on-secondary-container); }
.cc-menu li[hidden] { display: none; }
.cc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-code { color: var(--on-variant); font-variant-numeric: tabular-nums; }

/* ---------- сброс пароля ---------- */
.forgot { margin: -8px 0 20px; text-align: right; font-size: 14px; }
.notice { margin-bottom: 16px; padding: 16px; border-radius: 12px; background: var(--primary-container); color: var(--on-primary-container); animation: pop .4s var(--ease); }
.notice p { margin: 0 0 8px; }
.notice .btn { margin-top: 8px; }
.otp input { height: 64px; text-align: center; font-size: 28px; font-weight: 500; letter-spacing: .5em; text-indent: .5em; font-variant-numeric: tabular-nums; }
.otp.shake { animation: shake .45s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }

/* ---------- анимации интерфейса ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
/* fill-mode backwards: после показа слой не остаётся, поэтому выпадающие списки не прячутся под соседние карточки */
.card, .tag, .home .levels.guest { animation: rise .5s var(--ease) backwards; }
main > .card:nth-child(2), .home > :nth-child(2) { animation-delay: .07s; }
main > .card:nth-child(3), .home > :nth-child(3) { animation-delay: .14s; }
main > .card:nth-child(4) { animation-delay: .21s; }
main > .card:nth-child(n+5) { animation-delay: .28s; }
.list li { animation: rise .4s var(--ease) backwards; }
.list li:nth-child(2) { animation-delay: .04s; } .list li:nth-child(3) { animation-delay: .08s; }
.list li:nth-child(4) { animation-delay: .12s; } .list li:nth-child(5) { animation-delay: .16s; }
.list li:nth-child(n+6) { animation-delay: .2s; }
.seg .bar i { transform-origin: left; animation: grow var(--d, .6s) linear var(--delay, .35s) backwards; }   /* полосы заполняются по очереди: --delay и --d задаёт разметка */
.btn { transition: box-shadow .2s var(--ease), transform .15s var(--ease); }
.btn:active { transform: scale(.97); }
.item { transition: background-color .15s, transform .15s var(--ease); }
.item:active { transform: scale(.99); }
.navlink { transition: background-color .15s, color .15s; }
.navlink[aria-current="page"] { animation: pop .3s var(--ease); }
.btn.loading { pointer-events: none; }
.btn.loading::before {
  content: ""; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite;
}
.field input, .field textarea, .field select, .cc-btn { transition: border-color .2s, box-shadow .2s; }
@media (max-width: 520px) {
  .phone { gap: 6px; }
  .cc-btn { padding-left: 10px; }
}

/* ---------- переключатели (Material switch) ---------- */
.switches { margin: 8px 0 0; padding: 0; list-style: none; }
.switches li + li { border-top: 1px solid var(--outline-variant); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; margin: 0; cursor: pointer; font-weight: 400; }
.switch { position: relative; flex: none; width: 52px; height: 32px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch .track {
  position: absolute; inset: 0; border: 2px solid var(--outline); border-radius: 16px; background: var(--switch-track);
  transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.switch .track::after {
  content: ""; position: absolute; top: 6px; left: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--outline);
  transition: transform .25s var(--ease), width .2s var(--ease), height .2s var(--ease), top .2s var(--ease), left .2s var(--ease), background-color .2s;
}
.switch input:checked + .track { border-color: var(--primary); background: var(--primary); }
.switch input:checked + .track::after { top: 2px; left: 2px; width: 24px; height: 24px; background: var(--on-primary); transform: translateX(20px); }
.switch input:active + .track::after { width: 28px; height: 28px; top: 0; left: 0; }
.switch input:checked:active + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 3px solid var(--primary); outline-offset: 2px; }

/* ---------- окно «Уведомления» и подсказка у тумблера ---------- */
.support-line { min-height: 1.2em; margin: 8px 0 0; color: var(--on-variant); font-size: 13px; line-height: 18px; }
.btn.success { background: #0b7a3e; }
.btn.danger { background: #ba1a1a; }
.btn.success:hover { background: #086532; }
.btn.danger:hover { background: #9c1515; }
dialog.notify-dialog {
  width: min(420px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 28px; overflow: visible;
  background: var(--card); color: var(--on-surface); box-shadow: var(--shadow-3);
}
dialog.notify-dialog::backdrop { background: var(--scrim); }
.notify-dialog .inner { padding: 32px 24px 24px; text-align: center; }
.notify-dialog h2 { margin: 0 0 8px; font-size: 24px; line-height: 32px; }
.notify-dialog p { margin: 0; color: var(--on-variant); }
.notify-dialog .bell {
  display: grid; place-items: center; width: 76px; height: 76px; margin: 0 auto 16px; border-radius: 50%;
  background: var(--primary-container); color: var(--on-primary-container);
  animation: bell-pop .65s var(--ease) .15s backwards;
}
.notify-dialog .bell .icon { width: 38px; height: 38px; transform-origin: 50% 8%; animation: ring 1.5s ease-in-out .8s 2; }
.notify-dialog h2, .notify-dialog p { animation: rise .5s var(--ease) .3s backwards; }
.notify-dialog .actions { display: flex; gap: 12px; margin-top: 28px; animation: rise .5s var(--ease) .45s backwards; }
.notify-dialog .actions .btn { flex: 1; height: 48px; border-radius: 24px; font-size: 15px; }
dialog.notify-dialog[open] { animation: dialog-in .4s var(--ease); }
dialog.notify-dialog[open]::backdrop { animation: fade-in .4s var(--ease); }
dialog.notify-dialog.closing { animation: dialog-out .25s var(--ease) forwards; }
dialog.notify-dialog.closing::backdrop { animation: fade-out .25s var(--ease) forwards; }
@keyframes bell-pop { from { opacity: 0; transform: scale(.2) rotate(-35deg); } }
@keyframes ring {
  0%, 60%, 100% { transform: rotate(0); }
  10% { transform: rotate(18deg); } 20% { transform: rotate(-16deg); } 30% { transform: rotate(12deg); }
  40% { transform: rotate(-8deg); } 50% { transform: rotate(4deg); }
}

/* длинное название в шапке не ломает меню */
.brand { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) { .brand { font-size: 18px; } }

/* ---------- тёмная тема ---------- */
html { color-scheme: light; }
html[data-theme="dark"] {
  color-scheme: dark;
  --primary: #57d9a3; --on-primary: #003826;
  --primary-container: #005138; --on-primary-container: #89f8c7;
  --secondary-container: #35493e; --on-secondary-container: #cde9d8;
  --bg: #101412; --card: #1a201d; --surface-container: #202723; --surface-low: #1a201d;
  --on-surface: #e1e3df; --on-variant: #bfc9c2;
  --outline: #8a938c; --outline-variant: #414943;
  --error: #ffb4ab; --success: #5ad88c; --scrim: rgba(0, 0, 0, .62);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .6), 0 1px 3px 1px rgba(0, 0, 0, .35);
  --shadow-3: 0 1px 3px rgba(0, 0, 0, .6), 0 4px 8px 3px rgba(0, 0, 0, .4);
  --t0: #d99a63; --t1: #aab4bc; --t2: #e0b43a; --t3: #6bb0d8;
  --ink-rgb: 225, 227, 223; --track: #2f3833; --switch-track: #2f3833; --info: #8ab4f8;
  --snack-bg: #e1e3df; --snack-fg: #191c1a;
}
html[data-theme="dark"] .snackbar button { color: #006c4c; }
html[data-theme="dark"] .snackbar.error { background: #8c1d18; color: #ffdad6; }
html[data-theme="dark"] .snackbar.error button { color: #ffb4ab; }
html[data-theme="dark"] .tag.guest img, html[data-theme="dark"] .levels.guest img { filter: invert(1) hue-rotate(180deg); }
html[data-theme="dark"] .btn.outlined:hover, html[data-theme="dark"] .btn.text:hover { background: rgba(var(--ink-rgb), .08); }
html[data-theme="dark"] .btn.success { background: #1f8f4f; }
html[data-theme="dark"] .btn.danger { background: #c4372d; }
.tag img { background: #fff; border-radius: 12px; padding: 10px; }          /* QR всегда чёрный на белом */
.tag.guest img { background: none; padding: 0; border-radius: 0; }

/* ---------- подвал и мелочи новых страниц ---------- */
.foot { display: flex; justify-content: center; padding: 0 16px 32px; }
.foot .btn { color: var(--on-variant); }
a.item { text-decoration: none; color: inherit; }
.item .lead { font-weight: 500; font-size: 18px; }
.para { white-space: pre-line; overflow-wrap: anywhere; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 8px; }
.stats div { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--surface-container); }
.stats span { color: var(--on-variant); font-size: 13px; }
.stats b { font-size: 18px; font-variant-numeric: tabular-nums; }
.field.filter { margin: 8px 0 12px; }
.field.filter input[type="search"] { -webkit-appearance: none; appearance: none; }

/* ---------- согласие с условиями при регистрации ---------- */
.check { position: relative; display: flex; align-items: flex-start; gap: 12px; margin: 0 0 20px; font-weight: 400; cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 22px; height: 22px; margin: 0; cursor: pointer; }
.check .box {
  flex: none; display: grid; place-items: center; width: 22px; height: 22px; margin-top: 1px; border: 2px solid var(--outline); border-radius: 4px;
  transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.check .box::after {
  content: ""; width: 5px; height: 11px; margin-top: -2px; border: solid var(--on-primary); border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0); transition: transform .2s var(--ease);
}
.check input:checked + .box { background: var(--primary); border-color: var(--primary); }
.check input:checked + .box::after { transform: rotate(45deg) scale(1); }
.check input:focus-visible + .box { outline: 3px solid var(--primary); outline-offset: 2px; }
.check:hover .box { border-color: var(--on-surface); }
.check input:checked:hover + .box { border-color: var(--primary); }
.terms-link { color: var(--info); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- приложенные файлы ---------- */
.files { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.ftile { position: relative; display: flex; flex-direction: column; width: 112px; animation: rise .4s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 45ms); }
.ftile.removing { animation: tile-out .28s var(--ease) forwards; pointer-events: none; }
@keyframes tile-out { to { opacity: 0; transform: scale(.7); } }
.fthumb {
  position: relative; display: grid; place-items: center; width: 112px; height: 84px; padding: 0; overflow: hidden; cursor: pointer;
  border: 1px solid var(--outline-variant); border-radius: 10px; background: var(--surface-container); color: var(--on-variant);
  transition: transform .18s var(--ease), box-shadow .18s;
}
.fthumb:hover { box-shadow: var(--shadow-1); transform: translateY(-2px); }
.fthumb:active { transform: scale(.97); }
.fthumb img, .fthumb .fvideo { width: 100%; height: 100%; object-fit: cover; display: block; }
.fthumb .fvideo { background: #111; pointer-events: none; }
.fplay { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; pointer-events: none; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .6)); }
.fplay .icon { width: 34px; height: 34px; }
.ficon { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ficon .icon { width: 32px; height: 32px; }
.ficon small { font-size: 11px; font-weight: 600; letter-spacing: .4px; }
.fdl, .fdel button {
  position: absolute; top: 4px; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; transition: transform .15s var(--ease), background-color .15s;
}
.fdl:hover, .fdel button:hover { background: rgba(0, 0, 0, .8); transform: scale(1.1); }
.fdl { right: 4px; }
.fdel { margin: 0; }
.fdel button { right: 34px; }
.fdl .icon, .fdel .icon { width: 16px; height: 16px; }
.fname { margin-top: 4px; overflow: hidden; font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.fsize { color: var(--on-variant); font-size: 11px; }
.keep { margin-top: 2px; color: var(--on-variant); font-size: 11px; line-height: 14px; overflow-wrap: anywhere; }
.upload-box { margin-top: 20px; padding-top: 4px; border-top: 1px solid var(--outline-variant); }
.filepick { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; font-weight: 400; cursor: pointer; }
.filepick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.filepick .picked { color: var(--on-variant); font-size: 14px; overflow-wrap: anywhere; }
.upload-box progress { display: block; width: 100%; height: 8px; margin: 0 0 12px; accent-color: var(--primary); }
.danger-zone { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--outline-variant); }
.danger-zone form { margin: 0; }

/* сообщения внутри открытой карточки: окно перекрывает обычные всплывающие сообщения */
.dnote {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 12px; margin: 0 0 14px; padding: 10px 8px 10px 16px;
  border-radius: 12px; background: var(--primary-container); color: var(--on-primary-container); font-size: 14px; line-height: 20px;
  box-shadow: var(--shadow-1); animation: dnote-in .32s var(--ease);
}
.dnote.error { background: #ffdad6; color: #7f1d1d; }
html[data-theme="dark"] .dnote.error { background: #8c1d18; color: #ffdad6; }
.dnote .msg { flex: 1; }
.dnote button { width: 28px; height: 28px; border: 0; border-radius: 50%; background: none; color: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
.dnote button:hover { background: rgba(var(--ink-rgb), .12); }
@keyframes dnote-in { from { opacity: 0; transform: translateY(-14px); } }

/* строка с почтой в настройках */
.email-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 16px; }
.email-row form { margin: 0; }
.email-row .muted { overflow-wrap: anywhere; }
.btn.sm { height: 32px; padding: 0 14px; font-size: 13px; }
.status.verified { animation: pop .35s var(--ease); }

/* просмотр фото и видео */
dialog.viewer {
  position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  overflow: hidden; background: rgba(0, 0, 0, var(--bgalpha, .95)); color: #fff;
}
dialog.viewer::backdrop { background: transparent; }
dialog.viewer[open] { animation: viewer-in .28s var(--ease); }
dialog.viewer.closing { animation: viewer-out .22s var(--ease) forwards; }
@keyframes viewer-in { from { opacity: 0; transform: scale(.96); } }
@keyframes viewer-out { to { opacity: 0; transform: scale(.96); } }
.viewer-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.viewer-stage .slide { position: absolute; inset: 0; will-change: transform, opacity; }
.viewer-stage img, .viewer-stage video { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.viewer-stage img { transform-origin: 50% 50%; will-change: transform; opacity: 0; transition: opacity .25s; cursor: zoom-in; -webkit-user-drag: none; }
.viewer-stage .slide.ready img { opacity: 1; }
.viewer-stage.zoomed img { cursor: grab; }
.viewer-stage video { background: #000; }
.viewer-stage .spinner {
  position: absolute; left: 50%; top: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px; border: 3px solid rgba(255, 255, 255, .3);
  border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite;
}
.viewer-error { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
.viewer-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; align-items: center; gap: 4px; padding: 8px 12px 24px;
  background: linear-gradient(rgba(0, 0, 0, .7), rgba(0, 0, 0, 0)); pointer-events: none;
}
.viewer-bar > * { pointer-events: auto; }
.viewer-bar .iconbtn { color: #fff; }
.viewer-bar .iconbtn:hover { background: rgba(255, 255, 255, .18); }
.viewer-title { flex: 1; min-width: 0; overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.viewer-count { margin-right: 8px; font-size: 14px; opacity: .85; font-variant-numeric: tabular-nums; }
.vnav {
  position: absolute; top: 50%; z-index: 3; display: grid; place-items: center; width: 48px; height: 48px; margin-top: -24px; padding: 0; border: 0;
  border-radius: 50%; background: rgba(255, 255, 255, .18); color: #fff; cursor: pointer; transition: background-color .15s, transform .15s var(--ease);
}
.vnav:hover { background: rgba(255, 255, 255, .32); transform: scale(1.08); }
.vnav:active { transform: scale(.94); }
.vnav.prev { left: 12px; } .vnav.next { right: 12px; }
dialog.viewer.single .vnav { display: none; }
@media (hover: none) { .vnav { opacity: .55; } }
@media (max-width: 520px) { .ftile, .fthumb { width: 100px; } .fthumb { height: 76px; } .vnav { width: 40px; height: 40px; margin-top: -20px; } }

/* ---------- аватарки ---------- */
.avatar { flex: none; display: inline-grid; place-items: center; overflow: hidden; border-radius: 50%; background: var(--primary-container); color: var(--on-primary-container); font-weight: 500; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sm { width: 40px; height: 40px; font-size: 18px; }
.avatar.md { width: 40px; height: 40px; font-size: 18px; }
.avatar.lg { width: 72px; height: 72px; font-size: 30px; }
.avatar-letter { display: grid; place-items: center; width: 100%; height: 100%; background: hsl(var(--h, 150) 45% 82%); color: hsl(var(--h, 150) 55% 22%); }
html[data-theme="dark"] .avatar-letter { background: hsl(var(--h, 150) 35% 26%); color: hsl(var(--h, 150) 70% 85%); }
.avatar-row { display: flex; align-items: center; gap: 16px; margin: 0 0 16px; }
.avatar-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.avatar-actions form { margin: 0; }
.avatar-actions label.btn { cursor: pointer; }
.client-head { display: flex; align-items: center; gap: 16px; margin: 0 0 12px; }
.client-head h1 { margin: 0; }
.nav-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
a.item .avatar { margin-right: 0; }

/* красное уведомление о неактивной почте */
.mailbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding: 12px 12px 12px 16px; background: #ba1a1a; color: #fff; box-shadow: 0 -2px 10px rgba(0, 0, 0, .3); animation: mailbar-in .45s var(--ease);
}
html[data-theme="dark"] .mailbar { background: #93000a; }
.mailbar-text { flex: 1 1 260px; font-size: 14px; line-height: 20px; }
.mailbar form { margin: 0; }
.mailbar .btn.tonal { background: #fff; color: #ba1a1a; }
.mailbar-close { width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: #fff; font-size: 24px; line-height: 1; cursor: pointer; }
.mailbar-close:hover { background: rgba(255, 255, 255, .2); }
.mailbar.hiding { animation: mailbar-out .3s var(--ease) forwards; }
@keyframes mailbar-in { from { transform: translateY(100%); } }
@keyframes mailbar-out { to { transform: translateY(100%); opacity: 0; } }
body.has-mailbar main { padding-bottom: 150px; }
body.has-mailbar .snackbars { bottom: 96px; }
@media (min-width: 700px) { body.has-mailbar main { padding-bottom: 110px; } body.has-mailbar .snackbars { bottom: 80px; } }

/* длинный статус ремонта переносится на следующую строку и не обрезается */
.status { white-space: normal; overflow-wrap: anywhere; }
.item .status { max-width: 46%; }
.timeline li, .dnote .msg { overflow-wrap: anywhere; }

/* ---------- кнопки в разделе «Помощь» ---------- */
.help-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--outline-variant); }
.hl { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--on-variant); font-size: 13px; text-decoration: none; }
.hl-btn {
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; box-shadow: var(--shadow-1);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.hl:hover .hl-btn { transform: translateY(-3px) scale(1.07); box-shadow: var(--shadow-3); }
.hl:active .hl-btn { transform: scale(.93); }
.hl:focus-visible .hl-btn { outline: 3px solid var(--primary); outline-offset: 3px; }
.hl-btn .icon { width: 30px; height: 30px; }
.hl-btn.tg { background: linear-gradient(#37aee2, #1e96c8); color: #fff; }
.hl-btn.tg .icon { width: 34px; height: 34px; margin-right: 2px; }
.hl-btn.vk { background: #0077ff; color: #fff; font-size: 21px; font-weight: 800; letter-spacing: -1.5px; }
.hl-btn.ph { background: #fff; color: #34c759; border: 1px solid #d5ddd8; }

/* ---------- история авторизаций ---------- */
.flag { flex: none; display: grid; place-items: center; width: 40px; height: 40px; font-size: 30px; line-height: 1; }
.item .txt .sub { display: block; }
div.item.static { cursor: default; }
div.item.static:hover { background: none; }
.actions.split { justify-content: space-between; gap: 12px; }
.actions.split form { margin: 0; }
.actions.split .btn { min-width: 120px; }

/* ---------- форматирование текста в «Помощи» и «Условиях» ---------- */
.fmt { white-space: pre-line; overflow-wrap: anywhere; line-height: 1.5; }
.fmt-center { text-align: center; }
.fmt strong { font-weight: 700; }
.fmt-size { line-height: 1.3; }
.spoiler {
  margin: 8px 0; border: 1px solid var(--outline-variant); border-radius: 12px; background: var(--surface-container);
  white-space: normal; overflow: hidden;
}
.spoiler summary {
  position: relative; padding: 12px 44px 12px 14px; font-weight: 500; cursor: pointer; list-style: none; user-select: none;
  transition: background-color .15s;
}
.spoiler summary::-webkit-details-marker { display: none; }
.spoiler summary:hover { background: rgba(var(--ink-rgb), .06); }
.spoiler summary::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; margin-top: -6px;
  border: solid var(--on-variant); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .25s var(--ease);
}
.spoiler[open] summary::after { transform: rotate(225deg); margin-top: -2px; }
.spoiler-body { padding: 0 14px 12px; white-space: pre-line; animation: spoiler-in .3s var(--ease); }
@keyframes spoiler-in { from { opacity: 0; transform: translateY(-8px); } }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-head h2 { margin: 0; }
.fmt-help-btn { color: var(--primary); }
.fmt-help-btn .icon { width: 26px; height: 26px; }
.fmt-help-btn:hover { background: rgba(var(--ink-rgb), .08); }
.fmt-code {
  margin: 4px 0 8px; padding: 10px 12px; overflow-x: auto; border-radius: 10px; background: var(--surface-container);
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere;
}
.fmt-demo { padding: 10px 12px; border: 1px dashed var(--outline-variant); border-radius: 10px; }
.fmt-dialog h3 { margin-top: 18px; }

/* ---------- страница настроек: плитки заполняют всю ширину, а не идут одной узкой колонкой ---------- */
main.wide { max-width: 1480px; }
.settings-grid { columns: 380px; column-gap: 16px; }
.settings-grid > .card, .settings-grid > .card.narrow {
  display: inline-block; width: 100%; max-width: none; margin: 0 0 16px; break-inside: avoid; -webkit-column-break-inside: avoid;
  animation: rise .45s var(--ease) backwards;
}
.settings-grid > .card:nth-child(2) { animation-delay: .05s; }
.settings-grid > .card:nth-child(3) { animation-delay: .1s; }
.settings-grid > .card:nth-child(4) { animation-delay: .15s; }
.settings-grid > .card:nth-child(n+5) { animation-delay: .2s; }
@media (max-width: 779px) { .settings-grid { columns: 1; } }
.ok-text { color: var(--success); }
.test-form { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--outline-variant); }
.test-form form, .test-form { margin-bottom: 0; }
.check.small { margin: -4px 0 16px; font-size: 14px; }

/* текст на красных и зелёных кнопках всегда белый, в том числе в тёмной теме */
.btn.success, .btn.danger, .btn.success:hover, .btn.danger:hover,
html[data-theme="dark"] .btn.success, html[data-theme="dark"] .btn.danger { color: #fff; }

/* ---------- индикатор загрузки файлов: широкий, с процентами, только пока идёт загрузка ---------- */
.uprog { display: flex; align-items: center; gap: 12px; width: 100%; margin: 0 0 14px; }
.uprog[hidden] { display: none; }
.uprog-bar { flex: 1; height: 16px; overflow: hidden; border-radius: 8px; background: var(--track); }
.uprog-fill { display: block; width: 0; height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--primary), var(--on-primary-container)); transition: width .2s linear; }
.uprog-pct { min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; font-size: 15px; }

/* ---------- операция из нескольких частей, страницы ремонта и услуги ---------- */
.checks { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 4px 0 8px; }
.checks .check { margin: 0; }
.back { margin: 0 0 8px; font-size: 14px; }
.back a { color: var(--primary); }
.works-form { margin: 12px 0 8px; }

/* имя клиента на страницах ремонта и услуги: ссылка на страницу клиента */
.client-link { color: var(--primary); font-weight: 500; text-decoration: none; }
.client-link:hover { text-decoration: underline; }

/* ---------- кнопки «Зарегистрироваться» и «Войти» на главной у гостя ---------- */
/* компьютер: кнопки в верхней строке справа, рядом с названием сервиса */
@media (min-width: 1101px) {
  nav .navlink.cta-top {
    height: 40px; margin-left: 8px; padding: 0 22px; border-radius: 20px; font-weight: 500;
    transition: box-shadow .2s var(--ease), background-color .2s var(--ease), transform .2s var(--ease);
  }
  nav .navlink.cta-top .nav-icon { display: none; }
  nav .navlink.cta-top.reg { background: var(--primary); color: var(--on-primary); }
  nav .navlink.cta-top.reg:hover { box-shadow: var(--shadow-1); transform: translateY(-1px); }
  nav .navlink.cta-top.login { color: var(--primary); box-shadow: inset 0 0 0 1px var(--outline); }
  nav .navlink.cta-top.login:hover { background: rgba(var(--ink-rgb), .08); }
  .cta { display: none; }
}
/* телефон и планшет: те же кнопки плавают внизу экрана */
@media (max-width: 1100px) {
  .cta {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; flex-wrap: nowrap; gap: 12px; margin: 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: transparent; box-shadow: none;
    pointer-events: none; animation: mailbar-in .45s var(--ease);                /* подложка прозрачная и не мешает нажимать на страницу */
  }
  .cta .btn { flex: 1; justify-content: center; pointer-events: auto; box-shadow: var(--shadow-3); }
  .cta .btn.outlined { background: var(--bg); }
  .home:has(.cta) { padding-bottom: 96px; }
}

dialog.viewer.is-video [data-v="in"], dialog.viewer.is-video [data-v="out"] { display: none; }

/* кнопки в шапке у гостя одинаково выглядят на всех страницах, в том числе на той, что открыта сейчас */
@media (min-width: 1101px) {
  nav .navlink.cta-top[aria-current="page"], nav .navlink.cta-top.reg[aria-current="page"] { background: var(--primary); color: var(--on-primary); }
  nav .navlink.cta-top.login[aria-current="page"] { background: none; color: var(--primary); box-shadow: inset 0 0 0 1px var(--outline); }
}

/* ================= плавные анимации в стиле Telegram ================= */
:root { --spring: cubic-bezier(.34, 1.45, .64, 1); --smooth: cubic-bezier(.4, 0, .2, 1); }
html { scroll-behavior: smooth; }

/* Переход между страницами через View Transitions убран: пока он идёт, браузер замораживает страницу и не даёт её прокручивать (на медленном сервере 1–2 секунды). */

/* смена темы: круг раскрывается от переключателя (если браузер умеет), иначе мягкое перетекание цветов */
html.theme-vt::view-transition-old(root), html.theme-vt::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
html.theme-vt::view-transition-old(root) { z-index: 1; }
html.theme-vt::view-transition-new(root) { z-index: 2; }
html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
  transition: background-color .45s var(--smooth), color .45s var(--smooth), border-color .45s var(--smooth), box-shadow .45s var(--smooth) !important;
}

/* окна: упругое появление и размытие фона */
@keyframes dialog-spring { from { opacity: 0; transform: translateY(28px) scale(.9); } 55% { opacity: 1; } }
dialog.md-dialog[open], .md-dialog[open] { animation: dialog-spring .46s var(--spring); }
dialog.md-dialog::backdrop { backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }

/* нажатие: кнопка чуть сжимается и упруго возвращается */
.btn { transition: transform .42s var(--spring), box-shadow .2s var(--ease), background-color .2s var(--ease), color .2s var(--ease), opacity .2s; }
.btn:active { transform: scale(.95); transition-duration: .08s, .2s, .2s, .2s, .2s; }
.item, .fthumb, .hl, .iconbtn { transition: transform .4s var(--spring), background-color .15s, box-shadow .2s; }
.item:active, .iconbtn:active { transform: scale(.97); transition-duration: .08s, .15s, .2s; }
.switch .track::after { transition-timing-function: var(--spring); }

/* списки и пункты меню появляются по очереди */
.list > li { animation: rise .5s var(--spring) backwards; }
.list > li:nth-child(2) { animation-delay: 35ms; }
.list > li:nth-child(3) { animation-delay: 70ms; }
.list > li:nth-child(4) { animation-delay: 105ms; }
.list > li:nth-child(5) { animation-delay: 140ms; }
.list > li:nth-child(6) { animation-delay: 175ms; }
.list > li:nth-child(7) { animation-delay: 210ms; }
.list > li:nth-child(8) { animation-delay: 245ms; }
.list > li:nth-child(9) { animation-delay: 280ms; }
.list > li:nth-child(10) { animation-delay: 315ms; }
.list > li:nth-child(11) { animation-delay: 350ms; }
.list > li:nth-child(12) { animation-delay: 385ms; }
@keyframes nav-in { from { opacity: 0; transform: translateX(-20px); } }
html.drawer nav.open > .navlink, html.drawer nav.open > form, html.drawer nav.open > .nav-divider { animation: nav-in .5s var(--spring) backwards; }
html.drawer nav.open > :nth-child(2) { animation-delay: 30ms; }
html.drawer nav.open > :nth-child(3) { animation-delay: 60ms; }
html.drawer nav.open > :nth-child(4) { animation-delay: 90ms; }
html.drawer nav.open > :nth-child(5) { animation-delay: 120ms; }
html.drawer nav.open > :nth-child(6) { animation-delay: 150ms; }
html.drawer nav.open > :nth-child(7) { animation-delay: 180ms; }
html.drawer nav.open > :nth-child(8) { animation-delay: 210ms; }
html.drawer nav.open > :nth-child(9) { animation-delay: 240ms; }
html.drawer nav.open > :nth-child(10) { animation-delay: 270ms; }
html.drawer nav.open > :nth-child(11) { animation-delay: 300ms; }
html.drawer nav.open > :nth-child(12) { animation-delay: 330ms; }
html.drawer nav.open > :nth-child(13) { animation-delay: 360ms; }
html.drawer nav.open > :nth-child(14) { animation-delay: 390ms; }
html.drawer nav.open > :nth-child(15) { animation-delay: 420ms; }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  html { scroll-behavior: auto; }
}

/* закрытие окон: то же движение, что при открытии, но в обратную сторону (мои новые правила открытия перебивали старое закрытие) */
@keyframes dialog-spring-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(28px) scale(.9); } }
dialog.md-dialog.closing[open], .md-dialog.closing[open] { animation: dialog-spring-out .32s var(--smooth) forwards; }
dialog.md-dialog.closing[open]::backdrop, .md-dialog.closing[open]::backdrop { animation: fade-out .32s var(--smooth) forwards; }

/* ---------- редактор своей темы ---------- */
.theme-editor { margin-top: 16px; padding-top: 4px; animation: rise .4s var(--spring) backwards; }
.theme-colors { display: flex; gap: 16px; margin: 12px 0; }
.color-field { display: flex; flex: 1; flex-direction: column; gap: 6px; margin: 0; font-size: 13px; font-weight: 500; color: var(--on-variant); }
.color-field input[type="color"] {
  width: 100%; height: 48px; padding: 3px; border: 1px solid var(--outline); border-radius: 12px; background: var(--card); cursor: pointer;
  transition: transform .3s var(--spring), box-shadow .2s;
}
.color-field input[type="color"]:hover { box-shadow: var(--shadow-1); transform: translateY(-1px); }
.theme-presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.preset {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; border: 1px solid var(--outline-variant); border-radius: 18px;
  background: var(--card); color: var(--on-surface); font: inherit; font-size: 13px; cursor: pointer;
  transition: transform .3s var(--spring), border-color .2s, background-color .2s;
}
.preset:hover { border-color: var(--primary); transform: translateY(-1px); }
.preset:active { transform: scale(.96); }
.preset .swatch { position: relative; display: inline-block; width: 26px; height: 26px; overflow: hidden; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(128, 128, 128, .4); }
.preset .swatch i { position: absolute; right: 0; bottom: 0; width: 15px; height: 15px; border-radius: 50% 0 0 0; }
[hidden] { display: none !important; }

/* название сервиса в шапке и в боковом меню: Comic Sans (там, где шрифт есть в системе) */
@font-face { font-family: "MrJackComic"; src: url("/static/fonts/comic.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
.brand, html.drawer .nav-title, .nav-title {
  font-family: "MrJackComic", "Comic Sans MS", "Comic Sans", "Chalkboard SE", "Marker Felt", var(--font);
}

.later-form { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--outline-variant); }

/* почта клиента и удаление клиента (страница клиента у администратора) */
.email-state { margin: 0 0 8px; font-size: 14px; }
.email-btn { border: 0; background: none; font: inherit; font-weight: 500; cursor: pointer; padding: 2px 6px; margin-left: 4px; border-radius: 8px; transition: background-color .15s, transform .3s var(--spring); }
.email-btn:hover { background: rgba(var(--ink-rgb), .08); }
.email-btn:active { transform: scale(.96); }
.email-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.email-actions form { margin: 0; }
.danger-card { border: 1px solid var(--error); }

/* экспресс-приём и публичная страница ремонта */
.express-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.exp-item { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.exp-item form { margin: 0; align-self: flex-start; }
.repair-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 4px 0 12px; }

/* публичная страница ремонта: плавающие кнопки не закрывают содержимое */
@media (max-width: 1100px) { .pub-pad { padding-bottom: 88px; } }

/* появление списков короче: задержка растёт только у первых шести пунктов */
.list > li { animation-duration: .35s; }
.list > li:nth-child(n+7) { animation-delay: 125ms; }

/* глазок «показать пароль» */
.field.has-pw input { padding-right: 56px; }
.field input::-ms-reveal, .field input::-ms-clear { display: none; }                 /* у Edge свой глазок, он не нужен */
.pw-toggle {
  position: absolute; top: 8px; right: 6px; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--on-variant); cursor: pointer; transition: background-color .15s, color .15s, transform .3s var(--spring);
}
.pw-toggle:hover { background: rgba(var(--ink-rgb), .08); color: var(--on-surface); }
.pw-toggle:active { transform: scale(.9); }
.pw-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.pw-toggle .icon { width: 24px; height: 24px; }
.pw-toggle[aria-pressed="false"] .eye-off, .pw-toggle[aria-pressed="true"] .eye-on { display: none; }
.pw-toggle[aria-pressed="true"] { color: var(--primary); }

/* просмотр файла: кружок с процентами загрузки посередине, миниатюра пока грузится полное фото */
.viewer-stage .slide-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: blur(3px); opacity: .85; pointer-events: none; }
.vring {
  position: absolute; left: 50%; top: 50%; z-index: 2; width: 80px; height: 80px; margin: -40px 0 0 -40px; border-radius: 50%;
  background: rgba(0, 0, 0, .5); pointer-events: none; transition: opacity .2s;
}
.vring.hide { display: none; }
.vring svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.vring circle { fill: none; stroke-width: 5; }
.vring-bg { stroke: rgba(255, 255, 255, .25); }
.vring-fg { stroke: #fff; stroke-linecap: round; transition: stroke-dashoffset .15s linear; }
.vring-pct { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font: 600 17px/1 var(--font); }
.vring.indeterminate svg { animation: vring-spin 1s linear infinite; }
.vring.indeterminate .vring-fg { stroke-dasharray: 60 160 !important; stroke-dashoffset: 0 !important; }
@keyframes vring-spin { to { transform: rotate(270deg); } }

/* предоплата в карточке ремонта */
.prepay-box { margin: 12px 0; }
.prepay-delete { margin-top: 6px; }

/* оплаченный ремонт с предоплатой: стоимость и предоплата рядом */
.cost-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }

/* ремонты: каждый в скруглённой плитке */
.list.cards { display: grid; gap: 10px; margin: 0; }
.list.cards > li { border: 0; border-radius: 16px; background: var(--surface-container); overflow: hidden; transition: box-shadow .2s var(--ease), transform .3s var(--spring); }
.list.cards > li:hover { box-shadow: var(--shadow-1); }
.list.cards .item { padding: 12px 14px; border-radius: 16px; }


/* шестерёнка настроек клиента справа от имени */
.client-head .gear { margin-left: auto; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--on-variant); flex: none; }
.client-head .gear:hover { background: rgba(var(--ink-rgb), .08); color: var(--on-surface); }
.client-head .gear .icon { width: 26px; height: 26px; }

/* постраничный вывод списков */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 10px 0; scroll-margin-top: 84px; }
.pager[hidden] { display: none; }
.pager-btn { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: var(--surface-container); color: var(--on-surface); cursor: pointer; transition: background-color .15s, transform .3s var(--spring), opacity .15s; }
.pager-btn:hover:not(:disabled) { background: var(--primary-container, var(--surface-container)); }
.pager-btn:active:not(:disabled) { transform: scale(.9); }
.pager-btn:disabled { opacity: .35; cursor: default; }
.pager-btn svg { width: 26px; height: 26px; fill: currentColor; }
.pager-label { min-width: 130px; text-align: center; font-weight: 600; color: var(--on-variant); }
.pg-off { display: none !important; }

/* окно обрезки фото профиля: круг, перетаскивание, масштаб */
.crop-dialog .inner { max-width: 380px; }
.crop-stage { display: grid; place-items: center; margin: 8px 0 12px; }
.crop-stage canvas { width: min(78vw, 320px); aspect-ratio: 1; border-radius: 16px; background: #000; touch-action: none; cursor: grab; display: block; }
.crop-stage canvas:active { cursor: grabbing; }
.crop-zoom { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; color: var(--on-variant); }
.crop-zoom input { flex: 1; accent-color: var(--primary); }
.md-dialog.crop-dialog { width: min(92vw, 400px); }
.crop-dialog .inner { max-width: none; }

/* перелистывание страниц списка: строки не вылезают за края карточки во время движения */
ul[data-paginate].pg-moving { overflow-x: clip; overflow-clip-margin: 6px; }
@media (prefers-reduced-motion: reduce) { ul[data-paginate] li { animation: none !important; } }

/* гарантии: заголовки секций, активные зелёным, истёкшие красным */
.warranty-h { margin: 18px 0 8px; font-size: 1.1rem; }
.warranty-h.ok { color: var(--success); }
.warranty-h.bad { color: var(--error); }
.sort-form { margin: 4px 0 8px; }

/* выпадающие списки: строки берут цвета темы (иначе окно списка остаётся белым с чёрным текстом), стрелка видна и на тёмной теме */
.field select option, .field select optgroup { background-color: var(--card); color: var(--on-surface); }
.field select option:checked, .field select option:hover { background-color: var(--secondary-container); color: var(--on-secondary-container); }
html[data-theme="dark"] .field select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23bfc9c2'><path d='M7 10l5 5 5-5z'/></svg>");
}

/* текущая сессия в «Безопасности» и в истории входов */
.current-session { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; margin: 8px 0; border-radius: 14px; background: var(--surface-container); border: 1px solid var(--success); }
.current-session .flag { font-size: 1.6rem; line-height: 1; }
.current-session .txt { display: flex; flex-direction: column; gap: 2px; }
.current-session .txt b { color: var(--success); }
.current-session .sub, .cur-note { color: var(--on-variant); font-size: .9rem; }
.cur-note { color: var(--success); font-weight: 600; }

/* иконка ремонта: заголовок с шестерёнкой и окно выбора */
.repair-title { display: flex; align-items: center; gap: 12px; }
.repair-title h1 { margin: 0; flex: 1; min-width: 0; }
.repair-title .lead { flex: none; }
.repair-title .gear { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--on-variant); }
.repair-title .gear:hover { background: rgba(var(--ink-rgb), .08); color: var(--on-surface); }
.repair-title .gear .icon { width: 26px; height: 26px; }
.icon-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 8px 0 12px; }
.icon-opt { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px; border: 2px solid var(--outline-variant); border-radius: 16px; background: var(--surface-container); color: var(--on-surface); font: inherit; cursor: pointer; transition: border-color .15s, background-color .15s, transform .3s var(--spring); }
.icon-opt:hover { background: var(--secondary-container); }
.icon-opt:active { transform: scale(.96); }
.icon-opt.on { border-color: var(--primary); background: var(--secondary-container); font-weight: 600; }
.icon-opt .lead { width: 44px; height: 44px; }
.repair-title > .lead .icon, .repair-title > .lead svg { width: 30px; height: 30px; }
.icon-opt .lead { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--card); color: var(--on-surface); }
.icon-opt.on .lead { background: var(--primary); color: var(--on-primary, #fff); }
.icon-opt .lead .icon, .icon-opt .lead svg { width: 30px; height: 30px; }

/* метка роли (кассир, администратор) */
.role-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--secondary-container); color: var(--on-secondary-container); white-space: nowrap; }
.role-badge.admin { background: var(--primary); color: var(--on-primary, #fff); }
.client-head .role-badge { flex: none; }

/* карандаш рядом со стоимостью и предоплатой, плюс у приложенных файлов, окно загрузки */
.edit-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.edit-row .pencil, .files-head .plus { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--on-variant); margin-top: 4px; }
.edit-row .pencil:hover, .files-head .plus:hover { background: rgba(var(--ink-rgb), .08); color: var(--on-surface); }
.edit-row .pencil .icon, .files-head .plus .icon { width: 22px; height: 22px; }
.files-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.upload-dialog .filepick { margin-bottom: 14px; }
.upload-error { margin: 0 0 12px; color: var(--error); font-weight: 600; }
.upload-error[hidden] { display: none; }
.upload-dialog .support-line { margin: 12px 0 0; }

/* резервное копирование: дни недели как выбираемые «чипы», сведения о последней копии */
.weekdays { border: 0; padding: 0; margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.weekdays legend { padding: 0; margin: 0 0 8px; color: var(--on-variant); font-size: .9rem; }
.daychip { position: relative; cursor: pointer; }
.daychip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.daychip span { display: inline-block; min-width: 48px; text-align: center; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--outline); color: var(--on-surface); transition: background-color .15s, border-color .15s; }
.daychip input:checked + span { background: var(--secondary-container); border-color: var(--primary); font-weight: 700; }
.daychip input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.backup-status { margin: 16px 0; }
.backup-status p { margin: 6px 0; }
.backup-list ul { margin: 8px 0 0; padding-left: 18px; }
