@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:ital,wght@0,400;0,500;0,600;1,400;1,500;1,600&family=Pathway+Extreme:ital,opsz,wght@0,8..144,100..900;1,8..144,100..900&display=swap');

:root {
  --nx-bg: #030712;
  --nx-surface: #0a1628;
  --nx-elev: #102038;
  --nx-line: rgba(56, 189, 248, 0.16);
  --nx-line2: rgba(148, 163, 184, 0.12);
  --nx-text: #e8eef8;
  --nx-muted: #7b93b0;
  --nx-amber: #22d3ee;
  --nx-amber2: #bae6fd;
  --nx-danger: #f87171;
  --nx-ok: #4ade80;
  /* Широкий + курсив: один семейство для UI и «заголовков» */
  --nx-font: 'Pathway Extreme', system-ui, sans-serif;
  --nx-serif: 'Pathway Extreme', system-ui, sans-serif;
  --nx-mono: 'Chakra Petch', ui-monospace, monospace;
  --exl-wdth-ui: 112;
  --exl-wdth-display: 122;
  --nx-r: 14px;
  --nx-r2: 10px;
  --cc-sidebar-w: 272px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--nx-bg);
}

@keyframes exl-aurora-pulse {
  0% {
    opacity: 0.62;
  }
  100% {
    opacity: 1;
  }
}

@keyframes exl-blade-shine {
  0%,
  100% {
    filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.35)) drop-shadow(0 0 1px rgba(125, 211, 252, 0.3));
    transform: translateY(0);
  }
  50% {
    filter: drop-shadow(0 0 14px rgba(125, 211, 252, 0.7)) drop-shadow(0 0 4px rgba(14, 165, 233, 0.45));
    transform: translateY(-1px);
  }
}

@keyframes exl-name-shimmer {
  0% {
    background-position: 0% center;
  }
  100% {
    background-position: 220% center;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  position: relative;
  font-family: var(--nx-font);
  font-size: 15px;
  font-style: italic;
  font-optical-sizing: auto;
  font-variation-settings: "wdth" var(--exl-wdth-ui);
  line-height: 1.42;
  letter-spacing: 0.03em;
  color: var(--nx-text);
  background: var(--nx-bg);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(ellipse 130% 88% at 50% -34%, rgba(14, 165, 233, 0.15), transparent 58%),
    radial-gradient(ellipse 56% 44% at 100% 16%, rgba(30, 64, 175, 0.34), transparent 54%),
    radial-gradient(ellipse 50% 50% at 0% 90%, rgba(8, 47, 73, 0.42), transparent 52%),
    linear-gradient(180deg, rgba(3, 7, 18, 0) 0%, rgba(2, 12, 28, 0.72) 100%);
  animation: exl-aurora-pulse 15s ease-in-out infinite alternate;
}

.cc-app,
.cc-login-page {
  position: relative;
  z-index: 1;
}

::selection {
  background: rgba(56, 189, 248, 0.35);
  color: #fff;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  font-style: italic;
  font-variation-settings: "wdth" var(--exl-wdth-ui);
  letter-spacing: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

button:focus-visible,
.cc-btn:focus-visible,
.cc-nav a:focus-visible,
.cc-mobile-btn:focus-visible {
  outline: 2px solid var(--nx-amber);
  outline-offset: 2px;
}

.cc-mono {
  font-family: var(--nx-mono);
  font-style: italic;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.06em;
  word-break: break-all;
  color: var(--nx-muted);
}

.cc-muted {
  color: var(--nx-muted);
  font-size: 13px;
}

/* ——— Preloader ——— */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 30%, rgba(14, 165, 233, 0.08), var(--nx-bg) 55%);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.preloader.preloader--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.cc-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--nx-line2);
  border-top-color: var(--nx-amber);
  animation: cc-spin 0.75s linear infinite;
}

@keyframes cc-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ——— App shell ——— */
.cc-app {
  display: flex;
  min-height: 100vh;
  min-width: 0;
}

.cc-sidebar {
  width: var(--cc-sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--nx-line);
  background: linear-gradient(175deg, rgba(10, 28, 52, 0.98) 0%, rgba(4, 12, 28, 0.95) 50%, rgba(3, 7, 18, 0.99) 100%);
  backdrop-filter: blur(14px);
  box-shadow: 4px 0 32px rgba(0, 0, 0, 0.35);
}

.cc-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--nx-line2);
  text-decoration: none;
  color: inherit;
  transition: background 0.28s ease, box-shadow 0.28s ease;
}

.cc-brand:hover {
  background: rgba(56, 189, 248, 0.07);
  box-shadow: inset 0 -1px 0 rgba(56, 189, 248, 0.12);
}

.cc-brand__sword {
  flex-shrink: 0;
  width: 28px;
  height: auto;
  display: block;
  animation: exl-blade-shine 2.8s ease-in-out infinite;
}

.cc-brand__name {
  font-family: var(--nx-serif);
  font-style: italic;
  font-weight: 700;
  font-variation-settings: "wdth" var(--exl-wdth-display);
  font-size: 1.5rem;
  letter-spacing: 0.18em;
  line-height: 1;
  text-transform: lowercase;
  background: linear-gradient(100deg, #7dd3fc 0%, #f0f9ff 24%, #38bdf8 48%, #93c5fd 72%, #bae6fd 100%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: exl-name-shimmer 8s linear infinite;
}

.cc-nav {
  flex: 1;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.cc-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--nx-r2);
  font-weight: 600;
  font-size: 14px;
  color: var(--nx-muted);
  transition: color 0.22s ease, background 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}

.cc-nav a svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.85;
}

.cc-nav a:hover {
  color: var(--nx-text);
  background: rgba(56, 189, 248, 0.08);
  transform: translateX(2px);
  box-shadow: inset 3px 0 0 rgba(56, 189, 248, 0.45);
}

.cc-nav a.is-active {
  color: #ecfeff;
  background: linear-gradient(120deg, #0891b2, #0369a1);
  box-shadow: 0 0 26px rgba(14, 165, 233, 0.28);
  transform: translateX(0);
}

.cc-nav a.is-active svg {
  opacity: 1;
}

.cc-nav-rule {
  height: 1px;
  margin: 12px 4px 8px;
  background: var(--nx-line2);
}

.cc-nav-label {
  padding: 4px 14px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--nx-muted);
}

.cc-sidebar-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 18px;
  border-top: 1px solid var(--nx-line2);
  background: rgba(0, 0, 0, 0.2);
}

.cc-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--nx-elev);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--nx-amber2);
  flex-shrink: 0;
}

.cc-user-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cc-user-meta strong {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cc-user-meta span {
  font-size: 11px;
  color: var(--nx-muted);
}

.cc-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--nx-r2);
  border: 1px solid var(--nx-line2);
  display: grid;
  place-items: center;
  color: var(--nx-muted);
  transition: color 0.15s, border-color 0.15s;
}

.cc-icon-btn:hover {
  color: var(--nx-danger);
  border-color: rgba(248, 113, 113, 0.35);
}

.cc-icon-btn svg {
  width: 18px;
  height: 18px;
}

.cc-main {
  flex: 1;
  min-width: 0;
  padding: 28px 24px 48px;
  max-width: 1120px;
}

/* Настройки: на ПК на всю ширину окна минус сайдбар */
.cc-main--wide {
  max-width: none;
  width: 100%;
  padding-left: clamp(20px, 3vw, 48px);
  padding-right: clamp(20px, 3vw, 48px);
}

.cc-main--wide .cc-settings-grid {
  width: 100%;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: clamp(16px, 2vw, 24px);
}

/* Три колонки только если на странице реально три карточки (админ); иначе auto-fit тянет одну на всю ширину */
@media (min-width: 1200px) {
  .cc-main--wide .cc-settings-grid:has(> .cc-card:nth-child(3):not([hidden])) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.cc-mobile-btn {
  display: none;
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  z-index: 140;
  width: 48px;
  height: 48px;
  border-radius: var(--nx-r2);
  border: 1px solid var(--nx-line2);
  background: rgba(10, 28, 52, 0.92);
  backdrop-filter: blur(12px);
  color: var(--nx-text);
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4), 0 0 20px rgba(14, 165, 233, 0.12);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.15s ease,
    left 0.28s cubic-bezier(0.32, 0.72, 0, 1),
    right 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(56, 189, 248, 0.2);
}

.cc-mobile-btn:hover {
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 24px rgba(56, 189, 248, 0.2);
}

.cc-mobile-btn:active {
  transform: scale(0.96);
}

.cc-mobile-btn svg {
  width: 22px;
  height: 22px;
}

/* Внутри .cc-app: затемнение над main, но под сайдбаром (см. mobile z-index) */
.cc-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.cc-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* Открытое меню: кнопка уезжает вправо, чтобы не перекрывать сайдбар (иначе z-index бургера выше — тапы не доходят до вкладок) */
body.drawer-open .cc-mobile-btn {
  left: auto;
  right: max(14px, env(safe-area-inset-right));
}

/* ——— Page header ——— */
.cc-page-head {
  margin-bottom: 28px;
}

.cc-page-head h1 {
  margin: 0 0 8px;
  font-family: var(--nx-serif);
  font-style: italic;
  font-variation-settings: "wdth" var(--exl-wdth-display);
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.15;
  text-shadow: 0 0 40px rgba(56, 189, 248, 0.15);
}

.cc-page-head p {
  margin: 0;
  color: var(--nx-muted);
  max-width: 52ch;
}

.cc-page-head .cc-mono {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.45;
  max-width: 100%;
  color: var(--nx-muted);
}

.cc-page-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.cc-back {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--nx-muted);
  margin-bottom: 10px;
}

.cc-back:hover {
  color: var(--nx-amber2);
}

/* ——— Stats ——— */
.cc-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

@media (max-width: 640px) {
  .cc-stats {
    grid-template-columns: 1fr;
  }
}

.cc-stat {
  padding: 18px 16px;
  border-radius: var(--nx-r);
  border: 1px solid var(--nx-line2);
  background: var(--nx-surface);
}

.cc-stat b {
  display: block;
  font-family: var(--nx-serif);
  font-style: italic;
  font-variation-settings: "wdth" var(--exl-wdth-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.05;
  margin-bottom: 6px;
}

.cc-stat span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--nx-muted);
}

.cc-stat--accent b {
  color: var(--nx-amber2);
}

.cc-stat--ok b {
  color: var(--nx-ok);
}

.cc-stat--mute b {
  color: var(--nx-muted);
}

/* ——— Panels ——— */
.cc-panel {
  border-radius: var(--nx-r);
  border: 1px solid var(--nx-line);
  background: linear-gradient(180deg, rgba(15, 35, 62, 0.55), rgba(6, 16, 32, 0.92));
  overflow: hidden;
}

.cc-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--nx-line2);
}

.cc-panel-head--stack {
  flex-direction: column;
  align-items: stretch;
}

.cc-panel-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--nx-muted);
}

.cc-home-device-single {
  max-width: 420px;
  margin: 0 auto;
  min-width: 0;
}

.cc-home-device-single .cc-device-card {
  width: 100%;
}

.cc-empty-card {
  text-align: center;
  padding: 36px 20px;
  color: var(--nx-muted);
  border: 1px dashed var(--nx-line2);
  border-radius: var(--nx-r);
  background: rgba(0, 0, 0, 0.15);
}

/* ——— Device cards ——— */
.cc-device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 14px;
  width: 100%;
  min-width: 0;
}

/* Одна «плашка» загрузки/пусто на всю ширину сетки, а не узкая колонка */
.cc-device-grid > .cc-empty-card {
  grid-column: 1 / -1;
}

.cc-device-card {
  display: block;
  min-width: 0;
  width: 100%;
  padding: 18px;
  border-radius: var(--nx-r);
  border: 1px solid var(--nx-line2);
  background: var(--nx-surface);
  transition: border-color 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}

.cc-device-card:hover {
  border-color: rgba(56, 189, 248, 0.45);
  transform: translateY(-3px);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.4), 0 0 28px rgba(14, 165, 233, 0.12);
}

.cc-device-card--home {
  border-color: rgba(56, 189, 248, 0.38);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.14), 0 0 32px rgba(14, 165, 233, 0.1);
}

.cc-device-card__top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  min-width: 0;
}

.cc-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--nx-muted);
  flex-shrink: 0;
}

.cc-dot--on {
  background: var(--nx-ok);
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.45);
}

.cc-device-card__title {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.cc-device-card__id {
  display: block;
  font-size: 12px;
  color: var(--nx-muted);
  margin-bottom: 14px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.cc-dl {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  font-size: 13px;
}

.cc-dl > div {
  min-width: 0;
}

.cc-dl dt {
  margin: 0;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--nx-muted);
}

.cc-dl dd {
  margin: 3px 0 0;
  font-weight: 600;
  overflow-wrap: break-word;
}

.cc-device-card__foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--nx-line2);
  font-size: 12px;
  color: var(--nx-muted);
}

@media (max-width: 900px) {
  .cc-dl {
    grid-template-columns: 1fr;
  }
}

/* ——— Toolbar ——— */
.cc-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  align-items: flex-end;
}

.cc-search {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 4px 12px;
  border-radius: var(--nx-r2);
  border: 1px solid var(--nx-line2);
  background: rgba(0, 0, 0, 0.25);
}

.cc-search svg {
  width: 18px;
  height: 18px;
  color: var(--nx-muted);
  flex-shrink: 0;
}

.cc-search input {
  flex: 1;
  min-width: 0;
  padding: 10px 8px;
  border: none;
  background: transparent;
  outline: none;
}

.cc-seg {
  display: flex;
  padding: 4px;
  border-radius: var(--nx-r2);
  border: 1px solid var(--nx-line2);
  background: rgba(0, 0, 0, 0.25);
}

.cc-seg button {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--nx-muted);
}

.cc-seg button.is-active {
  background: rgba(56, 189, 248, 0.16);
  color: var(--nx-amber2);
}

/* ——— Tables ——— */
.cc-table-wrap {
  overflow: auto;
  border-radius: var(--nx-r2);
  border: 1px solid var(--nx-line2);
  background: var(--nx-surface);
}

.cc-panel--sms {
  border: 1px solid var(--nx-line);
  background: linear-gradient(180deg, rgba(12, 36, 62, 0.45), rgba(5, 14, 30, 0.95));
  border-radius: var(--nx-r);
  overflow: hidden;
}

.cc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.cc-table th,
.cc-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--nx-line2);
  vertical-align: top;
}

.cc-table th {
  position: sticky;
  top: 0;
  background: var(--nx-elev);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--nx-muted);
  z-index: 1;
}

.cc-empty {
  text-align: center;
  color: var(--nx-muted);
  padding: 24px 12px !important;
}

.cc-sms-text {
  word-break: break-word;
  max-width: 360px;
}

@media (max-width: 768px) {
  .cc-table-wrap--sms .cc-table--sms thead {
    display: none;
  }

  .cc-table-wrap--sms .cc-table--sms tr {
    display: block;
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--nx-line2);
  }

  .cc-table-wrap--sms .cc-table--sms td {
    display: block;
    padding: 6px 0;
    border: none;
  }

  .cc-table-wrap--sms .cc-table--sms td::before {
    content: attr(data-label);
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--nx-muted);
    margin-bottom: 4px;
  }
}

/* ——— Cards & forms ——— */
.cc-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 16px;
  align-items: start;
}

.cc-main > .cc-card {
  margin-bottom: 16px;
}

.cc-main > .cc-card:last-child {
  margin-bottom: 0;
}

.cc-card {
  border-radius: 12px;
  border: 1px solid var(--nx-line);
  background: var(--nx-surface);
  overflow: hidden;
  transition: border-color 0.28s ease, box-shadow 0.28s ease;
}

.cc-card:hover {
  border-color: rgba(56, 189, 248, 0.22);
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.06), 0 14px 48px rgba(0, 0, 0, 0.28);
}

.cc-card > h2 {
  margin: 0;
  padding: 14px 18px;
  font-family: var(--nx-serif);
  font-style: italic;
  font-variation-settings: "wdth" 108;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  line-height: 1.2;
  color: var(--nx-muted);
  border-bottom: 1px solid var(--nx-line2);
}

.cc-card-body {
  padding: 18px 18px 22px;
}

.cc-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

/* Номер + SIM в одну линию одинаковой высоты */
.cc-form-grid--sms-row {
  grid-template-columns: 1fr;
  align-items: stretch;
}

@media (min-width: 520px) {
  .cc-form-grid--sms-row {
    grid-template-columns: 1fr 1fr;
  }
}

.cc-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.cc-field--full {
  grid-column: 1 / -1;
}

.cc-field__lab {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--nx-muted);
}

.cc-field input,
.cc-field select,
.cc-field textarea {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--nx-line2);
  background: var(--nx-elev);
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.cc-field input,
.cc-field select {
  min-height: 44px;
  padding: 10px 12px;
  line-height: 1.25;
}

.cc-field select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--nx-elev);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a8a29e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.cc-field textarea {
  min-height: 96px;
  padding: 10px 12px;
  line-height: 1.45;
  resize: vertical;
}

.cc-field input:focus,
.cc-field select:focus,
.cc-field textarea:focus {
  border-color: rgba(56, 189, 248, 0.5);
}

.cc-hint {
  font-size: 12px;
  color: var(--nx-muted);
  margin-top: 6px;
  line-height: 1.45;
}

.cc-hint code {
  font-family: var(--nx-mono);
  font-size: 11px;
  color: var(--nx-amber2);
}

.cc-form-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.cc-form-status {
  font-size: 13px;
  color: var(--nx-muted);
}

.cc-form-status--ok {
  color: var(--nx-ok);
}

.cc-form-status--err {
  color: var(--nx-danger);
}

.cc-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 6px;
  vertical-align: middle;
}

.cc-badge--ussd {
  background: rgba(56, 189, 248, 0.18);
  color: #7dd3fc;
}

.cc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: var(--nx-r2);
  font-weight: 700;
  font-size: 14px;
  transition: transform 0.12s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.cc-btn:active {
  transform: scale(0.98);
}

.cc-btn--primary {
  background: linear-gradient(135deg, #22d3ee, #0369a1);
  color: #020617;
  border: none;
}

.cc-btn--primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 24px rgba(14, 165, 233, 0.35);
}

.cc-btn--ghost {
  border: 1px solid var(--nx-line2);
  color: var(--nx-muted);
  background: transparent;
}

.cc-btn--ghost:hover {
  border-color: var(--nx-amber);
  color: var(--nx-amber2);
}

.cc-btn--danger {
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
  background: rgba(248, 113, 113, 0.06);
}

.cc-btn--danger:hover {
  border-color: var(--nx-danger);
}

.cc-btn--sm {
  padding: 6px 12px;
  font-size: 12px;
}

.cc-btn--block {
  width: 100%;
}

.cc-kv-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

/* Карточка устройства: ровная сетка 2×2, последняя строка на всю ширину */
.cc-kv-grid--device {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 720px) {
  .cc-kv-grid--device {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.cc-kv {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  min-height: 72px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--nx-line2);
  background: rgba(0, 0, 0, 0.22);
  min-width: 0;
}

.cc-kv--full {
  grid-column: 1 / -1;
  min-height: 0;
}

.cc-kv span {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--nx-muted);
  margin: 0;
  line-height: 1.2;
}

.cc-kv strong {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--nx-text);
  overflow-wrap: break-word;
}

.cc-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.cc-pill--muted {
  background: rgba(255, 255, 255, 0.06);
  color: var(--nx-muted);
}

.cc-pill--accent {
  background: rgba(56, 189, 248, 0.18);
  color: var(--nx-amber2);
}

.cc-inline-link {
  color: var(--nx-amber2);
  text-decoration: underline;
  font-weight: 600;
}

/* ——— Login ——— */
.cc-login-page {
  min-height: 100vh;
}

.cc-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.cc-login__panel {
  width: 100%;
  max-width: 400px;
  padding: 36px 32px 40px;
  border-radius: var(--nx-r);
  border: 1px solid var(--nx-line);
  background: linear-gradient(165deg, rgba(12, 36, 62, 0.82), rgba(3, 8, 20, 0.96));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 60px rgba(14, 165, 233, 0.08);
}

.cc-login__brand {
  margin-bottom: 24px;
  text-align: center;
}

.cc-login__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 10px;
}

.cc-login__sword {
  flex-shrink: 0;
  animation: exl-blade-shine 2.8s ease-in-out infinite;
}

.cc-login__logo {
  display: block;
  font-family: var(--nx-serif);
  font-style: italic;
  font-variation-settings: "wdth" var(--exl-wdth-display);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: lowercase;
  background: linear-gradient(100deg, #7dd3fc, #f0f9ff, #38bdf8, #bae6fd);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: exl-name-shimmer 8s linear infinite;
}

.cc-login__tag {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--nx-muted);
}

.cc-login__err {
  padding: 10px 14px;
  border-radius: var(--nx-r2);
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
  font-size: 13px;
  margin-bottom: 16px;
}

.cc-login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cc-login__hint {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--nx-muted);
  text-align: center;
}

.cc-login__hint code {
  font-family: var(--nx-mono);
  color: var(--nx-amber2);
  font-size: 11px;
}

/* ——— Toast ——— */
.cc-toast-host {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}

.cc-toast {
  padding: 12px 16px;
  border-radius: var(--nx-r2);
  background: var(--nx-surface);
  border: 1px solid var(--nx-line);
  color: var(--nx-text);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.cc-toast.cc-toast--show {
  opacity: 1;
  transform: translateY(0);
}

.cc-toast--ok {
  border-color: rgba(74, 222, 128, 0.4);
}

.cc-toast--err {
  border-color: rgba(248, 113, 113, 0.45);
}

/* ——— Home overview (donut / rings) ——— */
.cc-main--home {
  max-width: 1200px;
}

.cc-home-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 28px;
}

.cc-home-hero h1 {
  margin: 0 0 8px;
  font-family: var(--nx-serif);
  font-style: italic;
  font-variation-settings: 'wdth' var(--exl-wdth-display);
  font-size: clamp(1.85rem, 4.2vw, 2.5rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.12;
  text-shadow: 0 0 48px rgba(56, 189, 248, 0.12);
}

.cc-home-hero p {
  margin: 0;
  max-width: 52ch;
  color: var(--nx-muted);
  font-size: 14px;
  line-height: 1.5;
}

.cc-home-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
}

@media (min-width: 880px) {
  .cc-home-layout {
    grid-template-columns: 1.35fr 0.65fr;
    grid-template-rows: auto auto;
    align-items: start;
  }

  .cc-home-panel--android {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .cc-home-panel--ring {
    grid-column: 2;
    grid-row: 1;
  }

  .cc-home-panel--recent {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}

.cc-home-panel {
  border-radius: 14px;
  border: 1px solid var(--nx-line);
  background: linear-gradient(165deg, rgba(12, 36, 62, 0.55), rgba(5, 14, 30, 0.92));
  overflow: hidden;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.cc-home-panel:hover {
  border-color: rgba(56, 189, 248, 0.22);
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.06), 0 18px 48px rgba(0, 0, 0, 0.28);
}

.cc-home-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--nx-line2);
}

.cc-home-panel--ring > h2 {
  margin: 0;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--nx-line2);
  font-family: var(--nx-serif);
  font-style: italic;
  font-variation-settings: 'wdth' 108;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--nx-muted);
}

.cc-home-panel__head h2 {
  margin: 0;
  padding: 0;
  border: none;
  font-family: var(--nx-serif);
  font-style: italic;
  font-variation-settings: 'wdth' 108;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--nx-muted);
}

.cc-home-panel__tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--nx-amber2);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.08);
}

.cc-home-android {
  display: grid;
  gap: 22px;
  padding: 20px 18px 24px;
  grid-template-columns: 1fr;
  align-items: center;
}

@media (min-width: 520px) {
  .cc-home-android {
    grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
  }
}

.cc-home-donut-wrap {
  position: relative;
  width: min(260px, 78vw);
  max-width: 100%;
  margin: 0 auto;
  aspect-ratio: 1;
}

.cc-home-donut {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from -90deg, #1e293b 0deg 360deg);
  box-shadow:
    0 0 0 1px rgba(56, 189, 248, 0.12),
    0 12px 48px rgba(0, 0, 0, 0.35);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 42px), #000 calc(100% - 41px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 42px), #000 calc(100% - 41px));
}

.cc-home-donut-core {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, rgba(56, 189, 248, 0.08), var(--nx-surface) 55%);
  border: 1px solid var(--nx-line2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 2px;
  padding: 8px;
}

.cc-home-donut-core b {
  font-family: var(--nx-serif);
  font-style: italic;
  font-size: clamp(1.5rem, 5vw, 1.85rem);
  font-weight: 700;
  line-height: 1;
  color: var(--nx-amber2);
}

.cc-home-donut-core span {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--nx-muted);
}

.cc-home-donut-empty {
  text-align: center;
  padding: 28px 16px;
  color: var(--nx-muted);
  font-size: 14px;
  border: 1px dashed var(--nx-line2);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.15);
}

.cc-home-donut-empty[hidden],
.cc-home-donut-wrap[hidden] {
  display: none !important;
}

.cc-home-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cc-home-legend li {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 10px 12px;
  align-items: center;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid transparent;
}

.cc-home-legend li:hover {
  border-color: rgba(56, 189, 248, 0.15);
}

.cc-home-legend__sw {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.12);
}

.cc-home-legend__lab {
  font-weight: 600;
  color: var(--nx-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cc-home-legend__val {
  font-family: var(--nx-mono);
  font-style: italic;
  font-size: 12px;
  color: var(--nx-muted);
  white-space: nowrap;
}

.cc-home-ring-block {
  padding: 18px 18px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

@media (min-width: 400px) {
  .cc-home-ring-block {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
  }
}

.cc-home-ring-wrap {
  position: relative;
  width: 160px;
  height: 160px;
  flex-shrink: 0;
}

.cc-home-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 22px), #000 calc(100% - 21px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 22px), #000 calc(100% - 21px));
  box-shadow: 0 0 32px rgba(74, 222, 128, 0.08);
}

.cc-home-ring-core {
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: var(--nx-surface);
  border: 1px solid var(--nx-line2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 2px;
}

.cc-home-ring-core b {
  font-family: var(--nx-serif);
  font-style: italic;
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--nx-ok);
  line-height: 1;
}

.cc-home-ring-core span {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--nx-muted);
}

.cc-home-ring-stats {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 320px;
}

.cc-home-ring-stats div {
  padding: 12px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--nx-line2);
  text-align: center;
}

.cc-home-ring-stats dt {
  margin: 0 0 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--nx-muted);
}

.cc-home-ring-stats dd {
  margin: 0;
  font-family: var(--nx-serif);
  font-style: italic;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--nx-text);
}

.cc-home-recent-slot {
  padding: 18px 18px 22px;
}

.cc-home-recent-slot .cc-home-device-single {
  max-width: 480px;
  margin: 0 auto;
}

/* ——— Mobile drawer ——— */
@media (max-width: 900px) {
  .cc-app {
    position: relative;
    isolation: isolate;
  }

  .cc-mobile-btn {
    display: flex;
  }

  .cc-overlay {
    z-index: 1;
  }

  .cc-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 88vw);
    z-index: 2;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.4);
    padding-top: env(safe-area-inset-top);
  }

  .cc-sidebar.sidebar-open {
    transform: translateX(0);
  }

  .cc-brand {
    padding-top: max(14px, calc(env(safe-area-inset-top) * 0.35 + 8px));
    padding-bottom: 14px;
  }

  .cc-nav a {
    min-height: 52px;
    padding: 14px 16px;
    -webkit-tap-highlight-color: rgba(56, 189, 248, 0.18);
    touch-action: manipulation;
  }

  .cc-nav a:active {
    background: rgba(56, 189, 248, 0.12);
  }

  .cc-sidebar-foot {
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

  .cc-icon-btn {
    min-width: 48px;
    min-height: 48px;
    touch-action: manipulation;
  }

  .cc-main {
    position: relative;
    z-index: 0;
    padding: 72px 16px 40px;
    max-width: none;
  }

  .cc-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .cc-seg button {
    flex: 1;
    text-align: center;
    min-height: 48px;
    touch-action: manipulation;
  }

  .cc-toast-host {
    left: 14px;
    right: 14px;
  }

  /* Весь шелл под кнопкой меню, но внутри шелла сайдбар > оверлей > main — затемнение не перекрывает вкладки */
  body.drawer-open .cc-app {
    z-index: 100;
  }

  body.drawer-open .cc-mobile-btn {
    z-index: 160;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cc-spinner,
  .cc-brand__sword,
  .cc-login__sword {
    animation: none;
  }

  .cc-brand__name,
  .cc-login__logo {
    animation: none;
  }

  body::before {
    animation: none;
  }
}
