/* Contacts++ web app. Builds on the site palette in /styles.css. */
body.webapp { background: var(--paper); min-height: 100vh; }
.boot, .noscript { min-height: 100vh; display: grid; place-content: center; text-align: center; gap: 12px; color: var(--muted); }
.boot img { width: 56px; margin: auto; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; transform: scale(.94); } }

/* Shell */
.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.side-nav { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 20px 14px; border-right: 1px solid var(--line); background: #fff; overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: 10px; font: 800 22px Manrope; padding: 4px 10px 18px; }
.side-brand img { width: 34px; height: 34px; border-radius: 10px; }
.side-brand b { color: var(--green); }
.side-nav nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 14px; font-weight: 600; color: #34504c; position: relative; }
.side-nav nav a:hover { background: #eef6f2; }
.side-nav nav a.active { background: var(--mint); color: var(--ink); }
.nav-icon { width: 24px; text-align: center; font-size: 18px; }
.nav-divider { height: 1px; background: var(--line); margin: 10px 8px; }
.badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: #b3261e; color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.side-user { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.chip-link { display: flex; align-items: center; gap: 10px; }
.chip-link b { display: block; } .chip-link small { color: var(--muted); }
.view { min-width: 0; padding: 24px clamp(16px, 4vw, 40px) 96px; outline: none; }
.bottom-nav { display: none; }
#root.full .app-shell { display: block; }

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .side-nav { display: none; }
  .view { padding: 16px 16px 96px; }
  .bottom-nav { display: flex; position: fixed; inset: auto 0 0 0; height: calc(68px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: #fff; border-top: 1px solid var(--line); z-index: 20; }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; font-weight: 600; color: var(--muted); position: relative; }
  .bottom-nav a.active { color: var(--ink); }
  .bottom-nav a.active .nav-icon { background: var(--mint); border-radius: 14px; }
  .bottom-nav .nav-icon { width: 52px; height: 28px; display: grid; place-items: center; }
  .bottom-nav .badge { position: absolute; top: 4px; left: 54%; margin: 0; }
}

/* Page layout */
.page { max-width: 760px; margin: 0 auto; }
.page.narrow { max-width: 520px; text-align: center; padding-top: 10vh; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font: 800 clamp(26px, 4vw, 34px) Manrope; letter-spacing: -1px; margin: 0; flex: 1; }
.page-head .back { font-size: 22px; padding: 4px 8px; border-radius: 10px; }
.section-title { font: 700 18px Manrope; margin: 26px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 18px; margin-bottom: 14px; }
.panel h3 { margin: 0 0 6px; font: 700 17px Manrope; }
.row { display: flex; align-items: center; gap: 12px; }
.row > .grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 12px; }
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; scrollbar-width: none; }
.tabs button, .tabs a { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 14px; font-weight: 600; cursor: pointer; }
.tabs .on { background: var(--mint); border-color: var(--mint); }
.list { background: #fff; border: 1px solid var(--line); border-radius: 22px; overflow: hidden; }
.list > * + * { border-top: 1px solid var(--line); }
.item { display: flex; align-items: center; gap: 14px; padding: 13px 16px; }
a.item:hover, button.item:hover { background: #f4faf7; }
button.item { width: 100%; text-align: left; border: 0; background: none; font: inherit; cursor: pointer; }
.item .grow { flex: 1; min-width: 0; }
.item b { display: block; } .item .sub { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .meta { color: var(--muted); font-size: 12px; text-align: right; flex: none; }
.unread b, .unread .sub { color: var(--ink); font-weight: 700; }
.count { background: var(--green); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; display: inline-block; margin-top: 4px; }
.avatar { border-radius: 50%; flex: none; object-fit: cover; display: inline-grid; place-items: center; background: var(--mint); color: var(--ink); font-weight: 700; }
.verified { display: inline-grid; place-items: center; width: 17px; height: 17px; margin-left: 5px; border-radius: 50%; background: #1d6fe0; color: #fff; font-size: 10px; vertical-align: 1px; }
.empty { text-align: center; padding: 48px 18px; color: var(--muted); }
.empty-icon { font-size: 40px; margin-bottom: 6px; }
.empty h3 { color: var(--ink); font: 700 19px Manrope; margin: 6px 0; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { color: #b3261e; }
.linkButton { background: none; border: 0; color: var(--green); font: inherit; font-weight: 700; cursor: pointer; padding: 6px 0; text-align: left; }
.pill, .cta { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; text-decoration: none; }
button.pill, button.cta { cursor: pointer; }
button:disabled, .cta[aria-disabled] { opacity: .55; cursor: default; }
.cta.danger { background: #b3261e; }
.cta.small, .pill.small { padding: 8px 14px; font-size: 14px; }
[data-busy] { position: relative; color: transparent !important; }
[data-busy]::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.pill[data-busy]::after { border-color: var(--line); border-top-color: var(--green); }

/* Forms */
.field { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.field small { font-weight: 400; color: var(--muted); }
input.input, select.input, textarea.input { width: 100%; padding: 12px 14px; border: 1px solid #cfdcd6; border-radius: 12px; background: #fff; font: inherit; font-weight: 400; color: var(--ink); }
textarea.input { resize: vertical; min-height: 96px; }
.input:focus { outline: 2px solid var(--green); outline-offset: 1px; border-color: transparent; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--green); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; }
.switch input { width: 44px; height: 24px; accent-color: var(--green); flex: none; }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(700px 400px at 90% 0%, rgba(201,247,221,.7), transparent 60%), var(--paper); }
.auth-card { width: min(440px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 28px; padding: 28px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.auth-card img.logo { width: 56px; height: 56px; border-radius: 16px; }
.auth-card h1 { font: 800 28px Manrope; letter-spacing: -1px; margin: 0; }
.auth-card .phone-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 8px; }
.otp { letter-spacing: 8px; font-size: 22px !important; text-align: center; }

/* Feed */
.composer textarea { border: 0; padding: 4px 0; min-height: 70px; outline: none; width: 100%; font: inherit; font-size: 17px; resize: vertical; }
.composer-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 8px; }
.composer-bar select { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); font: inherit; background: #fff; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.thumbs figure { position: relative; margin: 0; }
.thumbs img, .thumbs video { width: 96px; height: 96px; object-fit: cover; border-radius: 12px; }
.thumbs button { position: absolute; top: 4px; right: 4px; border: 0; border-radius: 50%; width: 24px; height: 24px; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; }
.post { background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 16px 18px; margin-bottom: 12px; }
.post-head { display: flex; gap: 12px; align-items: center; }
.post-head .who { flex: 1; min-width: 0; }
.post-head .who b { display: block; }
.post-head .who small { color: var(--muted); }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 8px; background: #eef6f2; color: #2f5550; margin-left: 4px; }
.tag.boost { background: #fff1c7; color: #7a4b00; }
.post-body { margin: 10px 0 6px; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
.media-grid { display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin: 10px 0; }
.media-grid img, .media-grid video { width: 100%; max-height: 480px; object-fit: cover; border-radius: 14px; background: #eef2f0; }
.post-actions { display: flex; gap: 6px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.post-actions button { border: 0; background: none; padding: 8px 10px; border-radius: 10px; font: inherit; font-weight: 600; color: #4b625e; cursor: pointer; }
.post-actions button:hover { background: #f1f6f4; }
.post-actions .on { color: var(--green); }
.reactions { display: flex; gap: 4px; }
.reactions button { font-size: 20px; padding: 6px; }
.comments { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; display: grid; gap: 10px; }
.comment { display: flex; gap: 10px; } .comment .bubble { background: #f2f6f4; border-radius: 14px; padding: 8px 12px; flex: 1; }
.comment .bubble b { font-size: 14px; } .comment .bubble p { margin: 2px 0 0; overflow-wrap: anywhere; }
.menu-button { border: 0; background: none; font-size: 20px; cursor: pointer; padding: 4px 8px; border-radius: 10px; color: var(--muted); }
.life { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; scrollbar-width: none; }
.life .card-mini { flex: none; width: 250px; background: var(--mint); border-radius: 16px; padding: 12px 14px; }
.life .card-mini small { display: block; color: #2f5550; margin-top: 4px; }

/* Chats */
.chat-layout { display: grid; grid-template-columns: 340px 1fr; gap: 0; height: calc(100vh - 48px); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; background: #fff; }
.chat-list { border-right: 1px solid var(--line); overflow-y: auto; }
.chat-list .search { padding: 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.thread { display: flex; flex-direction: column; min-height: 0; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.thread-head .grow b { display: block; }
.thread-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; background: #f7faf8; }
.msg { max-width: min(78%, 560px); padding: 9px 13px; border-radius: 18px; line-height: 1.45; position: relative; overflow-wrap: anywhere; }
.msg.in { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.out { align-self: flex-end; background: var(--green); color: #fff; border-bottom-right-radius: 6px; }
.msg.out a { color: #fff; text-decoration: underline; }
.msg .stamp { font-size: 11px; opacity: .7; margin-top: 3px; text-align: right; }
.msg img, .msg video { max-width: 280px; border-radius: 12px; display: block; margin-bottom: 4px; }
.msg .quote { font-size: 13px; border-left: 3px solid currentColor; padding-left: 8px; opacity: .8; margin-bottom: 4px; }
.msg.deleted { font-style: italic; opacity: .6; }
.msg .react-chip { position: absolute; bottom: -10px; right: 8px; background: #fff; border: 1px solid var(--line); border-radius: 99px; font-size: 12px; padding: 0 6px; color: var(--ink); }
.day-sep { align-self: center; font-size: 12px; color: var(--muted); font-weight: 600; margin: 10px 0 4px; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line); background: #fff; }
.composer-row textarea { flex: 1; resize: none; max-height: 140px; min-height: 44px; padding: 11px 14px; border-radius: 22px; border: 1px solid #cfdcd6; font: inherit; }
.icon-button { border: 0; background: #eef6f2; width: 44px; height: 44px; border-radius: 50%; font-size: 18px; cursor: pointer; flex: none; display: grid; place-items: center; }
.icon-button.send { background: var(--green); color: #fff; }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: #eef6f2; font-size: 13px; }
.reply-bar .grow { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@media (max-width: 860px) {
  .chat-layout { grid-template-columns: 1fr; height: calc(100vh - 100px); border-radius: 18px; }
  .chat-layout.has-thread .chat-list { display: none; }
  .chat-layout:not(.has-thread) .thread { display: none; }
}

/* Profile */
.profile-hero { display: flex; gap: 18px; align-items: center; }
.profile-hero h1 { margin: 0; font: 800 28px Manrope; letter-spacing: -.5px; }
.facts { display: grid; gap: 0; }
.fact { display: flex; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); align-items: center; }
.fact:first-child { border-top: 0; }
.fact .label { color: var(--muted); font-size: 13px; }
.fact .value { font-weight: 600; overflow-wrap: anywhere; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.qr { width: 180px; height: 180px; }

/* Dialogs & toasts */
dialog.modal { border: 0; border-radius: 24px; padding: 0; width: min(480px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0,0,0,.25); }
dialog.modal.wide { width: min(680px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(10,30,28,.45); }
.modal-body { padding: 22px; display: grid; gap: 14px; max-height: 86vh; }
.modal-body h2 { margin: 0; font: 700 21px Manrope; }
.modal-content { overflow-y: auto; display: grid; gap: 12px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 92px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; z-index: 100; transition: .25s; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #8f1d1d; }
.toast.success { background: var(--green); }
@media (min-width: 861px) { .toast { bottom: 32px; } }

/* Components set display; the hidden attribute must still win. */
[hidden] { display: none !important; }
.post-body a, .bubble a, .msg a, .panel p a { color: var(--green); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
@media (min-width: 861px) { .mobile-only { display: none; } }
