/* ====================================================
   EXL PANEL — App pages layout
   ==================================================== */

/* ——— Body ——— */
body.xl-body {
  min-height: 100svh;
  min-height: 100dvh;
  padding-top: calc(var(--header-h) + var(--safe-top));
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

/* ——— Blade rail (left edge accent) ——— */
body.xl-body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  z-index: 350;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, var(--cyan) 18%, rgba(255,255,255,0.85) 50%, var(--cyan) 82%, transparent 100%);
  box-shadow: 0 0 18px rgba(34,211,238,0.55), 2px 0 28px rgba(34,211,238,0.25);
  opacity: 0;
  animation: blade-rail-in 0.85s cubic-bezier(0.22,1,0.36,1) 0.05s both;
}

@keyframes blade-rail-in {
  0%   { transform: scaleY(0); transform-origin: top; opacity: 0; }
  35%  { opacity: 1; }
  100% { transform: scaleY(1); transform-origin: top; opacity: 0.55; }
}

/* ——— Diagonal page slash on load ——— */
.xl-main::before {
  content: '';
  position: fixed;
  top: -10%;
  left: -20%;
  width: 140%;
  height: 2px;
  z-index: 9990;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--cyan) 38%, rgba(255,255,255,0.95) 50%, var(--cyan) 62%, transparent);
  box-shadow: 0 0 22px var(--cyan), 0 0 60px rgba(34,211,238,0.35);
  transform: rotate(-8deg);
  transform-origin: left center;
  animation: page-slash 0.7s cubic-bezier(0.22,1,0.36,1) 0.12s both;
}

@keyframes page-slash {
  0%   { transform: rotate(-8deg) scaleX(0); opacity: 0; }
  20%  { opacity: 1; }
  75%  { transform: rotate(-8deg) scaleX(1); opacity: 1; }
  100% { transform: rotate(-8deg) scaleX(1); opacity: 0; }
}

/* ——— Header ——— */
.xl-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--header-h) + var(--safe-top));
  padding-top: var(--safe-top);
  z-index: 400;
  border-bottom: 1px solid var(--line);
  background: rgba(2,7,18,0.92);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
}

/* Subtle cyan accent line at bottom of header */
.xl-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.4;
}

.xl-header__inner {
  max-width: 1440px;
  margin: 0 auto;
  height: var(--header-h);
  padding: 0 max(14px, var(--safe-left)) 0 max(14px, var(--safe-right));
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* Brand */
.xl-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
  padding: 6px 10px 6px 4px;
  border-radius: 10px;
  transition: background 0.15s;
}

.xl-brand:hover { background: var(--cyan-dim); }

.xl-brand img {
  width: 18px;
  height: auto;
  filter: drop-shadow(0 0 6px rgba(34,211,238,0.5));
}

.xl-brand-name {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: lowercase;
  background: linear-gradient(135deg, #bae6fd, #22d3ee, #7dd3fc);
  background-size: 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer-slow 8s linear infinite;
}

@keyframes shimmer-slow {
  0%   { background-position: 0% center; }
  100% { background-position: 250% center; }
}

/* Nav */
.xl-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  padding: 0 8px;
}

.xl-nav__item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.xl-nav__item svg {
  width: 15px;
  height: 15px;
  opacity: 0.7;
}

.xl-nav__item:hover {
  color: var(--text);
  background: var(--cyan-dim);
}

.xl-nav__item.is-active {
  color: #ecfeff;
  background: linear-gradient(135deg, rgba(8,145,178,0.45), rgba(3,105,161,0.35));
  box-shadow: inset 0 0 0 1px rgba(56,189,248,0.25);
}

.xl-nav__item.is-active svg { opacity: 1; }

/* Active indicator dot */
.xl-nav__item.is-active::before {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
}

/* Header actions */
.xl-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

/* User chip */
.xl-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: var(--elev);
}

.xl-user__ava {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0891b2, #0369a1);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
}

.xl-user__info { display: flex; flex-direction: column; gap: 1px; }

.xl-user__name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xl-user__role {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Burger */
.xl-burger {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--line2);
  background: var(--elev);
  color: var(--text);
  place-items: center;
  cursor: pointer;
  transition: border-color 0.15s;
}

.xl-burger:hover { border-color: var(--line); }
.xl-burger svg { width: 18px; height: 18px; }

/* Overlay */
.xl-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 380;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(3px);
}

.xl-overlay.is-active { display: block; }

/* ——— Main content ——— */
.xl-main {
  width: 100%;
  max-width: 1440px;
  min-width: 0;
  margin: 0 auto;
  padding:
    clamp(18px, 3vw, 28px)
    max(var(--page-pad), var(--safe-left))
    max(48px, calc(24px + var(--safe-bottom)))
    max(var(--page-pad), var(--safe-right));
  animation: rise 0.45s cubic-bezier(0.22,1,0.36,1) 0.1s both;
}

/* ——— Page header ——— */
.xl-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: clamp(18px, 3vw, 28px);
}

.xl-page-head > .cc-btn,
.xl-page-head > a.cc-btn {
  width: 100%;
}

@media (min-width: 640px) {
  .xl-page-head > .cc-btn,
  .xl-page-head > a.cc-btn {
    width: auto;
    flex-shrink: 0;
  }
}

.xl-eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cyan);
}

.xl-page-title {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.xl-page-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.xl-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.15s;
}

.xl-back:hover { color: var(--cyan2); }

/* ——— Stat cards ——— */
.xl-stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.xl-stat-row .xl-stat:nth-child(1) { animation-delay: 0.04s; }
.xl-stat-row .xl-stat:nth-child(2) { animation-delay: 0.1s; }
.xl-stat-row .xl-stat:nth-child(3) { animation-delay: 0.16s; }

.xl-stat {
  padding: 20px 22px;
  border-radius: var(--r);
  border: 1px solid var(--line2);
  background: linear-gradient(145deg, var(--elev) 0%, var(--surface) 100%);
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  animation: pop-in 0.4s cubic-bezier(0.22,1,0.36,1) both;
  box-shadow: var(--shadow-card);
}

.xl-stat:hover {
  border-color: var(--line);
  box-shadow: 0 4px 24px rgba(34,211,238,0.06);
}

.xl-stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56,189,248,0.4), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.xl-stat:hover::before { opacity: 1; }

.xl-stat__val {
  display: block;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text);
}

.xl-stat__val--ok { color: var(--ok); }

.xl-stat__lab {
  display: block;
  margin-top: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ——— Bento grid (home) ——— */
.xl-bento {
  display: grid;
  grid-template-columns: 1.4fr 0.6fr;
  grid-template-rows: auto auto;
  gap: 16px;
}

.xl-tile {
  border-radius: var(--r);
  border: 1px solid var(--line2);
  background: linear-gradient(160deg, rgba(13,23,41,0.95) 0%, var(--surface) 100%);
  padding: 22px 24px;
  min-width: 0;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  animation: pop-in 0.45s cubic-bezier(0.22,1,0.36,1) both;
  box-shadow: var(--shadow-card);
}

.xl-bento .xl-tile:nth-child(1) { animation-delay: 0.06s; }
.xl-bento .xl-tile:nth-child(2) { animation-delay: 0.12s; }
.xl-bento .xl-tile:nth-child(3) { animation-delay: 0.18s; }

.xl-tile:hover {
  border-color: rgba(56,189,248,0.28);
  box-shadow: 0 8px 32px rgba(34,211,238,0.08), var(--shadow-card);
  transform: translateY(-2px);
}

.xl-tile--span2 { grid-column: 1 / -1; }

.xl-tile__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.xl-tile__head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.xl-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--elev2);
  border: 1px solid var(--line2);
  color: var(--muted);
}

/* Charts */
.xl-chart-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
}

.xl-donut-box {
  position: relative;
  width: 148px;
  height: 148px;
  flex-shrink: 0;
}

.xl-donut { width: 100%; height: 100%; border-radius: 50%; }

.xl-donut-core {
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 2px;
}

.xl-donut-core b {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--cyan2);
  line-height: 1;
}

.xl-donut-core span {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.xl-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.xl-legend li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
}

.xl-legend i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}

.xl-legend span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.xl-legend b {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

/* Ring */
.xl-ring-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 100%;
  min-height: 160px;
}

.xl-ring-wrap {
  position: relative;
  width: 130px;
  height: 130px;
}

.xl-ring { width: 100%; height: 100%; border-radius: 50%; }

.xl-ring-core {
  position: absolute;
  inset: 20%;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.xl-ring-core b {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ok);
  line-height: 1;
}

.xl-ring-core span {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* ——— Devices list ——— */
.xl-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: var(--r);
  border: 1px solid var(--line2);
  background: var(--surface);
}

.xl-toolbar .cc-search { flex: 1 1 100%; min-width: 0; }

.xl-toolbar .cc-seg {
  flex: 1 1 100%;
  display: flex;
}

.xl-toolbar .cc-seg button {
  flex: 1;
  min-width: 0;
}

@media (min-width: 640px) {
  .xl-toolbar { align-items: center; }
  .xl-toolbar .cc-search { flex: 1 1 220px; }
  .xl-toolbar .cc-seg { flex: 0 1 auto; }
  .xl-toolbar .cc-seg button { flex: initial; }
}

.xl-actions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: clamp(14px, 2.5vw, 16px) clamp(16px, 2.5vw, 20px);
  margin-bottom: 16px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: linear-gradient(120deg, rgba(8,47,73,0.3), var(--surface));
}

.xl-actions-bar p { margin: 0; flex: 1 1 220px; min-width: 0; }

.xl-actions-bar__btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1 1 100%;
}

@media (min-width: 720px) {
  .xl-actions-bar__btns {
    flex: 0 1 auto;
    justify-content: flex-end;
  }
}

.xl-actions-bar__btns .cc-btn {
  flex: 1 1 auto;
  min-width: 0;
  white-space: normal;
  text-align: center;
}

@media (min-width: 480px) {
  .xl-actions-bar__btns .cc-btn {
    flex: 0 1 auto;
    white-space: nowrap;
  }
}

/* Device rows */
.xl-device-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.xl-dev {
  display: grid;
  grid-template-columns: 4px 1fr auto;
  align-items: center;
  border-radius: var(--r);
  border: 1px solid var(--line2);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
  animation: rise 0.35s cubic-bezier(0.22,1,0.36,1) both;
}

.xl-dev:hover {
  border-color: rgba(56,189,248,0.35);
  background: rgba(56,189,248,0.04);
  transform: translateX(3px);
}

.xl-dev__bar {
  align-self: stretch;
  min-height: 56px;
  background: rgba(100,116,139,0.3);
}

.xl-dev[data-status='online'] .xl-dev__bar {
  background: linear-gradient(180deg, var(--ok), #16a34a);
  box-shadow: 2px 0 10px rgba(74,222,128,0.3);
}

.xl-dev__body {
  padding: 14px 16px;
  min-width: 0;
}

.xl-dev__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.xl-dev__head strong { font-size: 14px; font-weight: 700; }

.xl-dev__id {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
  word-break: break-all;
}

.xl-dev__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12px;
  color: var(--muted);
}

.xl-dev__arrow {
  padding: 0 20px 0 12px;
  font-size: 16px;
  color: var(--muted);
  opacity: 0.4;
  transition: opacity 0.15s, transform 0.15s;
}

.xl-dev:hover .xl-dev__arrow {
  opacity: 0.8;
  transform: translateX(3px);
}

/* ——— Device detail ——— */
.xl-kv-bar {
  padding: 18px 20px;
  border-radius: var(--r);
  border: 1px solid var(--line2);
  background: var(--surface);
  margin-bottom: 20px;
}

.xl-device-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}

.xl-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Panel card */
.xl-panel {
  border-radius: var(--r);
  border: 1px solid var(--line2);
  background: var(--surface);
  overflow: hidden;
  animation: pop-in 0.4s cubic-bezier(0.22,1,0.36,1) both;
}

.xl-panel + .xl-panel { animation-delay: 0.05s; }

.xl-panel h2 {
  margin: 0;
  padding: 14px 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line2);
  background: var(--elev);
}

.xl-panel__body {
  padding: 18px 20px 22px;
}

.xl-panel .cc-table-wrap { max-height: 520px; }

/* ——— Settings ——— */
.xl-settings {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: start;
}

.xl-settings-nav {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  border-radius: var(--r);
  border: 1px solid var(--line2);
  background: var(--surface);
  overflow: hidden;
  animation: pop-in 0.4s cubic-bezier(0.22,1,0.36,1) both;
}

.xl-settings-nav button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  padding: 13px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 1px solid var(--line2);
  background: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.xl-settings-nav button:last-child { border-bottom: none; }

.xl-settings-nav button svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.6;
}

.xl-settings-nav button:hover {
  color: var(--text);
  background: var(--cyan-dim);
}

.xl-settings-nav button.is-active {
  color: var(--cyan2);
  background: linear-gradient(90deg, rgba(34,211,238,0.1), transparent);
  box-shadow: inset 3px 0 0 var(--cyan);
}

.xl-settings-nav button.is-active svg { opacity: 1; }

.xl-settings-panels { display: flex; flex-direction: column; gap: 0; }

.xl-settings-panels .xl-panel[hidden] { display: none !important; }

/* Security split */
.xl-security-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.xl-security-box {
  padding: 16px;
  border-radius: var(--r2);
  border: 1px solid var(--line2);
  background: rgba(0,0,0,0.15);
}

.xl-security-box__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

/* ========================================
   TABLET / MOBILE ≤ 1024px
   ======================================== */
@media (max-width: 1024px) {
  .xl-header__inner { padding: 0 max(12px, var(--safe-left)) 0 max(12px, var(--safe-right)); }

  .xl-burger { display: grid; }

  .xl-user__info { display: none; }

  .xl-nav {
    position: fixed;
    top: calc(var(--header-h) + var(--safe-top));
    left: 0;
    right: 0;
    flex: initial;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 12px max(14px, var(--safe-right)) 12px max(14px, var(--safe-left));
    background: rgba(2,7,18,0.98);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(20px);
    z-index: 390;
    transform: translateY(-110%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s cubic-bezier(0.22,1,0.36,1), opacity 0.25s ease;
    max-height: calc(100dvh - var(--header-h) - var(--safe-top));
    overflow-y: auto;
  }

  .xl-nav.xl-nav--open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .xl-nav__item {
    padding: 12px 14px;
    border-radius: var(--r2);
    justify-content: flex-start;
    font-size: 14px;
  }

  .xl-nav__item.is-active::before { display: none; }

  .xl-bento { grid-template-columns: 1fr; }
  .xl-tile--span2 { grid-column: 1; }

  .xl-device-grid { grid-template-columns: 1fr; }

  .xl-settings { grid-template-columns: 1fr; gap: 16px; }

  .xl-settings-nav {
    position: static;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    overflow: visible;
    border-radius: var(--r);
  }

  .xl-settings-nav button {
    flex: none;
    width: 100%;
    border-bottom: 1px solid var(--line2);
    border-right: none;
    justify-content: flex-start;
    padding: 14px 16px;
    font-size: 14px;
    text-align: left;
    min-width: 0;
  }

  .xl-settings-nav button:last-child { border-bottom: none; }

  .xl-settings-nav button.is-active {
    box-shadow: inset 3px 0 0 var(--cyan);
    background: linear-gradient(90deg, rgba(34,211,238,0.1), transparent);
  }

  .xl-security-split { grid-template-columns: 1fr; }

  .dv-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .dv-card--sms { grid-column: auto; order: -1; }

  .dv-sms-form {
    padding: 16px;
    gap: 12px;
  }

  .dv-sms-form__row {
    grid-template-columns: 1fr;
  }

  .dv-sms-form textarea {
    min-height: 120px;
    font-size: 16px;
  }

  .dv-sms-form .cc-field input,
  .dv-sms-form .cc-field select {
    font-size: 16px;
    padding: 12px 14px;
  }

  .dv-form { grid-template-columns: 1fr; }
}

/* ========================================
   MOBILE ≤ 768px
   ======================================== */
@media (max-width: 768px) {
  .xl-stat-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .xl-stat { padding: 14px 12px; }
  .xl-stat__val { font-size: 1.5rem; }

  .xl-dev__arrow { display: none; }
  .xl-dev { grid-template-columns: 4px 1fr; }

  .xl-chart-row { flex-direction: column; align-items: flex-start; }
  .xl-donut-box { width: 120px; height: 120px; }

  .dv-head { padding: 16px 14px; }
  .dv-stats { grid-template-columns: 1fr 1fr; }
  .dv-table-wrap { max-height: min(420px, 50dvh); }

  .cc-table th,
  .cc-table td {
    padding: 9px 10px;
    font-size: 12px;
  }

  .cc-table--device { min-width: 520px; }
}

/* ========================================
   SMALL MOBILE ≤ 480px
   ======================================== */
@media (max-width: 480px) {
  .xl-brand-name { display: none; }

  .xl-stat-row { grid-template-columns: 1fr 1fr; }
  .xl-stat-row .xl-stat:last-child { grid-column: 1 / -1; }

  .xl-page-title { font-size: 1.35rem; }
  .xl-page-sub { font-size: 12px; }

  .xl-dev__body { padding: 12px 12px; }
  .xl-dev__meta { flex-direction: column; gap: 2px; font-size: 11px; }

  .xl-bento { gap: 12px; }
  .xl-tile { padding: 16px 14px; }

  .xl-kv-bar { padding: 14px 14px; }

  .dv-stats { grid-template-columns: 1fr; }
  .dv-panel__head { flex-direction: column; align-items: flex-start; }

  .dv-stat--wide { grid-column: 1 / -1; }

  .cc-table--device { min-width: 460px; }
}

/* ========================================
   DEVICE PAGE
   ======================================== */
.dv-page { display: flex; flex-direction: column; gap: 20px; }

.dv-head {
  padding: 22px 24px;
  border-radius: var(--r);
  border: 1px solid var(--line2);
  background: linear-gradient(145deg, var(--elev) 0%, var(--surface) 100%);
  box-shadow: var(--shadow-card);
}

.dv-head__row { margin-top: 8px; }

.dv-head__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
  background: rgba(100,116,139,0.15);
  border: 1px solid var(--line2);
  color: var(--muted);
}

.dv-head__status[data-status='online'] {
  background: var(--ok-dim);
  border-color: rgba(74,222,128,0.3);
  color: var(--ok);
}

.dv-head__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.dv-head__status[data-status='online'] .dv-head__dot {
  opacity: 1;
  box-shadow: 0 0 8px var(--ok);
}

.dv-head__title {
  margin: 0;
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  font-weight: 700;
  line-height: 1.15;
}

.dv-head__id {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.dv-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line2);
}

.dv-stat {
  padding: 12px 14px;
  border-radius: var(--r2);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--line2);
  min-width: 0;
}

.dv-stat--wide { grid-column: 1 / -1; }

.dv-stat__lab {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.dv-stat__val {
  display: block;
  font-size: 13px;
  font-weight: 700;
  word-break: break-word;
  line-height: 1.35;
}

/* Action cards */
.dv-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 14px;
}

.dv-card {
  border-radius: var(--r);
  border: 1px solid var(--line2);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  animation: pop-in 0.4s cubic-bezier(0.22,1,0.36,1) both;
}

.dv-card--sms { grid-column: span 1; }

@media (min-width: 1025px) {
  .dv-card--sms { grid-column: span 2; }
}

.dv-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line2);
  background: var(--elev);
}

.dv-card__head svg {
  width: 16px;
  height: 16px;
  color: var(--cyan);
  flex-shrink: 0;
}

.dv-card__head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.dv-card__body { padding: 16px 18px 18px; }

.dv-card__hint { margin: 0 0 12px; font-size: 12px; }

.dv-vnc-btns { display: flex; flex-direction: column; gap: 8px; }

/* SMS compose form */
.dv-sms-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px 20px;
}

.dv-sms-form__row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.dv-sms-form__sim select {
  width: 100%;
}

.dv-sms-form textarea {
  min-height: 96px;
  resize: vertical;
}

.dv-sms-form__foot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-top: 2px;
}

.dv-sms-form__foot .cc-form-status {
  text-align: center;
  min-height: 1.2em;
}

.dv-card--sms {
  border-color: rgba(56,189,248,0.2);
}

.dv-card--sms .dv-card__head {
  background: linear-gradient(90deg, rgba(34,211,238,0.08), var(--elev));
}

.dv-card--danger {
  border-color: rgba(239, 68, 68, 0.35);
}

.dv-card--danger .dv-card__head {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.1), var(--elev));
}

.dv-card--danger .dv-card__head svg {
  color: #f87171;
}

@media (min-width: 520px) {
  .dv-sms-form__row {
    grid-template-columns: 1fr min(140px, 32%);
    align-items: end;
  }
}

@media (min-width: 1025px) {
  .dv-sms-form {
    padding: 20px 22px 22px;
    gap: 16px;
  }

  .dv-sms-form__row {
    grid-template-columns: 1fr 160px;
  }

  .dv-sms-form textarea {
    min-height: 110px;
  }
}

.dv-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px 18px 18px;
}

.dv-form__wide { grid-column: 1 / -1; }

.dv-form__foot {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.dv-form--modal {
  padding: 0;
  margin-bottom: 20px;
}

.dv-modal__label {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.dv-modal-table { max-height: min(340px, 42vh); }

/* SMS feed: cards on mobile, table on desktop */
.dv-sms-feed { min-width: 0; }

.dv-sms-list {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 18px;
  max-height: min(560px, 65dvh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.dv-sms-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.dv-sms-card {
  padding: 14px 16px;
  border-radius: var(--r2);
  border: 1px solid var(--line2);
  background: var(--elev);
  border-left-width: 3px;
}

.dv-sms-card[data-dir='in'] {
  border-left-color: var(--ok);
  background: linear-gradient(90deg, rgba(74,222,128,0.06), var(--elev));
}

.dv-sms-card[data-dir='out'] {
  border-left-color: var(--cyan);
  background: linear-gradient(90deg, rgba(34,211,238,0.06), var(--elev));
}

.dv-sms-card[data-dir='delivery'] {
  border-left-color: var(--warn);
  background: linear-gradient(90deg, rgba(251,191,36,0.06), var(--elev));
}

.dv-sms-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 10px;
}

.dv-sms-card__contact {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  word-break: break-all;
}

.dv-sms-card__time {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.dv-sms-card__body {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
  color: var(--text);
}

@media (max-width: 768px) {
  .dv-panel--sms .dv-panel__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 14px 16px;
  }

  .dv-panel--sms .dv-panel__head .cc-muted {
    font-size: 11px;
    line-height: 1.45;
  }

  .dv-sms-list { display: flex; }

  .dv-sms-table-wrap { display: none; }
}

/* SMS / passwords panels */
.dv-panel {
  border-radius: var(--r);
  border: 1px solid var(--line2);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  animation: pop-in 0.45s cubic-bezier(0.22,1,0.36,1) 0.08s both;
}

.dv-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line2);
  background: var(--elev);
}

.dv-panel__head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.dv-panel__head .cc-muted {
  margin: 0;
  font-size: 11px;
  max-width: 100%;
}

.dv-table-wrap {
  overflow: auto;
  max-width: 100%;
  max-height: min(560px, 65dvh);
  -webkit-overflow-scrolling: touch;
}

.cc-table--device { min-width: 520px; }

.cc-table--device .cc-sms-text {
  max-width: 360px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.45;
}

/* ========================================
   HOME / OVERVIEW PAGE
   ======================================== */
.hm-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hm-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.hm-head__cta { width: 100%; }

@media (min-width: 640px) {
  .hm-head__cta { width: auto; }
}

.hm-hero {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 22px;
  border-radius: var(--r);
  border: 1px solid var(--line2);
  background: linear-gradient(145deg, var(--elev) 0%, var(--surface) 100%);
  box-shadow: var(--shadow-card);
}

.hm-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.hm-stat {
  text-align: center;
  padding: 14px 10px;
  border-radius: var(--r2);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--line2);
}

.hm-stat--ok {
  border-color: rgba(74,222,128,0.25);
  background: rgba(74,222,128,0.06);
}

.hm-stat__val {
  display: block;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.hm-stat--ok .hm-stat__val { color: var(--ok); }

.hm-stat__lab {
  display: block;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.hm-avail {
  padding-top: 4px;
  border-top: 1px solid var(--line2);
}

.hm-avail__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.hm-avail__label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.hm-avail__pct {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ok);
}

.hm-avail__track {
  height: 8px;
  border-radius: 999px;
  background: rgba(71,85,105,0.35);
  overflow: hidden;
}

.hm-avail__fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #16a34a, var(--ok));
  box-shadow: 0 0 12px rgba(74,222,128,0.45);
  transition: width 0.45s cubic-bezier(0.22,1,0.36,1);
}

.hm-avail__hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.hm-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

@media (min-width: 960px) {
  .hm-grid {
    grid-template-columns: 1.1fr 0.9fr;
    gap: 20px;
  }
}

.hm-panel {
  border-radius: var(--r);
  border: 1px solid var(--line2);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  min-width: 0;
}

.hm-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line2);
  background: var(--elev);
}

.hm-panel__head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.hm-panel__link {
  font-size: 12px;
  font-weight: 700;
  color: var(--cyan2);
  white-space: nowrap;
}

.hm-panel__link:hover { color: var(--cyan); }

.hm-android {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hm-android__chart {
  position: relative;
  width: 132px;
  height: 132px;
  margin: 0 auto;
  flex-shrink: 0;
}

.hm-donut {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.hm-donut-core {
  position: absolute;
  inset: 24%;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 2px;
}

.hm-donut-core b {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--cyan2);
  line-height: 1;
}

.hm-donut-core span {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.hm-android__empty {
  margin: 0;
  padding: 28px 16px;
}

.hm-ver-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hm-ver-item {
  display: grid;
  grid-template-columns: minmax(72px, 28%) 1fr auto;
  gap: 10px;
  align-items: center;
}

.hm-ver-item__lab {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hm-ver-item__bar {
  height: 7px;
  border-radius: 999px;
  background: var(--elev2);
  overflow: hidden;
  min-width: 0;
}

.hm-ver-item__bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  min-width: 2px;
  transition: width 0.4s ease;
}

.hm-ver-item__cnt {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

@media (min-width: 960px) {
  .hm-android {
    flex-direction: row;
    align-items: center;
    gap: 24px;
  }

  .hm-android__chart { margin: 0; }

  .hm-ver-list {
    flex: 1;
    min-width: 0;
  }
}

@media (max-width: 959px) {
  .hm-android__chart { display: none; }
}

.hm-recent {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px 16px;
  max-height: min(520px, 60dvh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.hm-recent__empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--line2);
  border-radius: var(--r2);
  background: rgba(255,255,255,0.015);
}

.hm-panel--recent .xl-dev { animation: none; }

@media (max-width: 480px) {
  .hm-hero { padding: 16px; }
  .hm-stats { gap: 8px; }
  .hm-stat { padding: 12px 8px; }
  .hm-panel__head { padding: 14px 16px; }
  .hm-android { padding: 14px 16px 16px; }

  .hm-ver-item {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 4px 10px;
  }

  .hm-ver-item__lab { grid-column: 1; }
  .hm-ver-item__cnt { grid-column: 2; grid-row: 1; }
  .hm-ver-item__bar { grid-column: 1 / -1; }
}

/* ========================================
   APK BUILDER
   ======================================== */
.bd-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.bd-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.bd-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.1), rgba(56, 189, 248, 0.04));
  box-shadow: 0 4px 20px rgba(34, 211, 238, 0.08);
  font-size: 13px;
}

.bd-chip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.6);
  flex-shrink: 0;
}

.bd-chip__lab {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.bd-chip code {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--cyan2);
}

.bd-alert {
  padding: 14px 18px;
  border-radius: var(--r2);
  border: 1px solid rgba(251, 146, 60, 0.35);
  background: rgba(251, 146, 60, 0.08);
  color: #fdba74;
  font-size: 14px;
  line-height: 1.5;
}

.bd-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 20px;
  align-items: start;
}

.bd-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.bd-aside {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: calc(var(--header-h) + 16px);
}

.bd-card {
  border-radius: var(--r);
  border: 1px solid var(--line2);
  background: linear-gradient(160deg, rgba(13, 23, 41, 0.92) 0%, var(--surface) 100%);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  animation: pop-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.bd-main .bd-card:nth-child(1) { animation-delay: 0.04s; }
.bd-main .bd-card:nth-child(2) { animation-delay: 0.08s; }
.bd-main .bd-card:nth-child(3) { animation-delay: 0.12s; }
.bd-aside .bd-card:nth-child(1) { animation-delay: 0.06s; }
.bd-aside .bd-card:nth-child(2) { animation-delay: 0.1s; }

.bd-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line2);
  background: rgba(0, 0, 0, 0.12);
}

.bd-card__head h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.bd-card__body {
  padding: 20px;
}

/* Brand row */
.bd-brand {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
}

.bd-icon {
  position: relative;
  flex: 0 0 112px;
  width: 112px;
  height: 112px;
  border-radius: 26px;
  border: 2px dashed rgba(56, 189, 248, 0.35);
  background: rgba(0, 0, 0, 0.2);
  display: grid;
  place-items: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.bd-icon:hover {
  border-color: rgba(34, 211, 238, 0.65);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.08);
  transform: translateY(-1px);
}

.bd-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bd-icon__ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.bd-icon__ph svg {
  width: 32px;
  height: 32px;
  color: var(--cyan);
  opacity: 0.85;
}

.bd-brand__fields {
  flex: 1;
  min-width: min(100%, 260px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bd-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

/* Segmented payload */
.bd-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 4px;
  border-radius: var(--r2);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line2);
}

.bd-seg__item {
  cursor: pointer;
}

.bd-seg__item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.bd-seg__btn {
  display: block;
  padding: 14px 16px;
  border-radius: calc(var(--r2) - 4px);
  text-align: center;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.bd-seg__btn strong {
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
}

.bd-seg__btn small {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.bd-seg__item input:checked + .bd-seg__btn {
  background: linear-gradient(145deg, rgba(34, 211, 238, 0.14), rgba(56, 189, 248, 0.06));
  border-color: rgba(34, 211, 238, 0.45);
  box-shadow: 0 4px 16px rgba(34, 211, 238, 0.1);
}

.bd-seg__item input:checked + .bd-seg__btn strong {
  color: var(--cyan2);
}

.bd-seg__item input:focus-visible + .bd-seg__btn {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* Format grid */
.bd-format-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.bd-format {
  cursor: pointer;
  min-width: 0;
}

.bd-format input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.bd-format__box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: 14px;
  border-radius: var(--r2);
  border: 1px solid var(--line2);
  background: rgba(0, 0, 0, 0.15);
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.bd-format__box:hover {
  border-color: rgba(56, 189, 248, 0.35);
}

.bd-format__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.bd-format__ico {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 16px;
  background: var(--elev2);
  border: 1px solid var(--line2);
  color: var(--muted);
}

.bd-format__ico--crypt { color: var(--cyan2); border-color: rgba(34, 211, 238, 0.25); }
.bd-format__ico--drop { color: #a78bfa; border-color: rgba(167, 139, 250, 0.25); }
.bd-format__ico--both { color: #fbbf24; border-color: rgba(251, 191, 36, 0.25); }

.bd-format__check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line2);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.bd-format__box strong {
  font-size: 14px;
  line-height: 1.2;
}

.bd-format__box small {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

.bd-format input:checked + .bd-format__box {
  border-color: rgba(34, 211, 238, 0.55);
  background: linear-gradient(145deg, rgba(34, 211, 238, 0.1), rgba(13, 23, 41, 0.5));
  box-shadow: 0 4px 20px rgba(34, 211, 238, 0.08);
}

.bd-format input:checked + .bd-format__box .bd-format__check {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #020712;
}

.bd-format input:focus-visible + .bd-format__box {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.bd-submit {
  padding: 4px 0 8px;
}

.bd-submit .cc-btn {
  width: 100%;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  font-size: 15px;
}

@media (min-width: 640px) {
  .bd-submit .cc-btn { width: auto; min-width: 220px; }
}

/* Phone preview */
.bd-phone {
  border-radius: 20px;
  border: 1px solid var(--line2);
  background: #050a14;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.bd-phone__bar {
  display: flex;
  justify-content: center;
  gap: 5px;
  padding: 10px 0 6px;
}

.bd-phone__bar span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.35);
}

.bd-phone__screen {
  min-height: 140px;
  padding: 24px 20px 28px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(34, 211, 238, 0.06), transparent),
    linear-gradient(180deg, #0a1220 0%, #050a14 100%);
}

.bd-launcher {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 88px;
  margin: 0 auto;
}

.bd-launcher__icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(145deg, var(--elev2), var(--elev));
  border: 1px solid var(--line2);
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 22px;
  font-weight: 700;
  color: var(--muted);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.bd-launcher__icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bd-launcher__name {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  line-height: 1.25;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--text);
}

.bd-preview-sub {
  margin: 14px 0 0;
  text-align: center;
  font-size: 11px;
}

/* Status */
.bd-state__title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.bd-state__sub {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.bd-state--building .bd-state__title {
  color: var(--cyan2);
}

.bd-state--done .bd-state__title {
  color: var(--ok);
}

.bd-state--error .bd-state__title {
  color: var(--danger, #f87171);
}

.bd-state__bar {
  height: 5px;
  border-radius: 999px;
  background: rgba(71, 85, 105, 0.4);
  overflow: hidden;
  margin-bottom: 10px;
}

.bd-state__bar span {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), #38bdf8);
  animation: bd-indeterminate 1.4s ease-in-out infinite;
}

@keyframes bd-indeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

.bd-state__hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.bd-state__meta {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: var(--r2);
  background: rgba(74, 222, 128, 0.06);
  border: 1px solid rgba(74, 222, 128, 0.2);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-line;
  font-family: var(--mono);
}

.bd-state__err {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: var(--r2);
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: #fca5a5;
  font-size: 13px;
  line-height: 1.45;
}

.bd-card--status .cc-pill--muted { font-size: 10px; }

@media (max-width: 960px) {
  .bd-grid {
    grid-template-columns: 1fr;
  }

  .bd-aside {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}

@media (max-width: 640px) {
  .bd-aside {
    grid-template-columns: 1fr;
  }

  .bd-format-grid {
    grid-template-columns: 1fr;
  }

  .bd-brand {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .bd-brand__fields {
    width: 100%;
  }

  .bd-chip {
    width: 100%;
    justify-content: center;
  }
}

/* ========================================
   REDUCED MOTION
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  body.xl-body::after,
  .xl-main::before,
  .hm-avail__fill,
  .xl-tile,
  .xl-panel,
  .xl-dev,
  .xl-main,
  .xl-stat,
  .xl-settings-nav {
    animation: none !important;
  }
}
