/* Кабинет поверх tokens.css (portal-web): значения — из design-handoff/design/mockups/Cabinet-*.html и Mobile-*.html,
   один в один. Цвета только из токенов; ниже — те немногие, что в макетах есть, а в tokens.css нет. */
:root {
    /* Точка-сигнал на точечном фоне (DESIGN.md §3.4) и мелкие линии карточек — из макетов. */
    --c-signal-bg: #121410;
    --c-signal-dot: #262A21;
    --c-row-line: #ECEBE1;
    --c-meter-off: #E6E5DA;
    --c-dashed: #BDBCAE;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
a { color: var(--c-text); }
a:hover { color: #000; }
button, input { font-family: inherit; }
h1, h2, h3, p { margin: 0; }
svg { flex-shrink: 0; }

.btn { width: auto; }
.btn--block { width: 100%; }
.btn--s-tall { height: var(--h-control); border-radius: var(--r-control); }
.btn--danger-text { color: var(--c-danger); }
.field { width: 100%; }
.field--s { height: 46px; }

.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- знак и бренд */
.brand { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 600; text-decoration: none; color: inherit; }
.brand:hover { color: inherit; }
.mark rect { fill: none; stroke: currentColor; stroke-width: 1.5; }
.mark circle { fill: var(--c-accent); }
.ico { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---- точка-сигнал: кольца, лаймовая точка со свечением и пульс-кольцом */
@keyframes ping { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(3.2); opacity: 0; } }
.signal { position: relative; height: 300px; border-radius: 20px; background-color: var(--c-signal-bg);
    background-image: radial-gradient(var(--c-signal-dot) 1px, transparent 1.3px); background-size: 14px 14px; overflow: hidden; }
.signal > span { position: absolute; left: 50%; top: 50%; border-radius: 50%; }
.signal__ring { border: 1px solid var(--c-line); }
.signal__ring--1 { width: 260px; height: 260px; margin: -130px 0 0 -130px; }
.signal__ring--2 { width: 180px; height: 180px; margin: -90px 0 0 -90px; }
.signal__ring--3 { width: 100px; height: 100px; margin: -50px 0 0 -50px; }
.signal__ping { width: 14px; height: 14px; margin: -7px 0 0 -7px; border: 1.5px solid var(--c-accent); animation: ping 2.4s ease-out infinite; }
.signal__dot { width: 14px; height: 14px; margin: -7px 0 0 -7px; background: var(--c-accent); box-shadow: 0 0 24px var(--c-accent); }
.signal--s { height: 220px; }
.signal--s .signal__ring--1 { width: 190px; height: 190px; margin: -95px 0 0 -95px; }
.signal--s .signal__ring--2 { width: 130px; height: 130px; margin: -65px 0 0 -65px; }
.signal--s .signal__ring--3 { width: 70px; height: 70px; margin: -35px 0 0 -35px; }

/* ---- вход и регистрация: тёмная половина с сигналом, светлая с формой (Cabinet-01-Login, Cabinet-05-Register) */
.auth { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); min-height: 100vh; }
.auth__aside { background: var(--c-bg); color: var(--c-text); padding: 48px; display: flex; flex-direction: column;
    justify-content: space-between; gap: 32px; }
.auth__hero { display: flex; flex-direction: column; gap: 32px; }
.auth__title { font-size: 44px; }
.auth__notes { display: flex; flex-wrap: wrap; gap: 24px; font-size: 13px; color: var(--c-muted); }
.auth__notes span { display: flex; align-items: center; gap: 8px; }
.auth__main { padding: 48px 96px; display: flex; flex-direction: column; justify-content: center; }
.auth__panel { width: 100%; max-width: 448px; margin: 0 auto; }
.auth__head { display: flex; justify-content: space-between; align-items: baseline; }
.auth__h { font-family: var(--font-display); font-weight: 600; font-size: 32px; letter-spacing: -.01em; }
.auth__lead { margin-top: 16px; font-size: 15px; line-height: 1.55; color: var(--c-muted); }
.auth__alt { margin-top: 24px; font-size: 14px; color: var(--c-muted); }
.auth__alt a { font-weight: 600; }

.form { margin-top: 40px; display: flex; flex-direction: column; gap: 20px; }
.form__field { display: flex; flex-direction: column; gap: 8px; }
.form__field label, .form__label { font-size: 13px; color: var(--c-muted); }
.form__hint { font-size: 12px; color: var(--c-muted); }
.form__submit { margin-top: 12px; }
.form__or { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }

/* Итог и отказ действия — плашкой над формой. */
.notice { margin-top: 24px; padding: 12px 16px; border-radius: var(--r-control); font-size: 14px; line-height: 1.5;
    background: var(--c-surface); border: 1px solid var(--c-line); }
.notice--ok { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-on-accent); }
.notice--error { color: var(--c-danger); }
.notice[hidden] { display: none; }
.status { font-size: 13px; color: var(--c-muted); min-height: 1em; }

/* ---- шапка с пилюлей-навигацией (Cabinet-02-Devices) */
.topbar { height: 76px; padding: 0 48px; display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--c-line); gap: 16px; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--c-surface-2); }
.tabs a { height: 40px; padding: 0 16px; border-radius: var(--r-pill); display: flex; align-items: center; font-size: 14px;
    text-decoration: none; color: var(--c-text); }
.tabs a:hover { box-shadow: inset 0 0 0 999px var(--hover); }
.tabs a[aria-current="page"] { background: var(--c-ink); color: var(--c-on-ink); }
.tabs a:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 3px; }
.topbar__me { display: flex; align-items: center; gap: 12px; }

/* Язык: сегменты у входа (Cabinet-01-Login: подложка surface-2, отступ 3, кнопки 30 × 44, выбранная — белая),
   в шапке — строка «RU | EN» моно 12 (Cabinet-02-Devices), выбранный — цветом текста. */
.lang { display: flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--c-surface-2); }
.lang a { height: 30px; min-width: 44px; border-radius: 7px; display: flex; align-items: center; justify-content: center;
    font-family: var(--font-mono); font-size: 12px; color: var(--c-muted); text-decoration: none; }
.lang a[aria-current="true"] { background: var(--c-surface); color: var(--c-text); }
.lang a:hover { color: var(--c-text); }
.lang a:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.lang--plain { padding: 0; gap: 0; background: none; align-items: center; }
.lang--plain a { min-width: 0; height: 36px; padding: 0 4px; }
.lang--plain a[aria-current="true"] { background: none; }
.lang__sep { font-family: var(--font-mono); font-size: 12px; color: var(--c-muted); }
.avatar { text-decoration: none; width: 36px; height: 36px; border-radius: 18px; background: var(--c-ink); color: var(--c-on-ink); display: flex;
    align-items: center; justify-content: center; font-size: 13px; font-weight: 600; text-transform: uppercase; }
.avatar:hover { color: var(--c-on-ink); box-shadow: inset 0 0 0 999px rgba(255,255,255,.07); }
.avatar:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 3px; }

.page { padding: 48px; display: flex; flex-direction: column; gap: 36px; }
.page > .notice { margin-top: 0; }
.page__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.page__title { display: flex; flex-direction: column; gap: 10px; }
.page__h { font-family: var(--font-display); font-weight: 600; font-size: 44px; letter-spacing: -.015em; line-height: 1.08; }
.page__notes { display: flex; flex-direction: column; gap: 12px; }
.page__note { font-family: var(--font-mono); font-size: 12px; color: var(--c-muted); }
.page__note--icon { display: flex; align-items: flex-start; gap: 8px; font-family: var(--font-body); line-height: 1.5; }

/* ---- карточки мест */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: start; }
.place { padding: 28px; display: flex; flex-direction: column; gap: 24px; }
.place__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.place__name { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.place__name h3 { font-family: var(--font-display); font-weight: 600; font-size: 26px; letter-spacing: -.01em;
    overflow-wrap: anywhere; }
.place__date { font-family: var(--font-mono); font-size: 12px; color: var(--c-muted); }
.place .pill { height: 30px; flex-shrink: 0; }
.pill--danger { background: var(--c-surface-2); color: var(--c-danger); }
.rows { margin: 0; display: flex; flex-direction: column; }
.rows > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--c-row-line);
    font-size: 14px; }
.rows > div:last-child { border-bottom: 0; }
.rows dt, .rows .k { color: var(--c-muted); }
.rows dd, .rows .v { margin: 0; font-family: var(--font-mono); font-size: 13px; text-align: right; overflow-wrap: anywhere; }
.place__form { display: flex; flex-direction: column; gap: 12px; }
.place__form .field { height: var(--h-control-s); border-radius: var(--r-m); font-family: var(--font-mono); font-size: var(--fs-mono); }

/* Пунктирная карточка «Ещё одна машина»: здесь — заявка на новое место. */
.add-card { border-radius: var(--r-card); border: 1.5px dashed var(--c-dashed); padding: 28px; display: flex; flex-direction: column;
    justify-content: center; align-items: flex-start; gap: 16px; min-height: 100%; }
.add-card__tile { width: 52px; height: 52px; border-radius: 16px; background: var(--c-ink); color: var(--c-on-ink); display: flex;
    align-items: center; justify-content: center; }
.add-card__h { font-family: var(--font-display); font-weight: 600; font-size: 22px; }
.add-card__text { font-size: 14px; line-height: 1.5; color: var(--c-muted); }
.add-card form { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.add-card .field { height: var(--h-control-s); border-radius: var(--r-m); }

/* ---- пусто (Cabinet-08-Empty) */
.empty { flex-grow: 1; padding: 48px; display: grid; grid-template-columns: minmax(0, 1fr) 460px; gap: 48px; align-items: center; }
.empty__text { display: flex; flex-direction: column; gap: 20px; }
.empty__h { font-family: var(--font-display); font-weight: 600; font-size: 56px; line-height: 1.05; letter-spacing: -.02em; text-wrap: balance; }
.empty__lead { font-size: 17px; line-height: 1.55; color: var(--c-muted); max-width: 520px; }
.empty__form { display: flex; gap: 12px; margin-top: 12px; max-width: 520px; }
.empty__form .field { flex: 1; min-width: 0; }
.empty__panel { border-radius: var(--r-hero); background: var(--c-bg); padding: 32px; display: flex; flex-direction: column; gap: 24px; }
.ticks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; color: var(--c-text); font-size: 14px; }
.ticks li { display: flex; gap: 10px; }
.ticks svg { color: var(--c-accent); stroke-width: 2; }
.shell { display: flex; flex-direction: column; min-height: 100vh; }

/* ---- настройки (Cabinet-09-Security) */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.split > section { display: flex; flex-direction: column; gap: 24px; }
.split__h { font-family: var(--font-display); font-weight: 600; font-size: 36px; letter-spacing: -.015em; }
.list-card { padding: 4px 28px 20px; display: flex; flex-direction: column; }
.list-card__row { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 72px;
    border-bottom: 1px solid var(--c-row-line); }
.list-card__row > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.list-card__t { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.list-card__s { font-family: var(--font-mono); font-size: 12px; color: var(--c-muted); }
.list-card__empty { min-height: 72px; display: flex; align-items: center; font-size: 14px; color: var(--c-muted);
    border-bottom: 1px solid var(--c-row-line); }
.list-card__add { margin-top: 20px; display: flex; flex-direction: column; gap: 12px; }
.list-card__add .field { height: 46px; }
.list-card__add .btn { align-self: flex-start; }
.box-card { padding: 24px 28px; display: flex; flex-direction: column; gap: 16px; }
.box-card__row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 16px;
    border-bottom: 1px solid var(--c-row-line); }
.box-card__row > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.small { font-size: 13px; line-height: 1.5; color: var(--c-muted); }

/* ---- нижняя панель с главным действием — только на телефоне */
.dock { display: none; }

/* ---- телефон (Mobile-01-Devices): одна колонка, своя шапка, главное действие — в нижней панели */
@media (max-width: 760px) {
    .auth { grid-template-columns: minmax(0, 1fr); }
    .auth__aside { padding: 20px; gap: 24px; }
    .auth__aside .signal, .auth__title, .auth__notes { display: none; }
    .auth__main { padding: 32px 20px 40px; justify-content: flex-start; }
    .form { margin-top: 28px; }

    .topbar { height: 60px; padding: 0 20px; border-bottom: 0; }
    .topbar .brand { gap: 10px; }
    .tabs { display: none; }
    .avatar { width: 44px; height: 44px; border-radius: 22px; font-size: 14px; }

    .page { padding: 8px 20px 120px; gap: 14px; }
    .page__head { flex-direction: column; align-items: stretch; }
    .page__head .btn { display: none; }
    .page__title { gap: 8px; margin-top: 8px; }
    .page__h { font-size: 30px; margin-bottom: 6px; }
    .cards { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .place { padding: 20px; gap: 16px; border-radius: 20px; }
    .place__name { gap: 6px; }
    .place__name h3 { font-size: 22px; }
    .place__head + .rows { margin-top: -4px; }
    .add-card { padding: 20px; border-radius: 20px; }

    .empty { grid-template-columns: minmax(0, 1fr); padding: 8px 20px 40px; gap: 24px; }
    .empty__h { font-size: 30px; }
    .empty__form { flex-direction: column; }
    .empty__panel { padding: 20px; border-radius: 20px; }

    .split { grid-template-columns: minmax(0, 1fr); }
    .split__h { font-size: 26px; }
    .list-card { padding: 4px 20px 20px; }
    .box-card { padding: 20px; }

    .dock { display: block; position: fixed; left: 0; right: 0; bottom: 0; padding: 16px 20px 28px; background: var(--c-bg);
        border-top: 1px solid var(--c-line); }
}

/* ---- «Подключить окно»: код крупно моноширинным, выбор места строками */
.field--code { font-family: var(--font-mono); font-size: 20px; letter-spacing: .12em; text-transform: uppercase; }
.link-form { margin-top: 0; }
.choice { border: 0; margin: 0; padding: 0; }
.choice__row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px; border-radius: var(--r-control);
    border: 1px solid var(--c-line); background: var(--c-surface); cursor: pointer; }
.choice__row:has(input:checked) { border-color: var(--c-ink); box-shadow: inset 0 0 0 1px var(--c-ink); }
.choice__row input { accent-color: var(--c-ink); width: 18px; height: 18px; margin: 0; }
.choice__t { font-size: 15px; font-weight: 500; }
.choice__s { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--c-muted); }
.choice__row + .choice__row { margin-top: 8px; }
