:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-strong: #f0f4f5;
  --surface-soft: #edf7f6;
  --text: #16201f;
  --muted: #64716f;
  --line: #dce5e3;
  --line-strong: #c7d3d0;
  --primary: #0e7c73;
  --primary-strong: #095e58;
  --primary-soft: #dff5f2;
  --accent: #e2583e;
  --accent-soft: #ffe9e3;
  --amber: #b56b09;
  --amber-soft: #fff2d6;
  --green: #168452;
  --green-soft: #def8eb;
  --red: #b42318;
  --red-soft: #ffe4e1;
  --blue: #315fba;
  --blue-soft: #e3edff;
  --shadow: 0 24px 70px rgba(18, 34, 32, 0.11);
  --shadow-soft: 0 14px 30px rgba(18, 34, 32, 0.08);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.dark {
  color-scheme: dark;
  --bg: #111715;
  --surface: #18211f;
  --surface-strong: #202c29;
  --surface-soft: #162b28;
  --text: #eef6f4;
  --muted: #9aacaa;
  --line: #2e3c39;
  --line-strong: #44524f;
  --primary: #4cc9bd;
  --primary-strong: #7be0d6;
  --primary-soft: #173b37;
  --accent: #ff866f;
  --accent-soft: #40241f;
  --amber: #f0b34b;
  --amber-soft: #3b2b12;
  --green: #5fd198;
  --green-soft: #173525;
  --red: #ff8b80;
  --red-soft: #3f1f1d;
  --blue: #8aaef7;
  --blue-soft: #1c2b4c;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.33);
  --shadow-soft: 0 14px 30px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(14, 124, 115, 0.08), transparent 290px),
    var(--bg);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.is-hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: clamp(24px, 7vw, 140px);
  background:
    radial-gradient(circle at 78% 50%, rgba(20, 184, 166, 0.2), transparent 34rem),
    linear-gradient(90deg, #03090f1a, #03090f47 46%, #03090fad),
    url("./assets/login-cyber-tycoon-6tn_TLs1.jpg") left center / cover no-repeat;
}

#loginView.login-view {
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
}

.brand-mark {
  width: 76px;
  height: 76px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 7px;
  padding: 9px;
  border-radius: var(--radius);
  background: var(--text);
  box-shadow: var(--shadow-soft);
}

.brand-mark span {
  display: block;
  border-radius: 5px;
}

.brand-mark span:nth-child(1) {
  background: var(--primary);
}

.brand-mark span:nth-child(2) {
  background: var(--accent);
}

.brand-mark span:nth-child(3) {
  grid-column: 1 / 3;
  background: #f3b33d;
}

.brand-mark.compact {
  width: 42px;
  height: 42px;
  padding: 6px;
  gap: 4px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: 4.8rem;
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.45rem;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: 1.08rem;
  letter-spacing: 0;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  background: #050c124d;
  border: 1px solid rgba(210, 218, 226, 0.92);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 24px 70px #0000006b, inset 0 0 0 1px #ffffff1a;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

#loginForm.login-panel {
  justify-self: center;
  align-self: center;
}

.login-panel .brand-row,
.login-panel label {
  color: #d7dde4;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}

.login-panel .brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0;
}

.login-panel .brand-row strong {
  font-size: 0.92rem;
}

.login-brand-icon {
  flex: 0 0 auto;
}

.login-panel label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  font-weight: 650;
}

.login-panel input {
  min-height: 0;
  border-radius: 6px;
  background: rgba(4, 17, 23, 0.42);
  border-color: rgba(216, 240, 245, 0.38);
  color: #f6fbfd;
  caret-color: #7ee7de;
  padding: 9px 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 24px #00000024;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.login-panel input:focus {
  background: rgba(5, 23, 31, 0.56);
  border-color: rgba(126, 231, 222, 0.78);
  outline: 3px solid rgba(126, 231, 222, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.11), 0 8px 24px #0000002e;
}

.login-panel input:-webkit-autofill,
.login-panel input:-webkit-autofill:hover,
.login-panel input:-webkit-autofill:focus {
  -webkit-text-fill-color: #f6fbfd;
  box-shadow: inset 0 0 0 1000px rgba(4, 17, 23, 0.72), 0 8px 24px #00000024;
  caret-color: #7ee7de;
}

.login-panel .primary-btn {
  min-height: 38px;
  border-radius: 6px;
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
  padding: 8px 12px;
}

.login-panel .primary-btn:hover {
  background: #0f766e;
}

.login-panel .login-message {
  min-height: 0;
  margin: 0;
  color: #f25b5b;
}

.login-panel .login-message:empty {
  display: none;
}

.auth-setup {
  padding: 14px;
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.auth-setup[hidden] {
  display: none;
}

.totp-qr {
  width: 142px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.totp-qr svg {
  width: 100%;
  height: 100%;
  display: block;
}

.totp-qr-mini {
  width: 180px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  justify-self: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.totp-qr-mini svg {
  width: 100%;
  height: 100%;
  display: block;
}

.input-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.input-action-row input {
  min-width: 0;
}

.login-message {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 0.86rem;
  font-weight: 750;
}

.login-message[data-tone="ok"] {
  color: var(--green);
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

input,
textarea,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  padding: 10px 12px;
  outline: none;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.primary-btn,
.ghost-btn,
.danger-btn,
.icon-btn,
.chip-btn {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  font-weight: 800;
  white-space: nowrap;
}

.primary-btn {
  color: #ffffff;
  background: var(--primary);
}

.primary-btn:hover {
  background: var(--primary-strong);
}

.primary-btn.small,
.ghost-btn.small,
.danger-btn.small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.85rem;
}

.ghost-btn,
.chip-btn {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
}

.ghost-btn:hover,
.chip-btn:hover,
.chip-btn.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.danger-btn {
  color: var(--red);
  background: var(--red-soft);
  border-color: transparent;
}

.icon-btn {
  width: 42px;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
}

.fine-print {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 20;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand-row strong,
.brand-row small {
  display: block;
}

.brand-row small {
  margin-top: 2px;
  color: var(--muted);
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-item {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 12px;
  display: flex;
  align-items: center;
  color: var(--muted);
  background: transparent;
  text-align: left;
  font-weight: 800;
}

.nav-item:hover,
.nav-item.active {
  color: var(--text);
  background: var(--surface-strong);
}

.nav-item.active {
  box-shadow: inset 3px 0 0 var(--primary);
}

.usage-panel {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.usage-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 0.9rem;
  font-weight: 850;
}

.meter {
  height: 9px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--line);
}

.meter span {
  display: block;
  width: 57%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.usage-panel small {
  display: block;
  margin-top: 9px;
  color: var(--muted);
}

.main-area {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  min-height: 78px;
  padding: 16px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(245, 247, 248, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
  z-index: 10;
}

body.dark .topbar {
  background: rgba(17, 23, 21, 0.88);
}

.breadcrumb {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-menu {
  display: none;
}

.mobile-menu span {
  width: 17px;
  height: 2px;
  border-radius: 99px;
  background: currentColor;
}

.view-root {
  width: 100%;
  max-width: none;
  padding: 24px;
  display: grid;
  gap: 22px;
}

.section-band {
  display: grid;
  gap: 16px;
}

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

.section-head p {
  margin: 5px 0 0;
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 14px;
}

.metric-card,
.panel,
.account-card,
.plan-card,
.post-card,
.message-row,
.audit-row,
.team-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.metric-card {
  min-height: 132px;
  padding: 16px;
  display: grid;
  align-content: space-between;
  gap: 16px;
}

.metric-card span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.metric-card strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: 0;
}

.metric-card small {
  color: var(--muted);
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 14px;
}

.panel {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.inline-panel-head {
  margin-bottom: 10px;
}

.inline-panel-head h3 {
  margin-bottom: 0;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.account-card {
  min-height: 210px;
  padding: 15px;
  display: grid;
  gap: 14px;
}

.account-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--primary);
  font-weight: 900;
}

.account-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-title strong,
.account-title small {
  display: block;
}

.account-title small {
  margin-top: 2px;
  color: var(--muted);
}

.status-pill,
.tag,
.role-pill {
  min-height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  font-size: 0.74rem;
  font-weight: 850;
}

.status-pill.ok,
.role-pill.admin {
  color: var(--green);
  background: var(--green-soft);
}

.status-pill.warn,
.role-pill.operator {
  color: var(--amber);
  background: var(--amber-soft);
}

.status-pill.danger,
.role-pill.viewer {
  color: var(--red);
  background: var(--red-soft);
}

.status-pill.info {
  color: var(--blue);
  background: var(--blue-soft);
}

.tag {
  color: var(--text);
  background: var(--surface-strong);
}

.team-2fa-toggle {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--surface-strong);
  font-size: 0.74rem;
  font-weight: 850;
}

.team-2fa-toggle.active {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--line));
  color: var(--primary);
  background: var(--primary-soft);
}

.team-2fa-toggle:disabled {
  opacity: 0.72;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.stat-line {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stat-line div {
  display: grid;
  gap: 2px;
}

.stat-line strong {
  font-size: 1.05rem;
}

.stat-line span {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 800;
}

.card-actions {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
  margin-top: auto;
}

.card-actions button {
  min-width: 0;
  flex: 1 1 0;
}

.device-card .card-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 88px), 1fr));
  align-self: stretch;
}

.device-card .card-actions button {
  width: 100%;
  min-width: 0;
  padding-inline: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-workbench {
  display: grid;
  grid-template-columns: minmax(430px, 0.86fr) minmax(760px, 1.14fr);
  gap: 14px;
  align-items: start;
}

.device-panels-grid {
  min-width: 0;
  max-height: calc(100vh - 118px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  display: grid;
  gap: 14px;
  align-content: start;
}

.device-list-panel,
.device-control-panel {
  min-width: 0;
}

.device-list-panel {
  max-height: calc(100vh - 118px);
  overflow: hidden;
}

.device-grid {
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 12px;
  align-items: stretch;
  align-content: start;
}

.device-card {
  min-height: 172px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  position: relative;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.device-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
  transform: translateY(-1px);
}

.device-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.device-card-head,
.device-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.device-card-head {
  justify-content: space-between;
  min-width: 0;
}

.device-title {
  min-width: 0;
  flex: 1 1 auto;
}

.device-popup-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
}

.device-popup-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(5, 10, 10, 0.68);
  backdrop-filter: blur(7px);
}

.device-popup-shell {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.device-popup-small {
  width: min(620px, calc(100vw - 36px));
}

.device-popup-medium {
  width: min(760px, calc(100vw - 36px));
}

.device-popup-large {
  width: min(960px, calc(100vw - 36px));
}

.device-popup-expanded {
  width: min(1240px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
}

.device-popup-head {
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.device-popup-head h3,
.device-popup-head p {
  margin: 0;
}

.device-popup-head p:not(.eyebrow) {
  color: var(--muted);
  font-size: 0.9rem;
}

.device-popup-body {
  min-height: 0;
  padding: 18px;
  display: grid;
  place-items: center;
  overflow: auto;
}

.device-popup-body .phone-frame {
  position: relative;
  top: auto;
}

.device-popup-body .phone-size-small {
  --phone-frame-width: min(56vw, 280px);
}

.device-popup-body .phone-size-medium {
  --phone-frame-width: min(62vw, 360px);
}

.device-popup-body .phone-size-large {
  --phone-frame-width: min(70vw, 470px);
}

.device-popup-body .phone-size-expanded {
  --phone-frame-width: min(78vw, 640px, calc((100vh - 170px) * 0.464));
}

.popup-focus-panel {
  min-height: 260px;
}

.popup-focus-body {
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.popup-focus-body strong {
  color: var(--text);
  font-size: 1.1rem;
}

.popup-focus-body p {
  max-width: 440px;
  margin: 0;
  line-height: 1.45;
}

.device-title input {
  width: 18px;
  min-height: 18px;
  margin-top: 3px;
}

.device-title strong,
.device-title small {
  display: block;
  min-width: 0;
}

.device-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-title small {
  margin-top: 2px;
  color: var(--muted);
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.35;
}

.device-dot {
  width: 12px;
  height: 12px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--line-strong);
  box-shadow: 0 0 0 4px var(--surface-strong);
  flex: 0 0 auto;
}

.device-dot.online {
  background: var(--green);
}

.device-dot.booting,
.device-dot.creating,
.device-dot.waiting_adb,
.device-dot.waiting_boot_completed,
.device-dot.starting_stream,
.device-dot.reconnecting,
.device-dot.adb_offline,
.device-dot.rebooting,
.device-dot.stopping,
.device-dot.paused {
  background: var(--amber);
}

.device-dot.offline,
.device-dot.stopped,
.device-dot.stream_error,
.device-dot.api_offline,
.device-dot.error {
  background: var(--red);
}

.device-mini-screen {
  height: 102px;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 10px;
  display: grid;
  align-content: space-between;
  background:
    linear-gradient(145deg, rgba(14, 124, 115, 0.8), rgba(49, 95, 186, 0.72)),
    var(--surface-strong);
}

.mini-status {
  width: 54%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.mini-apps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.mini-apps span {
  aspect-ratio: 1;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.75);
}

.phone-layout {
  display: grid;
  grid-template-columns: minmax(250px, var(--phone-frame-width, 330px)) minmax(300px, 1fr);
  gap: 18px;
  align-items: start;
  justify-content: stretch;
  min-width: 0;
}

.phone-layout-small {
  --phone-frame-width: 250px;
  --phone-panel-width: 250px;
}

.phone-layout-medium {
  --phone-frame-width: 330px;
  --phone-panel-width: 330px;
}

.phone-layout-large {
  --phone-frame-width: 430px;
  --phone-panel-width: 430px;
}

.phone-layout-expanded {
  --phone-frame-width: min(74vh, 620px);
  --phone-panel-width: min(74vh, 620px);
}

.phone-frame {
  width: min(100%, var(--phone-frame-width, 330px));
  aspect-ratio: 9 / 19.4;
  padding: 12px;
  border-radius: 32px;
  background: #101615;
  box-shadow: var(--shadow);
  position: sticky;
  top: 102px;
}

.phone-speaker {
  position: absolute;
  top: 9px;
  left: 50%;
  width: 86px;
  height: 18px;
  transform: translateX(-50%);
  border-radius: 0 0 14px 14px;
  background: #101615;
  z-index: 2;
}

.phone-back-button {
  position: absolute;
  top: -42px;
  left: 10px;
  z-index: 6;
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: #ffffff;
  background: rgba(16, 22, 21, 0.84);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.real-phone-frame.has-back-control {
  margin-top: 44px;
}

.phone-back-button:hover:not(:disabled),
.phone-back-button:focus-visible {
  border-color: var(--primary);
  background: var(--primary);
  outline: 0;
}

.phone-back-button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.phone-screen {
  height: 100%;
  overflow: hidden;
  border-radius: 24px;
  display: grid;
  grid-template-rows: 34px minmax(0, 1fr) 42px;
  color: #ffffff;
  background:
    linear-gradient(160deg, rgba(14, 124, 115, 0.95), rgba(49, 95, 186, 0.88) 48%, rgba(226, 88, 62, 0.9)),
    #0e1716;
  user-select: none;
}

.phone-screen.dimmed {
  background: #1d2524;
}

.real-phone-frame {
  aspect-ratio: var(--device-aspect, 9 / 20);
}

.phone-size-small {
  --phone-frame-width: 250px;
  --phone-panel-width: 250px;
}

.phone-size-medium {
  --phone-frame-width: 330px;
  --phone-panel-width: 330px;
}

.phone-size-large {
  --phone-frame-width: 430px;
  --phone-panel-width: 430px;
}

.phone-size-expanded {
  --phone-frame-width: min(74vh, 620px);
  --phone-panel-width: min(74vh, 620px);
}

.real-phone-screen {
  position: relative;
  display: block;
  cursor: default;
  background: #070b0b;
  outline: 0;
  touch-action: none;
}

.real-novnc-screen,
.real-novnc-screen canvas {
  cursor: default !important;
}

.real-phone-screen:focus-visible {
  box-shadow: 0 0 0 3px rgba(14, 124, 115, 0.35);
}

.real-screen-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
  border-radius: 24px;
  background: #070b0b;
  pointer-events: none;
}

.real-screen-preview {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 1;
  transition: opacity 0.08s linear;
}

.real-screen-preview.is-hidden {
  opacity: 0;
}

.real-screen-webrtc-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.real-screen-iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  border-radius: 24px;
  background: #070b0b;
  pointer-events: auto;
}

.real-screen-iframe.adb-controlled-stream {
  pointer-events: none;
}

.real-screen-native-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 24px;
  background: #070b0b;
  object-fit: fill;
  pointer-events: none;
}

.real-screen-iframe-mount {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  border-radius: 24px;
  background: transparent;
  opacity: 0;
  transition: opacity 0.08s linear;
}

.real-screen-iframe-mount.is-ready {
  opacity: 1;
}

.persistent-webrtc-dock {
  position: fixed;
  left: 0;
  top: 0;
  width: 240px;
  height: 520px;
  opacity: 0.001;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
  contain: paint;
}

.persistent-webrtc-dock .real-screen-iframe {
  width: 240px;
  height: 520px;
  border-radius: 0;
}

.real-screen-input-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 24px;
  background: transparent;
  cursor: default;
  pointer-events: auto;
  touch-action: none;
}

.real-novnc-screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 24px;
  background: #070b0b;
  pointer-events: auto;
}

.real-novnc-screen > div {
  width: 100%;
  height: 100%;
}

.real-novnc-screen div,
.real-novnc-screen canvas {
  max-width: 100%;
  max-height: 100%;
}

.real-novnc-screen canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  outline: 0;
}

.real-screen-placeholder {
  position: absolute;
  inset: 0;
  padding: 28px;
  display: grid;
  place-content: center;
  gap: 10px;
  text-align: center;
  color: #ffffff;
  background:
    linear-gradient(160deg, rgba(14, 124, 115, 0.92), rgba(49, 95, 186, 0.78), rgba(226, 88, 62, 0.86)),
    #0e1716;
  z-index: 3;
  pointer-events: none;
}

.real-screen-placeholder strong {
  font-size: 1.2rem;
}

.real-screen-placeholder span {
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.5;
}

.real-screen-placeholder.is-soft-reconnect {
  inset: auto 14px 16px 14px;
  width: auto;
  min-height: 0;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(8, 16, 19, 0.78);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(8px);
}

.real-screen-placeholder.is-soft-reconnect strong {
  font-size: 0.84rem;
}

.real-screen-placeholder.is-soft-reconnect span {
  max-width: 230px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.72rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.real-screen-placeholder.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.segmented-control {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segmented-control button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--surface);
  font-weight: 850;
}

.segmented-control button.active {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.device-size-control {
  margin: 10px 0;
}

.android-statusbar,
.android-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 0.76rem;
  font-weight: 850;
  background: rgba(0, 0, 0, 0.16);
}

.android-navbar {
  justify-content: space-around;
  font-size: 1.22rem;
}

.android-home {
  min-height: 0;
  padding: 18px;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 18px;
}

.android-wallpaper-label {
  display: grid;
  align-content: start;
  gap: 7px;
  padding-top: 24px;
}

.android-wallpaper-label strong {
  font-size: 1.24rem;
}

.android-wallpaper-label span {
  max-width: 100%;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.android-app-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.android-app-grid button {
  min-width: 0;
  border: 0;
  display: grid;
  gap: 5px;
  justify-items: center;
  color: #ffffff;
  background: transparent;
}

.android-app-grid button span {
  width: 46px;
  aspect-ratio: 1;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.24);
  font-weight: 900;
}

.android-app-grid button small {
  max-width: 58px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.68rem;
  font-weight: 850;
}

.android-app-view,
.phone-offline {
  min-height: 0;
  padding: 22px;
  display: grid;
  align-content: start;
  gap: 12px;
  background: rgba(255, 255, 255, 0.1);
}

.android-app-view strong,
.phone-offline strong {
  font-size: 1.25rem;
}

.android-app-view p,
.phone-offline span {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.android-app-view span {
  padding: 10px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.16);
  overflow-wrap: anywhere;
}

.android-app-view.chat p {
  padding: 12px;
  border-radius: 14px 14px 14px 4px;
  background: rgba(255, 255, 255, 0.2);
}

.android-recents {
  min-height: 0;
  padding: 20px;
  display: grid;
  gap: 12px;
  align-content: center;
}

.android-recents div {
  min-height: 92px;
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.2);
  font-weight: 850;
}

.control-stack {
  min-width: 300px;
  display: grid;
  gap: 13px;
  align-content: start;
}

.control-group {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.control-group h3 {
  margin-bottom: 10px;
  font-size: 0.92rem;
}

.app-catalog-panel {
  display: grid;
  gap: 10px;
}

.app-catalog-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.app-catalog-head strong {
  min-width: 0;
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.app-catalog-head span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
}

.app-catalog-search {
  width: 100%;
}

.app-category-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.app-category-tabs button {
  flex: 0 0 auto;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--surface);
  font-size: 0.75rem;
  font-weight: 900;
}

.app-category-tabs button.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.app-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 8px;
  max-height: 310px;
  overflow: auto;
  padding-right: 2px;
}

.app-catalog-card {
  min-width: 0;
  min-height: 128px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  display: grid;
  gap: 5px;
  justify-items: start;
  align-content: start;
  color: var(--text);
  background: var(--surface);
  text-align: left;
}

.app-catalog-card:hover,
.app-catalog-card.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.app-catalog-card.installed {
  border-color: rgba(18, 134, 108, 0.36);
}

.app-catalog-icon {
  width: 34px;
  aspect-ratio: 1;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--primary);
  font-size: 0.72rem;
  font-weight: 950;
}

.app-catalog-name {
  width: 100%;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.app-catalog-card small,
.app-catalog-card em {
  color: var(--muted);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.app-selected-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  display: grid;
  gap: 9px;
  background: var(--surface);
}

.app-selected-card.muted {
  color: var(--muted);
}

.app-selected-card strong,
.app-selected-card small {
  display: block;
  overflow-wrap: anywhere;
}

.app-selected-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.app-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.device-text-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.device-text-row input {
  min-width: 0;
}

.device-text-row .primary-btn {
  min-height: 44px;
}

.compact-toolbar {
  gap: 7px;
  flex-wrap: wrap;
}

.compact-toolbar button {
  flex: 0 1 auto;
}

.proxy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.proxy-grid label {
  min-width: 0;
  font-size: 0.78rem;
}

.proxy-grid input,
.proxy-grid select {
  min-width: 0;
}

.proxy-wide {
  grid-column: 1 / -1;
}

.proxy-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.proxy-status-grid .summary-cell {
  background: var(--surface);
  border: 1px solid var(--line);
}

.proxy-status-grid .summary-cell strong {
  overflow-wrap: anywhere;
  font-size: 0.98rem;
  line-height: 1.25;
}

.proxy-status-cell strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.proxy-status-light {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  flex: 0 0 auto;
  background: var(--red);
  box-shadow:
    0 0 0 3px var(--red-soft),
    0 0 12px color-mix(in srgb, var(--red) 72%, transparent);
}

.proxy-status-cell.ok .proxy-status-light {
  background: var(--green);
  box-shadow:
    0 0 0 3px var(--green-soft),
    0 0 12px color-mix(in srgb, var(--green) 72%, transparent);
}

.proxy-generated-table code {
  display: block;
  max-width: 360px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.device-identity-panel {
  border-color: rgba(20, 184, 166, 0.26);
}

.identity-warning {
  border: 1px solid rgba(245, 158, 11, 0.38);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(245, 158, 11, 0.12);
  line-height: 1.45;
}

.identity-summary-grid {
  margin: 10px 0;
}

.identity-summary-grid .summary-cell strong,
.identity-form-grid input {
  overflow-wrap: anywhere;
}

.identity-form-grid .full {
  grid-column: 1 / -1;
}

.identity-toggle {
  align-self: end;
}

.app-list-mini {
  max-height: 92px;
  overflow: auto;
  display: grid;
  gap: 5px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.app-list-mini span {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.android-nav-controls {
  display: grid;
  grid-template-columns: repeat(3, 48px);
  gap: 10px;
}

.runtime-log {
  max-height: 190px;
  overflow: auto;
  padding: 10px;
  border-radius: var(--radius);
  color: #dff5f2;
  background: #101615;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
}

.runtime-log span {
  display: block;
  overflow-wrap: anywhere;
}

.metrics-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.metrics-mini-grid div {
  min-width: 112px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.metrics-mini-grid strong,
.metrics-mini-grid span {
  display: block;
  overflow-wrap: normal;
  word-break: normal;
  white-space: normal;
  hyphens: none;
}

.metrics-mini-grid span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.device-status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.device-status-head h3 {
  margin-bottom: 0;
}

.device-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.device-status-cell {
  min-height: 86px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  background: var(--surface);
}

.device-status-cell.ok {
  border-left-color: var(--green);
}

.device-status-cell.warn {
  border-left-color: var(--amber);
}

.device-status-cell.danger {
  border-left-color: var(--red);
}

.device-status-cell.info {
  border-left-color: var(--blue);
}

.device-status-cell strong {
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.25;
}

.device-status-cell small {
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.device-health-checks {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.device-health-title,
.device-health-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.device-health-title {
  justify-content: space-between;
}

.device-health-title strong {
  font-size: 0.86rem;
}

.device-health-title span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: right;
}

.device-health-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 7px;
}

.device-health-item {
  align-items: flex-start;
  min-height: 58px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
}

.device-health-item > span {
  width: 9px;
  height: 9px;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--blue);
  flex: 0 0 auto;
}

.device-health-item.ok > span {
  background: var(--green);
}

.device-health-item.warn > span {
  background: var(--amber);
}

.device-health-item.danger > span {
  background: var(--red);
}

.device-health-item strong,
.device-health-item small {
  display: block;
  overflow-wrap: anywhere;
}

.device-health-item strong {
  font-size: 0.8rem;
  line-height: 1.3;
}

.device-health-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.device-status-events {
  display: grid;
  gap: 7px;
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.device-status-event {
  display: grid;
  grid-template-columns: minmax(72px, 92px) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
}

.device-status-event time {
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}

.device-status-event strong {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 0.83rem;
  line-height: 1.3;
}

.device-status-event strong span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--blue);
  flex: 0 0 auto;
}

.device-status-event.ok strong span {
  background: var(--green);
}

.device-status-event.warn strong span {
  background: var(--amber);
}

.device-status-event.danger strong span {
  background: var(--red);
}

.device-status-event small,
.device-status-empty {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.device-status-empty {
  margin: 0;
  padding: 10px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: var(--radius);
}

.data-table th,
.data-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  background: var(--surface-strong);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.post-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 14px;
}

.post-lane {
  min-height: 440px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.post-lane h3 {
  margin: 0 0 12px;
  font-size: 0.9rem;
}

.post-card {
  margin-bottom: 10px;
  padding: 12px;
  box-shadow: none;
}

.post-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  margin-bottom: 10px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(14, 124, 115, 0.9), rgba(226, 88, 62, 0.84)),
    url("./assets/social-post-pattern.svg") center / cover;
  font-weight: 900;
}

.post-card p {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.message-list,
.audit-list,
.team-list {
  display: grid;
  gap: 10px;
}

.message-row,
.audit-row,
.team-row {
  padding: 13px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  box-shadow: none;
}

.message-row p,
.audit-row p,
.team-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.chart {
  height: 260px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 12px;
  padding-top: 20px;
}

.bar {
  min-height: 18px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  position: relative;
}

.bar span {
  position: absolute;
  left: 50%;
  bottom: -28px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
}

.plan-card {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.plan-card.featured {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow-soft);
}

.price {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.price strong {
  font-size: 2rem;
  letter-spacing: 0;
}

.feature-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  line-height: 1.4;
}

.feature-list li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex: 0 0 auto;
}

.billing-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.summary-cell {
  padding: 13px;
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.summary-cell span,
.summary-cell small {
  display: block;
  color: var(--muted);
}

.summary-cell strong {
  display: block;
  margin: 7px 0 3px;
  font-size: 1.25rem;
}

.qr-wrap {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.qr-code {
  width: 150px;
  aspect-ratio: 1;
  border: 10px solid var(--surface);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, var(--text) 10px, transparent 10px) 0 0 / 26px 26px,
    linear-gradient(var(--text) 10px, transparent 10px) 0 0 / 26px 26px,
    var(--surface-strong);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-soft);
}

.import-preview {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface);
}

.proxy-primary-config,
.proxy-optional-config {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px) auto;
  gap: 10px;
  align-items: end;
}

.proxy-optional-config {
  margin-top: 12px;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px) auto;
}

.proxy-secret-preview {
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  align-items: center;
}

.proxy-secret-preview span {
  color: var(--muted);
  font-size: 0.78rem;
}

.proxy-secret-preview strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.label-with-help {
  cursor: help;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.proxy-advanced-config {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.proxy-advanced-config summary {
  cursor: pointer;
  padding: 12px 14px;
  color: var(--text);
  font-weight: 850;
}

.proxy-advanced-config .form-grid,
.proxy-advanced-config .toolbar,
.proxy-advanced-config .fine-print {
  margin: 0 14px 14px;
}

.proxy-status-summary,
.proxy-context-empty .summary-grid {
  margin-top: 14px;
}

.proxy-summary-cell {
  border: 1px solid var(--line);
}

.proxy-context-empty {
  min-height: 220px;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.proxy-context-empty > strong,
.proxy-context-empty > p {
  display: block;
  max-width: 720px;
}

.proxy-context-empty > p {
  margin: 7px 0 0;
  color: var(--muted);
}

.proxy-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 12px;
}

.proxy-skeleton-card {
  min-height: 96px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.proxy-skeleton-card span,
.proxy-skeleton-card strong,
.proxy-skeleton-card small {
  display: block;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--surface), var(--line), var(--surface));
  background-size: 200% 100%;
  animation: proxy-skeleton-pulse 1.2s ease-in-out infinite;
}

.proxy-skeleton-card strong {
  width: 68%;
  height: 20px;
  margin-top: 16px;
}

.proxy-skeleton-card small {
  width: 52%;
  margin-top: 10px;
}

.text-danger {
  color: var(--red);
}

@keyframes proxy-skeleton-pulse {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@media (max-width: 900px) {
  .proxy-primary-config,
  .proxy-optional-config {
    grid-template-columns: 1fr;
  }

  .proxy-skeleton-grid {
    grid-template-columns: 1fr;
  }
}

.modal {
  width: min(680px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  color: var(--text);
  background: transparent;
}

.two-factor-modal {
  width: min(520px, calc(100vw - 28px));
}

.modal::backdrop {
  background: rgba(8, 12, 12, 0.52);
  backdrop-filter: blur(8px);
}

.modal-shell {
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.two-factor-modal .modal-shell {
  color: #f6fbfd;
  background: rgba(3, 15, 20, 0.76);
  border-color: rgba(216, 240, 245, 0.28);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.modal-head {
  padding: 18px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.two-factor-modal .modal-head {
  border-bottom-color: rgba(216, 240, 245, 0.2);
  background: rgba(255, 255, 255, 0.03);
}

.two-factor-modal .eyebrow {
  color: #7ee7de;
}

.two-factor-modal h3,
.two-factor-modal label {
  color: #f6fbfd;
}

.close-btn {
  font-size: 1.35rem;
}

.two-factor-modal .close-btn,
.two-factor-modal .ghost-btn {
  color: #f6fbfd;
  background: rgba(4, 17, 23, 0.38);
  border-color: rgba(216, 240, 245, 0.32);
}

.two-factor-modal .close-btn:hover,
.two-factor-modal .ghost-btn:hover {
  background: rgba(14, 124, 115, 0.28);
  border-color: rgba(126, 231, 222, 0.62);
}

.modal-body {
  padding: 18px;
  display: grid;
  gap: 16px;
}

.two-factor-user {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.two-factor-modal .two-factor-user {
  color: rgba(226, 241, 244, 0.78);
}

.two-factor-modal input {
  background: rgba(4, 17, 23, 0.42);
  border-color: rgba(216, 240, 245, 0.38);
  color: #f6fbfd;
  caret-color: #7ee7de;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 24px #00000024;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.two-factor-modal input:focus {
  background: rgba(5, 23, 31, 0.56);
  border-color: rgba(126, 231, 222, 0.78);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.11), 0 0 0 3px rgba(126, 231, 222, 0.2);
}

.two-factor-modal input:-webkit-autofill,
.two-factor-modal input:-webkit-autofill:hover,
.two-factor-modal input:-webkit-autofill:focus {
  -webkit-text-fill-color: #f6fbfd;
  box-shadow: inset 0 0 0 1000px rgba(4, 17, 23, 0.72), 0 8px 24px #00000024;
  caret-color: #7ee7de;
}

.two-factor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.setup-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  gap: 10px;
  background: var(--surface-soft);
}

.setup-box p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.model-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}

.model-option {
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 6px;
  justify-items: start;
  color: var(--text);
  background: var(--surface);
  text-align: left;
}

.model-option:hover,
.model-option.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.model-option strong,
.model-option span,
.model-option small {
  display: block;
}

.model-option span,
.model-option small {
  color: var(--muted);
  line-height: 1.35;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.segmented {
  min-height: 42px;
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.segmented button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  font-weight: 850;
}

.segmented button.active {
  color: var(--text);
  background: var(--surface-strong);
}

.toggle-line {
  min-height: 46px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: var(--text);
}

.toggle-line input {
  width: 46px;
  min-height: 26px;
  appearance: none;
  border-radius: 999px;
  padding: 0;
  background: var(--line-strong);
  position: relative;
}

.toggle-line input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface);
  transition: transform 0.18s ease;
}

.toggle-line input:checked {
  background: var(--primary);
}

.toggle-line input:checked::after {
  transform: translateX(20px);
}

.command-palette {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: start center;
  padding-top: 13vh;
  background: rgba(8, 12, 12, 0.42);
  backdrop-filter: blur(10px);
}

.command-box {
  width: min(640px, calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.command-box input {
  min-height: 58px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.command-results {
  max-height: 360px;
  overflow: auto;
  padding: 8px;
}

.command-results button {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
  background: transparent;
  text-align: left;
  font-weight: 800;
}

.command-results button:hover {
  background: var(--surface-strong);
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  gap: 10px;
}

.toast {
  width: min(360px, calc(100vw - 36px));
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-weight: 750;
}

.toast small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 650;
}

@media (max-width: 1120px) {
  .metrics-grid,
  .billing-summary {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .split-grid,
  .plan-grid,
  .device-workbench {
    grid-template-columns: 1fr;
  }

  .phone-frame {
    position: relative;
    top: auto;
  }

  .post-board {
    grid-template-columns: repeat(2, minmax(190px, 1fr));
  }
}

@media (max-width: 1040px) {
  .phone-layout {
    grid-template-columns: 1fr;
  }

  .control-stack {
    min-width: 0;
  }

  .phone-frame {
    margin: 0 auto;
  }
}

@media (max-width: 820px) {
  h1 {
    font-size: 3.1rem;
  }

  .login-view {
    justify-items: center;
    padding: 24px;
    background-position: 30% center;
  }

  .login-panel {
    padding: 28px 22px 40px;
  }

  .auth-setup {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .totp-qr {
    width: min(180px, 100%);
    justify-self: center;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(310px, calc(100vw - 40px));
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-menu {
    display: inline-grid;
  }

  .topbar {
    align-items: flex-start;
    padding: 14px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .view-root {
    padding: 14px;
  }

  .metrics-grid,
  .billing-summary,
  .post-board,
  .form-grid,
  .phone-layout {
    grid-template-columns: 1fr;
  }

  .phone-frame {
    margin: 0 auto;
  }

  .section-head,
  .topbar,
  .device-popup-head {
    flex-wrap: wrap;
  }

  .device-popup-layer {
    padding: 10px;
  }

  .device-popup-shell,
  .device-popup-small,
  .device-popup-medium,
  .device-popup-large,
  .device-popup-expanded {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .device-popup-head .toolbar,
  .device-popup-head .segmented-control {
    width: 100%;
  }

  .device-popup-head .segmented-control {
    flex-wrap: wrap;
  }

  .device-popup-body {
    padding: 12px;
  }

  .data-table {
    display: block;
    overflow-x: auto;
  }

  .qr-wrap {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 2.35rem;
  }

  .topbar-actions .ghost-btn,
  .topbar-actions .primary-btn {
    flex: 1 1 120px;
  }

  .metrics-grid {
    gap: 10px;
  }

  .message-row,
  .audit-row,
  .team-row {
    grid-template-columns: 1fr;
  }
}
