:root {
  --ground: #F5F6FB;
  --surface: #FFFFFF;
  --line: #E6E8F2;
  --line-strong: #D5D9E8;
  --divider: #EEF0F6;
  --ink: #17152B;
  --ink-soft: #555A72;
  --chevron: #9AA0B8;
  --lav: #7C64BF;          /* primary */
  --lav-dark: #5E48A3;     /* links, active nav */
  --lav-tint: #EFEBFA;
  --indigo: #231A57;       /* hero panels */
  --on-indigo: #D4CEF4;
  --yellow: #FFD66B;       /* the ring button: the one loud thing */
  --blue: #3E5BA8;         /* touch */
  --blue-tint: #EAF0FB;
  --red: #C8403A;          /* alert fill */
  --red-text: #B03A33;
  --red-tint: #FCEDEC;
  --amber-text: #7A5500;   /* buzz */
  --amber-tint: #FFF4D6;
  --green: #1C7F52;
  --green-tint: #E6F5EE;
  --shadow: 0 12px 32px rgba(35, 26, 87, 0.12);
  --font: "Nunito", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--ground); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--lav-dark); }
a:hover { color: #4A3690; }
:focus-visible { outline: 3px solid var(--lav); outline-offset: 2px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }

/* ---------- Brand ---------- */
.logo { display: flex; align-items: center; gap: 12px; font-size: 24px; font-weight: 900; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.logo-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--lav-tint); color: var(--lav); display: grid; place-items: center; }
.logo-mark svg { width: 24px; height: 24px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 22px; border-radius: 999px; border: 1.5px solid transparent; font-size: 16px; font-weight: 800; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--lav); color: #FFFFFF; }
.btn-primary:hover:not(:disabled) { background: var(--lav-dark); color: #FFFFFF; }
.btn-dark { background: var(--ink); color: #FFFFFF; }
/* Apple's sign-in button: black, white logo, system font, same size as Google's large pill button. */
.btn-apple { align-self: center; width: 100%; max-width: 360px; min-height: 40px; background: #000000; color: #FFFFFF; font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif; font-size: 15px; font-weight: 500; }
.btn-outline { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-outline-dark { background: var(--surface); border-color: var(--ink); color: var(--ink); }
.btn-touch { background: var(--blue-tint); color: var(--blue); }
.btn-ring { background: var(--lav); color: #FFFFFF; }
.btn-alert { background: var(--surface); border-color: var(--red); color: var(--red-text); }
.btn-buzz { background: var(--amber-tint); color: var(--amber-text); }
.btn-checkin { background: var(--green-tint); color: var(--green); }
.btn-danger { background: var(--red); color: #FFFFFF; }
.btn-yellow { background: var(--yellow); color: var(--ink); }
.btn-ghost-light { background: transparent; border-color: rgba(255, 255, 255, 0.6); color: #FFFFFF; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 15px; }
.btn-block { width: 100%; min-height: 52px; font-size: 17px; }
.link-btn { background: none; border: 0; padding: 0; font-weight: 800; font-size: 14px; color: var(--lav-dark); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn.danger { color: var(--red-text); }
.play { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--lav-dark); display: grid; place-items: center; cursor: pointer; }
.play svg { width: 14px; height: 14px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 8px; font-size: 15px; font-weight: 700; }
.input, .select { height: 48px; width: 100%; padding: 0 16px; border: 1.5px solid var(--line-strong); border-radius: 12px; background: var(--surface); font-size: 16px; font-weight: 400; color: var(--ink); }
.select { font-weight: 700; padding: 0 12px; }
.select-sm { height: 40px; width: auto; min-width: 0; font-size: 14px; border-radius: 10px; padding: 0 10px; }
.input:focus, .select:focus { border-color: var(--lav); outline: none; }
.input::placeholder { color: #8A8FA6; }
.error { color: var(--red-text); font-weight: 700; min-height: 1.5em; font-size: 15px; }
.switch { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; border-radius: 13px; background: var(--line-strong); position: relative; margin: 0; cursor: pointer; flex-shrink: 0; }
.switch::before { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #FFFFFF; transition: left 0.15s; }
.switch:checked { background: var(--lav); }
.switch:checked::before { left: 21px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 15px; font-weight: 700; }
input[type="range"] { accent-color: var(--lav); width: 100%; margin: 0; }
.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 4px; border-radius: 999px; background: #F0F2F8; }
.segmented button { height: 36px; border: 0; border-radius: 999px; background: transparent; font-size: 14px; font-weight: 700; color: var(--ink-soft); cursor: pointer; }
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--ink); font-weight: 800; box-shadow: 0 2px 6px rgba(23, 21, 43, 0.08); }

/* ---------- Chips, avatars, cards ---------- */
.chip { display: inline-flex; align-items: center; font-size: 13px; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: #F0F2F8; color: var(--ink-soft); }
.chip.touch { background: var(--blue-tint); color: var(--blue); }
.chip.ring { background: var(--lav-tint); color: var(--lav-dark); }
.chip.alert { background: var(--red-tint); color: var(--red-text); }
.chip.buzz { background: var(--amber-tint); color: var(--amber-text); }
.chip.ok, .chip.checkin { background: var(--green-tint); color: var(--green); }
.chip.chat { background: var(--lav-tint); color: var(--lav-dark); }
.avatar { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; font-weight: 900; background: var(--blue-tint); color: var(--blue); }
.avatar.c1 { background: var(--lav-tint); color: var(--lav-dark); }
.avatar.c2 { background: var(--green-tint); color: var(--green); }
.avatar.c3 { background: #FDF3DA; color: #8A5A00; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.card-pad { padding: 24px; }
.muted { color: var(--ink-soft); }
.ok-text { color: var(--green); font-weight: 700; }
.warn-text { color: var(--red-text); font-weight: 700; }

/* ---------- Sign in ---------- */
.topnav { height: 80px; padding: 0 64px; display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-bottom: 1px solid var(--line); }
.topnav nav { display: flex; gap: 12px; }
.hero { min-height: calc(100vh - 80px); padding: 24px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.hero-panel { background: var(--indigo); color: #FFFFFF; border-radius: 24px; padding: 88px 88px 72px; display: flex; flex-direction: column; justify-content: space-between; gap: 48px; }
.hero-panel h1 { font-size: clamp(40px, 4.4vw, 64px); line-height: 1.02; font-weight: 900; letter-spacing: -0.035em; }
.hero-panel .lede { max-width: 480px; font-size: 20px; color: var(--on-indigo); margin-top: 24px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; max-width: 560px; }
.tile { padding: 18px 18px 16px; border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.06); display: flex; flex-direction: column; gap: 8px; }
.tile strong { font-size: 17px; font-weight: 800; }
.tile span { font-size: 14px; color: #C9C3EE; }
.tile svg { width: 24px; height: 24px; }
.hero-side { position: relative; background: #EEF2FA; border-radius: 24px; display: grid; place-items: center; padding: 96px 24px; }
.float-chip { position: absolute; display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); font-size: 15px; font-weight: 800; }
.float-chip.top { top: 48px; left: 48px; }
.float-chip.bottom { bottom: 48px; right: 48px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.auth-card { width: min(440px, 100%); padding: 40px; background: var(--surface); border-radius: 24px; box-shadow: 0 20px 48px rgba(35, 26, 87, 0.10); display: flex; flex-direction: column; gap: 18px; }
.auth-card h2 { font-size: 30px; font-weight: 900; }
.divider-text { display: flex; align-items: center; gap: 12px; color: var(--ink-soft); font-size: 14px; }
.divider-text::before, .divider-text::after { content: ""; flex-grow: 1; height: 1px; background: var(--line); }

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 256px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; padding: 28px 20px; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; }
.sidebar .logo { padding: 0 8px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 32px; }
.side-nav button, .side-nav a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 0; border-radius: 12px; background: transparent; color: var(--ink-soft); font-size: 16px; font-weight: 700; cursor: pointer; text-align: left; }
.side-nav a { text-decoration: none; }
.side-nav button svg, .side-nav a svg { width: 22px; height: 22px; }
.side-nav button[aria-current="page"] { background: var(--lav-tint); color: var(--lav-dark); font-weight: 800; }
.user-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: var(--ground); }
.user-card .avatar { width: 40px; height: 40px; }
.user-card .name { font-size: 15px; font-weight: 800; overflow-wrap: anywhere; }
.mobilebar, .mobiletabs { display: none; }
/* Theater mode: the button in the sidebar / mobile bar, and the banner while it's on. */
.theater-btn { margin-top: 16px; width: 100%; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; font-weight: 800; text-align: left; cursor: pointer; }
.theater-btn.on { background: var(--indigo); border-color: var(--indigo); color: #FFFFFF; }
.theater-btn-sm { margin-top: 0; width: auto; min-height: 36px; font-size: 14px; border-radius: 999px; }
.theater-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; padding: 12px 16px; border-radius: 14px; background: var(--indigo); color: #FFFFFF; font-weight: 700; font-size: 15px; }
.theater-banner .link-btn { color: var(--yellow); }
.theater-icon { font-size: 40px; line-height: 1; }
.content { flex-grow: 1; min-width: 0; padding: 40px 56px 120px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.page-head h1 { font-size: 36px; font-weight: 900; letter-spacing: -0.025em; }
.page-head p { font-size: 17px; color: var(--ink-soft); margin-top: 6px; }
.section-title { font-size: 20px; font-weight: 900; margin: 32px 0 14px; }
.notice { background: var(--ink); color: #FFFFFF; border-radius: 16px; padding: 14px 18px; margin-bottom: 20px; font-weight: 800; white-space: pre-line; }

/* ---------- Phones ---------- */
.hero-card { position: relative; min-height: 420px; background: var(--indigo); color: #FFFFFF; border-radius: 24px; padding: 48px 56px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; overflow: hidden; }
.hero-info { display: flex; flex-direction: column; justify-content: space-between; gap: 24px; }
.hero-info .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-dark { font-size: 13px; font-weight: 800; padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); color: #FFFFFF; }
.chip-dark.ok { background: rgba(28, 127, 82, 0.28); color: #9BE3BE; }
.chip-dark.warn { background: rgba(255, 214, 107, 0.18); color: var(--yellow); }
.hero-info h2 { font-size: 48px; font-weight: 900; letter-spacing: -0.03em; margin-top: 16px; overflow-wrap: anywhere; }
.hero-info .detail { font-size: 17px; color: var(--on-indigo); margin-top: 8px; }
.status { font-size: 22px; font-weight: 800; min-height: 1.5em; }
.stage-extra { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 12px; font-size: 15px; color: var(--on-indigo); }
.stage-extra:empty { display: none; }
.stage-extra a, .stage-extra .link-btn { color: var(--yellow); font-weight: 800; font-size: 15px; }
.hero-card[data-state="ringing"] .status { color: var(--yellow); }
.hero-card[data-state="failed"] .status { color: #FFB4AC; }
.bell-wrap { position: relative; display: grid; place-items: center; min-height: 320px; }
.bell { position: relative; z-index: 1; width: 232px; height: 232px; border-radius: 50%; border: 0; background: var(--yellow); color: var(--ink); font-size: 44px; font-weight: 900; letter-spacing: -0.02em; box-shadow: 0 0 0 12px rgba(255, 214, 107, 0.18); cursor: pointer; transition: transform 120ms ease; }
.bell:active:not(:disabled) { transform: scale(0.97); }
.bell:disabled { cursor: default; }
.hero-card[data-state="idle"] .bell:disabled { background: #6A5FA3; color: #C9C3EE; box-shadow: none; }
.hero-card[data-state="busy"] .bell, .hero-card[data-state="ringing"] .bell { font-size: 36px; }
.wave { position: absolute; width: 232px; height: 232px; border-radius: 50%; border: 3px solid var(--yellow); opacity: 0; pointer-events: none; }
/* The one moment of motion: while the phone confirms it's ringing. */
.hero-card[data-state="ringing"] .wave { animation: wave 1.8s ease-out infinite; }
.hero-card[data-state="ringing"] .wave + .wave { animation-delay: 0.9s; }
@keyframes wave { from { transform: scale(1); opacity: 0.8; } to { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .hero-card[data-state="ringing"] .wave { animation: none; opacity: 0.5; transform: scale(1.25); }
}
.phone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.phone-card { display: flex; align-items: center; gap: 16px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; text-align: left; cursor: pointer; width: 100%; }
.phone-card[aria-pressed="true"] { border: 2px solid var(--lav); padding: 21px; }
.phone-card.add { background: transparent; border: 1.5px dashed #C5CAE0; cursor: default; }
.icon-tile { width: 48px; height: 48px; flex-shrink: 0; border-radius: 14px; display: grid; place-items: center; background: var(--lav-tint); color: var(--lav); }
.icon-tile svg { width: 24px; height: 24px; }
.icon-tile.emoji-tile { font-size: 24px; line-height: 1; }
.icon-tile.blue { background: var(--blue-tint); color: var(--blue); }
.icon-tile.red { background: var(--red-tint); color: var(--red-text); }
.icon-tile.amber { background: var(--amber-tint); color: var(--amber-text); }
.icon-tile.green { background: var(--green-tint); color: var(--green); }
.buzz-icon { width: 60px; height: 60px; border-radius: 50%; background: var(--amber-tint); color: var(--amber-text); display: grid; place-items: center; }
.buzz-icon svg { width: 28px; height: 28px; }
.icon-tile.plain { background: var(--surface); color: var(--ink-soft); }
.phone-card .grow, .row .grow { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.title-sm { font-size: 17px; font-weight: 800; overflow-wrap: anywhere; }
.meta { font-size: 14px; color: var(--ink-soft); }

/* ---------- People ---------- */
.people-layout { display: flex; gap: 32px; align-items: flex-start; }
.people-main { flex-grow: 1; min-width: 0; }
.people-side { width: 380px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 40px; }
.group-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 24px 0 10px; }
.group-head h2 { font-size: 20px; font-weight: 900; margin-right: 4px; }
.group-head .link-btn { margin-left: auto; }
.list-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 16px; padding: 18px 22px; }
.list-card .row + .row { border-top: 1px solid var(--divider); }
.person-btn { display: flex; align-items: center; gap: 16px; flex-grow: 1; min-width: 0; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.empty { padding: 22px; color: var(--ink-soft); }
.link-field { display: flex; align-items: center; min-height: 46px; border: 1.5px solid var(--line-strong); border-radius: 12px; padding: 5px 6px 5px 14px; gap: 6px; }
.link-field .prefix { font-size: 14px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.link-field .code { font-size: 14px; font-weight: 800; flex-grow: 1; }
.link-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-soft); margin-top: 6px; }
.invite-item + .invite-item { margin-top: 14px; }

/* Live status toast */
.toast { position: fixed; left: calc(256px + 56px); bottom: 32px; z-index: 5; display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 256px - 112px); padding: 12px 12px 12px 20px; background: var(--ink); color: #FFFFFF; border-radius: 999px; box-shadow: 0 16px 40px rgba(23, 21, 43, 0.25); }
.toast svg { width: 22px; height: 22px; flex-shrink: 0; }
.toast .t-main { display: flex; align-items: center; gap: 14px; min-width: 0; flex-grow: 1; }
.toast .t-title { font-size: 16px; font-weight: 800; white-space: nowrap; }
.toast .t-status { display: flex; align-items: center; gap: 8px; font-size: 15px; color: #CFE9DC; }
.toast[data-state="failed"] .t-status { color: #FFB4AC; }
.toast .t-status .dot { width: 8px; height: 8px; background: #5FD39A; }
.toast[data-state="failed"] .t-status .dot { background: #FF8A80; }
.toast .btn { min-height: 36px; padding: 0 16px; font-size: 14px; }
.toast .close { background: none; border: 0; color: #C9C3EE; cursor: pointer; font-weight: 800; padding: 8px; }

/* ---------- Settings ---------- */
.defaults-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.type-card { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.type-head { display: flex; align-items: center; gap: 12px; }
.type-head .icon-tile { width: 44px; height: 44px; }
.type-head strong { font-size: 19px; font-weight: 900; display: block; }
.stack-8 { display: flex; flex-direction: column; gap: 8px; }
.label { font-size: 15px; font-weight: 700; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline .select { flex-grow: 1; }
.groups-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin: 40px 0 16px; }
.groups-head form { display: flex; gap: 8px; }
.groups-head .input { width: 240px; height: 46px; }
.groups-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 720px), 1fr)); gap: 16px; }
.group-card { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.group-card .head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.group-card .head strong { font-size: 19px; font-weight: 900; }
.group-card .head .spacer { flex-grow: 1; }
.rules { display: grid; grid-template-columns: 64px repeat(3, minmax(0, 220px)); gap: 10px 12px; align-items: center; font-size: 14px; }
.rules .th { font-weight: 700; color: var(--ink-soft); }
.rules .type { font-weight: 900; }
.rules .fixed { font-size: 13px; font-weight: 800; color: var(--green); }
/* People: filter by group, and each person's groups. */
.filter-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin-bottom: 14px; scrollbar-width: none; }
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chip { flex-shrink: 0; min-height: 36px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; }
.filter-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }
.person-groups { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.person-groups .chip { font-size: 12px; padding: 2px 10px; }
.name-card { padding: 24px; display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.name-card .field { flex-grow: 1; min-width: 220px; }

/* ---------- Activity ---------- */
.activity .row { align-items: flex-start; }
.activity .quote { font-weight: 700; }
.maps-link { font-weight: 800; font-size: 14px; }
.activity-filter { display: flex; margin: -12px 0 16px; }
.activity-filter .select-sm { max-width: min(320px, 60vw); }

/* ---------- Dialogs ---------- */
/* Long dialogs (many people, many powers) scroll inside, so their buttons stay reachable. */
dialog { border: 0; border-radius: 24px; padding: 0; width: min(520px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow: auto; background: var(--surface); color: var(--ink); box-shadow: 0 24px 64px rgba(23, 21, 43, 0.25); }
dialog::backdrop { background: rgba(23, 21, 43, 0.45); }
.dialog-body { display: flex; flex-direction: column; gap: 18px; padding: 28px; }
.dialog-center { align-items: center; text-align: center; }
.big-avatar { width: 84px; height: 84px; font-size: 38px; }
.alert-icon { width: 60px; height: 60px; border-radius: 50%; background: var(--red-tint); color: var(--red-text); display: grid; place-items: center; }
.alert-icon svg { width: 30px; height: 30px; }
.share-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--ground); }
.share-row .grow { flex-grow: 1; display: flex; flex-direction: column; }
.rule-row { display: grid; grid-template-columns: 56px 1fr; gap: 8px 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--divider); }
.rule-row .type { font-weight: 900; }
.rule-row .controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.checkin-icon { width: 60px; height: 60px; border-radius: 50%; background: var(--green-tint); display: grid; place-items: center; font-size: 28px; }

/* People: search, sort, group sends */
.people-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.people-tools .input { flex: 1 1 auto; height: 44px; }
.sort-field { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
.group-send { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.person-extra { font-size: 14px; font-weight: 700; color: var(--ink-soft); }

/* Chat with one person or a group: the log scrolls, the header and the composer stay put. */
dialog.chat-dialog { width: min(640px, calc(100% - 32px)); height: min(760px, calc(100dvh - 32px)); overflow: hidden; }
.chat { display: flex; flex-direction: column; height: 100%; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--divider); }
.chat-head .grow { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.chat-head h2 { font-size: 20px; font-weight: 900; overflow-wrap: anywhere; }
.chat-close { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--ground); font-size: 16px; cursor: pointer; flex-shrink: 0; }
.chat-log { flex: 1 1 auto; overflow-y: auto; padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 4px; background: var(--ground); overscroll-behavior: contain; }
.chat-info { text-align: center; font-size: 14px; color: var(--ink-soft); padding: 8px 0; }
.chat-day { display: flex; justify-content: center; margin: 12px 0 6px; }
.chat-day span { font-size: 13px; font-weight: 800; color: var(--ink-soft); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 2px 12px; }
.chat-row { display: flex; align-items: flex-end; gap: 8px; max-width: 85%; }
.chat-row.first { margin-top: 6px; }
.chat-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.chat-row.theirs { align-self: flex-start; }
.chat-avatar, .chat-avatar-space { width: 30px; height: 30px; font-size: 14px; flex-shrink: 0; }
.chat-col { display: flex; flex-direction: column; min-width: 0; }
.chat-row.mine .chat-col { align-items: flex-end; }
.chat-name { font-size: 13px; font-weight: 800; color: var(--lav-dark); margin: 0 0 2px 10px; }
.chat-bubble { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px 12px 6px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); overflow-wrap: anywhere; }
.chat-row.mine .chat-bubble { background: var(--lav-tint); border-color: transparent; }
.chat-text { white-space: pre-wrap; }
.chat-bubble.event, .chat-bubble.power { padding: 6px 12px 4px; border-style: dashed; }
.chat-bubble.event .chat-text, .chat-bubble.power .chat-text { font-weight: 800; font-size: 15px; }
.chat-bubble.alert { background: var(--red-tint); border-color: var(--red); color: var(--red-text); }
.chat-row.mine .chat-bubble.alert { background: var(--red-tint); border-color: var(--red); }
.chat-bubble.alert .chat-text { font-weight: 900; }
.chat-quote { font-weight: 700; font-size: 15px; }
.chat-detail { font-size: 14px; color: var(--ink-soft); }
.chat-foot { align-self: flex-end; font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.chat-notice { padding: 8px 20px 0; font-size: 14px; white-space: pre-line; }
.chat-composer { display: flex; gap: 10px; align-items: flex-end; padding: 12px 16px 16px; }
.chat-composer textarea { font: inherit; flex: 1 1 auto; min-height: 48px; max-height: 160px; resize: none; padding-top: 11px; padding-bottom: 11px; line-height: 1.4; }
.chat-closed { padding: 12px 20px 16px; text-align: center; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 640px) {
  dialog.chat-dialog { width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .chat-row { max-width: 92%; }
}

/* Settings: about you */
.about-card { padding: 24px; display: flex; flex-direction: column; gap: 18px; max-width: 720px; }
.display-card { padding: 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; max-width: 720px; }
.display-card .meta { grid-column: 1 / -1; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .people-layout { flex-direction: column; }
  .people-side { width: 100%; position: static; }
}
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
  .hero-panel { padding: 48px 32px; }
  .hero-side { padding: 88px 16px; }
  .topnav { padding: 0 16px; }
  .sidebar { display: none; }
  .shell { flex-direction: column; }
  .mobilebar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .mobilebar .logo { font-size: 21px; }
  .mobilebar .logo-mark { width: 34px; height: 34px; border-radius: 10px; }
  .mobiletabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin: 16px 16px 0; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
  .mobiletabs { overflow-x: auto; scrollbar-width: none; grid-auto-columns: minmax(max-content, 1fr); }
  .mobiletabs::-webkit-scrollbar { display: none; }
  .mobiletabs button { padding: 0 10px; }
  .people-tools { flex-wrap: wrap; }
  .mobiletabs button { height: 40px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-soft); font-size: 14px; font-weight: 700; cursor: pointer; }
  .mobiletabs button[aria-current="page"] { background: var(--ink); color: #FFFFFF; font-weight: 800; }
  .content { padding: 20px 16px 120px; }
  .page-head h1 { font-size: 30px; }
  .hero-card { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 24px; min-height: 0; text-align: center; }
  /* Name first, then the button, then the status (the design's phone order). */
  .hero-info { display: contents; }
  .hero-info > :first-child { order: 1; }
  .bell-wrap { order: 2; min-height: 230px; width: 100%; }
  .hero-info > :last-child { order: 3; align-items: center; }
  .hero-info .chips { justify-content: center; }
  .hero-info h2 { font-size: 32px; margin-top: 12px; }
  .bell, .wave { width: 168px; height: 168px; }
  .bell { font-size: 32px; }
  .hero-card[data-state="busy"] .bell, .hero-card[data-state="ringing"] .bell { font-size: 28px; }
  .row { flex-wrap: wrap; }
  .actions { width: 100%; justify-content: stretch; }
  .actions .btn { flex: 1 1 0; }
  .toast { left: 16px; right: 16px; bottom: 16px; max-width: none; border-radius: 22px; padding: 10px 8px 10px 16px; }
  .toast .t-main { flex-direction: column; align-items: flex-start; gap: 0; }
  .toast .t-title { font-size: 14px; white-space: normal; }
  .toast .t-status { font-size: 13px; }
  .rules { grid-template-columns: 56px repeat(2, minmax(0, 1fr)); }
  .rules .silent { grid-column: 2 / -1; }
  .rules .th.silent { display: none; }
}

/* ---------- Powers (optional) ---------- */
.nav-powers[hidden] { display: none !important; }
.power-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.power-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 16px 18px; text-align: center; border-top: 5px solid var(--rarity, var(--line)); }
.power-card.locked { opacity: 0.55; }
.power-card.invite { --rarity: var(--lav); }
/* Invites: two rows that scroll sideways, so the list can grow without pushing the collection down. */
.invite-scroll { grid-template-columns: none; grid-template-rows: repeat(2, auto); grid-auto-flow: column; grid-auto-columns: 200px; min-width: 0; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding: 2px 2px 8px; }
.invite-scroll > * { scroll-snap-align: start; }
.power-card .emoji { font-size: 44px; line-height: 1.1; }
.power-card .name { font-size: 17px; font-weight: 900; }
.power-card .actions { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 6px; }
.rarity { font-size: 12px; font-weight: 900; letter-spacing: 0.04em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; color: var(--rarity-ink); background: var(--rarity-tint); }
.r-common { --rarity: #8C95B0; --rarity-ink: #4F5873; --rarity-tint: #EEF0F6; }
.r-uncommon { --rarity: #2E9E6A; --rarity-ink: #1C7F52; --rarity-tint: #E6F5EE; }
.r-rare { --rarity: #3E6FD8; --rarity-ink: #2F55A8; --rarity-tint: #EAF0FB; }
.r-mythical { --rarity: #8B55D6; --rarity-ink: #5E48A3; --rarity-tint: #EFEBFA; }
.r-legendary { --rarity: #E59A1A; --rarity-ink: #7A5500; --rarity-tint: #FFF4D6; }
.row.unavailable { opacity: 0.55; }
.power-profile { display: flex; flex-direction: column; gap: 18px; margin-bottom: 8px; }
.profile-head { display: flex; align-items: center; gap: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--ground); min-width: 0; }
.stat strong { font-size: 18px; font-weight: 900; overflow-wrap: anywhere; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.set-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.set-card.done { border-color: var(--green); }
.set-card .grow { flex-grow: 1; min-width: 0; }
.set-emoji { font-size: 30px; line-height: 1; }
.progress { height: 8px; border-radius: 4px; background: var(--divider); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--lav); border-radius: 4px; }
.set-card.done .progress span { background: var(--green); }
.set-powers { display: flex; flex-wrap: wrap; gap: 4px; font-size: 20px; }
.set-powers .missing { opacity: 0.35; }

/* A bounded people list in the power sheet, so groups and the buttons below stay in view. */
.scroll-list { max-height: min(340px, 45dvh); overflow-y: auto; flex-shrink: 0; }
.scroll-list .row { padding: 12px 16px; }
/* Picking a power from a person's details. */
.power-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; max-height: min(380px, 50dvh); overflow-y: auto; padding: 2px; }
.power-pick { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px 10px; border: 1px solid var(--line); border-top: 4px solid var(--rarity, var(--line)); border-radius: 14px; background: var(--surface); color: var(--ink); text-align: center; cursor: pointer; }
.power-pick.invite { --rarity: var(--lav); }
.power-pick-grid.invite-scroll { grid-auto-columns: 118px; max-height: none; overflow-y: visible; }
.power-pick:hover:not(:disabled) { border-color: var(--lav); }
.power-pick:disabled { opacity: 0.5; cursor: default; }
.power-pick .emoji { font-size: 32px; line-height: 1.1; }
.power-pick .name { font-size: 14px; font-weight: 900; overflow-wrap: anywhere; }
.power-pick .meta { font-size: 12px; }
.help-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }

/* A section title with a control on its right, like the Powers collection's sort. */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 32px 0 14px; }
.section-head .section-title { margin: 0; }

/* A contact who has RinGo open right now: a green dot on the avatar's corner. */
.avatar-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.presence-dot { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--green); border: 2px solid var(--surface); }
.big-avatar + .presence-dot { right: 4px; bottom: 4px; width: 18px; height: 18px; border-width: 3px; }
