:root {
  --ink: #161815;
  --muted: #73776f;
  --line: #dedfd8;
  --paper: #f5f5f1;
  --panel: #ffffff;
  --accent: #d93a2f;
  --accent-soft: #f8e8e4;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #dedfd9;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 50% -10%, #ffffff 0, transparent 42%),
    #dedfd9;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.phone-shell {
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 0 48px rgba(24, 28, 22, 0.14);
}

.topbar {
  height: calc(64px + var(--safe-top));
  padding: calc(14px + var(--safe-top)) 20px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(22, 24, 21, 0.08);
  background: rgba(245, 245, 241, 0.9);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: var(--ink);
  font: 800 14px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.service-state {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.service-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #aaa;
}

[data-service-state="online"] .service-dot {
  background: #2e9b62;
  box-shadow: 0 0 0 4px rgba(46, 155, 98, 0.12);
}

[data-service-state="offline"] .service-dot {
  background: var(--accent);
}

.views {
  padding: 30px 20px calc(94px + var(--safe-bottom));
}

.view {
  animation: view-in 180ms ease-out;
}

.view[hidden] {
  display: none;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.eyebrow,
.panel-label {
  margin: 0 0 8px;
  color: var(--accent);
  font: 750 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.13em;
}

h1 {
  max-width: 360px;
  margin: 0;
  font-size: clamp(34px, 10vw, 48px);
  line-height: 1.02;
  letter-spacing: -0.055em;
}

.lead {
  max-width: 390px;
  margin: 16px 0 28px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.primary-actions {
  display: grid;
  gap: 12px;
}

.action-card {
  width: 100%;
  min-height: 126px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  cursor: pointer;
}

.action-card-primary {
  color: #fff;
  border-color: var(--ink);
  background: var(--ink);
}

.action-kicker {
  margin-bottom: auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.action-card-primary .action-kicker {
  color: #acb0a8;
}

.action-card strong {
  margin-top: 18px;
  font-size: 18px;
  letter-spacing: -0.025em;
}

.action-card > span:last-child {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.action-card-primary > span:last-child {
  color: #acb0a8;
}

.panel {
  margin-top: 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
}

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

.panel h2,
.empty-state h2,
.account-card h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.025em;
}

.status-pill {
  padding: 5px 8px;
  border-radius: 99px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 700;
}

.status-pill[data-state="online"] {
  color: #23764b;
  background: #e5f3ea;
}

.status-pill[data-state="offline"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.connection-grid {
  margin: 22px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.connection-grid > div {
  padding: 12px;
  border-radius: 14px;
  background: var(--paper);
}

.connection-grid dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.connection-grid dd {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 700;
}

.connection-actions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.text-button {
  padding: 5px 0;
  border: 0;
  color: var(--accent);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.checked-at {
  color: #999c95;
  font: 600 10px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.empty-state {
  min-height: 390px;
  margin-top: 26px;
  padding: 30px 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px dashed #c9cbc3;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.58);
  text-align: center;
}

.empty-mark {
  width: 54px;
  height: 54px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  background: var(--ink);
  color: #fff;
  font: 750 14px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.empty-state p,
.account-card p {
  margin: 9px auto 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.composer {
  margin-top: 16px;
  padding: 8px;
  display: flex;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.composer textarea {
  min-width: 0;
  flex: 1;
  resize: none;
  border: 0;
  padding: 11px 8px;
  background: transparent;
  font-size: 16px;
  outline: none;
}

.composer button {
  border: 0;
  border-radius: 12px;
  padding: 0 15px;
  color: #fff;
  background: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.composer button:disabled {
  opacity: 0.45;
}

.account-card {
  margin-top: 26px;
  padding: 18px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
}

.avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}

.account-card p {
  margin-top: 3px;
  font-size: 11px;
}

.account-state {
  padding: 6px 9px;
  border-radius: 99px;
  color: var(--muted);
  background: var(--paper);
  font-size: 10px;
  font-weight: 700;
}

.disclaimer {
  margin: 28px 0 0;
  color: #999c95;
  text-align: center;
  font-size: 11px;
}

.tabbar {
  height: calc(70px + var(--safe-bottom));
  padding: 7px 8px var(--safe-bottom);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid rgba(22, 24, 21, 0.09);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 10;
  width: min(100%, 480px);
  transform: translateX(-50%);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  border-radius: 14px;
  color: #8a8e86;
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.tab svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab.is-active {
  color: var(--ink);
  background: #f1f1ec;
}

.sr-only {
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  position: absolute;
}

html.batx-mobile {
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

html.batx-mobile input,
html.batx-mobile textarea,
html.batx-mobile select {
  font-size: max(16px, 1em);
}

@media (max-width: 540px) {
  :root,
  body {
    background: var(--paper);
  }

  .phone-shell {
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .view {
    animation: none;
  }
}
