:root {
  color-scheme: dark;
  font-family: "Segoe UI", "Noto Sans Bengali", system-ui, sans-serif;
  background: #0a1021;
  color: #f2f2e9;
  font-synthesis: none;
  --night: #0a1021;
  --indigo: #16233d;
  --chart-blue: #24374f;
  --glass: rgba(18, 30, 52, 0.78);
  --glass-deep: rgba(11, 20, 38, 0.9);
  --line: rgba(229, 203, 160, 0.28);
  --line-bright: rgba(255, 179, 107, 0.62);
  --ink: #f2f2e9;
  --muted: #c1c6d3;
  --amber: #ffb36b;
  --signal: #ff644e;
  --aqua: #91d9d3;
  --rose: #f1a2bc;
  --focus: #ffe1a3;
  --radius-lg: 24px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--night); }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 82% 7%, rgba(52, 77, 111, 0.34), transparent 38rem),
    radial-gradient(ellipse at 9% 37%, rgba(255, 100, 78, 0.09), transparent 30rem),
    linear-gradient(155deg, #0a1021 0%, #111b31 54%, #0a1021 100%);
  color: var(--ink);
}

button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

button:disabled { cursor: not-allowed; opacity: 0.52; }

.shell {
  width: min(1120px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 0 16px;
}

.glass {
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.075), transparent 42%),
    var(--glass);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
  backdrop-filter: blur(18px) saturate(135%);
}

.app-header {
  position: relative;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  margin-bottom: 30px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: ui-serif, Georgia, serif;
  font-size: 25px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.035em;
}

.brand-mark {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border: 1px solid var(--line-bright);
  border-radius: 50%;
  color: var(--amber);
  font-size: 21px;
  box-shadow: inset 0 0 14px rgba(255, 179, 107, 0.1);
}

.profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(310px, 55vw);
  min-height: 48px;
  padding: 5px 13px 5px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(22, 35, 61, 0.74);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.profile-avatar, .chat-avatar {
  display: grid;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line-bright);
  border-radius: 50%;
  background: rgba(255, 179, 107, 0.12);
  color: var(--amber);
  font-weight: 750;
}

.profile-summary {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.profile-summary strong, .profile-summary small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-summary strong { font-size: 13px; }
.profile-summary small { color: var(--muted); font-size: 11px; }
.profile-chevron { color: var(--amber); font-size: 18px; }

.profile-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(340px, calc(100vw - 32px));
  padding: 18px;
  border-radius: var(--radius-md);
}

.profile-menu-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 16px;
}

.profile-menu-head > div { display: grid; min-width: 0; gap: 4px; }
.profile-menu-head strong { font-size: 15px; }
.profile-menu-head small { overflow-wrap: anywhere; color: var(--muted); font-size: 12px; }

.profile-id-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 16, 33, 0.52);
}

.profile-id-row span { display: grid; gap: 4px; }
.profile-id-row small { color: var(--muted); font-size: 11px; }
.profile-id-row strong { color: var(--amber); font-size: 14px; letter-spacing: 0.05em; }

.copy-id-btn, .text-link {
  border: 0;
  background: transparent;
  color: var(--amber);
  font-weight: 700;
  cursor: pointer;
}

.profile-menu label, .auth-view label, .page-view label {
  display: block;
  margin: 13px 0 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

input, select {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(202, 211, 227, 0.27);
  border-radius: 12px;
  padding: 0 14px;
  background: rgba(7, 13, 27, 0.76);
  color: var(--ink);
}

input::placeholder { color: #adb5c7; opacity: 1; }
select option { background: var(--night); color: var(--ink); }

.secondary-btn, .primary-btn {
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--line-bright);
  border-radius: 12px;
  font-weight: 750;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.primary-btn {
  background: var(--signal);
  border-color: var(--signal);
  color: #160f18;
}

.primary-btn:hover { background: #ff8569; border-color: #ff8569; }

.secondary-btn {
  background: rgba(22, 35, 61, 0.7);
  color: var(--ink);
}

.secondary-btn:hover { background: rgba(36, 55, 79, 0.96); }
.secondary-btn, .primary-btn { width: 100%; margin-top: 9px; }

.logout-btn {
  width: 100%;
  min-height: 46px;
  margin-top: 8px;
  border: 1px solid rgba(255, 100, 78, 0.45);
  border-radius: 12px;
  background: rgba(255, 100, 78, 0.1);
  color: #ffd2c6;
  font-weight: 700;
  cursor: pointer;
}

.auth-view {
  position: relative;
  overflow: hidden;
  width: min(520px, 100%);
  margin: 7vh auto 44px;
  padding: clamp(24px, 5vw, 42px);
  border-radius: var(--radius-lg);
}

.auth-view h1, .atlas-intro h1, .page-heading h1 {
  margin: 0;
  font-family: ui-serif, Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.auth-view h1 { max-width: 12ch; font-size: clamp(30px, 5vw, 43px); line-height: 1.16; }
.auth-view > p { max-width: 44ch; line-height: 1.65; }
.auth-view label small { font-weight: 400; }
.auth-orbit {
  position: relative;
  display: grid;
  width: 82px;
  height: 82px;
  place-items: center;
  float: right;
  margin: -5px 0 5px 12px;
  border: 1px solid var(--line-bright);
  border-radius: 50%;
  color: var(--amber);
  font-size: 30px;
  box-shadow: inset 0 0 30px rgba(255, 179, 107, 0.1);
}

.auth-orbit i, .auth-orbit b {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal);
}

.auth-orbit i { top: 8px; right: 13px; }
.auth-orbit b { bottom: 11px; left: 7px; width: 5px; height: 5px; background: var(--aqua); }
.auth-actions { display: grid; gap: 3px; margin-top: 12px; }
.auth-actions .primary-btn, .auth-actions .secondary-btn { margin-top: 0; }
.muted { color: var(--muted); }

.view { animation: atlas-arrive 420ms cubic-bezier(0.16, 1, 0.3, 1) both; }

.app-update-banner {
  position: fixed;
  z-index: 100;
  right: 24px;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 420px;
  padding: 13px 14px 13px 16px;
  border-radius: 16px;
}

.app-update-banner div { display: grid; gap: 3px; }
.app-update-banner small { color: var(--muted); }
.app-update-banner button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line-bright);
  border-radius: 11px;
  background: var(--signal);
  color: var(--button-ink);
  font-weight: 750;
  cursor: pointer;
}

.admin-whatsapp {
  position: fixed;
  z-index: 45;
  right: 18px;
  bottom: 18px;
  display: grid;
  grid-template-columns: 44px auto;
  align-items: center;
  min-height: 44px;
  padding: 5px 12px 5px 5px;
  border: 1px solid rgba(145, 217, 211, 0.55);
  border-radius: 999px;
  background: rgba(11, 20, 38, 0.92);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}
.admin-whatsapp span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: #25d366;
  color: #092415;
  font-size: 18px;
}
.admin-whatsapp small { padding-left: 7px; font-size: 12px; font-weight: 750; }

.secondary-actions { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.secondary-actions .text-btn { min-height: 44px; }

.post-composer, .profile-page, .profile-posts { border-radius: var(--radius-lg); }
.post-composer { padding: 18px; }
.post-composer textarea {
  min-height: 112px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: rgba(7, 13, 27, 0.76);
  color: var(--ink);
}
.post-composer-actions {
  display: grid;
  grid-template-columns: auto minmax(130px, 220px);
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}
.post-image-btn, .profile-media-actions label {
  display: inline-grid;
  min-height: 48px;
  place-items: center;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(22, 35, 61, 0.7);
  cursor: pointer;
}
.post-feed { display: grid; gap: 16px; margin-top: 18px; }
.post-card { overflow: hidden; border-radius: 18px; padding: 16px; }
.post-card header { display: flex; align-items: center; gap: 10px; }
.post-card header div { display: grid; gap: 2px; }
.post-card header small { color: var(--muted); }
.post-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line-bright);
  border-radius: 50%;
  color: var(--amber);
  background: rgba(255, 179, 107, 0.09);
}
.post-text { line-height: 1.65; white-space: pre-wrap; }
.post-image { display: block; width: 100%; max-height: 520px; margin-top: 12px; border-radius: 14px; object-fit: cover; }
.post-actions { display: flex; gap: 8px; margin-top: 12px; }
.post-actions button, .comment-form button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(22, 35, 61, 0.7);
  color: var(--ink);
  cursor: pointer;
}
.comments { display: grid; gap: 7px; margin-top: 12px; }
.comments p { margin: 0; padding: 9px 11px; border-radius: 10px; background: rgba(7, 13, 27, 0.48); }
.comment-form { grid-template-columns: 1fr auto; gap: 8px; margin-top: 10px; }
.comment-form:not(.hidden) { display: grid; }
.comment-form input { min-width: 0; }

.profile-page { overflow: hidden; }
.profile-cover {
  display: grid;
  height: 230px;
  place-items: end start;
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 80% 22%, rgba(255,179,107,.2), transparent 18rem),
    linear-gradient(135deg, rgba(36,55,79,.86), rgba(10,16,33,.92));
  color: var(--amber);
  font-size: 42px;
}
.profile-avatar-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin: -48px 20px 0;
}
.profile-avatar-row div { display: grid; gap: 3px; padding-bottom: 6px; }
.profile-avatar-row small { color: var(--muted); }
.profile-page-avatar {
  display: grid;
  width: 96px;
  height: 96px;
  flex: 0 0 96px;
  place-items: center;
  border: 4px solid var(--night);
  border-radius: 50%;
  background: rgba(255,179,107,.12) center/cover;
  color: var(--amber);
  font-size: 28px;
}
.profile-edit-grid, .admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 20px;
}
.profile-edit-grid label:last-child { grid-column: 1 / -1; }
.profile-edit-grid textarea, .admin-notifications textarea, .admin-tab textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border: 1px solid rgba(202,211,227,.27);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(7,13,27,.76);
  color: var(--ink);
}
.profile-media-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 0 20px 20px; }
.profile-media-actions .primary-btn { margin: 0; }
.profile-posts { margin-top: 24px; }

.admin-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.admin-tabs button, .layout-presets label, .admin-role-grid label {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(22,35,61,.65);
  color: var(--ink);
  cursor: pointer;
}
.admin-tabs button { font-weight: 750; }
.admin-tab { padding: 20px; border-radius: var(--radius-lg); }
.admin-user-list, .sub-admin-list { display: grid; gap: 9px; }
.admin-user-row, .sub-admin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7,13,27,.42);
}
.admin-user-row > div:first-child, .sub-admin-row div { display: grid; gap: 3px; }
.admin-user-row small, .sub-admin-row small { color: var(--muted); }
.admin-user-row span.locked { color: #ffb3a5; }
.admin-user-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.admin-user-actions button, .sub-admin-row button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(22,35,61,.7);
  color: var(--ink);
  cursor: pointer;
}
.admin-user-actions .danger { border-color: rgba(255,100,78,.5); color: #ffd2c6; }
.admin-role-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin: 12px 0; }
.admin-role-grid label { display: flex; align-items: center; gap: 8px; padding: 0 12px; }
.layout-presets { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; border: 0; margin: 16px 0 0; padding: 0; }
.layout-presets legend { margin-bottom: 8px; color: var(--muted); }
.layout-presets label { display: flex; align-items: center; gap: 8px; padding: 0 12px; }

.atlas-nodes.card-layout { grid-template-columns: repeat(3, minmax(0,1fr)); align-items: center; }
.atlas-panel.compact-mode { min-height: 220px; }
.atlas-panel.compact-mode .atlas-nodes { min-height: 120px; }

.global-popup {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4,8,18,.72);
  backdrop-filter: blur(8px);
}
.global-popup-card {
  position: relative;
  width: min(460px, 100%);
  padding: 28px;
  border-radius: var(--radius-lg);
  text-align: center;
}
.global-popup-card #closeGlobalPopup {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 24px;
  cursor: pointer;
}
.popup-star { display: block; margin-bottom: 8px; color: var(--amber); font-size: 34px; }
@keyframes atlas-arrive {
  from { opacity: 0.35; filter: blur(7px); transform: translateY(8px); }
  to { opacity: 1; filter: blur(0); transform: translateY(0); }
}

.atlas-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--amber);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.atlas-intro h1 { font-size: clamp(34px, 5.2vw, 56px); line-height: 1.05; }
.atlas-intro .muted { margin: 10px 0 0; }

.add-contact-shortcut {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid var(--line-bright);
  border-radius: 999px;
  background: rgba(36, 55, 79, 0.62);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.add-contact-shortcut span { margin-right: 5px; color: var(--amber); font-size: 20px; vertical-align: -1px; }

.atlas-panel {
  position: relative;
  min-height: 330px;
  overflow: hidden;
  padding: 22px 26px 18px;
  border-radius: var(--radius-lg);
  isolation: isolate;
}

.atlas-grid {
  position: absolute;
  z-index: -2;
  inset: 0;
  background:
    radial-gradient(circle at 20% 28%, rgba(242, 242, 233, 0.76) 0 1px, transparent 2px),
    radial-gradient(circle at 57% 19%, rgba(255, 179, 107, 0.72) 0 1px, transparent 2px),
    radial-gradient(circle at 83% 70%, rgba(242, 242, 233, 0.6) 0 1px, transparent 2px),
    linear-gradient(rgba(179, 197, 226, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(179, 197, 226, 0.055) 1px, transparent 1px),
    radial-gradient(ellipse at 50% 50%, rgba(36, 55, 79, 0.92), rgba(10, 16, 33, 0.86) 78%);
  background-size: auto, auto, auto, 42px 42px, 42px 42px, auto;
}

.atlas-panel::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(118deg, rgba(255, 255, 255, 0.08), transparent 43%, rgba(255, 100, 78, 0.055));
  content: "";
  pointer-events: none;
}

.atlas-lines {
  position: absolute;
  inset: 24px 4% 24px;
  z-index: -1;
  width: 92%;
  height: calc(100% - 48px);
  opacity: 0.67;
}

.atlas-lines path {
  fill: none;
  stroke: rgba(255, 179, 107, 0.58);
  stroke-width: 1;
  stroke-dasharray: 2 7;
}

.atlas-lines circle { fill: var(--amber); filter: drop-shadow(0 0 5px rgba(255, 179, 107, 0.6)); }

.atlas-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chart-label {
  color: #d3d9e8;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.12em;
}

.contact-count {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 16, 33, 0.5);
  color: var(--amber);
  font-size: 12px;
}

.atlas-nodes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 16px;
  min-height: 205px;
  padding: 25px 1.5% 10px;
}

.atlas-node {
  position: relative;
  display: grid;
  min-height: 118px;
  align-content: center;
  justify-items: start;
  gap: 5px;
  padding: 16px 18px;
  border: 1px solid rgba(225, 219, 204, 0.3);
  border-radius: 18px 18px 18px 5px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), transparent 58%),
    rgba(18, 31, 55, 0.68);
  color: var(--ink);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 12px 24px rgba(0, 0, 0, 0.14);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.atlas-node:hover { transform: translateY(-4px); border-color: var(--line-bright); }
.atlas-node strong { font-size: 17px; }
.atlas-node small { color: #d1d6e2; font-size: 12px; }
.node-star { margin-bottom: 2px; color: var(--amber); font-size: 20px; }
.node-messages { transform: translateY(10px); }
.node-remember { transform: translateY(-7px); border-color: rgba(255, 179, 107, 0.5); }
.node-location { transform: translateY(16px); }
.node-messages:hover { transform: translateY(6px); }
.node-remember:hover { transform: translateY(-11px); }
.node-location:hover { transform: translateY(12px); }

.atlas-footnote {
  margin: 0;
  color: #d1d6e2;
  font-size: 12px;
  text-align: right;
}

.dashboard-lower {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(220px, 0.8fr);
  gap: 30px;
  margin-top: 34px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h2, .search-panel h2, .remembrance-panel h2, .location-layout h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.dashboard-contact-list, .contact-list {
  display: grid;
  gap: 10px;
}

.contact-row {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(18, 30, 52, 0.66);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.contact-row:hover { border-color: var(--line-bright); background: rgba(36, 55, 79, 0.72); }
.contact-row .contact-details { display: grid; flex: 1; min-width: 0; gap: 3px; }
.contact-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-row small { color: var(--muted); font-size: 12px; }
.contact-row .contact-arrow { color: var(--amber); font-size: 19px; }

.contact-orb {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 179, 107, 0.45);
  border-radius: 50%;
  background: rgba(255, 179, 107, 0.08);
  color: var(--amber);
}

.dashboard-note {
  align-self: stretch;
  display: grid;
  align-content: center;
  min-height: 135px;
  padding: 22px;
  border-radius: 18px 18px 18px 5px;
}

.dashboard-note p { max-width: 30ch; margin: 10px 0 0; line-height: 1.65; }
.note-star { color: var(--rose); font-size: 25px; }
.empty-note { margin: 0; padding: 16px 0; color: var(--muted); line-height: 1.6; }
.secondary-actions { margin-top: 24px; }
.text-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.text-btn:hover, .text-link:hover { color: var(--focus); }

.page-view { max-width: 900px; margin: 0 auto; }
.page-heading {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 24px;
}

.page-heading h1 { font-size: 40px; }
.page-heading .eyebrow { margin-bottom: 3px; }
.back-btn {
  display: grid;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(18, 30, 52, 0.76);
  color: var(--ink);
  font-size: 23px;
  cursor: pointer;
}

.back-btn:hover { border-color: var(--line-bright); color: var(--amber); }
.search-panel, .remembrance-panel, .location-map-panel, .location-share-panel {
  padding: clamp(20px, 4vw, 30px);
  border-radius: var(--radius-lg);
}

.search-panel > .muted { margin: 8px 0 17px; line-height: 1.55; }
.search-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.search-form input { min-width: 0; text-transform: uppercase; }
.search-form .primary-btn { width: auto; min-width: 110px; margin: 0; }
.search-result:empty { display: none; }
.search-result { margin-top: 15px; }

.search-result-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line-bright);
  border-radius: 14px;
  background: rgba(10, 16, 33, 0.56);
}

.search-result-card div { display: grid; min-width: 0; gap: 4px; }
.search-result-card strong { overflow-wrap: anywhere; }
.search-result-card small { color: var(--muted); }
.search-result-card .secondary-btn, .search-result-card .primary-btn { width: auto; min-width: 100px; margin: 0; }
.contact-section { margin-top: 32px; }
.contact-section .section-heading .muted { font-size: 13px; }
.contact-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.chat-view {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  grid-template-rows: 72px 1fr 78px;
  width: 100%;
  height: 100dvh;
  padding: 0 max(18px, calc((100vw - 1000px) / 2));
  background:
    radial-gradient(ellipse at 76% 10%, rgba(36, 55, 79, 0.4), transparent 38rem),
    var(--night);
}

.chat-header {
  display: grid;
  grid-template-columns: 50px 1fr auto;
  align-items: center;
  gap: 12px;
  margin: 10px 0 0;
  padding: 8px 12px;
  border-radius: 17px 17px 0 0;
}

.chat-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-avatar { flex-basis: 38px; width: 38px; height: 38px; }
.chat-person > span:last-child { display: grid; min-width: 0; gap: 3px; }
.chat-person strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-person small { color: var(--muted); font-size: 11px; }
.chat-call-actions { display: flex; gap: 7px; }

.chat-call-actions button, .attach-btn, .send-btn {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(10, 16, 33, 0.54);
  color: var(--amber);
  font-size: 18px;
  cursor: pointer;
}

.chat-call-actions button:hover, .attach-btn:hover { border-color: var(--line-bright); }
.messages {
  overflow-y: auto;
  padding: 24px max(16px, calc((100vw - 760px) / 2));
  scroll-behavior: smooth;
}

.message {
  clear: both;
  max-width: min(78%, 560px);
  margin: 8px 0;
  padding: 9px 13px 11px;
  border: 1px solid rgba(229, 203, 160, 0.18);
  border-radius: 16px 16px 16px 5px;
  background: rgba(36, 55, 79, 0.75);
  overflow-wrap: anywhere;
}

.message.mine {
  float: right;
  border-color: rgba(241, 162, 188, 0.32);
  border-radius: 16px 16px 5px 16px;
  background: rgba(90, 50, 79, 0.74);
}

.message-author {
  display: block;
  margin-bottom: 5px;
  color: var(--amber);
  font-size: 11px;
  font-weight: 750;
}

.message-text { white-space: pre-wrap; line-height: 1.55; }
.message img { display: block; max-width: 100%; max-height: 340px; border-radius: 10px; }
.message audio { display: block; max-width: min(320px, 70vw); }
.message-time { display: block; margin-top: 5px; color: #c4cad7; font-size: 10px; text-align: right; }
.chat-controls {
  display: grid;
  grid-template-columns: 42px 42px 1fr 44px;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
  padding: 9px;
  border-radius: 0 0 17px 17px;
}

.chat-controls input { height: 46px; }
.send-btn { width: 44px; height: 44px; border-color: var(--signal); background: var(--signal); color: #150f19; }

.remembrance-panel { max-width: 680px; margin: 0 auto; }
.remembrance-copy { position: relative; padding-right: 78px; }
.remembrance-copy h2 { font-family: ui-serif, Georgia, serif; font-size: 28px; }
.remembrance-copy p { max-width: 56ch; line-height: 1.6; }
.remembrance-star { position: absolute; top: 1px; right: 10px; color: var(--amber); font-size: 48px; }

.count-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0 14px;
}

.count-pair article {
  display: grid;
  min-height: 102px;
  align-content: center;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(10, 16, 33, 0.56);
}

.count-pair span { color: var(--muted); font-size: 13px; line-height: 1.45; }
.count-pair strong { color: var(--amber); font-size: 28px; }

.remember-btn {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line-bright);
  border-radius: 14px;
  background: var(--signal);
  color: #170f18;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.remember-btn span { margin-right: 8px; font-size: 20px; }

.location-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(270px, 0.85fr); gap: 18px; }
.location-layout h2 { font-size: 18px; }
.location-layout .section-heading { align-items: flex-start; }
.location-layout .section-heading .muted { margin: 6px 0 0; font-size: 13px; line-height: 1.45; }

.location-state {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.location-state.is-live { border-color: rgba(145, 217, 211, 0.55); color: var(--aqua); }
.location-state.is-stale { border-color: rgba(255, 179, 107, 0.55); color: var(--amber); }

.location-empty {
  display: grid;
  min-height: 210px;
  align-content: center;
  justify-items: center;
  gap: 8px;
  margin-top: 15px;
  padding: 22px;
  border: 1px dashed rgba(229, 203, 160, 0.3);
  border-radius: 14px;
  background: rgba(10, 16, 33, 0.42);
  color: var(--muted);
  text-align: center;
}

.location-empty > span { color: var(--amber); font-size: 29px; }
.location-empty strong { color: var(--ink); }
.location-empty p { max-width: 35ch; margin: 0; font-size: 13px; line-height: 1.55; }
.partner-map { width: 100%; height: 260px; margin-top: 15px; border-radius: 14px; overflow: hidden; background: var(--indigo); }
.location-meta { min-height: 20px; margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.map-link { display: inline-block; margin-top: 6px; color: var(--amber); font-size: 13px; font-weight: 700; }
.share-contact-list { display: grid; gap: 8px; margin: 18px 0; }

.share-contact-option {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 16, 33, 0.52);
  cursor: pointer;
}

.share-contact-option input { width: 18px; height: 18px; min-height: auto; margin: 0; accent-color: var(--signal); }
.share-contact-option span { display: grid; gap: 3px; }
.share-contact-option strong { font-size: 13px; }
.share-contact-option small { color: var(--muted); font-size: 11px; }

.share-location-btn {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line-bright);
  border-radius: 13px;
  background: rgba(255, 100, 78, 0.17);
  color: #ffe0d7;
  font-weight: 800;
  cursor: pointer;
}

.share-location-btn.is-sharing { border-color: rgba(145, 217, 211, 0.7); background: rgba(48, 113, 109, 0.48); color: #d9fffa; }
.location-note { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }

.global-status {
  min-height: 22px;
  margin: 20px 0 4px;
  color: #d1d6e2;
  font-size: 13px;
}

.app-footer {
  padding: 20px 0 8px;
  border-top: 1px solid rgba(229, 203, 160, 0.16);
  color: #c1c6d3;
  font-size: 12px;
  text-align: center;
}

.incoming-call {
  position: fixed;
  z-index: 31;
  left: 50%;
  bottom: 24px;
  width: min(360px, calc(100% - 32px));
  transform: translateX(-50%);
  padding: 18px;
  border-radius: 18px;
}

.incoming-call div { display: flex; gap: 9px; margin-top: 13px; }
.incoming-call button { flex: 1; min-height: 42px; border: 1px solid var(--line); border-radius: 11px; background: rgba(10, 16, 33, 0.7); cursor: pointer; }
.incoming-call button:first-child { border-color: var(--aqua); background: var(--aqua); color: #0a1720; }

.call-overlay {
  position: fixed;
  z-index: 30;
  inset: 0;
  background: #04070f;
}

.call-overlay video#remoteVideo { width: 100%; height: 100%; object-fit: cover; }
.call-overlay video#localVideo { position: absolute; right: 18px; bottom: 100px; width: 112px; height: 150px; border-radius: 14px; object-fit: cover; background: #000; transform: scaleX(-1); }
.call-controls { position: absolute; left: 50%; bottom: 28px; display: flex; gap: 18px; transform: translateX(-50%); }
.call-controls button { width: 54px; height: 54px; border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 50%; background: rgba(22, 35, 61, 0.88); color: var(--ink); font-size: 20px; cursor: pointer; }
.call-controls .hangup { border-color: #ef5264; background: #ef5264; color: white; transform: rotate(135deg); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 720px) {
  .shell { width: min(100% - 32px, 620px); padding-top: 14px; }
  .app-header { margin-bottom: 22px; }
  .atlas-intro { align-items: flex-start; flex-direction: column; gap: 16px; }
  .atlas-intro h1 { font-size: clamp(33px, 9vw, 46px); }
  .add-contact-shortcut { width: 100%; }
  .atlas-panel { min-height: 0; padding: 18px 15px 15px; }
  .atlas-lines { inset: 62px 0 38px; width: 100%; }
  .atlas-nodes { grid-template-columns: 1fr; gap: 10px; min-height: 0; padding: 22px 3px 14px; }
  .atlas-node, .node-messages, .node-remember, .node-location { min-height: 75px; transform: none; }
  .atlas-node:hover, .node-messages:hover, .node-remember:hover, .node-location:hover { transform: translateY(-2px); }
  .atlas-footnote { text-align: left; line-height: 1.45; }
  .dashboard-lower { grid-template-columns: 1fr; gap: 18px; margin-top: 27px; }
  .dashboard-note { min-height: 110px; }
  .contact-list { grid-template-columns: 1fr; }
  .location-layout { grid-template-columns: 1fr; }
  .page-heading h1 { font-size: 34px; }
  .chat-view { padding: 0 10px; grid-template-rows: 68px 1fr 72px; }
  .chat-header { margin-top: 6px; padding: 6px 8px; }
  .chat-controls { margin-bottom: 6px; padding: 6px; gap: 4px; }
  .chat-controls { grid-template-columns: 38px 38px 1fr 42px; }
  .chat-controls .attach-btn { width: 38px; height: 38px; }
  .chat-controls input { height: 42px; padding: 0 10px; }
  .messages { padding: 18px 10px; }
  .admin-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-form-grid, .profile-edit-grid { grid-template-columns: 1fr; }
  .profile-edit-grid label:last-child { grid-column: auto; }
  .profile-media-actions { grid-template-columns: 1fr; }
  .layout-presets { grid-template-columns: 1fr; }
  .admin-role-grid { grid-template-columns: 1fr; }
  .admin-user-row { grid-template-columns: 1fr; }
  .admin-user-actions { width: 100%; }
  .admin-user-actions button { flex: 1; }
  .post-composer-actions { grid-template-columns: 1fr; }
  .post-composer-actions .primary-btn { width: 100%; }
  .profile-cover { height: 180px; }
  .profile-avatar-row { margin-left: 14px; }
  .profile-page-avatar { width: 82px; height: 82px; flex-basis: 82px; }
}

@media (max-width: 430px) {
  .shell { width: calc(100% - 24px); }
  .app-update-banner {
    right: 12px;
    bottom: 12px;
    left: 12px;
    max-width: none;
  }
  .brand { gap: 7px; font-size: 21px; }
  .brand-mark { width: 34px; height: 34px; font-size: 18px; }
  .profile-badge { gap: 7px; max-width: 56vw; padding-right: 9px; }
  .profile-avatar { flex-basis: 32px; width: 32px; height: 32px; }
  .profile-summary strong { font-size: 12px; }
  .profile-summary small { font-size: 10px; }
  .profile-chevron { font-size: 16px; }
  .auth-view { margin-top: 4vh; padding: 23px 19px; }
  .auth-view h1 { font-size: 32px; }
  .search-form { grid-template-columns: 1fr; }
  .search-form .primary-btn { width: 100%; }
  .search-result-card { align-items: stretch; flex-direction: column; }
  .search-result-card .secondary-btn, .search-result-card .primary-btn { width: 100%; }
  .count-pair { grid-template-columns: 1fr; }
  .count-pair article { min-height: 82px; }
  .chat-call-actions button { width: 37px; height: 37px; }
  .chat-view { grid-template-columns: minmax(0, 1fr); }
  .chat-person strong { max-width: 37vw; }
  .chat-controls { grid-template-columns: 34px 34px minmax(0, 1fr) 40px; }
  .chat-controls .attach-btn { width: 34px; height: 38px; border: 0; }
  .chat-controls input { min-width: 0; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
