:root {
  --bg: #fafafa;
  --card: #ffffff;
  --ink: #262626;
  --muted: #8e8e8e;
  --line: #dbdbdb;
  --brand: #0095f6;        /* Instagram blue (primary action) */
  --brand-dark: #1877f2;
  --accent: #405de6;
  --heart: #ed4956;        /* Instagram like red */
  --radius: 8px;
  --shadow: none;
  --topbar-h: 54px;
  --bottomnav-h: 50px;
  --feed-w: 614px;
}
* { box-sizing: border-box; }
/* The HTML `hidden` attribute must always win — component rules like
   `.btn { display:inline-flex }` would otherwise override the UA display:none
   and reveal elements toggled via `hidden` (editor footer buttons, etc.). */
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: none; }
img { max-width: 100%; }
.link-blue, .link-blue:hover { color: var(--brand); font-weight: 600; }

h1 { font-size: 1.4rem; line-height: 1.25; margin: 0 0 14px; font-weight: 700; }
h2 { font-size: 1.15rem; line-height: 1.3; margin: 0 0 10px; font-weight: 700; }
h3 { font-size: 1rem; line-height: 1.3; margin: 22px 0 10px; font-weight: 700; }

/* ---- Top bar ---- */
.nav {
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
}
.nav-inner {
  max-width: 935px; margin: 0 auto; display: flex; align-items: center;
  gap: 18px; padding: 0 16px; height: var(--topbar-h);
}
.brand {
  font-weight: 700; font-size: 1.4rem; color: var(--ink);
  font-family: "Segoe Script", "Bradley Hand", "Snell Roundhand", cursive;
  letter-spacing: .02em;
}
.brand:hover { text-decoration: none; }
/* The full text link row lives in the bottom nav on every viewport; the top bar
   keeps only the brand + a couple of quick icons. */
.nav-links { display: none; }
.nav-user { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.nav-user .who { display: flex; align-items: center; gap: 7px; color: var(--ink); font-weight: 600; }
.nav-icon { display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; line-height: 1; position: relative; color: var(--ink); }
.badge {
  position: absolute; top: -5px; right: -8px; background: var(--heart); color: #fff;
  border-radius: 999px; font-size: .65rem; font-weight: 700; padding: 1px 5px; min-width: 16px; text-align: center;
}

/* ---- Bottom nav (mobile-style tab bar, shown on all sizes) ---- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  min-height: var(--bottomnav-h); background: var(--card); border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav a {
  flex: 1; display: flex; align-items: center; justify-content: center;
  line-height: 1; color: var(--ink); height: 100%; position: relative;
  transition: transform .1s ease;
}
.bottom-nav a:active { transform: scale(.92); }
.bottom-nav a .ic { width: 26px; height: 26px; display: block; }
.bottom-nav a.create .ic { width: 27px; height: 27px; }
/* Inactive tabs show the outline glyph, the active tab shows the solid one. */
.bottom-nav a .i-outline, .bottom-nav a .i-solid { display: inline-flex; }
.bottom-nav a .i-solid { display: none; }
.bottom-nav a.active .i-outline { display: none; }
.bottom-nav a.active .i-solid { display: inline-flex; }
.bottom-nav a.create.active .ic { color: var(--brand); }
.bottom-nav .nav-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.bottom-nav a.profile-tab.active .nav-avatar { border-color: var(--ink); border-width: 2px; padding: 0; }
.bottom-nav .badge { top: 6px; right: 22%; }

/* ---- Layout ---- */
.container { max-width: var(--feed-w); margin: 20px auto; padding: 0 0 calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px) + 28px); }
.container.wide { max-width: 935px; padding-left: 16px; padding-right: 16px; }
.footer { display: none; }
@media (min-width: 641px) { .footer { display: block; text-align: center; color: var(--muted); padding: 20px 16px calc(var(--bottomnav-h) + 20px); font-size: .8rem; } }

/* ---- Cards ---- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 0 12px 16px;
}
@media (min-width: 641px) { .card { margin-left: 0; margin-right: 0; } }
.card h2, .card h3 { margin-top: 0; }
.form-narrow { max-width: 560px; margin: 0 auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }

/* ---- Buttons & forms ---- */
.btn { display: inline-block; background: var(--brand); color: #fff; border: none; padding: 8px 18px; border-radius: 8px; font-weight: 600; cursor: pointer; font-size: .9rem; }
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn:disabled { opacity: .4; cursor: default; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 5px 12px; font-size: .82rem; }
.btn-danger { background: transparent; color: var(--heart); border: 1px solid #f0c4c8; }
.btn-block { display: block; width: 100%; text-align: center; }
.link-btn { background: none; border: none; color: var(--brand); cursor: pointer; font: inherit; font-weight: 600; padding: 0; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; background: none; border: none; padding: 3px; border-radius: 6px; cursor: pointer; color: var(--muted); opacity: .7; transition: color .15s, background .15s, opacity .15s; }
.icon-btn:hover { opacity: 1; background: rgba(0,0,0,.06); }
.icon-btn svg { display: block; }
.icon-btn-danger:hover { color: var(--heart); background: rgba(237,73,86,.1); }
.msg.me .icon-btn { color: rgba(255,255,255,.8); }
.msg.me .icon-btn:hover { color: #fff; background: rgba(255,255,255,.22); }
.inline { display: inline; }

input[type=text], input[type=password], input[type=email], input[type=datetime-local],
input[type=date], input[type=file], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: var(--bg); margin-top: 4px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--muted); background: #fff; }
textarea { resize: vertical; }
label { display: block; margin-bottom: 12px; font-weight: 600; font-size: .9rem; }
label .helptext, label input, label textarea, label select { font-weight: 400; }
form p { margin: 0 0 12px; }
form p label { font-weight: 600; }
.errorlist { color: var(--heart); list-style: none; padding: 0; margin: 4px 0; font-size: .85rem; }
.form-actions { margin-top: 8px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---- Avatars ---- */
.avatar-sm { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--line); }
.avatar-lg { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; background: var(--line); }
.avatar-fallback { display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #405de6, #833ab4, #e1306c); color: #fff; border-radius: 50%; font-weight: 700; }

/* ---- Flash messages ---- */
.flashes { margin: 0 12px 12px; }
@media (min-width: 641px) { .flashes { margin-left: 0; margin-right: 0; } }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; font-size: .9rem; border: 1px solid var(--line); background: var(--card); }
.flash-success { border-color: #b7e1cd; background: #eafaf1; }
.flash-error { border-color: #f0c4c8; background: #fdecee; color: #a11; }

/* ---- Stories bar ---- */
.story-bar {
  display: flex; gap: 14px; overflow-x: auto; padding: 14px 12px; margin: 0 0 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  scrollbar-width: none;
}
.story-bar::-webkit-scrollbar { display: none; }
@media (min-width: 641px) { .story-bar { margin: 0 0 16px; } }
.story { flex: 0 0 auto; width: 66px; text-align: center; }
.story-ring {
  width: 62px; height: 62px; border-radius: 50%; padding: 3px; margin: 0 auto 4px;
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  display: flex; align-items: center; justify-content: center;
}
.story-ring.seen { background: var(--line); }
.story-ring img, .story-ring .avatar-fallback {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--card); background: var(--card);
}
.story-ring .avatar-fallback { display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.story .story-name { font-size: .72rem; color: var(--ink); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story.add .story-ring { background: var(--line); position: relative; }
.story.add .plus {
  position: absolute; bottom: 0; right: 0; width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand); color: #fff; border: 2px solid var(--card);
  display: flex; align-items: center; justify-content: center; font-size: 1rem; line-height: 1;
}

/* ---- Instagram-style post ---- */
.ig-post { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 16px; overflow: hidden; }
@media (max-width: 640px) { .ig-post { border-left: none; border-right: none; border-radius: 0; margin-bottom: 8px; } }
.ig-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.ig-head .name { font-weight: 600; font-size: .9rem; }
.ig-head .sub { font-size: .78rem; color: var(--muted); }
.ig-head .menu { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.ig-media { position: relative; background: #000; display: flex; justify-content: center; }
.ig-media img { width: 100%; max-height: 720px; object-fit: cover; display: block; }
.ig-media .heart-burst {
  position: absolute; inset: 0; margin: auto; width: 90px; height: 90px; color: #fff;
  opacity: 0; pointer-events: none; font-size: 90px; display: flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.4));
}
.ig-media .heart-burst.animate { animation: heartpop .9s ease; }
@keyframes heartpop {
  0% { opacity: 0; transform: scale(.2); }
  15% { opacity: 1; transform: scale(1.2); }
  30% { transform: scale(.95); }
  45% { transform: scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: scale(1); }
}
.ig-actions { display: flex; align-items: center; gap: 14px; padding: 8px 14px 4px; }
.ig-action { background: none; border: none; padding: 0; cursor: pointer; font-size: 1.6rem; line-height: 1; color: var(--ink); display: inline-flex; align-items: center; transition: transform .12s ease; }
.ig-action:active { transform: scale(1.2); }
.ig-action.like.liked { color: var(--heart); }
.ig-action.share { margin-left: auto; }
.likes-count { padding: 2px 14px; font-weight: 600; font-size: .9rem; }
.ig-caption { padding: 2px 14px 4px; font-size: .9rem; white-space: pre-wrap; }
.ig-caption .name { font-weight: 600; margin-right: 6px; }
.ig-comments { padding: 2px 14px 6px; }
.ig-comments .comment { display: block; margin-bottom: 3px; font-size: .9rem; }
.ig-comments .comment .name { font-weight: 600; margin-right: 6px; }
.ig-comments .view-all { color: var(--muted); font-size: .88rem; display: inline-block; margin: 3px 0; }
.ig-time { padding: 2px 14px 12px; font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.ig-addcomment { display: flex; align-items: center; border-top: 1px solid var(--line); padding: 4px 14px; }
.ig-addcomment input[type=text] { border: none; background: none; padding: 10px 0; margin: 0; }
.ig-addcomment input[type=text]:focus { background: none; }
.ig-addcomment button { color: var(--brand); font-weight: 600; background: none; border: none; cursor: pointer; font-size: .9rem; }
/* Optional emoji reactions, tucked behind a details toggle to keep the family
   flavour without cluttering the Instagram layout. */
.more-reacts { padding: 0 14px 8px; }
.more-reacts summary { cursor: pointer; color: var(--muted); font-size: .8rem; list-style: none; }
.more-reacts summary::-webkit-details-marker { display: none; }
.reactions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding-top: 8px; }
.react-btn { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; padding: 3px 9px; font-size: 1rem; }
.react-btn.active { background: #e7f0fe; border-color: var(--brand); }
.react-count { color: var(--muted); font-size: .82rem; margin-left: auto; }
.reactions-sm { padding-top: 4px; gap: 4px; }
.reactions-sm .react-btn { padding: 1px 7px; font-size: .82rem; }

/* legacy post classes still used by post_edit preview etc. */
.post-image { border-radius: 8px; margin-bottom: 12px; }
.post-text { white-space: pre-wrap; margin: 4px 0 12px; }
.comment .bubble { background: var(--bg); border-radius: 12px; padding: 7px 12px; }
.comment .bubble .name { font-weight: 600; font-size: .85rem; }

/* ---- Profile ---- */
.profile-header { display: flex; align-items: center; gap: 22px; padding: 8px 16px 16px; }
.profile-header .avatar-lg { flex: none; }
.profile-id { flex: 1; min-width: 0; }
.profile-id .uname { font-size: 1.4rem; font-weight: 400; margin-bottom: 12px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.profile-stats { display: flex; gap: 26px; margin-bottom: 10px; }
.profile-stats .stat b { font-weight: 700; }
.profile-bio { padding: 0 16px 16px; font-size: .9rem; }
.profile-bio .fullname { font-weight: 700; }
.profile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; border-top: 1px solid var(--line); padding-top: 3px; }
.profile-grid .tile { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--line); }
.profile-grid .tile img { width: 100%; height: 100%; object-fit: cover; }
.profile-grid .tile .tile-cap { position: absolute; inset: 0; background: rgba(0,0,0,.35); color: #fff; opacity: 0; display: flex; align-items: center; justify-content: center; gap: 12px; font-weight: 600; font-size: .85rem; transition: opacity .15s; padding: 8px; text-align: center; }
.profile-grid .tile:hover .tile-cap { opacity: 1; }
.profile-tabs { display: flex; justify-content: center; gap: 40px; border-top: 1px solid var(--line); margin-top: 8px; }
.profile-tabs a { padding: 12px; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; border-top: 1px solid transparent; margin-top: -1px; }
.profile-tabs a.active { color: var(--ink); border-top-color: var(--ink); }

/* ---- Stories full-screen viewer ---- */
.story-viewer { position: fixed; inset: 0; background: #000; z-index: 60; display: flex; align-items: center; justify-content: center; }
.story-stage { position: relative; width: 100%; max-width: 440px; height: 100%; max-height: 100vh; background: #000; display: flex; align-items: center; justify-content: center; }
.story-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.story-progress { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; gap: 4px; z-index: 3; }
.story-progress .bar { flex: 1; height: 3px; background: rgba(255,255,255,.35); border-radius: 3px; overflow: hidden; }
.story-progress .bar > span { display: block; height: 100%; width: 0; background: #fff; }
.story-topbar { position: absolute; top: 18px; left: 10px; right: 10px; display: flex; align-items: center; gap: 10px; z-index: 3; color: #fff; }
.story-topbar .avatar-sm { border: 1px solid rgba(255,255,255,.6); }
.story-topbar .name { font-weight: 600; font-size: .9rem; }
.story-topbar .t { font-size: .78rem; opacity: .8; }
.story-topbar .close, .story-topbar form button { margin-left: auto; background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; line-height: 1; }
.story-cap { position: absolute; bottom: 40px; left: 0; right: 0; text-align: center; color: #fff; padding: 0 20px; font-size: 1rem; text-shadow: 0 1px 4px rgba(0,0,0,.6); z-index: 3; }
.story-nav { position: absolute; top: 0; bottom: 0; width: 40%; z-index: 2; cursor: pointer; }
.story-nav.prev { left: 0; } .story-nav.next { right: 0; }

/* ---- Grids (albums/events/members) ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.grid > .card { margin: 0; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.gallery .tile { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 4px; background: var(--line); }
.gallery .tile img, .gallery .tile video { width: 100%; height: 100%; object-fit: cover; }
.album-cover { aspect-ratio: 1; object-fit: cover; border-radius: 8px; width: 100%; background: var(--line); }

/* ---- Members ---- */
.member { display: flex; align-items: center; gap: 12px; }
.pill { display: inline-block; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: .78rem; color: var(--muted); }

/* ---- Events ---- */
.event-date { display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--ink); color: #fff; border-radius: 10px; width: 60px; height: 60px; flex: none; }
.event-date .m { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; }
.event-date .d { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.event-row { display: flex; gap: 14px; align-items: center; }

/* ---- Messaging ---- */
.thread-list .thread-row { display: flex; align-items: center; border-radius: 10px; }
.thread-list .thread-row:hover { background: var(--bg); }
.thread-list .thread-row.unread { background: #e7f0fe; }
.thread-list .thread { flex: 1; display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 10px; min-width: 0; }
.thread-list .thread:hover { text-decoration: none; }
.thread-list .thread-del { padding: 0 10px; display: flex; align-items: center; }
.select-tile { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); }
.select-tile input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.select-tile:has(input:checked) { border-color: var(--brand); background: #e7f0fe; }
details.rename summary { list-style: none; cursor: pointer; }
details.rename summary::-webkit-details-marker { display: none; }
details.rename input[type="text"] { min-width: 0; }
.messages { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.msg { max-width: 72%; padding: 8px 13px; border-radius: 18px; }
.msg.them { background: var(--bg); border: 1px solid var(--line); align-self: flex-start; }
.msg.me { background: var(--brand); color: #fff; align-self: flex-end; }
.msg .who { font-size: .72rem; opacity: .8; margin-bottom: 2px; }
.msg-form { display: flex; gap: 8px; }
.msg-form input { flex: 1; }
.thread-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.thread-tools { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; flex: none; }
.thread-tools details { width: 260px; max-width: 60vw; }
.thread-tools summary { text-align: right; }
.thread-tools details[open] summary { margin-bottom: 2px; }
.add-people-list { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.add-people-list .select-tile { margin: 0; }

/* ---- Auth screens ---- */
.auth-wrap { max-width: 360px; margin: 6vh auto; }
.auth-wrap .brand-big { font-size: 2.6rem; font-weight: 700; color: var(--ink); text-align: center; display: block; margin-bottom: 16px;
  font-family: "Segoe Script", "Bradley Hand", "Snell Roundhand", cursive; }

/* ---- Relationships ---- */
.rel-list { display: flex; flex-direction: column; gap: 10px; }
.rel-row { display: flex; align-items: center; gap: 10px; }
.rel-request { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.rel-request select { max-width: 320px; }
.rel-request .custom-kind { max-width: 320px; }

.section-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding: 0 12px; }
@media (min-width: 641px) { .section-title { padding: 0; } }
.section-title h1 { margin: 0; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

/* ---- Activity ---- */
.activity-row { display: flex; align-items: center; gap: 12px; padding: 8px 4px; }
.activity-row .thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; margin-left: auto; background: var(--line); }
.activity-row .txt { font-size: .9rem; }

/* ---- Composer photo preview (image editor) ---- */
.composer-photo { margin: 8px 0; }
.composer-preview { display: block; width: 100%; border-radius: 8px; margin-bottom: 8px; }
.composer-preview.ie-empty { display: none; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  h1 { font-size: 1.25rem; }
  .profile-header { gap: 16px; padding: 12px; }
  .profile-header .avatar-lg { width: 86px; height: 86px; }
  .profile-id .uname { font-size: 1.2rem; }
  .profile-stats { gap: 18px; }
  .msg { max-width: 85%; }
  .thread-head { flex-wrap: wrap; }
  .thread-tools { flex-direction: row; align-items: center; width: 100%; }
  .thread-tools details { width: auto; max-width: none; }
  .thread-tools details[open] { width: 100%; }
}

/* ============================================================= SVG icons
   Inline icons rendered via partials/icon.html. They inherit currentColor so a
   parent's `color` tints them, and swap outline<->solid for active states. */
.ic { display: block; flex: none; vertical-align: middle; }
.i-outline, .i-solid { display: inline-flex; }
.nav-icon { color: var(--ink); }
.nav-icon .ic { width: 24px; height: 24px; }
.nav-user { gap: 18px; }

/* Feed post action row — bigger tap targets, IG spacing. */
.ig-actions { gap: 16px; padding: 8px 12px 4px; }
.ig-action { font-size: 0; }
.ig-action .ic { width: 25px; height: 25px; }
.ig-action.like .i-solid { display: none; }
.ig-action.like.liked .i-outline { display: none; }
.ig-action.like.liked .i-solid { display: inline-flex; }
.ig-action.like.liked { color: var(--heart); }
.ig-action.like:active .ic { animation: likepop .28s ease; }
@keyframes likepop { 0%{transform:scale(1)} 40%{transform:scale(.8)} 100%{transform:scale(1)} }
.icon-btn .ic { width: 20px; height: 20px; }

/* Small inline meta icons (location/cake/family), aligned to text baseline. */
.meta-ic { width: 15px; height: 15px; display: inline-block; vertical-align: -3px; color: var(--muted); }
.tile-cap .ic { width: 18px; height: 18px; }

/* ---- Header refinements ---- */
.nav-inner { gap: 12px; }
.brand { font-size: 1.55rem; }

/* ---- Buttons: tighter, more IG ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 16px; border-radius: 8px; font-size: .875rem; line-height: 1.3; }
.btn-block { display: flex; width: 100%; }
.btn .ic { flex: none; }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-ghost { border-color: var(--line); font-weight: 600; }
.btn-follow { width: 100%; }

/* ---- Profile polish ---- */
.profile-header { padding: 14px 16px 10px; }
.profile-id .uname { font-weight: 600; }
.profile-actions { display: flex; gap: 8px; margin: 4px 12px 16px; }
.profile-actions .btn { flex: 1; text-align: center; }
.profile-grid { gap: 2px; padding-top: 2px; }

/* ---- Members / search rows ---- */
.member-list { display: flex; flex-direction: column; }
.member-row { display: flex; align-items: center; gap: 12px; padding: 8px 14px; }
.member-row:hover { background: var(--bg); }
.member-row .who { min-width: 0; }
.member-row .who .nm { font-weight: 600; font-size: .9rem; }
.member-row .who .sub { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Cleaner form fields (edit profile, composers) ---- */
.ff { margin: 0 0 14px; }
.ff > label { display: block; font-weight: 600; font-size: .78rem; color: var(--muted);
  margin: 0 0 5px; letter-spacing: .02em; }
.ff input, .ff textarea, .ff select { margin-top: 0; }
.field-row.two { display: flex; gap: 12px; }
.field-row.two .ff { flex: 1; min-width: 0; }
.edit-profile h1 { padding: 0 12px; }
@media (min-width: 641px) { .edit-profile h1 { padding: 0; } }
.avatar-editor-row { align-items: center; margin-bottom: 18px; }
/* Keep the round preview square — without flex:none the flex row shrinks its
   width and it renders as an ellipse. */
.avatar-editor-row .avatar-lg, #avatar-preview { flex: none; }
.avatar-editor-title { font-weight: 600; font-size: .95rem; margin-bottom: 4px; }
.avatar-editor-controls .ie-control { margin-top: 4px; }
.cap-label { display: block; font-weight: 600; font-size: .78rem; color: var(--muted); margin: 0 0 5px; letter-spacing: .02em; }

/* ---- Profile meta / empty state / family panel ---- */
.profile-meta-line { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 14px; }
.profile-meta-line span { display: inline-flex; align-items: center; gap: 4px; }
.empty-ic { display: inline-flex; align-items: center; justify-content: center;
  width: 68px; height: 68px; border: 2px solid var(--ink); border-radius: 50%;
  margin: 0 auto 12px; }
.empty-ic .ic { width: 34px; height: 34px; }
.fam-summary { cursor: pointer; font-weight: 700; display: flex; align-items: center; gap: 8px; list-style: none; }
.fam-summary::-webkit-details-marker { display: none; }
details.card > .fam-summary .ic { color: var(--ink); }

/* =================================================================== dark */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000; --card: #000; --ink: #f5f5f5; --muted: #a8a8a8; --line: #262626;
  }
  input[type=text], input[type=password], input[type=email], input[type=datetime-local],
  input[type=date], input[type=file], textarea, select { background: #121212; }
  input:focus, textarea:focus, select:focus { background: #1a1a1a; border-color: #3a3a3a; }
  .flash-success { background: #10241a; border-color: #1d503a; color: #7ee2b0; }
  .flash-error { background: #2a1416; border-color: #5a2a2f; color: #f3a3aa; }
  .react-btn.active, .thread-list .thread-row.unread, .select-tile:has(input:checked) { background: #12263b; }
  .icon-btn:hover { background: rgba(255,255,255,.08); }
  .story-ring img, .story-ring .avatar-fallback { border-color: #000; }
}
