:root {
  --paj-orange: #f47b20;
  --paj-charcoal: #121417;
  --paj-blue: #1f4e79;
  --paj-green: #2f8f6d;
  --paj-red: #d64545;
  --bg-top: #f7f8fa;
  --bg-bottom: #eef1f5;
  --text: #1e2530;
  --muted: #66768e;
  --card-bg: rgba(255, 255, 255, 0.82);
  --card-border: rgba(18, 20, 23, 0.08);
  --radius-xl: 26px;
  --radius-md: 16px;
  --shadow: 0 16px 38px rgba(18, 20, 23, 0.08);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Sora", sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg-top), var(--bg-bottom));
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: #0f1318;
}

p {
  margin: 0;
}

.bg-shape {
  position: fixed;
  width: 280px;
  height: 280px;
  border-radius: 999px;
  filter: blur(38px);
  pointer-events: none;
  z-index: 0;
}

.bg-shape-orange {
  left: -80px;
  top: -60px;
  background: rgba(244, 123, 32, 0.2);
}

.bg-shape-blue {
  right: -70px;
  top: -90px;
  background: rgba(31, 78, 121, 0.14);
}

.page {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 18px 14px 26px;
  display: grid;
  gap: 12px;
}

.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
}

.eyebrow {
  color: #76839a;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.73rem;
  font-weight: 600;
}

.topbar h1 {
  margin-top: 4px;
  font-size: clamp(1.3rem, 2.6vw, 1.85rem);
}

.notice {
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid rgba(47, 143, 109, 0.3);
  background: rgba(47, 143, 109, 0.11);
  color: #1d5f4a;
}

.notice.error {
  border-color: rgba(214, 69, 69, 0.32);
  background: rgba(214, 69, 69, 0.12);
  color: #8d2f2f;
}

.hidden {
  display: none !important;
}

.section {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.muted {
  color: var(--muted);
}

.onboarding-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.card-stack {
  display: grid;
  gap: 10px;
}

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

input,
select,
button {
  font-family: inherit;
  border-radius: 13px;
  border: 1px solid rgba(18, 20, 23, 0.14);
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  font-size: 0.94rem;
}

input,
select {
  width: 100%;
  padding: 10px 12px;
}

button {
  cursor: pointer;
  padding: 10px 14px;
  background: linear-gradient(130deg, var(--paj-orange), #ff954f);
  border-color: rgba(244, 123, 32, 0.5);
  color: white;
  font-weight: 600;
}

button:hover {
  filter: brightness(1.03);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.74);
  color: var(--paj-charcoal);
  border-color: rgba(18, 20, 23, 0.17);
}

.app-shell {
  display: grid;
  gap: 12px;
}

.session-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(18, 20, 23, 0.16);
  background: rgba(255, 255, 255, 0.74);
  font-size: 0.8rem;
}

.pill.soft {
  background: rgba(244, 123, 32, 0.13);
  border-color: rgba(244, 123, 32, 0.22);
}

.tab-panel {
  display: grid;
  gap: 12px;
  padding-bottom: 88px;
}

.hero-card h2 {
  font-size: clamp(1.35rem, 3.6vw, 2rem);
}

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

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

#map {
  width: 100%;
  height: min(54vh, 360px);
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(18, 20, 23, 0.12);
}

#map.map-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(244, 123, 32, 0.12), rgba(31, 78, 121, 0.18));
}

.map-fallback-inner {
  max-width: 320px;
  text-align: center;
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(18, 20, 23, 0.14);
  background: rgba(255, 255, 255, 0.82);
}

.member-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.member-card {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(18, 20, 23, 0.1);
  padding: 12px;
  display: grid;
  gap: 6px;
}

.member-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
}

.status-chip {
  margin-left: auto;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.75rem;
  border: 1px solid rgba(18, 20, 23, 0.13);
}

.list-stack {
  display: grid;
  gap: 10px;
}

.list-item {
  border-radius: 16px;
  border: 1px solid rgba(18, 20, 23, 0.1);
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
}

.action-row,
.zone-row,
.device-row,
.backend-row,
.alert-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.quick-action-btn {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border: 1px solid rgba(18, 20, 23, 0.1);
  padding: 12px;
}

.quick-action-btn span {
  display: grid;
  gap: 2px;
}

.quick-action-btn .muted {
  font-size: 0.82rem;
}

.route-controls label {
  min-width: 190px;
}

.icon-pill {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  flex: 0 0 36px;
}

.chat-list {
  max-height: 280px;
  overflow-y: auto;
  display: grid;
  gap: 8px;
}

.conversation-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0;
}

.conversation-card {
  border-radius: 16px;
  border: 1px solid rgba(18, 20, 23, 0.1);
  background: rgba(255, 255, 255, 0.72);
  padding: 11px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.conversation-card.active {
  background: rgba(244, 123, 32, 0.15);
  border-color: rgba(244, 123, 32, 0.3);
}

.chat-msg {
  border-radius: 14px;
  border: 1px solid rgba(18, 20, 23, 0.1);
  background: rgba(255, 255, 255, 0.7);
  padding: 9px 11px;
  display: grid;
  gap: 3px;
}

.chat-msg.me {
  border-color: rgba(244, 123, 32, 0.32);
  background: rgba(244, 123, 32, 0.15);
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.invite-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1.2fr 1fr;
}

.qr-wrap {
  min-height: 220px;
  border-radius: 18px;
  border: 1px dashed rgba(18, 20, 23, 0.22);
  background: rgba(255, 255, 255, 0.58);
  display: grid;
  place-items: center;
}

.qr-wrap img {
  width: min(220px, 88%);
  height: auto;
}

.family-code {
  margin: 2px 0;
  text-align: center;
  font-size: clamp(1.8rem, 5vw, 2.45rem);
  letter-spacing: 0.06em;
  font-weight: 700;
  color: #0f1318;
}

.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.inline-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.app-card {
  border-radius: 16px;
  border: 1px solid rgba(18, 20, 23, 0.11);
  background: rgba(255, 255, 255, 0.72);
  padding: 11px;
  display: grid;
  gap: 8px;
}

.alert-row .ghost-btn {
  margin-left: auto;
  padding: 6px 10px;
  font-size: 0.78rem;
}

.progress {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: rgba(18, 20, 23, 0.08);
  overflow: hidden;
}

.bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(130deg, var(--paj-orange), var(--paj-blue));
}

.pill.warn {
  border-color: rgba(214, 69, 69, 0.28);
  background: rgba(214, 69, 69, 0.13);
  color: #8d2f2f;
}

.bottom-tabs {
  position: fixed;
  z-index: 10;
  left: 50%;
  transform: translateX(-50%);
  bottom: 10px;
  width: min(980px - 28px, calc(100% - 20px));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  padding: 8px;
}

.tab-btn {
  border-radius: 13px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.72);
  color: #334155;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 10px 6px;
}

.tab-btn.active {
  background: linear-gradient(130deg, var(--paj-orange), #ff954f);
  color: white;
}

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

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

  .section {
    padding: 14px;
  }

  .topbar {
    padding: 14px;
  }
}

@media (max-width: 610px) {
  .bottom-tabs {
    width: calc(100% - 14px);
    bottom: 6px;
    gap: 4px;
  }

  .tab-btn {
    font-size: 0.7rem;
    padding: 9px 4px;
  }
}
