:root {
  --bg: #07101f;
  --bg-elevated: rgba(10, 20, 38, 0.92);
  --panel: rgba(12, 22, 42, 0.78);
  --panel-strong: rgba(17, 29, 54, 0.94);
  --line: rgba(104, 170, 255, 0.18);
  --line-strong: rgba(104, 170, 255, 0.32);
  --text: #eef4ff;
  --text-muted: #b3c2dc;
  --text-soft: #86a0c8;
  --cyan: #55ddff;
  --violet: #8e75ff;
  --pink: #ff58d8;
  --green: #65f5ba;
  --amber: #ffd36e;
  --red: #ff7f8f;
  --shadow: 0 24px 60px rgba(1, 5, 14, 0.45);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --input-bg: rgba(6, 13, 27, 0.75);
  --gradient: linear-gradient(135deg, #55ddff 0%, #8e75ff 52%, #ff58d8 100%);
  --gradient-soft: linear-gradient(135deg, rgba(85, 221, 255, 0.16), rgba(142, 117, 255, 0.16));
  --transition: 180ms ease;
}

* {
  box-sizing: border-box;
}

*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(85, 221, 255, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 88, 216, 0.11), transparent 25%),
    radial-gradient(circle at 50% 50%, rgba(142, 117, 255, 0.09), transparent 35%),
    var(--bg);
  font: 15px/1.5 Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

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

button {
  cursor: pointer;
}

a {
  color: var(--cyan);
}

code {
  padding: 0.2rem 0.45rem;
  border-radius: 8px;
  background: rgba(85, 221, 255, 0.12);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

[hidden] {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.page {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 72px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px max(16px, calc((100vw - 1320px) / 2 + 16px));
  backdrop-filter: blur(22px);
  background: rgba(5, 10, 20, 0.74);
  border-bottom: 1px solid rgba(104, 170, 255, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-title span {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  color: var(--text-soft);
  font-size: 12px;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  position: relative;
  overflow: hidden;
  margin: 28px 0 22px;
  min-height: 280px;
  background:
    linear-gradient(135deg, rgba(85, 221, 255, 0.12), rgba(142, 117, 255, 0.14)),
    var(--panel-strong);
}

.hero-image {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  opacity: 0.6;
}

.hero.asset-missing .hero-image {
  display: none;
}

.hero-copy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  padding: 34px;
  background: linear-gradient(180deg, rgba(7, 16, 31, 0.12) 10%, rgba(7, 16, 31, 0.92) 100%);
}

.kicker {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(101, 245, 186, 0.12);
  border: 1px solid rgba(101, 245, 186, 0.22);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.hero-copy p {
  margin: 0;
  max-width: 760px;
  color: var(--text-muted);
  font-size: 16px;
}

.layout-stack {
  display: grid;
  gap: 22px;
}

.view {
  display: grid;
  gap: 22px;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(280px, 0.95fr);
  gap: 22px;
}

.section {
  padding: 24px;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.section-title h2,
.section-title h3 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.section-title p {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
}

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

.connection-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
}

.notice {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(7, 16, 31, 0.4);
  color: var(--text-muted);
}

.notice strong {
  color: var(--text);
}

.notice.info {
  background: rgba(85, 221, 255, 0.08);
  border-color: rgba(85, 221, 255, 0.18);
}

.notice.warning {
  background: rgba(255, 211, 110, 0.08);
  border-color: rgba(255, 211, 110, 0.2);
}

.notice.success {
  background: rgba(101, 245, 186, 0.08);
  border-color: rgba(101, 245, 186, 0.2);
}

.notice.error {
  background: rgba(255, 127, 143, 0.08);
  border-color: rgba(255, 127, 143, 0.2);
}

.badge-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pill-neutral {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

.pill-cyan {
  color: var(--cyan);
  background: rgba(85, 221, 255, 0.1);
  border-color: rgba(85, 221, 255, 0.22);
}

.pill-green {
  color: var(--green);
  background: rgba(101, 245, 186, 0.11);
  border-color: rgba(101, 245, 186, 0.24);
}

.pill-amber {
  color: var(--amber);
  background: rgba(255, 211, 110, 0.11);
  border-color: rgba(255, 211, 110, 0.24);
}

.pill-red {
  color: var(--red);
  background: rgba(255, 127, 143, 0.11);
  border-color: rgba(255, 127, 143, 0.24);
}

.pill-violet {
  color: #c6bbff;
  background: rgba(142, 117, 255, 0.14);
  border-color: rgba(142, 117, 255, 0.26);
}

.auth-grid {
  align-items: start;
}

.auth-stack {
  display: grid;
  gap: 18px;
}

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

.mini-card {
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(104, 170, 255, 0.14);
  background: rgba(7, 16, 31, 0.42);
}

.mini-card h3,
.mini-card h4 {
  margin: 0 0 8px;
  font-size: 16px;
}

.mini-card p {
  margin: 0;
  color: var(--text-muted);
}

.google-slot {
  min-height: 44px;
  display: flex;
  align-items: center;
}

.small-muted {
  color: var(--text-soft);
  font-size: 13px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

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

label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(150, 188, 255, 0.12);
  background: var(--input-bg);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

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

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(85, 221, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(85, 221, 255, 0.12);
}

input::placeholder,
textarea::placeholder {
  color: rgba(179, 194, 220, 0.66);
}

.field-hint {
  color: var(--text-soft);
  font-size: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 700;
  transition: transform var(--transition), border-color var(--transition), background var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  color: #06111b;
  background: var(--gradient);
  box-shadow: 0 16px 34px rgba(85, 221, 255, 0.14);
}

.btn-secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.btn-ghost {
  color: var(--text-muted);
  background: transparent;
  border-color: rgba(255, 255, 255, 0.12);
}

.btn-danger {
  color: var(--red);
  background: rgba(255, 127, 143, 0.08);
  border-color: rgba(255, 127, 143, 0.22);
}

.btn-sm {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 13px;
}

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

.form-shell {
  margin-top: 16px;
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(104, 170, 255, 0.16);
  background: rgba(7, 16, 31, 0.38);
}

.provider-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.provider-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.provider-name {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.provider-subtitle {
  color: var(--text-muted);
}

.tab-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tab-btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-weight: 700;
}

.tab-btn.active {
  color: #06111b;
  background: var(--gradient);
  border-color: transparent;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: grid;
  gap: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.metric-card {
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(104, 170, 255, 0.16);
  background: rgba(7, 16, 31, 0.46);
}

.metric-label {
  color: var(--text-soft);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  margin-top: 10px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.metric-footnote {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(104, 170, 255, 0.12);
  background: rgba(7, 16, 31, 0.42);
}

.timeline-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.timeline-title {
  font-weight: 700;
}

.timeline-details {
  color: var(--text-muted);
  font-size: 14px;
}

.table-wrap {
  overflow: auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(104, 170, 255, 0.12);
}

.data-table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
  background: rgba(7, 16, 31, 0.28);
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(104, 170, 255, 0.08);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--text-soft);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.03);
}

.data-table td .subtle {
  display: block;
  margin-top: 4px;
  color: var(--text-soft);
  font-size: 13px;
}

.data-table tr:hover td {
  background: rgba(85, 221, 255, 0.03);
}

.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.empty-state,
.result-box {
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(255, 255, 255, 0.16);
  background: rgba(7, 16, 31, 0.34);
  color: var(--text-muted);
}

.result-box {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  max-height: 320px;
  overflow: auto;
}

.result-box.success {
  border-color: rgba(101, 245, 186, 0.24);
  color: #cffff0;
}

.result-box.error {
  border-color: rgba(255, 127, 143, 0.26);
  color: #ffd2da;
}

.result-box.info {
  border-color: rgba(85, 221, 255, 0.24);
}

.device-search-results {
  display: grid;
  gap: 10px;
}

.device-result {
  width: 100%;
  text-align: left;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(104, 170, 255, 0.14);
  background: rgba(7, 16, 31, 0.42);
  color: var(--text);
}

.device-result strong {
  display: block;
}

.device-result small {
  display: block;
  color: var(--text-soft);
  margin-top: 4px;
}

details summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
}

details summary::-webkit-details-marker {
  display: none;
}

.footer {
  padding: 10px 0 0;
  color: var(--text-soft);
  font-size: 13px;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  display: grid;
  gap: 12px;
  width: min(380px, calc(100vw - 36px));
}

.toast {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(104, 170, 255, 0.16);
  background: rgba(7, 16, 31, 0.92);
  box-shadow: var(--shadow);
}

.toast strong {
  display: block;
  margin-bottom: 4px;
}

.toast.info {
  border-color: rgba(85, 221, 255, 0.24);
}

.toast.success {
  border-color: rgba(101, 245, 186, 0.24);
}

.toast.warning {
  border-color: rgba(255, 211, 110, 0.24);
}

.toast.error {
  border-color: rgba(255, 127, 143, 0.28);
}

.loading-dots::after {
  content: "";
  display: inline-block;
  width: 1em;
  animation: dots 1.2s infinite steps(4, end);
}

@keyframes dots {
  0% {
    content: "";
  }
  25% {
    content: ".";
  }
  50% {
    content: "..";
  }
  75% {
    content: "...";
  }
  100% {
    content: "";
  }
}

body.is-readonly [data-write-only] {
  display: none !important;
}

@media (max-width: 1080px) {
  .split-grid,
  .card-grid,
  .summary-grid,
  .form-grid.cols-3 {
    grid-template-columns: 1fr 1fr;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .page {
    width: min(100%, calc(100% - 22px));
  }

  .split-grid,
  .card-grid,
  .summary-grid,
  .form-grid.cols-2,
  .form-grid.cols-3,
  .connection-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    padding: 24px;
  }

  .section {
    padding: 20px;
  }

  .provider-bar,
  .section-header,
  .topbar {
    align-items: flex-start;
  }

  .data-table {
    min-width: 680px;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .page {
    width: calc(100% - 16px);
  }

  .hero {
    min-height: 260px;
  }

  .hero-copy h1 {
    font-size: 28px;
  }

  .section {
    padding: 18px;
  }

  .toast-stack {
    right: 10px;
    left: 10px;
    width: auto;
  }
}


.pairing-setup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(104, 170, 255, 0.18);
  background: rgba(7, 16, 31, 0.34);
}

.google-placeholder-btn {
  width: 100%;
}

body.has-onboarding {
  overflow: hidden;
}

.onboarding-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 7, 16, 0.7);
  backdrop-filter: blur(14px);
}

.onboarding-card {
  width: min(620px, 100%);
  padding: 28px;
  background: var(--panel-strong);
}
