/* Кабинет партнёра: надстройка над дизайн-системой Guardora (style.css, tabbar.css, login-orbit.css). */
[hidden] { display: none !important; }
body.cp-locked { overflow: hidden; }
.cp-small { font-size: 12.5px; }
.cp-nowrap { white-space: nowrap; }
button > svg { width: 16px; height: 16px; flex: 0 0 auto; }

/* оболочка: topbar + сайдбар */
.brand .cp-brand__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-shell .account, .cp-shell .account:hover { cursor: default; background: rgba(255, 255, 255, .02); border-color: rgba(255, 255, 255, .08); }
.nav-item[data-view] { user-select: none; }
.nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* экран входа (login.html один в один, внутри SPA) */
.cp-auth { width: 100%; }
.orbit-login .tabbar { display: none !important; }
.auth__mark svg { display: block; }

/* шапка страницы: поиск и обновление */
.cp-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.cp-search { position: relative; display: block; flex: 1 1 220px; min-width: 180px; max-width: 360px; }
.cp-search input { padding-left: 38px; height: 40px; }
.cp-search > svg { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--text-dim); pointer-events: none; }

/* статусы и метки */
.cp-status { white-space: nowrap; }
.cp-tag { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); font-size: 11.5px; color: var(--text-dim); white-space: nowrap; }

/* карточка «Общая скорость» */
.cp-speed { margin-bottom: 16px; }
.cp-speed__sub { font-size: 12.5px; }
.cp-speed__row { display: flex; align-items: stretch; gap: 14px 28px; flex-wrap: wrap; }
.cp-speed__item { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cp-speed__arrow { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 22px; font-weight: 800; line-height: 1; flex: 0 0 auto; background: linear-gradient(180deg, var(--accent-hi), var(--accent)); color: var(--accent-ink); box-shadow: var(--shadow-accent); }
.cp-speed__item--tx .cp-speed__arrow { background: var(--dark); color: var(--accent); box-shadow: none; }
.cp-speed__val { display: flex; flex-direction: column; min-width: 0; }
.cp-speed__line.balance-big { margin: 0; padding: 0; line-height: 1.1; display: flex; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; }
.cp-speed__unit { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.cp-speed__val small { font-size: 12px; }
.cp-speed__stat { display: flex; flex-direction: column; justify-content: center; gap: 3px; min-width: 130px; padding: 10px 14px; border-radius: 12px; background: var(--bg); }
.cp-speed__label { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); }
.cp-speed__stat b { font-size: 20px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.cp-speed__stat b span { font-size: 13px; font-weight: 500; color: var(--text-dim); }
.cp-speed__bar.quota-bar { height: 6px; max-width: 150px; margin-top: 4px; background: var(--muted); }
.cp-speed--idle .cp-speed__line, .cp-speed--idle .cp-speed__stat b { color: var(--text-dim); }
.cp-speed__note { margin: 12px 0 0; font-size: 13px; }
.cp-speed--empty .cp-speed__note { margin-top: 0; }

/* сетка машин */
.cp-grid { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
a.cp-card { display: block; color: inherit; text-decoration: none; padding: 18px; transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease); }
a.cp-card:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
a.cp-card:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.cp-card--missing { opacity: .72; }
.cp-card__top { display: flex; align-items: flex-start; gap: 12px; }
.cp-card__body { min-width: 0; flex: 1; }
.cp-card__name { font-weight: 700; font-size: 15.5px; overflow-wrap: anywhere; }
.cp-card__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.cp-card__power { font-size: 12.5px; }
.cp-card__ips { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; }
.cp-card__spec { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--text-dim); }
.cp-card__spec b { color: var(--text); font-weight: 600; }
.cp-card__foot { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--text-dim); flex-wrap: wrap; }
.cp-card__foot span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-card__agent { margin-top: 12px; display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-dim); }
.cp-card__agent .vmm-mini__c b { color: var(--text); }
.cp-card__net { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cp-adot { width: 8px; height: 2px; border-radius: 1px; background: var(--border-strong); flex: 0 0 auto; }
.cp-adot--off { width: 7px; height: 7px; border-radius: 50%; background: transparent; border: 1.5px solid var(--orange); }

/* логотип ОС */
.cp-os { width: 46px; height: 46px; border-radius: 13px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; position: relative; background: var(--surface-2); border: 1px solid var(--border); }
@supports (color: color-mix(in srgb, red 10%, transparent)) {
  .cp-os { background: color-mix(in srgb, var(--os, #888) 11%, var(--surface)); border-color: color-mix(in srgb, var(--os, #888) 26%, var(--border)); }
}
.cp-os img { width: 27px; height: 27px; display: block; }
.cp-os img.err { display: none; }
.cp-os b { display: none; font-size: 19px; font-weight: 800; color: var(--os, var(--text-dim)); }
.cp-os img.err + b { display: block; }
.cp-os--lg { width: 60px; height: 60px; border-radius: 16px; }
.cp-os--lg img { width: 34px; height: 34px; }
.cp-os--sm { width: 36px; height: 36px; border-radius: 10px; }
.cp-os--sm img { width: 20px; height: 20px; }
.cp-os--sm b { font-size: 15px; }

/* адреса и кнопка копирования */
.cp-ip { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.cp-ip code { font-family: var(--mono); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-ip .cp-tag { font-size: 10.5px; padding: 0 6px; }
button.cp-iconbtn--xs { width: 24px; height: 24px; padding: 0; border-radius: 7px; border-color: transparent; background: transparent; box-shadow: none; color: var(--text-dim); }
button.cp-iconbtn--xs:hover { background: var(--hover-ghost); color: var(--text); box-shadow: none; transform: none; }
button.cp-iconbtn--xs > svg { width: 14px; height: 14px; }

/* страница машины */
.cp-head { display: flex; align-items: flex-start; gap: 16px; min-width: 0; flex: 1 1 auto; }
.cp-head__body { min-width: 0; flex: 1; }
.cp-head__name { overflow-wrap: anywhere; }
.cp-head__pills { display: flex; gap: 8px 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; font-size: 13px; }
.cp-head__ips { display: flex; gap: 6px 16px; flex-wrap: wrap; margin-top: 10px; }
.cp-actions { margin-bottom: 16px; }
.cp-actions__busy { padding: 0 0 12px; }
.cp-actions__group { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--border); }
.cp-actions__label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); min-width: 96px; }
.cp-actions__btns { display: flex; gap: 8px; flex-wrap: wrap; }
.cp-mon { margin-bottom: 16px; }
.cp-facts .cp-facts__wide { grid-column: 1 / -1; }
.cp-kv .kv-row { justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.cp-kv .kv-row:last-child { border-bottom: 0; padding-bottom: 0; }
.cp-kv .kv-k { color: var(--text-dim); flex: 0 0 auto; max-width: 45%; }
.cp-kv .kv-v { min-width: 0; text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.cp-kv .kv-v code, .cp-kv .kv-k code { font-family: var(--mono); font-size: 12.5px; font-weight: 500; }
.cp-kv--macs { margin-top: 12px; border-top: 1px solid var(--border); }
.cp-net { padding: 8px 0; border-bottom: 1px solid var(--border); }
.cp-net:last-child { border-bottom: 0; padding-bottom: 0; }
.cp-net:first-child { padding-top: 0; }
.cp-net__name { font-size: 12.5px; margin-bottom: 4px; }
.cp-net__ips { display: flex; flex-direction: column; gap: 4px; }
.cp-fault__text { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.cp-hist__msg { color: var(--red); font-size: 12.5px; overflow-wrap: anywhere; }
.cp-table td { vertical-align: top; }
.cp-table .badge { white-space: nowrap; }

/* модалки на классах Guardora */
.modal.cp-modal--wide { width: min(780px, 100%); }
.cp-modal__form { display: contents; }
.cp-modal__text { margin: 0 0 12px; font-size: 14.5px; line-height: 1.55; }
.cp-modal__text:last-child { margin-bottom: 0; }
.cp-modal__warn { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--badge-warn-bg); color: var(--text); font-size: 13.5px; line-height: 1.5; margin-bottom: 14px; }
.cp-modal__warn--danger { background: var(--badge-err-bg); color: var(--badge-err-fg); }
.cp-modal__warn > svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; }
.cp-modal__err { margin-top: 12px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--badge-err-fg); background: var(--badge-err-bg); font-size: 13.5px; }
.modal__foot .cp-btn--left { margin-right: auto; }
.cp-field { margin-bottom: 14px; }
.cp-field__label { display: block; font-size: 12px; margin-bottom: 7px; letter-spacing: .03em; }
.cp-pre { margin: 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--dark); color: var(--on-dark); font: 12px/1.45 var(--mono); max-height: 60vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.cp-secret { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px dashed var(--border-strong); }
.cp-secret code { flex: 1; font-family: var(--mono); font-size: 15px; overflow-wrap: anywhere; }
.cp-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(156px, 100%), 1fr)); gap: 10px; margin-top: 10px; }
.cp-tile { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s, transform .12s; }
.cp-tile:hover { border-color: var(--text-dim); transform: translateY(-1px); }
.cp-tile input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; box-shadow: none; }
.cp-tile.is-checked { border-color: var(--dark); background: var(--accent); color: var(--accent-ink); }
.cp-tile.is-checked .cp-tile__sub { color: var(--accent-ink); opacity: .75; }
.cp-tile__name { font-size: 13px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.cp-tile__sub { font-size: 12px; color: var(--text-dim); }
.cp-tile__empty { color: var(--text-dim); font-size: 13.5px; text-align: center; padding: 20px; }
.cp-tile-search { margin-top: 10px; }
.cp-flavor-info { margin-top: 8px; font-size: 13.5px; color: var(--text-dim); }

/* уведомления: стопка .toast Guardora */
.cp-toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; max-width: calc(100vw - 40px); }
.cp-toasts .toast { position: static; pointer-events: auto; animation: rowIn .2s ease both; }
.empty button { margin-top: 4px; }

/* адаптив */
@media (max-width: 900px) {
  .tabbar { grid-template-columns: repeat(3, 1fr); }
  .orbit-login body { padding-bottom: 0; }
  .cp-toasts { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .cp-actions__label { min-width: 100%; }
  .modal-overlay { z-index: 140; }
}
@media (max-width: 720px) {
  .cp-tools { width: 100%; flex-wrap: nowrap; }
  .cp-search { flex: 1 1 140px; min-width: 0; max-width: none; }
  .cp-tools > button { flex: 0 0 auto; }
  .cp-speed__row { gap: 12px 18px; }
  .cp-speed__stat { flex: 1 1 calc(50% - 9px); min-width: 0; }
}
@media (max-width: 560px) {
  .page-head .cp-head { width: 100%; }
  .cp-actions__btns { width: 100%; }
  .cp-actions__btns button { flex: 1 1 auto; }
  .cp-kv .kv-k { max-width: 50%; }
}
@media (max-width: 400px) {
  .cp-os { width: 40px; height: 40px; border-radius: 11px; }
  .cp-os img { width: 23px; height: 23px; }
  .cp-os--lg { width: 50px; height: 50px; }
  .cp-os--lg img { width: 28px; height: 28px; }
  .cp-tiles { grid-template-columns: 1fr 1fr; }
  .cp-speed__item { flex: 1 1 100%; }
  .cp-speed__arrow { width: 40px; height: 40px; font-size: 19px; }
  .cp-toasts { right: 12px; max-width: calc(100vw - 24px); }
}

/* тёмная тема */
:root[data-theme="dark"] .cp-os img { filter: brightness(1.15); }
:root[data-theme="dark"] .cp-speed__item--tx .cp-speed__arrow { background: var(--surface-2); }
:root[data-theme="dark"] .cp-pre { background: #03090b; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cp-os img { filter: brightness(1.15); }
  :root:not([data-theme="light"]) .cp-speed__item--tx .cp-speed__arrow { background: var(--surface-2); }
  :root:not([data-theme="light"]) .cp-pre { background: #03090b; }
}
