:root {
  color-scheme: light;
  --bg: #f6f1f3;
  --panel: #ffffff;
  --panel-2: #fcf3f6;
  --text: #2d2227;
  --muted: #75636b;
  --line: #ead8df;
  --brand: #d75b8e;
  --brand-dark: #b13e70;
  --brand-soft: #fae5ed;
  --brand-ink: #a73564;
  --brand-border: #edb7ca;
  --danger: #e64646;
  --good: #4bb34b;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #181216;
  --panel: #241b20;
  --panel-2: #30232a;
  --text: #f6edf1;
  --muted: #b9a4ad;
  --line: #49343e;
  --brand: #cb4f82;
  --brand-dark: #ad3a69;
  --brand-soft: #442836;
  --brand-ink: #e991b3;
  --brand-border: #7a4058;
  --danger: #ef6666;
  --good: #62c862;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  transition: background-color .18s ease, color .18s ease;
}

#app, .shell, .layout, #main {
  min-width: 0;
  max-width: 100%;
}
img, video { max-width: 100%; }

.app-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 22% 18%, rgba(255,255,255,.32) 0 13%, transparent 13.5%),
    linear-gradient(155deg, #f9c5d7 0%, #f6afc8 52%, #ee9fbd 100%);
}
.app-splash-inner {
  display: grid;
  justify-items: center;
  gap: 30px;
  transform: translateY(-3vh);
}
.app-splash-logo {
  width: clamp(132px, 34vw, 176px);
  aspect-ratio: 1;
  border-radius: 34px;
  box-shadow: 0 20px 50px rgba(119,44,77,.2), 0 0 0 1px rgba(255,255,255,.32);
}
.app-splash-spinner {
  width: 38px;
  height: 38px;
  border: 4px solid rgba(177,62,112,.2);
  border-top-color: var(--brand-dark);
  border-right-color: var(--brand-dark);
  border-radius: 50%;
  animation: app-splash-spin .78s linear infinite;
  filter: drop-shadow(0 2px 5px rgba(177,62,112,.18));
}
.app-section-loader { animation: app-loader-appear .16s ease both; }
.app-section-loader .app-splash-inner { gap: 20px; }
.app-loading-label {
  max-width: min(82vw, 340px);
  color: #7f264d;
  font-size: 15px;
  line-height: 1.35;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255,255,255,.32);
}
@keyframes app-loader-appear { from { opacity: 0; } to { opacity: 1; } }
@keyframes app-splash-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .app-splash-spinner { animation-duration: 1.6s; }
}

button, input, textarea, select { font: inherit; }
button {
  border: 0;
  border-radius: 4px;
  background: var(--brand);
  color: white;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 600;
}
button:hover { background: var(--brand); }
button.secondary, .filepick, .chat-filepick {
  background: var(--brand-soft);
  color: var(--brand-ink);
}
button.secondary:hover, .filepick:hover, .chat-filepick:hover { background: #f7dde7; }
button.ghost {
  background: transparent;
  color: var(--brand-ink);
  padding: 7px 8px;
}
button.ghost:hover { background: var(--brand-soft); }
button.danger { color: #d32f2f; }
button.logo {
  background: transparent;
  padding: 0;
}

input, textarea, select {
  width: 100%;
  border: 1px solid #e5d5dc;
  border-radius: 4px;
  padding: 10px 11px;
  background: #fff;
  color: var(--text);
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand-border); }
select { max-width: 220px; }
textarea { resize: vertical; min-height: 86px; }

.shell { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 48px;
  background: var(--brand);
  color: white;
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
}
.logo {
  font-size: 20px;
  font-weight: 800;
  color: white;
  letter-spacing: .1px;
}
.hamburger {
  position: relative;
  display: none;
  width: 38px;
  height: 38px;
  padding: 0;
  background: rgba(255,255,255,.12);
  font-size: 22px;
  border-radius: 14px;
}
.tabs { display: flex; gap: 6px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  background: rgba(255,255,255,.10);
  color: white;
  padding: 8px 11px;
  border-radius: 14px;
}
.tab.active { background: rgba(255,255,255,.22); }
.userbar { display: flex; align-items: center; gap: 10px; }
.top-ghost { color: white; border-radius: 14px; }
.top-ghost:hover { background: rgba(255,255,255,.14); }

.badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: white;
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
}
.live-unread-badge[hidden] { display: none; }
.hamburger-badge {
  position: absolute;
  top: -5px;
  right: -6px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border: 2px solid var(--brand);
  font-size: 10px;
}

.layout {
  max-width: 1280px;
  margin: 18px auto;
  padding: 0 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.side, .rightcol { display: flex; flex-direction: column; gap: 12px; }
.profile {
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
  flex: 0 0 auto;
}
.avatar.big { width: 52px; height: 52px; font-size: 18px; }
.avatar-img { object-fit: cover; }
.small { color: var(--muted); font-size: 13px; }

.navlist { padding: 8px; border-radius: 20px; }
.navitem {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: transparent;
  color: var(--brand-ink);
  font-weight: 600;
  padding: 9px 10px;
  text-align: left;
  border-radius: 14px;
}
.navitem:hover, .navitem.active { background: var(--brand-soft); }
.mobile-menu button,
.mobile-menu input,
.mobile-menu textarea,
.mobile-menu select,
.rightcol button,
.rightcol input,
.rightcol textarea,
.rightcol select { border-radius: 14px; }
.mobile-menu .card,
.rightcol .card { border-radius: 20px; }
.mobile-backdrop, .mobile-menu { display: none; }

.composer, .post, .section { padding: 14px; }
.composer-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.composer-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
}
.publish-button {
  min-width: 126px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.publish-button:disabled { opacity: .88; cursor: wait; }
.button-spinner {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 2px solid rgba(255,255,255,.42);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: publish-spin .75s linear infinite;
}
.publish-progress {
  margin: 12px 0 0 54px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-radius: 9px;
  background: #fcecf2;
  color: var(--brand-ink);
  font-size: 13px;
  font-weight: 650;
}
.publish-progress .button-spinner { border-color: #efbbcd; border-top-color: var(--brand-ink); }
.publish-progress[hidden] { display: none; }
.composer.is-publishing textarea,
.composer.is-publishing .meme-link-import,
.composer.is-publishing select,
.composer.is-publishing .filepick { opacity: .62; }
.post-error { margin: 8px 0 0 54px; min-height: 0; }
@keyframes publish-spin { to { transform: rotate(360deg); } }
.file-name { margin: 8px 0 0 54px; }
.filepick {
  border-radius: 4px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 600;
}
.filepick input { display: none; }
.meme-link-import {
  margin: 10px 0 0 54px;
  display: grid;
  gap: 5px;
}
.meme-link-import input {
  min-height: 44px;
  border-color: var(--brand-border);
  border-radius: 10px;
  background: var(--panel-2);
}
.meme-link-import .small { line-height: 1.4; }
.feed { display: flex; flex-direction: column; gap: 12px; }

.notice {
  margin: 12px 14px 0;
  padding: 10px 12px;
  border-radius: 4px;
  background: #fff8e5;
  color: #7a5b12;
  border: 1px solid #f0dfaa;
  font-weight: 600;
}
.push-highlight {
  animation: pushGlow 2.4s ease;
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
@keyframes pushGlow {
  0% { box-shadow: 0 0 0 0 rgba(215,91,142,.35); }
  45% { box-shadow: 0 0 0 10px rgba(215,91,142,.12); }
  100% { box-shadow: none; }
}

.post-head {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.post-title { flex: 1; }
.post-text { white-space: pre-wrap; line-height: 1.45; margin: 8px 0 12px; overflow-wrap: anywhere; }
.media {
  max-height: 620px;
  width: 100%;
  object-fit: contain;
  border-radius: 4px;
  background: #2b1821;
  border: 1px solid var(--line);
}
.media-click { cursor: zoom-in; }
.post-source-link {
  width: fit-content;
  margin-top: 8px;
  display: inline-flex;
  color: var(--brand-ink);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.post-source-link:hover { text-decoration: underline; }

.reactions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 10px;
}
.reaction-picker { position: relative; }
.reaction-summary {
  list-style: none;
  width: 48px;
  min-width: 48px;
  height: 38px;
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--brand-ink);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  font-weight: 700;
  font-size: 21px;
  cursor: pointer;
}
.reaction-summary::-webkit-details-marker { display: none; }
.reaction-summary::after { content: ""; }
.reaction-summary.active { background: var(--brand-soft); border-color: var(--brand-border); }
.reaction-menu {
  position: absolute;
  z-index: 20;
  top: 44px;
  left: 0;
  width: 236px;
  max-width: calc(100vw - 28px);
  max-height: min(292px, calc(100vh - 110px));
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: white;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
}
.reaction-option {
  background: var(--panel-2);
  color: var(--brand-ink);
  border: 1px solid transparent;
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.reaction-option:hover, .reaction-option.active {
  background: var(--brand-soft);
  border-color: var(--brand-border);
}
.reaction-icon { font-size: 21px; }
.reaction-totals { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 32px; }
.reaction-total {
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brand-ink);
  padding: 5px 8px;
  font-size: 13px;
  font-weight: 800;
}
.reaction-total-button {
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.reaction-total-button:hover,
.reaction-total-button:focus-visible {
  border-color: var(--brand-border);
  background: var(--brand-soft);
  color: var(--brand-ink);
}
.reaction-total-button:active { transform: scale(.94); }

.reaction-people-open { overflow: hidden; }
.reaction-people-overlay {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(33,20,27,.42);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.reaction-people-card {
  width: min(390px, 100%);
  max-height: min(560px, calc(100dvh - 40px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 22px 60px rgba(45,22,32,.25);
  animation: reaction-card-in .18s ease-out;
}
.reaction-people-head {
  min-height: 74px;
  padding: 13px 14px 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}
.reaction-people-title { min-width: 0; display: flex; align-items: center; gap: 12px; }
.reaction-people-title > span:last-child { min-width: 0; display: grid; gap: 3px; }
.reaction-people-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.reaction-people-title small { color: var(--muted); font-size: 12px; }
.reaction-people-emoji {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--brand-soft);
  font-size: 25px;
}
.reaction-people-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}
.reaction-people-close:hover,
.reaction-people-close:focus-visible { background: var(--brand-soft); color: var(--brand-ink); }
.reaction-people-list {
  max-height: min(460px, calc(100dvh - 132px));
  overflow-y: auto;
  padding: 8px;
}
.reaction-person {
  min-height: 58px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 13px;
}
.reaction-person:hover { background: var(--panel-2); }
.reaction-person-avatar { width: 42px; height: 42px; font-size: 14px; }
@keyframes reaction-card-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 640px) {
  .reaction-people-overlay { align-items: end; padding: 0; }
  .reaction-people-card {
    width: 100%;
    max-height: min(70dvh, 620px);
    border-radius: 22px 22px 0 0;
    animation-name: reaction-sheet-in;
  }
  .reaction-people-list { max-height: calc(70dvh - 74px); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}
@keyframes reaction-sheet-in {
  from { opacity: .7; transform: translateY(34px); }
  to { opacity: 1; transform: translateY(0); }
}

.comments { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.comment {
  background: var(--panel-2);
  border-radius: 4px;
  padding: 9px 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  overflow-wrap: anywhere;
}
.comment-form { display: flex; gap: 8px; margin-top: 10px; }
.comment-form input { flex: 1; }

.panel-title {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}
.people, .chat-list { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.person, .chat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 4px;
  background: var(--panel-2);
}
.person { display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: start; }
.person-name {
  background: transparent;
  color: var(--text);
  padding: 0;
  font-weight: 700;
  text-align: left;
}
.person-name:hover { background: transparent; color: var(--brand-ink); }
.mini { padding: 7px 9px; font-size: 13px; white-space: nowrap; }
.person-actions { width: 100%; grid-column: 2; display: flex; align-items: center; justify-self: stretch; gap: 6px; }
.person-actions .mini { min-width: 0; flex: 1 1 0; padding: 8px 9px; overflow: hidden; text-overflow: ellipsis; }

.chat-inbox { border-radius: 14px; overflow: hidden; }
.chat-inbox-head {
  padding: 18px 18px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.chat-inbox-head h2 { margin: 2px 0 0; font-size: 26px; }
.chat-inbox .chat-list { padding: 8px; gap: 4px; }
.chat-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 14px 10px 6px;
}
.chat-hint {
  background: var(--panel-2);
  border-radius: 10px;
  padding: 12px;
}
.chat-row {
  width: 100%;
  min-height: 70px;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.chat-row:hover { background: #fdf3f6; }
.chat-row.selected { border-color: var(--brand-border); background: #fcecf2; }
.family-chat-row { margin-bottom: 2px; background: #fdf1f5; }
.chat-list-avatar { width: 50px; height: 50px; font-size: 17px; }
.family-chat-avatar { background: linear-gradient(145deg, #e57fa5, #a73564); box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.chat-row-body { min-width: 0; display: grid; gap: 5px; }
.chat-row-top {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}
.chat-row-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.chat-row-side { display: flex; align-items: center; gap: 7px; }
.chat-row-side time { color: #9c8991; font-size: 11px; font-weight: 500; }
.chat-row-preview { color: var(--muted); font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row .badge { color: white; }

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card { width: min(430px, 100%); padding: 28px; border-radius: 28px; }
.auth-card h1 { margin: 0; text-align: center; }
.auth-card input:not([type="hidden"]),
.auth-card button { min-height: 50px; border-radius: 16px; }
.auth-card input:not([type="hidden"]) { padding: 12px 16px; }
.form { display: grid; gap: 12px; margin-top: 18px; }
.auth-card .error:empty { display: none; }
.error { color: #b91c1c; min-height: 20px; }

.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
body.admin-page .layout {
  width: 100%;
  max-width: 1400px;
  grid-template-columns: minmax(0, 1fr);
}
body.admin-page .side,
body.admin-page .rightcol { display: none; }
.admin-console { display: grid; gap: 14px; }
.admin-console-head {
  padding: 20px 22px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  border-radius: 16px;
}
.admin-console-head h1 { margin: 5px 0 6px; font-size: 29px; letter-spacing: -.03em; }
.admin-console-head p { margin: 0; color: var(--muted); }
.admin-menu {
  flex: 0 0 auto;
  padding: 4px;
  display: flex;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
}
.admin-menu button {
  min-height: 38px;
  padding: 8px 13px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}
.admin-menu button.active {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 5px 15px rgba(177,62,112,.2);
}
.admin-members-card { padding: 12px; }
.admin-role {
  justify-self: end;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--brand-ink);
  background: var(--brand-soft);
  font-size: 11px;
  font-weight: 800;
}
.audit-dashboard { display: grid; gap: 14px; }
.audit-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.audit-stat { min-height: 92px; padding: 17px; display: grid; align-content: center; gap: 7px; }
.audit-stat strong { color: var(--brand-ink); font-size: 28px; line-height: 1; }
.audit-stat span { color: var(--muted); font-size: 12px; font-weight: 700; }
.audit-stat.warning strong { color: #d44949; }
.audit-card { overflow: hidden; border-radius: 16px; }
.audit-card-head {
  padding: 20px 21px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}
.audit-card-head h2 { margin: 5px 0 4px; font-size: 23px; }
.audit-card-head p { margin: 0; color: var(--muted); font-size: 13px; }
.audit-refresh { flex: 0 0 auto; min-height: 40px; border-radius: 9px; }
.audit-filters {
  padding: 13px 15px;
  display: grid;
  grid-template-columns: minmax(150px, .75fr) minmax(170px, .85fr) minmax(220px, 1.5fr) auto auto;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.audit-filters input,
.audit-filters select,
.audit-filters button { min-width: 0; min-height: 40px; border-radius: 9px; }
.audit-table-head,
.audit-row {
  display: grid;
  grid-template-columns: 145px minmax(170px, .9fr) minmax(220px, 1.35fr) minmax(170px, 1fr);
  gap: 13px;
  align-items: center;
}
.audit-table-head {
  padding: 11px 17px;
  color: var(--muted);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.audit-list { max-height: min(620px, 66vh); overflow-y: auto; }
.audit-row {
  min-height: 78px;
  padding: 12px 17px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.audit-row:last-child { border-bottom: 0; }
.audit-row:hover { background: var(--panel-2); }
.audit-row.failed { box-shadow: inset 3px 0 #e36c6c; }
.audit-time,
.audit-user span,
.audit-action,
.audit-connection { min-width: 0; display: grid; gap: 4px; }
.audit-time strong,
.audit-user strong,
.audit-action strong,
.audit-connection strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.audit-time span,
.audit-user small,
.audit-connection span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.audit-user { min-width: 0; display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 9px; align-items: center; }
.audit-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  object-fit: cover;
  color: #fff;
  background: var(--brand);
  font-size: 12px;
  font-weight: 850;
}
.audit-avatar-empty { background: #a98b97; }
.audit-event {
  justify-self: start;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--brand-ink);
  background: var(--brand-soft);
  font-size: 10px;
  font-weight: 850;
}
.audit-event.failed { color: #ad3030; background: #fde4e4; }
.audit-loading,
.audit-error {
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}
.audit-error { flex-direction: column; }
.audit-error p { margin: 0; color: var(--muted); }
.audit-empty { padding: 42px 18px; color: var(--muted); text-align: center; }

body.vpn-page .layout {
  max-width: 1180px;
  grid-template-columns: minmax(0, 1fr);
}
body.vpn-page .rightcol { display: none; }
.vpn-admin { display: grid; gap: 18px; }
.vpn-hero {
  min-height: 168px;
  padding: 26px 28px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  overflow: hidden;
  position: relative;
  border-radius: 18px;
  color: white;
  background:
    radial-gradient(circle at 82% 22%, rgba(255,255,255,.18), transparent 25%),
    linear-gradient(135deg, #bc3e74 0%, #d75b8e 52%, #e881aa 100%);
  box-shadow: 0 18px 45px rgba(144,42,84,.18);
}
.vpn-hero::after {
  content: "";
  position: absolute;
  width: 230px;
  height: 230px;
  right: -100px;
  bottom: -150px;
  border: 26px solid rgba(255,255,255,.08);
  border-radius: 50%;
}
.vpn-hero-icon {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.32);
  border-radius: 23px;
  background: rgba(255,255,255,.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2);
}
.vpn-hero-icon svg { width: 42px; height: 42px; fill: none; stroke: white; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.vpn-hero-copy { position: relative; z-index: 1; min-width: 0; }
.vpn-eyebrow, .vpn-step {
  display: block;
  color: var(--brand-ink);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: .12em;
}
.vpn-hero .vpn-eyebrow { color: rgba(255,255,255,.76); }
.vpn-hero h1 { margin: 6px 0 7px; font-size: clamp(28px, 4vw, 38px); line-height: 1.05; letter-spacing: -.035em; }
.vpn-hero p { max-width: 560px; margin: 0; color: rgba(255,255,255,.86); font-size: 15px; line-height: 1.45; }
.vpn-server-state {
  position: relative;
  z-index: 1;
  min-width: 178px;
  padding: 13px 15px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 13px;
  background: rgba(72,18,43,.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.vpn-server-state div { min-width: 0; display: grid; gap: 3px; }
.vpn-server-state strong { font-size: 13px; }
.vpn-server-state small { overflow: hidden; color: rgba(255,255,255,.7); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.vpn-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #55db88;
  box-shadow: 0 0 0 5px rgba(85,219,136,.16);
}
.vpn-server-state.offline .vpn-status-dot, .vpn-status-dot.offline { background: #ff8383; box-shadow: 0 0 0 5px rgba(255,131,131,.14); }
.vpn-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.vpn-summary-card {
  min-width: 0;
  padding: 17px 19px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 6px 22px rgba(91,45,65,.045);
}
.vpn-summary-card > span { grid-column: 1 / -1; color: var(--muted); font-size: 12px; font-weight: 700; }
.vpn-summary-card strong { color: var(--brand-ink); font-size: 25px; line-height: 1; letter-spacing: -.025em; }
.vpn-summary-card small { justify-self: end; color: var(--muted); font-size: 10px; text-align: right; }
.vpn-summary-card.traffic strong { font-size: 20px; }
.vpn-admin-grid { display: grid; grid-template-columns: minmax(290px, 360px) minmax(0, 1fr); gap: 18px; align-items: start; }
.vpn-create-card, .vpn-users-card { border-radius: 16px; box-shadow: 0 8px 28px rgba(91,45,65,.06); }
.vpn-create-card { padding: 23px; }
.vpn-create-card h2, .vpn-users-head h2 { margin: 6px 0 5px; font-size: 22px; letter-spacing: -.02em; }
.vpn-create-card > p { margin: 0; color: var(--muted); line-height: 1.45; }
.vpn-create-form { margin-top: 22px; display: grid; gap: 12px; }
.vpn-create-form label { display: grid; gap: 7px; }
.vpn-create-form label > span { color: var(--muted); font-size: 12px; font-weight: 750; }
.vpn-create-form input { min-height: 46px; padding: 11px 13px; border-radius: 10px; }
.vpn-create-form button { min-height: 46px; border-radius: 10px; position: relative; }
.vpn-create-form button:disabled { cursor: wait; opacity: .76; }
.vpn-button-spinner { display: none; width: 18px; height: 18px; margin: auto; border: 2px solid rgba(255,255,255,.35); border-top-color: white; border-radius: 50%; animation: app-splash-spin .7s linear infinite; }
.vpn-create-form button.loading .vpn-button-label { display: none; }
.vpn-create-form button.loading .vpn-button-spinner { display: block; }
.vpn-hint {
  margin-top: 20px;
  padding: 13px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.vpn-hint svg { width: 24px; height: 24px; fill: none; stroke: var(--brand-ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.vpn-users-card { overflow: hidden; }
.vpn-users-head {
  padding: 21px 22px 17px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}
.vpn-count {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 12px;
  font-weight: 750;
}
.vpn-user-list { padding: 7px 13px 13px; }
.vpn-user {
  min-width: 0;
  padding: 13px 9px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.vpn-user:last-child { border-bottom: 0; }
.vpn-user.revoked { opacity: .58; }
.vpn-user-symbol {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--brand-soft);
  color: var(--brand-ink);
}
.vpn-user-symbol.system { color: white; background: linear-gradient(145deg, var(--brand), var(--brand-dark)); }
.vpn-user-symbol svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.vpn-user-copy { min-width: 0; display: grid; gap: 5px; }
.vpn-user-title { min-width: 0; display: flex; align-items: center; gap: 7px; }
.vpn-user-title strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.vpn-user-copy > span { color: var(--muted); font-size: 12px; }
.vpn-user-status { min-height: 17px; font-size: 12px; }
.vpn-online { display: inline-flex; align-items: center; gap: 5px; color: var(--good); font-weight: 750; }
.vpn-online i {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 15%, transparent);
}
.vpn-online b { font-weight: 750; }
.vpn-offline { color: var(--muted); }
.vpn-traffic {
  margin-top: 2px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}
.vpn-traffic span, .vpn-traffic strong {
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--panel-2);
  white-space: nowrap;
}
.vpn-traffic strong { color: var(--text); font-weight: 800; }
.vpn-tag {
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.vpn-user-actions { display: flex; align-items: center; gap: 4px; }
.vpn-user-actions button { min-height: 36px; border-radius: 9px; padding: 8px 11px; font-size: 12px; }
.vpn-revoke-button { white-space: nowrap; }
.vpn-empty { padding: 34px 18px; color: var(--muted); text-align: center; }
.vpn-loading, .vpn-error-card {
  min-height: 190px;
  padding: 28px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.vpn-loader { width: 25px; height: 25px; border: 3px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: app-splash-spin .75s linear infinite; }
.vpn-error-card { justify-content: flex-start; }
.vpn-error-card div { flex: 1; }
.vpn-error-card h2 { margin: 0 0 5px; }
.vpn-error-card p { margin: 0; color: var(--muted); }
.vpn-error-card button { border-radius: 9px; }
.vpn-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  padding: max(20px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  overflow-y: auto;
  background: rgba(33,15,24,.76);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}
.vpn-qr-dialog {
  width: min(430px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: var(--panel);
  box-shadow: 0 28px 80px rgba(22,8,14,.35);
  text-align: center;
}
.vpn-qr-dialog .vpn-step { color: var(--brand); }
.vpn-qr-dialog h2 { margin: 7px 0 5px; font-size: 25px; }
.vpn-qr-dialog > p { max-width: 340px; margin: 0 auto 18px; color: var(--muted); line-height: 1.45; }
.vpn-qr-frame {
  width: min(300px, 100%);
  aspect-ratio: 1;
  margin: 0 auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
}
.vpn-qr-frame img { width: 100%; height: 100%; display: block; border-radius: 9px; }
.vpn-modal-close {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  padding: 0 0 3px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  color: white;
  font-size: 29px;
  line-height: 1;
}
.vpn-modal-actions { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.vpn-modal-actions button, .vpn-download {
  min-height: 43px;
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
}
.vpn-download { background: var(--brand-soft); color: var(--brand-ink); }
.vpn-copy-status { min-height: 17px; margin-top: 10px; display: block; color: var(--muted); }

.chat-wrap { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 12px; }
.chat-wrap.chat-focus, .chat-wrap.chat-list-only { grid-template-columns: minmax(0, 1fr); }
.chat-window { min-height: 560px; display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; }
.chat-conversation-header {
  position: relative;
  z-index: 5;
  min-height: 68px;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: auto 46px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--line);
  border-radius: 14px 14px 0 0;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.chat-back {
  min-height: 38px;
  padding: 7px 9px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand-ink);
}
.chat-back:hover { background: #f7dde7; }
.back-chevron {
  width: 9px;
  height: 9px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}
.chat-header-avatar { width: 46px; height: 46px; font-size: 16px; }
.chat-header-copy { min-width: 0; display: grid; gap: 3px; }
.chat-header-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.chat-header-copy small { color: var(--muted); font-size: 12px; }
.messages {
  padding: 10px 12px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #fdf7f9;
}
.messages.chat-opening { visibility: hidden; }
.message {
  position: relative;
  min-width: 120px;
  max-width: 78%;
  padding: 7px 10px 6px;
  border: 1px solid rgba(159,126,140,.12);
  border-radius: 16px 16px 16px 6px;
  background: #ffffff;
  box-shadow: 0 3px 12px rgba(64,38,49,.07);
  overflow: visible;
}
.message.mine {
  align-self: flex-end;
  border-radius: 16px 16px 6px 16px;
  background: linear-gradient(145deg, #fbe8f0 0%, #f7dce8 100%);
}
.message-head { min-height: 27px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.message-head > strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--brand-ink); }
.message-head-actions { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; }
.message-reply-button {
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(167,53,100,.12);
  border-radius: 50%;
  background: rgba(255,255,255,.6);
  color: var(--brand-ink);
  box-shadow: 0 2px 7px rgba(87,41,61,.07);
  opacity: .72;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, opacity .16s ease, transform .16s ease;
}
.message-edit-button,
.message-delete-button {
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(167,53,100,.12);
  border-radius: 50%;
  background: rgba(255,255,255,.6);
  color: var(--brand-ink);
  box-shadow: 0 2px 7px rgba(87,41,61,.07);
  opacity: .72;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, opacity .16s ease, transform .16s ease;
  font-size: 15px;
  line-height: 1;
}
.message-delete-button { color: var(--brand-ink); font-size: 20px; font-weight: 500; line-height: 1; }
.message-edit-button:hover,
.message-delete-button:hover,
.message-edit-button:focus-visible,
.message-delete-button:focus-visible {
  background: #ffffff;
  border-color: rgba(167,53,100,.24);
  box-shadow: 0 4px 12px rgba(87,41,61,.12);
  opacity: 1;
}
.message-edit-button:active,
.message-delete-button:active { transform: scale(.91); }
@media (hover: none) {
  .message-edit-button,
  .message-delete-button { opacity: .88; }
}
.message.editing { width: min(92%, 440px); max-width: min(92%, 440px); }
.message-edit-form { width: 100%; min-width: 0; max-width: 100%; margin-top: 5px; display: grid; gap: 6px; overflow: hidden; }
.message-edit-form[hidden] { display: none; }
.message-edit-form textarea { width: 100%; min-width: 0; max-width: 100%; min-height: 62px; padding: 8px 10px; border-radius: 12px; box-sizing: border-box; resize: vertical; }
.message-edit-form > div { display: flex; justify-content: flex-end; gap: 6px; }
.message-edit-form button { min-height: 32px; padding: 6px 10px; border-radius: 12px; }
.message-edit-form .error { min-height: 0; font-size: 12px; }
@media (max-width: 699px) {
  .message.editing { width: calc(100% - 8px); max-width: calc(100% - 8px); }
  .message.editing .message-head { align-items: flex-start; }
}
.message:hover .message-reply-button, .message-reply-button:focus-visible {
  background: #ffffff;
  border-color: rgba(167,53,100,.24);
  box-shadow: 0 4px 12px rgba(87,41,61,.12);
  opacity: 1;
}
.message-reply-button:active { transform: scale(.91); }
.message-reply-glyph {
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Symbol", sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  transform: translateY(-1px);
}
@media (hover: none) {
  .message-reply-button { opacity: .88; }
}
.message-reply-quote {
  width: 100%;
  margin: 6px 0 3px;
  padding: 7px 9px;
  display: grid;
  gap: 2px;
  border-left: 3px solid var(--brand);
  border-radius: 7px;
  background: rgba(215,91,142,.09);
  color: var(--text);
  text-align: left;
}
.message-reply-quote:hover { background: rgba(215,91,142,.14); }
.message-reply-quote strong { color: var(--brand-ink); font-size: 12px; }
.message-reply-quote span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; font-weight: 500; }
.message-text { margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-bottom { margin-top: 4px; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.message-reactions { min-width: 34px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.message-reaction-picker { z-index: 4; }
.message-reaction-picker[open] { z-index: 40; }
.message-reaction-picker .reaction-summary {
  width: 27px;
  min-width: 27px;
  height: 27px;
  padding: 0;
  border-radius: 999px;
  font-size: 15px;
  background: rgba(255,255,255,.58);
  border-color: rgba(159,126,140,.2);
}
.message-reaction-picker .reaction-menu { top: auto; bottom: 32px; left: 0; border-radius: 14px; }
.message.mine .message-reaction-picker .reaction-menu { right: 0; left: auto; }
@media (max-width: 699px) {
  .messages { overflow-x: hidden; }
  .message:not(.mine) .message-reaction-picker .reaction-menu {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
  }
  .message.mine .message-reaction-picker .reaction-menu {
    right: 0;
    left: auto;
    transform: none;
  }
}
.message-reactions .reaction-total { padding: 4px 7px; border-color: rgba(159,126,140,.2); background: rgba(255,255,255,.68); }
.message-meta {
  flex: 0 0 auto;
  margin: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.message:not(.mine) .message-meta { justify-content: flex-start; }
.message-status { font-weight: 700; color: #7b6670; }
.message-status.read { color: var(--brand-ink); }
.chat-media {
  display: block;
  width: min(320px, 100%);
  max-height: 360px;
  margin-top: 5px;
  border-radius: 14px;
  object-fit: contain;
  background: #2b1821;
}
.chat-media-click { cursor: zoom-in; }
.message-form {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  align-items: center;
  background: #fefafb;
}
.chat-wrap button,
.chat-wrap input,
.chat-wrap textarea,
.chat-wrap select { border-radius: 14px; }
.message-form > input[name="text"] { min-width: 0; min-height: 44px; border-radius: 22px; padding-inline: 15px; }
.message-form > button { min-height: 42px; border-radius: 21px; padding-inline: 18px; }
.message-form > button:disabled { cursor: wait; }
.message-send-error { grid-column: 1 / -1; min-height: 0; }
.message-reply-composer {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 8px 10px 8px 13px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: center;
  gap: 10px;
  border-left: 3px solid var(--brand);
  border-radius: 9px;
  background: var(--brand-soft);
}
.message-reply-composer[hidden] { display: none; }
.message-reply-composer > div { min-width: 0; display: grid; gap: 2px; }
.message-reply-composer strong { color: var(--brand-ink); font-size: 12px; }
.message-reply-composer span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.message-reply-composer button {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--brand-ink);
  font-size: 23px;
  line-height: 1;
}
.message-reply-composer button:hover { background: rgba(167,53,100,.1); }
.chat-filepick {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 650;
  cursor: pointer;
  line-height: 1;
}
.chat-filepick input { display: none; }
.chat-file-name { grid-column: 2 / 4; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

body.chat-page { height: 100svh; overflow: hidden; }
body.chat-page .shell { height: 100svh; min-height: 0; overflow: hidden; }
body.chat-page .layout {
  width: 100%;
  max-width: none;
  height: calc(100svh - 48px);
  min-height: 0;
  margin: 0;
  padding: 12px 18px;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}
body.chat-page .side,
body.chat-page .rightcol { display: none; }
body.chat-page #main,
body.chat-page .chat-wrap { width: 100%; height: 100%; min-height: 0; }
body.chat-page .chat-inbox,
body.chat-page .chat-window { height: 100%; min-height: 0; }
body.chat-page .chat-inbox { display: flex; flex-direction: column; }
body.chat-page .chat-inbox .chat-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
body.chat-page .chat-wrap { gap: 0; }
.message.reply-highlight { animation: reply-highlight 1.35s ease; }
@keyframes reply-highlight {
  0%, 35% { box-shadow: 0 0 0 3px rgba(215,91,142,.36), 0 5px 18px rgba(167,53,100,.16); }
  100% { box-shadow: 0 2px 7px rgba(64,38,49,.06); }
}

.empty { padding: 30px; text-align: center; color: var(--muted); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; }
.stat {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
}
.stat strong { display: block; font-size: 22px; color: var(--brand-ink); }
.stat span { color: var(--muted); font-size: 13px; }
.push-box { padding: 12px; display: grid; gap: 9px; }
.push-box button:disabled { opacity: .65; cursor: not-allowed; }
.mobile-push-card { display: none; margin-bottom: 14px; }

.photo-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.media-section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.media-section-head h2 { margin: 0 0 5px; }
.media-section-head > button { flex: 0 0 auto; }
.media-library-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.video-album-group { margin-top: 18px; }
.video-album-group + .video-album-group { margin-top: 24px; }
.library-form {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, auto) auto auto;
  gap: 10px;
  align-items: center;
}
.library-form.video-library-form { grid-template-columns: minmax(0, 1fr) auto auto; }
.music-library-head {
  padding: 4px 2px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.music-library-head h2 { margin: 2px 0 0; font-size: 30px; letter-spacing: -.5px; }
.eyebrow {
  color: #9b657a;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.music-library-actions { display: flex; gap: 8px; }
.music-owner-switcher {
  margin: 0 0 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.music-owner {
  min-width: 150px;
  padding: 9px 13px 9px 9px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  box-shadow: 0 4px 14px rgba(91,38,60,.05);
}
.music-owner:hover { background: var(--brand-soft); color: var(--text); }
.music-owner.active { border-color: var(--brand-border); background: var(--brand-soft); box-shadow: 0 0 0 2px rgba(215,91,142,.12); }
.music-owner-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  object-fit: cover;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}
.music-owner > span:last-child { min-width: 0; display: grid; gap: 2px; }
.music-owner strong, .music-owner small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-owner small { color: var(--muted); font-weight: 500; }
.music-tool-panel { margin-bottom: 14px; padding: 16px; }
.music-tool-panel h3 { margin: 0 0 12px; }
.music-album-form {
  display: grid;
  grid-template-columns: minmax(200px, 320px) auto;
  gap: 8px;
  justify-content: start;
}
.music-upload-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px) auto auto;
  gap: 9px;
  align-items: center;
}
.music-upload-form select { max-width: none; }
.music-all-section {
  margin: 4px 0 24px;
  display: grid;
  gap: 12px;
}
.music-all-head {
  padding: 4px 2px 0;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}
.music-all-head h3 { margin: 3px 0 4px; font-size: 24px; letter-spacing: -.35px; }
.music-all-head .music-album-actions { margin-top: 0; }
.music-all-player { box-shadow: 0 8px 24px rgba(91,38,60,.08); }
.music-album-grid {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px 16px;
}
.music-album-card {
  border: 0;
  padding: 0;
  display: grid;
  gap: 9px;
  text-align: left;
  color: var(--text);
  background: transparent;
  border-radius: 12px;
}
.music-album-card:hover { background: transparent; color: var(--brand-ink); }
.music-album-card:hover .music-album-cover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(105,41,69,.18); }
.music-album-cover {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 15px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(145deg, #f0a0bd, #aa3d6d);
  color: #fff;
  font-size: clamp(48px, 6vw, 76px);
  box-shadow: 0 8px 22px rgba(105,41,69,.14);
  transition: transform .18s ease, box-shadow .18s ease;
}
.music-album-cover span {
  width: 48%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.17);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}
.album-tone-1 { background: linear-gradient(145deg, #f3b7cd, #c85d89 58%, #7a294d); }
.album-tone-2 { background: linear-gradient(145deg, #f2cada, #d17a9e 55%, #8d365d); }
.album-tone-3 { background: linear-gradient(145deg, #e997b6, #a83f6b 60%, #67243f); }
.album-tone-4 { background: linear-gradient(145deg, #efb2c8, #bd577f 58%, #7b2c50); }
.music-album-info { min-width: 0; display: grid; gap: 2px; padding: 0 2px; }
.music-album-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.music-album-info small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.music-empty { grid-column: 1 / -1; }
.music-album-page { display: grid; gap: 16px; }
.music-back {
  justify-self: start;
  padding: 6px 2px;
  background: transparent;
  color: var(--brand-ink);
  font-size: 16px;
}
.music-back:hover { background: transparent; color: #7f264d; }
.music-album-hero {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 28px;
  align-items: end;
  padding: 2px 4px 10px;
}
.music-album-cover-large { max-width: 240px; font-size: 70px; }
.music-album-summary { min-width: 0; padding-bottom: 4px; }
.music-album-summary h2 { margin: 6px 0; font-size: clamp(30px, 5vw, 48px); line-height: 1.02; letter-spacing: -1.2px; }
.music-album-owner { color: var(--muted); font-size: 15px; }
.music-album-actions { margin-top: 20px; display: flex; gap: 10px; }
.music-album-actions button {
  min-width: 150px;
  min-height: 42px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}
.button-icon { width: 18px; height: 18px; display: grid; place-items: center; }
.shuffle-glyph {
  display: inline-block;
  font-family: Arial, sans-serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  transform: translateY(-1px);
}
.apple-player {
  padding: 16px 18px;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  align-items: center;
  gap: 12px 20px;
  border-radius: 14px;
}
.now-playing {
  min-width: 0;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
}
.now-cover {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #f0a0bd, #aa3d6d);
  color: white;
  font-size: 22px;
}
.now-playing > span:last-child { min-width: 0; display: grid; gap: 3px; }
.now-playing strong, .now-playing small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-playing small { color: var(--muted); }
.player-controls { display: flex; align-items: center; justify-content: center; gap: 12px; }
.player-icon, .player-play {
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: transform .12s ease, background .12s ease, box-shadow .12s ease;
}
.player-icon {
  width: 42px;
  height: 42px;
  border: 1px solid #edd9e1;
  background: #fcf5f8;
  color: var(--brand-ink);
}
.player-icon:hover { background: #f9e8ef; color: #7f264d; transform: translateY(-1px); }
.player-icon.active { border-color: var(--brand-ink); background: var(--brand-ink); color: white; }
.player-play {
  width: 58px;
  height: 58px;
  background: var(--brand-ink);
  color: #fff;
  box-shadow: 0 7px 18px rgba(167,53,100,.25);
}
.player-play:hover { background: #8e2d58; transform: translateY(-1px); box-shadow: 0 9px 22px rgba(167,53,100,.30); }
.play-state-icon { display: block; position: relative; flex: 0 0 auto; }
.play-state-icon.icon-play {
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid currentColor;
  transform: translateX(1px);
}
.play-state-icon.icon-pause { width: 13px; height: 16px; }
.play-state-icon.icon-pause::before,
.play-state-icon.icon-pause::after {
  content: "";
  position: absolute;
  top: 0;
  width: 4px;
  height: 16px;
  border-radius: 1px;
  background: currentColor;
}
.play-state-icon.icon-pause::before { left: 1px; }
.play-state-icon.icon-pause::after { right: 1px; }
.skip-icon { width: 18px; height: 18px; display: block; position: relative; }
.skip-icon::before {
  content: "";
  position: absolute;
  top: 3px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}
.skip-icon::after {
  content: "";
  position: absolute;
  top: 3px;
  width: 2px;
  height: 12px;
  border-radius: 1px;
  background: currentColor;
}
.skip-icon.previous::before { left: 4px; border-right: 9px solid currentColor; }
.skip-icon.previous::after { left: 2px; }
.skip-icon.next::before { right: 4px; border-left: 9px solid currentColor; }
.skip-icon.next::after { right: 2px; }
.player-timeline {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
}
.player-timeline span:last-child { text-align: right; }
.player-timeline input {
  width: 100%;
  height: 18px;
  padding: 0;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
}
.player-timeline input::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--brand-ink) 0 var(--progress), #ecd9e1 var(--progress) 100%);
}
.player-timeline input::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 2px solid #fff;
  border-radius: 50%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--brand-ink);
  box-shadow: 0 1px 5px rgba(93,36,61,.28);
}
.player-timeline input::-moz-range-track { height: 4px; border-radius: 999px; background: #ecd9e1; }
.player-timeline input::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--brand-ink); }
.player-timeline input::-moz-range-thumb { width: 11px; height: 11px; border: 2px solid #fff; border-radius: 50%; background: var(--brand-ink); }
.music-track-list { padding: 0 16px; overflow: hidden; border-radius: 14px; }
.music-track-row {
  width: 100%;
  min-height: 62px;
  padding: 9px 4px;
  display: grid;
  grid-template-columns: 28px 0 minmax(0, 1fr);
  align-items: center;
  gap: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.music-track-row:last-child { border-bottom: 0; }
.music-track-row:hover, .music-track-row.active { background: #fdf3f6; }
.music-track-row.active { color: var(--brand-ink); grid-template-columns: 0 28px minmax(0, 1fr); }
.track-number { color: var(--muted); text-align: center; }
.track-play-mark { opacity: 0; color: var(--brand-ink); display: grid; place-items: center; }
.mini-play-triangle {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid currentColor;
}
.music-track-row.active .track-number { opacity: 0; }
.music-track-row.active .track-play-mark { opacity: 1; text-align: center; }
.track-copy { min-width: 0; display: grid; gap: 3px; }
.track-copy strong, .track-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-copy small { color: var(--muted); font-weight: 500; }
.library-list-title {
  margin: 18px 2px 8px;
  color: var(--brand-ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.library-list-title span {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 12px;
  background: #f9e3ec;
  color: #a75b77;
  font-size: 13px;
  text-align: center;
}
.media-library-card {
  padding: 14px;
  display: grid;
  gap: 10px;
}
.library-title {
  color: var(--brand-ink);
  font-weight: 800;
  font-size: 17px;
}
.library-player {
  width: 100%;
  max-height: 360px;
  border-radius: 6px;
  background: #000;
}
.call-wrap {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 14px;
}
.call-list {
  padding: 8px;
  display: grid;
  gap: 4px;
  align-content: start;
  border-radius: 14px;
}
.call-list-head {
  padding: 10px 10px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.call-list-head h2 { margin: 2px 0 0; font-size: 24px; }
.call-target {
  width: 100%;
  min-height: 70px;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
}
.call-target:hover { background: var(--panel-2); }
.call-target.selected { border-color: var(--brand-border); background: var(--brand-soft); }
.family-call-target { background: var(--panel-2); }
.call-list-avatar { width: 50px; height: 50px; font-size: 17px; }
.call-target-copy { min-width: 0; display: grid; gap: 4px; }
.call-target-copy strong, .call-target-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-target small { color: var(--muted); font-weight: 500; }
.call-row-actions { display: flex; align-items: center; gap: 6px; }
.call-type-button {
  min-width: 54px;
  padding: 7px 8px;
  border: 1px solid var(--brand-border);
  border-radius: 9px;
  font-size: 12px;
  line-height: 1;
  font-weight: 750;
  box-shadow: none;
}
.call-type-video { background: var(--brand); color: #fff; }
.call-type-video:hover { background: var(--brand-dark); }
.call-only-video { min-width: 68px; }
.call-type-button:disabled { opacity: .55; cursor: wait; }
.incoming-call-screen[hidden] { display: none; }
.incoming-call-screen {
  position: fixed;
  z-index: 300;
  inset: 0;
  min-height: 100svh;
  padding: max(36px, env(safe-area-inset-top)) 24px max(34px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  color: #fff;
  background:
    radial-gradient(circle at 50% 24%, rgba(224,111,157,.38), transparent 30%),
    radial-gradient(circle at 18% 84%, rgba(143,51,91,.34), transparent 38%),
    linear-gradient(160deg, #6b2947 0%, #43202e 48%, #211018 100%);
}
.incoming-call-content {
  width: min(100%, 430px);
  min-height: min(680px, calc(100svh - 70px));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.incoming-call-kicker { margin-bottom: 34px; color: rgba(255,255,255,.72); font-size: 16px; font-weight: 700; }
.incoming-call-avatar {
  position: relative;
  width: 156px;
  height: 156px;
  margin-bottom: 25px;
  border: 4px solid rgba(255,255,255,.88);
  border-radius: 50%;
  box-shadow: 0 20px 55px rgba(0,0,0,.34), 0 0 0 13px rgba(255,255,255,.08);
}
.incoming-call-avatar::before,
.incoming-call-avatar::after {
  content: "";
  position: absolute;
  inset: -18px;
  border: 2px solid rgba(255,255,255,.2);
  border-radius: 50%;
  animation: incoming-ring-pulse 1.9s ease-out infinite;
}
.incoming-call-avatar::after { animation-delay: .7s; }
.incoming-call-avatar-photo,
.incoming-call-avatar .call-avatar-fallback { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.incoming-call-content h2 { margin: 0; color: #fff; font-size: clamp(30px, 8vw, 42px); line-height: 1.08; letter-spacing: -.03em; }
.incoming-call-note { margin-top: 12px; color: rgba(255,255,255,.72); font-size: 16px; }
.incoming-call-actions { width: 100%; margin-top: auto; padding-top: 58px; display: flex; justify-content: center; gap: 52px; }
.incoming-call-choice,
.incoming-call-choice:hover {
  width: 96px;
  min-width: 0;
  padding: 0;
  display: grid;
  justify-items: center;
  gap: 10px;
  color: #fff;
  background: transparent;
  box-shadow: none;
}
.incoming-call-choice-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 34px;
  font-weight: 500;
  box-shadow: 0 12px 28px rgba(0,0,0,.24);
}
.incoming-call-choice > span:last-child { width: 100%; overflow: hidden; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.incoming-decline .incoming-call-choice-icon { background: #ef4444; }
.incoming-accept .incoming-call-choice-icon { background: #34c759; }
.incoming-call-choice:disabled { opacity: .55; cursor: default; }
.call-wrap.call-ringing .call-avatar-shell { animation: outgoing-ring-pulse 1.8s ease-in-out infinite; }
.call-wrap.call-ringing #toggleMicButton,
.call-wrap.call-ringing #toggleCameraButton { display: none; }
@keyframes incoming-ring-pulse {
  0% { opacity: .65; transform: scale(.9); }
  100% { opacity: 0; transform: scale(1.24); }
}
@keyframes outgoing-ring-pulse {
  0%, 100% { box-shadow: 0 14px 45px rgba(0,0,0,.32), 0 0 0 10px rgba(255,255,255,.08); }
  50% { box-shadow: 0 14px 45px rgba(0,0,0,.32), 0 0 0 20px rgba(255,255,255,.025); }
}
.call-panel { padding: 12px; display: grid; gap: 12px; }
.call-panel-header { display: none; }
.call-stage {
  position: relative;
  min-height: 460px;
  border-radius: 20px;
  overflow: hidden;
  background:
    radial-gradient(circle at 25% 15%, rgba(210,91,140,.34), transparent 38%),
    radial-gradient(circle at 80% 88%, rgba(130,42,80,.32), transparent 42%),
    linear-gradient(145deg, #4d2635 0%, #2b1720 46%, #1e0f16 100%);
  display: grid;
  place-items: center;
}

body.call-page { height: 100svh; overflow: hidden; }
body.call-page .shell { height: 100svh; min-height: 0; overflow: hidden; }
body.call-page .layout {
  width: 100%;
  max-width: 1400px;
  height: calc(100svh - 48px);
  min-height: 0;
  margin: 0 auto;
  padding: 14px 18px;
  grid-template-columns: minmax(0, 1fr);
}
body.call-page .side, body.call-page .rightcol { display: none; }
body.call-page #main, body.call-page .call-wrap { height: 100%; min-height: 0; }
body.call-page .call-list { min-height: 0; overflow-y: auto; }
body.call-page .call-panel { min-height: 0; grid-template-rows: minmax(0, 1fr) auto; }
body.call-page .call-stage { height: auto; min-height: 0; }
.remote-video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background: #1e0f16;
  opacity: 0;
  transition: opacity .28s ease;
}
.call-stage.remote-camera-on .remote-video { opacity: 1; }
.group-call-grid {
  position: absolute;
  z-index: 2;
  inset: 14px 14px 112px;
  width: calc(100% - 28px);
  height: calc(100% - 126px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 10px;
}
.group-call-grid[hidden] { display: none; }
.call-stage.group-call-active .audio-call-card,
.call-stage.group-call-active > .remote-video,
.call-stage.group-call-active > .local-video { display: none; }
.group-participant {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 38%, rgba(224,111,157,.24), transparent 44%),
    rgba(22,10,16,.62);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07);
}
.group-participant.self { background: rgba(255,255,255,.075); }
.group-participant-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .2s ease;
}
.group-participant.camera-on .group-participant-video { opacity: 1; }
.group-participant-avatar {
  width: clamp(76px, 18vh, 132px);
  height: clamp(76px, 18vh, 132px);
  border: 3px solid rgba(255,255,255,.82);
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 13px 36px rgba(0,0,0,.3), 0 0 0 8px rgba(255,255,255,.06);
}
.group-participant-avatar-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.group-participant-footer {
  position: absolute;
  z-index: 2;
  right: 10px;
  bottom: 10px;
  left: 10px;
  min-width: 0;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 11px;
  color: #fff;
  background: rgba(15,7,11,.55);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.group-participant-footer strong,
.group-participant-footer span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.group-participant-footer strong { font-size: 13px; }
.group-participant-state { color: rgba(255,255,255,.7); font-size: 11px; }
.group-participant.mic-muted .group-participant-state { color: #ffc4d9; }
.audio-call-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px;
  color: #fff;
  text-align: center;
  transition: opacity .22s ease;
}
.call-stage.remote-camera-on .audio-call-card { opacity: 0; pointer-events: none; }
.call-avatar-shell {
  width: 148px;
  height: 148px;
  margin-bottom: 8px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 4px solid rgba(255,255,255,.78);
  box-shadow: 0 14px 45px rgba(0,0,0,.32), 0 0 0 10px rgba(255,255,255,.08);
  overflow: hidden;
}
.call-avatar-photo, .call-avatar-fallback {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  font-size: 52px;
  font-weight: 800;
}
.call-avatar-stack { display: flex; overflow: visible; width: 190px; border: 0; box-shadow: none; }
.call-avatar-stack .call-avatar-photo { width: 112px; height: 112px; flex: 0 0 112px; border: 4px solid rgba(255,255,255,.9); margin-left: -48px; }
.call-avatar-stack .call-avatar-photo:first-child { margin-left: 0; }
.call-person-name { font-size: 28px; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; }
.local-video {
  position: absolute;
  z-index: 3;
  right: 14px;
  bottom: 112px;
  width: min(180px, 34%);
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 10px;
  border: 3px solid rgba(255,255,255,.82);
  background: #2b1821;
  display: none;
}
.call-stage.local-camera-on .local-video { display: block; }
.call-placeholder {
  color: rgba(255,255,255,.72);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}
.remote-muted-badge { margin-top: 7px; padding: 7px 11px; border-radius: 999px; background: rgba(255,255,255,.13); font-size: 13px; font-weight: 700; }
.remote-muted-badge[hidden] { display: none; }
.call-media-controls {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(3, 72px);
  place-items: start center;
  gap: 10px;
  max-width: calc(100vw - 24px);
  padding: 0 4px 24px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.call-media-controls[hidden], .call-device-controls[hidden], .call-device-hint[hidden] { display: none; }
.call-control {
  position: relative;
  min-width: 68px;
  width: 68px;
  height: 68px;
  padding: 0;
  display: grid;
  place-items: center;
  justify-self: center;
  border-radius: 50%;
  overflow: visible;
  background: rgba(255,255,255,.94);
  color: #2b1821;
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 12px 28px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.72);
  transition: transform .16s ease, background .16s ease, box-shadow .16s ease, opacity .16s ease;
}
.call-control:hover { transform: translateY(-1px); background: #fff; box-shadow: 0 14px 30px rgba(0,0,0,.28), inset 0 1px 0 #fff; }
.call-control:active { transform: scale(.95); }
.call-control:disabled { opacity: .56; }
.call-control-icon {
  --call-icon: none;
  position: relative;
  display: block;
  width: 27px;
  height: 27px;
  color: currentColor;
  background: currentColor;
  -webkit-mask: var(--call-icon) center / contain no-repeat;
  mask: var(--call-icon) center / contain no-repeat;
}
.call-control-label {
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  width: 78px;
  color: #fff;
  font-size: 10.5px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: .01em;
  text-shadow: 0 1px 5px rgba(0,0,0,.72);
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.call-control.control-active { color: #2b1821; background: rgba(255,255,255,.94); border-color: rgba(255,255,255,.7); }
.call-control.control-off {
  color: #fff;
  background: rgba(63,38,49,.92);
  border-color: rgba(255,255,255,.16);
}
.call-control.control-off::after {
  content: "";
  position: absolute;
  width: 32px;
  height: 2.5px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(-44deg);
  box-shadow: 0 0 0 1.5px rgba(63,38,49,.76);
}
.call-end-button, .call-end-button:hover {
  grid-column: 2;
  color: #fff;
  background: #ff3b30;
  border-color: #ff5a50;
  box-shadow: 0 6px 18px rgba(255,59,48,.38), inset 0 1px 0 rgba(255,255,255,.22);
}
.mic-glyph { --call-icon: url("/icons/mic.svg"); }
.camera-glyph { --call-icon: url("/icons/video.svg"); }
.phone-glyph { --call-icon: url("/icons/phone.svg"); transform: rotate(135deg); }
.call-device-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: #fcf5f8;
  border: 1px solid var(--line);
}
.call-device-controls label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.call-device-controls select { width: 100%; }
.call-device-hint { text-align: center; }
.album-form {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
}
.album-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.album-card { overflow: hidden; cursor: pointer; }
.album-card img, .album-cover-empty {
  width: 100%;
  aspect-ratio: 1.7;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  color: var(--brand-ink);
  font-size: 48px;
  font-weight: 900;
}
.album-body { padding: 12px; }
.album-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.album-add-button { flex: 0 0 auto; }
.album-body p { margin: 8px 0 0; color: var(--muted); }
.album-detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.album-detail-head h2 { margin: 0; }
.album-upload-card h3 { margin: 0 0 12px; }
.album-upload-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.album-file-name { margin-left: 0; margin-top: 8px; }

.profile-page { overflow: hidden; }
.cover { height: 150px; }
.profile-main {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
  padding: 0 18px 18px;
}
.profile-avatar {
  width: 92px;
  height: 92px;
  font-size: 30px;
  margin-top: -38px;
  border: 4px solid white;
}
.profile-main h2 { margin: 0 0 4px; }
.profile-main p { margin: 10px 0 0; color: #49343e; }
.theme-setting { margin: 4px 0; padding: 0; border: 0; }
.theme-setting legend { margin-bottom: 9px; color: var(--muted); font-size: 13px; font-weight: 700; }
.theme-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-option { min-width: 0; cursor: pointer; }
.theme-option > input { position: absolute; opacity: 0; pointer-events: none; }
.theme-choice-card {
  min-height: 92px;
  padding: 11px;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.theme-option:hover .theme-choice-card { transform: translateY(-1px); }
.theme-option > input:checked + .theme-choice-card { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(215,91,142,.22); }
.theme-choice-card > span:last-child { min-width: 0; display: grid; gap: 4px; }
.theme-choice-card strong { font-size: 15px; }
.theme-choice-card small { color: var(--muted); font-size: 12px; line-height: 1.25; }
.theme-preview {
  width: 88px;
  height: 62px;
  padding: 8px;
  display: grid;
  align-content: start;
  gap: 7px;
  border-radius: 9px;
  box-shadow: inset 0 0 0 1px rgba(164,126,143,.28);
}
.theme-preview i { display: block; height: 9px; border-radius: 4px; }
.theme-preview b { display: block; width: 78%; height: 6px; border-radius: 3px; }
.theme-preview b:last-child { width: 55%; }
.theme-preview-light { background: #f9f1f4; }
.theme-preview-light i { background: var(--brand); }
.theme-preview-light b { background: #e0cfd6; }
.theme-preview-dark { background: #25191f; }
.theme-preview-dark i { background: #d06c96; }
.theme-preview-dark b { background: #574149; }
.password-settings-card { margin-top: 14px; }
.password-settings-head h2 { margin: 0 0 5px; }
.password-form { max-width: 760px; }
.password-form label { min-width: 0; display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
.password-new-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.password-message { min-height: 0; }
.password-message:empty { display: none; }
.success { color: var(--good); font-weight: 700; }
.password-form > button { justify-self: start; min-width: 170px; }
.profile-compact-card { padding: 18px; border-radius: 22px; }
.profile-compact-form {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}
.profile-avatar-button { position: relative; width: 92px; height: 92px; cursor: pointer; }
.profile-avatar-button .profile-avatar { margin: 0; }
.profile-avatar-button > span {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--brand);
  color: white;
  font-size: 14px;
}
.profile-avatar-button > input { display: none; }
.profile-name-setting { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 9px; }
.profile-name-setting label { min-width: 0; display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
.profile-name-setting input { min-height: 44px; border-radius: 14px; }
.profile-name-setting button { min-height: 44px; border-radius: 14px; }
.profile-quick-actions { display: flex; align-items: center; gap: 8px; }
.profile-icon-button,
.profile-password-toggle { min-height: 40px; padding: 8px 12px; border-radius: 14px; }
.profile-icon-button { width: 40px; padding: 0; font-size: 22px; }
.profile-password-toggle { white-space: nowrap; }
.profile-compact-form > .error { grid-column: 2 / -1; min-height: 0; }
.password-settings-card[hidden] { display: none; }
.profile-simple-view .profile-main { padding-top: 18px; }
@media (max-width: 699px) {
  .profile-compact-form { grid-template-columns: 76px minmax(0, 1fr); gap: 12px; }
  .profile-avatar-button,
  .profile-avatar-button .profile-avatar { width: 72px; height: 72px; }
  .profile-name-setting { grid-template-columns: 1fr; }
  .profile-name-setting button { width: 100%; }
  .profile-quick-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .profile-compact-form > .error { grid-column: 1 / -1; }
}

.photo-tile { overflow: hidden; }
.photo-tile img, .photo-tile video {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: #2b1821;
  cursor: zoom-in;
}
.photo-caption { padding: 9px 10px; color: var(--muted); font-size: 13px; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(39,19,28,.88);
  display: grid;
  place-items: center;
  padding: 22px;
}
.lightbox img {
  max-width: 96vw;
  max-height: 92vh;
  border-radius: 4px;
  box-shadow: 0 20px 70px rgba(0,0,0,.4);
}
.lightbox-close {
  position: fixed;
  top: 16px;
  right: 18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 0;
  font-size: 28px;
  background: rgba(255,255,255,.16);
}

html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--text);
}
html[data-theme="dark"] input:focus,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] select:focus { border-color: #d8789e; }
html[data-theme="dark"] button.secondary,
html[data-theme="dark"] .filepick,
html[data-theme="dark"] .chat-filepick,
html[data-theme="dark"] button.ghost:not(.top-ghost),
html[data-theme="dark"] .person-name,
html[data-theme="dark"] .chat-back,
html[data-theme="dark"] .music-back,
html[data-theme="dark"] .reaction-summary,
html[data-theme="dark"] .reaction-option,
html[data-theme="dark"] .reaction-total,
html[data-theme="dark"] .library-title,
html[data-theme="dark"] .library-list-title,
html[data-theme="dark"] .stat strong,
html[data-theme="dark"] .message-status.read { color: #e58eb0; }
html[data-theme="dark"] button.secondary:hover,
html[data-theme="dark"] .filepick:hover,
html[data-theme="dark"] .chat-filepick:hover,
html[data-theme="dark"] .chat-back:hover { background: #4a2b37; }
html[data-theme="dark"] .reaction-menu,
html[data-theme="dark"] .reaction-total,
html[data-theme="dark"] .chat-conversation-header,
html[data-theme="dark"] .message-form,
html[data-theme="dark"] .mobile-close { background: var(--panel); }
html[data-theme="dark"] .call-target { background: transparent; }
html[data-theme="dark"] .family-call-target,
html[data-theme="dark"] .call-target:hover { background: var(--panel-2); }
html[data-theme="dark"] .call-target.selected { background: var(--brand-soft); }
html[data-theme="dark"] .call-type-video { border-color: #dc82a6; background: var(--brand); color: #fff; }
html[data-theme="dark"] .chat-row:hover,
html[data-theme="dark"] .music-track-row:hover,
html[data-theme="dark"] .music-track-row.active { background: var(--panel-2); }
html[data-theme="dark"] .chat-row.selected,
html[data-theme="dark"] .family-chat-row,
html[data-theme="dark"] .message.mine,
html[data-theme="dark"] .publish-progress { background: var(--brand-soft); }
html[data-theme="dark"] .messages { background: #25191f; }
html[data-theme="dark"] .message { background: #35262d; }
html[data-theme="dark"] .message-head > strong,
html[data-theme="dark"] .message-reply-quote strong,
html[data-theme="dark"] .message-reply-composer strong { color: #e58eb0; }
html[data-theme="dark"] .message-reply-button,
html[data-theme="dark"] .message-edit-button,
html[data-theme="dark"] .message-delete-button {
  border-color: rgba(229,142,176,.13);
  background: rgba(255,255,255,.06);
  color: #cdb7c0;
}
html[data-theme="dark"] .message:hover .message-reply-button,
html[data-theme="dark"] .message-reply-button:focus-visible,
html[data-theme="dark"] .message-edit-button:hover,
html[data-theme="dark"] .message-delete-button:hover,
html[data-theme="dark"] .message-edit-button:focus-visible,
html[data-theme="dark"] .message-delete-button:focus-visible {
  border-color: rgba(229,142,176,.28);
  background: rgba(229,142,176,.14);
  color: #f1aec7;
}
html[data-theme="dark"] .message-reply-quote { background: rgba(215,91,142,.18); }
html[data-theme="dark"] .message-reply-quote:hover { background: rgba(215,91,142,.25); }
html[data-theme="dark"] .message-reaction-picker .reaction-summary { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.1); }
html[data-theme="dark"] .message-reply-composer button { color: #e58eb0; }
html[data-theme="dark"] .player-icon { border-color: var(--line); background: var(--panel-2); color: #e58eb0; }
html[data-theme="dark"] .player-icon:hover { background: #4a303a; color: #f1aec7; }
html[data-theme="dark"] .player-icon.active { border-color: var(--brand); background: var(--brand); color: white; }
html[data-theme="dark"] .profile-avatar { border-color: var(--panel); }
html[data-theme="dark"] .profile-main p,
html[data-theme="dark"] .remember-row { color: var(--text); }
html[data-theme="dark"] .notice { border-color: #675b31; background: #302b1e; color: #e3ca7d; }
html[data-theme="dark"] .push-highlight { box-shadow: 0 0 0 3px rgba(214,112,154,.45); }
html[data-theme="dark"] .theme-option > input:checked + .theme-choice-card { border-color: #e28bad; box-shadow: 0 0 0 2px rgba(226,139,173,.22); }
html[data-theme="dark"] .audit-event.failed { color: #ffaaaa; background: rgba(218,78,78,.18); }

@media (max-width: 1000px) {
  .audit-filters { grid-template-columns: 1fr 1fr; }
  .audit-filters input { grid-column: 1 / -1; }
  .audit-table-head { display: none; }
  .audit-row {
    grid-template-columns: minmax(130px, .7fr) minmax(180px, 1fr);
    gap: 12px 18px;
  }
  .audit-action, .audit-connection { padding-top: 9px; border-top: 1px dashed var(--line); }
}

@media (max-width: 699px) {
  input, textarea, select { font-size: 16px; }
  input, textarea, select, form, .card, .composer, .message-form { max-width: 100%; }
  body.menu-open { overflow: hidden; }
  .topbar, .topbar-inner { height: 50px; }
  .topbar-inner { padding: 0 12px; }
  .hamburger { display: grid; place-items: center; flex: 0 0 38px; }
  .logo { flex: 1; text-align: left; }
  .tabs { display: none; }
  .userbar { max-width: 42%; justify-content: flex-end; }
  .top-ghost, .userbar span { display: none; }
  .mobile-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(39,19,28,.36);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
  }
  .mobile-backdrop.open { opacity: 1; pointer-events: auto; }
  .mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(88vw, 360px);
    height: 100dvh;
    padding: 12px;
    overflow-y: auto;
    background: var(--bg);
    box-shadow: 22px 0 52px rgba(76,39,55,.24);
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  .mobile-menu.open { transform: translateX(0); }
  .mobile-menu-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 10px;
    align-items: start;
  }
  .mobile-profile { margin: 0; }
  .mobile-close {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    padding: 0;
    background: white;
    color: var(--brand-ink);
    font-size: 30px;
    line-height: 1;
  }
  .mobile-nav { padding: 8px; }
  .mobile-menu .navitem { min-height: 46px; font-size: 16px; }
  .mobile-menu .card { flex: 0 0 auto; }
  .mobile-logout { width: 100%; margin-bottom: 10px; }
  .layout { grid-template-columns: 1fr; margin: 12px auto; padding: 0 12px; }
  .side, .rightcol, .mobile-push-card { display: none; }
  .chat-wrap, .admin-grid { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .album-grid, .album-form, .album-upload-form, .media-library-grid, .library-form, .call-wrap { grid-template-columns: 1fr; }
  .library-form.video-library-form { grid-template-columns: 1fr; }
  .music-library-head { align-items: stretch; flex-direction: column; }
  .media-section-head { align-items: stretch; flex-direction: column; }
  .media-section-head > button { width: 100%; }
  .music-library-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .music-owner-switcher { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .music-owner { min-width: 0; padding-right: 9px; }
  .music-album-form { grid-template-columns: 1fr; }
  .music-upload-form { grid-template-columns: 1fr; }
  .music-all-section { margin-bottom: 20px; }
  .music-all-head { align-items: stretch; flex-direction: column; }
  .music-all-head .music-album-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .music-album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
  .music-album-cover { border-radius: 12px; }
  .music-album-hero { grid-template-columns: 1fr; gap: 18px; padding-top: 0; }
  .music-album-cover-large { width: min(68vw, 240px); justify-self: center; }
  .music-album-summary { text-align: center; }
  .music-album-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .music-album-actions button { min-width: 0; }
  .apple-player { grid-template-columns: 1fr; padding: 14px; }
  .player-controls { grid-row: 2; }
  .player-timeline { grid-row: 3; }
  .music-track-list { padding: 0 10px; }
  .album-title-row { align-items: center; }
  .profile-main { grid-template-columns: 1fr; align-items: start; }
  .theme-options { grid-template-columns: 1fr; }
  .password-new-fields { grid-template-columns: 1fr; }
  .password-form > button { width: 100%; }
  body.admin-page .layout { margin: 10px auto; padding: 0 10px; }
  .admin-console-head { padding: 17px; align-items: stretch; flex-direction: column; }
  .admin-console-head h1 { font-size: 25px; }
  .admin-menu { width: 100%; }
  .admin-menu button { flex: 1 1 0; min-width: 0; padding-inline: 8px; }
  .audit-summary { grid-template-columns: 1fr 1fr; }
  .audit-stat { min-height: 82px; padding: 14px; }
  .audit-card-head { padding: 17px; align-items: stretch; flex-direction: column; }
  .audit-refresh { width: 100%; }
  .audit-filters { grid-template-columns: 1fr; }
  .audit-filters input { grid-column: auto; }
  .audit-row { grid-template-columns: 1fr; padding: 14px; gap: 11px; }
  .audit-time { grid-template-columns: auto 1fr; align-items: baseline; gap: 8px; }
  .audit-time span { text-align: right; }
  .audit-action, .audit-connection { padding-top: 9px; border-top: 1px dashed var(--line); }
  .audit-list { max-height: none; }
  .composer-head { grid-template-columns: 1fr; }
  .composer-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .composer-actions select { max-width: none; }
  .composer-actions .publish-button { grid-column: 1 / -1; width: 100%; }
  .publish-progress, .post-error, .meme-link-import { margin-left: 0; }
  .file-name { margin-left: 0; }
  .person { grid-template-columns: 42px minmax(0, 1fr); }
  .person-actions { grid-column: 2; justify-self: start; flex-wrap: wrap; }
  .message { max-width: 86%; }
  .message-form { grid-template-columns: 42px minmax(0, 1fr); }
  .message-form > button, .chat-file-name { grid-column: 1 / 3; }
  body.chat-page .layout { height: calc(100svh - 50px); margin: 0; padding: 0; }
  body.chat-page .chat-inbox,
  body.chat-page .chat-window,
  body.chat-page .chat-conversation-header { border-radius: 0; }
  body.chat-page .messages { padding: 11px 10px; }
  body.chat-page .message-form { grid-template-columns: 42px minmax(0, 1fr) auto; padding: 9px 10px max(9px, env(safe-area-inset-bottom)); }
  body.chat-page .message-form > button { grid-column: auto; min-width: 44px; padding-inline: 12px; }
  body.chat-page .chat-file-name { grid-column: 2 / 4; }
  body.chat-page .message-reply-composer { grid-column: 1 / -1; }
  .call-panel { padding: 8px; }
  body.call-page { height: 100svh; overflow: hidden; }
  body.call-page .shell { height: 100svh; min-height: 0; overflow: hidden; }
  body.call-page .layout { height: calc(100svh - 50px); min-height: 0; margin: 0 auto; padding: 8px 10px; }
  body.call-page #main { height: 100%; min-height: 0; overflow: hidden; }
  body.call-page .call-wrap { height: 100%; min-height: 0; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
  body.call-page .call-list {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    align-content: start;
    gap: 4px;
    padding: 8px;
    overflow-y: auto;
  }
  body.call-page .call-target { min-width: 0; min-height: 70px; padding: 9px 10px; }
  body.call-page .call-row-actions { gap: 5px; }
  body.call-page .call-type-button { min-width: 52px; padding: 8px 7px; }
  body.call-page .call-panel { display: none; }
  body.call-page .call-wrap.target-selected .call-list { display: none; }
  body.call-page .call-wrap.target-selected .call-panel { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
  body.call-page .call-panel-header { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; }
  body.call-page .call-wrap.call-active .call-panel-header { display: none; }
  body.call-page .call-stage { flex: 1 1 auto; min-height: 0; border-radius: 17px; }
  body.call-page #callStatus { flex: 0 0 auto; min-height: 16px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .local-video { width: 34%; right: 10px; bottom: 104px; }
  body.call-page .call-device-controls {
    position: absolute;
    z-index: 6;
    left: 10px;
    right: 10px;
    bottom: 104px;
    grid-template-columns: 1fr;
    box-shadow: 0 14px 38px rgba(55,22,37,.28);
  }
  .call-media-controls {
    position: absolute;
    bottom: max(14px, env(safe-area-inset-bottom));
    flex: 0 0 auto;
    grid-template-columns: repeat(3, 68px);
    gap: 8px;
    padding: 0 2px 24px;
  }
  .call-control { width: 66px; min-width: 66px; height: 66px; }
  .call-avatar-shell { width: clamp(94px, 19vh, 128px); height: clamp(94px, 19vh, 128px); }
  .call-person-name { font-size: 24px; }
  .group-call-grid {
    inset: 8px 8px 98px;
    width: calc(100% - 16px);
    height: calc(100% - 106px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }
  .group-participant {
    border-radius: 13px;
  }
  .group-participant-avatar {
    width: clamp(62px, 14vh, 102px);
    height: clamp(62px, 14vh, 102px);
  }
  .group-participant-footer {
    right: 6px;
    bottom: 6px;
    left: 6px;
    padding: 6px 7px;
  }
  .group-participant-footer { display: grid; gap: 1px; }
  .group-participant-footer strong { font-size: 11px; }
  .group-participant-state { font-size: 9px; }
}

@media (min-width: 700px) and (max-width: 1180px) {
  input, textarea, select { font-size: 16px; }
  button, .filepick, .chat-filepick { min-height: 40px; }

  .topbar, .topbar-inner { height: 56px; }
  .topbar-inner {
    width: 100%;
    max-width: none;
    gap: 10px;
    padding-right: max(14px, env(safe-area-inset-right));
    padding-left: max(14px, env(safe-area-inset-left));
  }
  .hamburger, .mobile-backdrop, .mobile-menu { display: none; }
  .logo { flex: 0 0 auto; font-size: 18px; }
  .tabs { display: flex; gap: 4px; }
  .tab { min-height: 40px; padding: 8px 10px; font-size: 14px; }
  .userbar { display: none; }

  .layout {
    width: 100%;
    max-width: none;
    margin: 14px auto;
    padding: 0 14px;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  .side { display: none; }
  .rightcol { display: none; }
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .album-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .album-upload-form { grid-template-columns: auto minmax(0, 1fr) auto; }
  .media-library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .music-library-head { align-items: center; flex-direction: row; }
  .music-library-actions { flex-wrap: wrap; justify-content: flex-end; }
  .music-owner-switcher { display: flex; }
  .music-owner { min-width: 150px; }
  .music-album-form { grid-template-columns: minmax(200px, 320px) auto; }
  .music-upload-form { grid-template-columns: minmax(0, 1fr) minmax(170px, 220px); }
  .music-upload-form .file-name { grid-column: 1 / -1; }
  .music-all-head { align-items: end; flex-direction: row; }
  .music-all-head .music-album-actions { display: flex; }
  .music-album-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 14px; }
  .music-album-hero { grid-template-columns: minmax(180px, 220px) minmax(0, 1fr); gap: 22px; align-items: end; }
  .music-album-cover-large { width: 100%; justify-self: auto; }
  .music-album-summary { text-align: left; }
  .music-album-actions { display: flex; }
  .music-album-actions button { min-width: 0; }
  .apple-player { grid-template-columns: minmax(150px, 1fr) auto; padding: 16px; }
  .player-controls { grid-row: auto; }
  .player-timeline { grid-row: auto; }

  .profile-main { grid-template-columns: 92px minmax(0, 1fr) auto; align-items: end; }
  .theme-options { grid-template-columns: 1fr 1fr; }
  .composer-head { grid-template-columns: 42px minmax(0, 1fr); }
  .composer-actions { display: flex; }
  .composer-actions .publish-button { grid-column: auto; width: auto; }
  .person { grid-template-columns: 42px minmax(0, 1fr); }
  .person-actions { grid-column: 2; justify-self: stretch; flex-wrap: nowrap; }

  .call-wrap { grid-template-columns: 320px minmax(0, 1fr); }
  body.call-page { height: 100svh; overflow: hidden; }
  body.call-page .shell { height: 100svh; min-height: 0; overflow: hidden; }
  body.call-page .layout {
    height: calc(100svh - 56px);
    min-height: 0;
    margin: 0;
    padding: 12px 14px;
    grid-template-columns: minmax(0, 1fr);
  }
  body.call-page .side, body.call-page .rightcol { display: none; }
  body.call-page #main, body.call-page .call-wrap { height: 100%; min-height: 0; }
  body.call-page .call-list { min-height: 0; overflow-y: auto; }
  body.call-page .call-panel { min-height: 0; }
  body.call-page .call-stage { min-height: 0; height: 100%; }

  body.chat-page .layout { height: calc(100svh - 56px); padding: 12px 14px; }
  body.chat-page .chat-inbox,
  body.chat-page .chat-window,
  body.chat-page .chat-conversation-header { border-radius: 14px; }
}

@media (min-width: 1000px) and (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr) 280px; }
  .rightcol { display: flex; min-width: 0; }
  .rightcol .person { grid-template-columns: 42px minmax(0, 1fr); }
  .rightcol .person-actions { grid-column: 2; justify-self: start; }
  body.call-page .layout, body.chat-page .layout { grid-template-columns: minmax(0, 1fr); }
  body.call-page .rightcol, body.chat-page .rightcol { display: none; }
}

@media (max-width: 760px) {
  body.vpn-page .layout { margin: 0; padding: 12px; }
  .vpn-admin { gap: 12px; }
  .vpn-hero {
    min-height: 0;
    padding: 21px;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 15px;
    border-radius: 16px;
  }
  .vpn-hero-icon { width: 58px; height: 58px; border-radius: 18px; }
  .vpn-hero-icon svg { width: 33px; height: 33px; }
  .vpn-hero h1 { margin-top: 4px; font-size: 26px; }
  .vpn-hero p { font-size: 13px; }
  .vpn-server-state { grid-column: 1 / -1; width: 100%; }
  .vpn-summary-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .vpn-summary-card { padding: 14px; }
  .vpn-summary-card.traffic { grid-column: 1 / -1; }
  .vpn-admin-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .vpn-create-card { padding: 20px; }
  .vpn-users-head { padding: 19px 18px 15px; }
  .vpn-user-list { padding: 5px 10px 10px; }
  .vpn-user {
    padding: 12px 7px;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
  }
  .vpn-user-symbol { width: 44px; height: 44px; }
  .vpn-user-actions { grid-column: 2; justify-content: flex-start; }
  .vpn-user-actions button { min-height: 38px; }
  .vpn-qr-dialog { padding: 23px 18px 20px; border-radius: 19px; }
  .vpn-qr-frame { width: min(280px, 100%); }
}

@media (max-width: 390px) {
  .vpn-hero { grid-template-columns: 1fr; }
  .vpn-hero-icon { display: none; }
  .vpn-server-state { grid-column: auto; }
  .vpn-modal-actions { grid-template-columns: 1fr; }
}

body.tree-page .layout { max-width: 1440px; grid-template-columns: minmax(0, 1fr); }
body.tree-page .rightcol { display: none; }
body.tree-page #main { min-width: 0; }

.family-tree-hero {
  min-height: 174px;
  padding: 28px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  overflow: hidden;
  border: 1px solid #efc5d5;
  border-radius: 22px;
  background:
    radial-gradient(circle at 88% 15%, rgba(255,255,255,.7) 0 58px, transparent 59px),
    linear-gradient(135deg, #fff5f9 0%, #f9dce8 100%);
  box-shadow: 0 12px 34px rgba(112,49,75,.09);
}
.family-tree-hero h1 { margin: 4px 0 7px; color: var(--brand-ink); font-size: clamp(30px, 4vw, 46px); line-height: 1.05; }
.family-tree-hero p { max-width: 650px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.family-tree-hero > button { flex: 0 0 auto; min-height: 46px; padding: 0 18px; border-radius: 14px; box-shadow: 0 8px 20px rgba(167,53,100,.17); }

.family-tree-form-card { margin-top: 16px; padding: 22px; border-radius: 18px; }
.family-tree-form-card[hidden] { display: none; }
.family-tree-form-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.family-tree-form-head h2 { margin: 0 0 4px; font-size: 21px; }
.family-tree-form-head p { margin: 0; color: var(--muted); font-size: 13px; }
.family-tree-form-close { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; border-radius: 50%; font-size: 25px; }
.family-tree-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.family-tree-form label { min-width: 0; display: grid; gap: 7px; }
.family-tree-form label > span,
.family-tree-photo-field > span { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.family-tree-form input,
.family-tree-form select,
.family-tree-form textarea { width: 100%; min-width: 0; border-radius: 12px; }
.family-tree-form input,
.family-tree-form select { height: 44px; min-height: 44px; }
.family-tree-form input[type="date"] {
  display: block;
  max-width: 100%;
  min-inline-size: 0;
  line-height: 22px;
  box-sizing: border-box;
  overflow: hidden;
}
.family-tree-form select:disabled { opacity: .55; }
.family-tree-relation-hint {
  grid-column: 1 / -1;
  margin-top: -5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.family-tree-photo-field { grid-column: 1 / -1; display: grid; gap: 7px; }
.family-tree-photo-picker { display: flex; align-items: center; gap: 12px; }
.family-tree-photo-picker .file-name { min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.family-tree-description-field { grid-column: 1 / -1; }
.family-tree-description-field textarea { min-height: 104px; resize: vertical; }
.family-tree-form-error { grid-column: 1 / -1; min-height: 18px; }
.family-tree-submit { grid-column: 1 / -1; justify-self: start; min-width: 190px; border-radius: 12px; }

.family-tree-toolbar {
  margin: 18px 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.family-tree-toolbar > span { color: var(--muted); font-size: 13px; font-weight: 700; }
.family-tree-modes {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
}
.family-tree-modes button {
  min-height: 36px;
  padding: 7px 14px;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
}
.family-tree-modes button.active { background: var(--brand); color: white; box-shadow: 0 4px 12px rgba(167,53,100,.17); }

.family-tree-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.family-tree-empty { grid-column: 1 / -1; padding: 36px 20px; }
.family-person-card {
  min-width: 0;
  padding: 16px;
  border-radius: 17px;
  box-shadow: 0 6px 20px rgba(64,38,49,.05);
}
.family-person-head { display: grid; grid-template-columns: 54px minmax(0, 1fr) 30px; align-items: center; gap: 12px; }
.family-tree-avatar,
.family-org-avatar {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: white;
  font-size: 16px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.28);
}
.family-tree-photo { object-fit: cover; }
.family-person-main { min-width: 0; }
.family-person-main h3 { margin: 0 0 4px; overflow: hidden; color: var(--text); font-size: 16px; line-height: 1.25; text-overflow: ellipsis; }
.family-person-maiden { margin-bottom: 3px; overflow: hidden; color: var(--brand-ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.family-person-birth { color: var(--muted); font-size: 12px; line-height: 1.35; }
.family-person-delete {
  align-self: start;
  width: 30px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 21px;
}
.family-person-delete:hover { background: #fff0f2; color: var(--danger); }
.family-relation-pill {
  width: fit-content;
  max-width: 100%;
  margin-top: 13px;
  padding: 6px 9px;
  overflow-wrap: anywhere;
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.4;
}
.family-person-description { min-height: 42px; margin: 13px 0 12px; color: var(--text); font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.family-person-description.muted { color: var(--muted); }
.family-person-author { padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

.family-tree-org-scroll {
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(rgba(255,255,255,.72), rgba(255,255,255,.72)),
    radial-gradient(circle, rgba(167,53,100,.17) 1px, transparent 1.5px);
  background-size: auto, 22px 22px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
.family-tree-org-board { width: max-content; min-width: 100%; padding: 28px 34px 40px; }
.family-generation { position: relative; min-width: max-content; }
.family-generation + .family-generation { margin-top: 44px; }
.family-generation-label {
  position: relative;
  z-index: 2;
  width: fit-content;
  margin: 0 auto 14px;
  padding: 5px 10px;
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--brand-ink);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .035em;
  text-transform: uppercase;
}
.family-generation-row {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 22px;
}
.family-generation.connected .family-generation-row::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 112px;
  right: 112px;
  border-top: 2px solid var(--brand-border);
}
.family-org-person {
  position: relative;
  width: 224px;
  min-height: 166px;
  padding: 16px 15px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  text-align: center;
  box-shadow: 0 10px 26px rgba(70,35,51,.09);
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.family-org-person:hover,
.family-org-person:focus-visible {
  border-color: var(--brand-border);
  box-shadow: 0 14px 32px rgba(108,45,73,.15);
  transform: translateY(-2px);
  outline: none;
}
.family-generation.connected .family-org-person::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  height: 10px;
  border-left: 2px solid var(--brand-border);
}
.family-org-avatar { width: 58px; height: 58px; margin-bottom: 10px; border-radius: 50%; font-size: 17px; }
.family-org-person strong { max-width: 100%; overflow: hidden; color: var(--text); font-size: 15px; line-height: 1.25; text-overflow: ellipsis; }
.family-org-person em { max-width: 100%; margin-top: 3px; overflow: hidden; color: var(--brand-ink); font-size: 10px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.family-org-person > span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.family-org-person small {
  width: 100%;
  margin-top: auto;
  padding-top: 10px;
  overflow: hidden;
  border-top: 1px solid var(--line);
  color: var(--brand-ink);
  font-size: 10px;
  font-weight: 800;
  display: -webkit-box;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

body.family-tree-editor-open { overflow: hidden; }
.family-tree-editor {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100%;
  height: 100dvh;
  min-height: 100svh;
  background: var(--bg);
}
.family-tree-editor-screen {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.family-tree-editor-header {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  min-height: 68px;
  padding: 10px max(18px, env(safe-area-inset-right)) 10px max(18px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: 0 6px 24px rgba(64,38,49,.06);
}
.family-tree-editor-header > div { min-width: 0; display: grid; gap: 2px; }
.family-tree-editor-header span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.family-tree-editor-header strong {
  overflow: hidden;
  color: var(--text);
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.family-tree-editor-close {
  width: 42px;
  height: 42px;
  padding: 0 2px 3px 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 35px;
  font-weight: 400;
  line-height: 1;
}
.family-tree-editor-save-top {
  min-height: 42px;
  padding-inline: 18px;
  border-radius: 12px;
}
.family-tree-editor-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
.family-tree-editor-form {
  width: min(860px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 calc(42px + env(safe-area-inset-bottom));
}
.family-tree-editor-photo {
  margin-bottom: 18px;
  padding: 22px;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(135deg, var(--panel), var(--brand-soft));
}
.family-tree-editor-avatar,
.family-tree-editor-avatar-image {
  width: 132px;
  height: 132px;
  border-radius: 50%;
}
.family-tree-editor-avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(79,38,57,.18), inset 0 0 0 4px rgba(255,255,255,.72);
}
.family-tree-editor-avatar-image {
  display: grid;
  place-items: center;
  color: white;
  font-size: 34px;
  font-weight: 900;
  object-fit: cover;
}
.family-tree-editor-photo-actions { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.family-tree-editor-photo-actions > strong {
  flex-basis: 100%;
  overflow: hidden;
  color: var(--text);
  font-size: 24px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.family-tree-editor-relations {
  flex-basis: 100%;
  margin: -2px 0 3px;
  color: var(--brand-ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}
.family-tree-editor-photo-actions .filepick {
  min-height: 40px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 800;
}
.family-tree-editor-remove-photo {
  min-height: 40px;
  border-radius: 11px;
  color: var(--danger);
}
.family-tree-editor-photo-actions > .small {
  flex-basis: 100%;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.family-tree-editor-fields {
  padding: 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  border-radius: 22px;
}
.family-tree-editor-fields label { min-width: 0; display: grid; gap: 7px; }
.family-tree-editor-fields label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .055em;
  text-transform: uppercase;
}
.family-tree-editor-fields input,
.family-tree-editor-fields select {
  width: 100%;
  max-width: none;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  border-radius: 12px;
}
.family-tree-editor-fields input[type="date"] {
  display: block;
  max-width: 100%;
  min-inline-size: 0;
  line-height: 22px;
  box-sizing: border-box;
  overflow: hidden;
}
.family-tree-editor-fields select:disabled { opacity: .55; }
.family-tree-editor-description { grid-column: 1 / -1; }
.family-tree-editor-description textarea { min-height: 132px; border-radius: 12px; resize: vertical; }
.family-tree-editor-error { min-height: 20px; margin: 12px 2px 0; }
.family-tree-editor-submit {
  width: 100%;
  min-height: 50px;
  margin-top: 3px;
  border-radius: 14px;
  font-size: 15px;
}

@supports (-webkit-touch-callout: none) {
  .family-tree-form input[type="date"],
  .family-tree-editor-fields input[type="date"] {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-inline-size: 0 !important;
    padding-inline: 10px;
    -webkit-appearance: none;
    appearance: none;
  }
  .family-tree-form input[type="date"]::-webkit-date-and-time-value,
  .family-tree-editor-fields input[type="date"]::-webkit-date-and-time-value {
    min-width: 0;
    margin: 0;
    text-align: left;
  }
}

html[data-theme="dark"] .family-tree-hero {
  border-color: #694052;
  background:
    radial-gradient(circle at 88% 15%, rgba(255,255,255,.06) 0 58px, transparent 59px),
    linear-gradient(135deg, #34222b 0%, #452734 100%);
}
html[data-theme="dark"] .family-tree-org-scroll {
  background:
    linear-gradient(rgba(35,23,30,.88), rgba(35,23,30,.88)),
    radial-gradient(circle, rgba(229,142,176,.22) 1px, transparent 1.5px);
  background-size: auto, 22px 22px;
}
html[data-theme="dark"] .family-person-delete:hover { background: rgba(210,76,94,.13); }
html[data-theme="dark"] .family-tree-editor-photo {
  background: linear-gradient(135deg, var(--panel), rgba(167,53,100,.16));
}

@media (max-width: 980px) {
  .family-tree-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .family-tree-editor-form { width: min(760px, calc(100% - 26px)); padding-top: 22px; }
}

@media (max-width: 640px) {
  body.tree-page .layout { margin: 0; padding: 12px; }
  .family-tree-hero { min-height: 0; padding: 23px 20px; align-items: stretch; flex-direction: column; border-radius: 18px; }
  .family-tree-hero h1 { font-size: 32px; }
  .family-tree-hero > button { width: 100%; }
  .family-tree-form-card { padding: 17px; }
  .family-tree-form { grid-template-columns: minmax(0, 1fr); }
  .family-tree-description-field,
  .family-tree-photo-field,
  .family-tree-form-error,
  .family-tree-submit { grid-column: auto; }
  .family-tree-photo-picker { align-items: stretch; flex-direction: column; }
  .family-tree-submit { width: 100%; }
  .family-tree-toolbar { align-items: flex-end; }
  .family-tree-modes { flex: 1; }
  .family-tree-modes button { flex: 1; padding-inline: 9px; }
  .family-tree-toolbar > span { white-space: nowrap; }
  .family-tree-grid { grid-template-columns: minmax(0, 1fr); }
  .family-person-card { padding: 15px; }
  .family-tree-org-board { padding: 24px 22px 34px; }
  .family-org-person { width: 202px; }
  .family-generation.connected .family-generation-row::before { left: 101px; right: 101px; }
  .family-tree-editor-header {
    min-height: 60px;
    padding-top: max(7px, env(safe-area-inset-top));
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 9px;
  }
  .family-tree-editor-header strong { font-size: 15px; }
  .family-tree-editor-header span { font-size: 9px; }
  .family-tree-editor-close { width: 38px; height: 38px; }
  .family-tree-editor-save-top { min-height: 38px; padding-inline: 11px; border-radius: 10px; font-size: 13px; }
  .family-tree-editor-form { width: 100%; padding: 14px 12px calc(28px + env(safe-area-inset-bottom)); }
  .family-tree-editor-photo {
    padding: 17px;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 14px;
    border-radius: 18px;
  }
  .family-tree-editor-avatar,
  .family-tree-editor-avatar-image { width: 88px; height: 88px; }
  .family-tree-editor-avatar-image { font-size: 25px; }
  .family-tree-editor-photo-actions > strong { font-size: 18px; }
  .family-tree-editor-photo-actions .filepick,
  .family-tree-editor-remove-photo { min-height: 36px; padding: 8px 10px; font-size: 12px; }
  .family-tree-editor-fields { padding: 17px; grid-template-columns: minmax(0, 1fr); gap: 13px; border-radius: 18px; }
  .family-tree-editor-description { grid-column: auto; }
}

body.alice-page .layout { max-width: 1440px; grid-template-columns: minmax(0, 1fr); }
body.alice-page .rightcol { display: none; }
body.alice-page #main { min-width: 0; }

.alice-loading {
  min-height: 220px;
  padding: 30px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  border-radius: 22px;
  color: var(--brand-ink);
}
.alice-loading .button-spinner { width: 28px; height: 28px; border-color: var(--brand-border); border-top-color: var(--brand); }

.alice-hero {
  min-height: 190px;
  padding: 30px 32px;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  align-items: center;
  gap: 26px;
  overflow: hidden;
  border: 1px solid #edc1d1;
  border-radius: 26px;
  background:
    radial-gradient(circle at 92% 14%, rgba(255,255,255,.78) 0 76px, transparent 77px),
    linear-gradient(135deg, #fff5f9 0%, #f9d5e3 56%, #f3bed3 100%);
  box-shadow: 0 18px 44px rgba(117,49,79,.11);
}
.alice-monogram {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border: 6px solid rgba(255,255,255,.72);
  border-radius: 36px;
  background: linear-gradient(145deg, #e67ca7, #c9447b);
  color: white;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 58px;
  font-weight: 700;
  box-shadow: 0 18px 35px rgba(151,51,94,.24);
}
.alice-avatar-control { position: relative; overflow: hidden; cursor: pointer; }
.alice-avatar-control img { width: 100%; height: 100%; display: block; object-fit: cover; }
.alice-avatar-control > small { position: absolute; inset: auto 0 0; padding: 7px 4px; background: rgba(64,23,41,.7); color: white; font: 800 10px/1 system-ui,sans-serif; text-align: center; opacity: 0; transition: opacity .18s ease; }
.alice-avatar-control:hover > small, .alice-avatar-control:focus-within > small, .alice-avatar-control.uploading > small { opacity: 1; }
.alice-avatar-control.uploading { opacity: .65; pointer-events: none; }
.alice-hero-copy { min-width: 0; }
.alice-hero-copy > span,
.alice-section-title span,
.alice-history-head span,
.alice-stat-toolbar > div > span {
  color: var(--brand-ink);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.alice-hero h1 { margin: 4px 0 7px; color: #8e2e58; font-family: Georgia, "Times New Roman", serif; font-size: clamp(38px, 5vw, 58px); line-height: 1; }
.alice-hero p { max-width: 700px; margin: 0; color: #73535f; font-size: 15px; line-height: 1.55; }
.alice-current-status {
  min-width: 190px;
  padding: 12px 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid rgba(255,255,255,.74);
  border-radius: 999px;
  background: rgba(255,255,255,.68);
  color: #754257;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 9px 24px rgba(108,45,73,.08);
}
.alice-current-status > .alice-heart { width: auto; height: auto; flex: 0 0 auto; border-radius: 0; background: transparent; color: #d95887; font-size: 17px; line-height: 1; box-shadow: none; }
.alice-current-status.sleeping > span { background: #8c77ce; box-shadow: 0 0 0 5px rgba(140,119,206,.13); }

.alice-tabs {
  width: fit-content;
  margin: 18px 0;
  padding: 5px;
  display: flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
  box-shadow: 0 7px 22px rgba(64,38,49,.05);
}
.alice-tabs button {
  min-width: 132px;
  min-height: 40px;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
}
.alice-tabs button.active { background: var(--brand); color: white; box-shadow: 0 6px 16px rgba(167,53,100,.18); }

.alice-entry-card { padding: 24px; border-radius: 22px; box-shadow: 0 10px 30px rgba(67,38,50,.06); }
.alice-section-title,
.alice-history-head,
.alice-stat-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}
.alice-section-title h2,
.alice-history-head h2,
.alice-stat-toolbar h2 { margin: 3px 0 0; font-size: 22px; line-height: 1.2; }
.alice-section-title > small { color: var(--muted); }

.alice-event-types {
  margin: 20px 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 9px;
}
.alice-event-types button {
  min-width: 0;
  min-height: 84px;
  padding: 11px 8px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel-2);
  color: var(--muted);
}
.alice-event-types button > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--panel);
  color: var(--brand-ink);
  font-size: 17px;
  font-weight: 900;
}
.alice-event-types button > strong { max-width: 100%; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.alice-event-types button.active { border-color: var(--brand-border); background: var(--brand-soft); color: var(--brand-ink); box-shadow: inset 0 0 0 1px var(--brand-border); }
.alice-event-types button.active > span { background: var(--brand); color: white; }

.alice-entry-form {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel-2) 65%, var(--panel));
}
.alice-entry-form > label { min-width: 0; display: grid; gap: 7px; }
.alice-entry-form > label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .045em;
  text-transform: uppercase;
}
.alice-entry-form input,
.alice-entry-form select { width: 100%; max-width: none; min-width: 0; min-height: 46px; border-radius: 12px; }
.alice-note-field { grid-column: 1 / -1; }
.alice-simple-event-hint {
  min-height: 46px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  border: 1px dashed var(--brand-border);
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 13px;
}
.alice-feeding-choice {
  min-height: 46px;
  padding: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.alice-feeding-choice button { border-radius: 9px; background: transparent; color: var(--muted); }
.alice-feeding-choice button.active { background: var(--brand-soft); color: var(--brand-ink); }
.alice-diaper-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.alice-diaper-options label {
  min-width: 0;
  min-height: 58px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
  cursor: pointer;
}
.alice-diaper-options input { width: 20px; height: 20px; min-height: 0; padding: 0; flex: 0 0 auto; accent-color: var(--brand); }
.alice-diaper-options label > span { min-width: 0; display: grid; gap: 2px; }
.alice-diaper-options b { color: var(--text); font-size: 13px; }
.alice-diaper-options small { color: var(--muted); font-size: 11px; }
.alice-entry-error { grid-column: 1 / -1; min-height: 18px; }
.alice-save-event { grid-column: 1 / -1; min-height: 48px; border-radius: 13px; font-size: 14px; }
.alice-save-event:disabled { opacity: .7; cursor: wait; }

.alice-history { margin-top: 24px; }
.alice-history-head { margin-bottom: 13px; padding: 0 4px; }
.alice-history-head > strong {
  min-width: 36px;
  height: 36px;
  padding: 0 9px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-ink);
}
.alice-timeline { display: grid; gap: 8px; }
.alice-day-heading { margin: 10px 0 2px; color: var(--muted); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.alice-event {
  min-width: 0;
  padding: 13px 14px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 12px;
  border-radius: 17px;
}
.alice-event-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 18px;
  font-weight: 900;
}
.alice-event-icon.sleep { background: #eee9ff; color: #6753ae; }
.alice-event-icon.wake { background: #fff3d5; color: #a56f08; }
.alice-event-icon.feeding { background: #fde5ee; color: #b6396b; }
.alice-event-icon.diaper { background: #e3f5ef; color: #32846d; }
.alice-event-icon.weight { background: #e3f0fa; color: #39789f; font-size: 11px; }
.alice-event-icon.walk { background: #eaf4df; color: #587e32; }
.alice-event-icon.supplement { background: #f4e6fa; color: #824da0; }
.alice-event-icon.bath { background: #e1f4f7; color: #337f8c; }
.alice-event-icon.massage { background: #fff0df; color: #a06629; }
.alice-event-main { min-width: 0; }
.alice-event-main > strong { color: var(--text); font-size: 14px; line-height: 1.35; }
.alice-event-main > p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; white-space: pre-wrap; }
.alice-event-main > div { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: 11px; }
.alice-event-main time { color: var(--brand-ink); font-weight: 800; }
.alice-event-delete {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  color: var(--muted);
  font-size: 23px;
}
.alice-event-delete:hover { background: #fff0f2; color: var(--danger); }
.alice-empty { padding: 34px 20px; border-radius: 17px; color: var(--muted); text-align: center; }

.alice-stat-toolbar { margin: 2px 0 15px; padding: 0 4px; }
.alice-periods {
  padding: 4px;
  display: flex;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
}
.alice-periods button { min-height: 36px; padding: 7px 12px; border-radius: 9px; background: transparent; color: var(--muted); }
.alice-periods button.active { background: var(--brand); color: white; }
.alice-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
}
.alice-metric {
  min-width: 0;
  min-height: 190px;
  padding: 17px;
  display: flex;
  flex-direction: column;
  border-radius: 19px;
  box-shadow: 0 8px 26px rgba(68,38,50,.05);
}
.alice-metric-head { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.alice-metric-head > span {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 900;
}
.alice-metric > b { margin: 20px 0 12px; overflow-wrap: anywhere; color: var(--text); font-size: clamp(24px, 2.5vw, 34px); line-height: 1; }
.alice-metric > div:last-child { margin-top: auto; display: grid; gap: 5px; }
.alice-metric small { color: var(--muted); font-size: 11px; line-height: 1.35; }
.alice-metric.sleep { border-top: 4px solid #8772cd; }
.alice-metric.feeding { border-top: 4px solid #d95a8e; }
.alice-metric.diaper { border-top: 4px solid #57a88f; }
.alice-metric.weight { border-top: 4px solid #5793ba; }
.alice-metric.walk { border-top: 4px solid #79a94c; }
.alice-metric.supplement { border-top: 4px solid #a06cbc; }
.alice-metric.care { border-top: 4px solid #55a6b4; }
.alice-stat-details { margin-top: 15px; display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.4fr); gap: 15px; }
.alice-weight-card,
.alice-guidelines { padding: 22px; border-radius: 21px; }
.alice-weight-history { margin-top: 18px; display: grid; gap: 11px; }
.alice-weight-row {
  display: grid;
  grid-template-columns: 52px minmax(70px, 1fr) 74px 72px;
  align-items: center;
  gap: 9px;
}
.alice-weight-row time { color: var(--muted); font-size: 11px; }
.alice-weight-track { height: 9px; overflow: hidden; border-radius: 99px; background: var(--brand-soft); }
.alice-weight-track span { height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, #eb8eb2, var(--brand)); }
.alice-weight-row strong { color: var(--text); font-size: 12px; text-align: right; }
.alice-weight-row small { color: var(--muted); font-size: 10px; text-align: right; }
.alice-weight-row small.positive { color: var(--good); }
.alice-weight-row small.negative { color: var(--danger); }
.alice-stat-empty { padding: 30px 12px; color: var(--muted); text-align: center; }
.alice-weight-chart-card, .alice-simple-history-card { margin-bottom: 15px; padding: 22px; border-radius: 21px; }
.alice-weight-chart { margin-top: 18px; overflow-x: auto; }
.alice-weight-chart svg { display: block; width: 100%; min-width: 520px; height: auto; }
.chart-axis { stroke: var(--brand-border); stroke-width: 1.5; }
.chart-line { fill: none; stroke: var(--brand); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.chart-dot { fill: white; stroke: var(--brand); stroke-width: 4; }
.chart-value { fill: var(--text); font-size: 12px; font-weight: 800; }
.chart-date { fill: var(--muted); font-size: 11px; }
.alice-formula-chart .chart-line { stroke: #c88442; }
.alice-formula-chart .chart-dot { stroke: #c88442; }
.alice-simple-history { display: grid; margin-top: 14px; }
.alice-simple-history-row { display: grid; grid-template-columns: 48px minmax(0,1fr); align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.alice-simple-history-row:first-child { border-top: 0; }
.alice-simple-history-row strong, .alice-simple-history-row small { display: block; }
.alice-simple-history-row small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.alice-simple-history-row p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.alice-wet-chart { height: 190px; margin-top: 18px; display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); align-items: end; gap: 10px; }
.alice-wet-day { min-width: 0; height: 100%; display: grid; grid-template-rows: 24px minmax(70px,1fr) 30px; align-items: end; text-align: center; }
.alice-wet-day > strong { color: var(--brand-ink); font-size: 17px; }
.alice-wet-day > div { width: min(34px,75%); height: 100%; margin: 5px auto 0; display: flex; align-items: end; overflow: hidden; border-radius: 12px 12px 5px 5px; background: var(--brand-soft); }
.alice-wet-day > div span { width: 100%; min-height: 4px; display: block; border-radius: inherit; background: linear-gradient(180deg,#81cce5,#4d98c2); }
.alice-wet-day > small { overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.2; text-overflow: ellipsis; }
@media (max-width: 520px) { .alice-wet-chart { gap: 5px; } .alice-wet-day > small { font-size: 9px; } }
.alice-guideline-grid { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.alice-guideline-grid a {
  min-width: 0;
  padding: 14px;
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel-2);
  color: inherit;
  text-decoration: none;
  transition: transform .15s ease, border-color .15s ease;
}
.alice-guideline-grid a:hover { border-color: var(--brand-border); transform: translateY(-1px); }
.alice-guideline-grid b { color: var(--brand-ink); font-size: 23px; line-height: 1; }
.alice-guideline-grid span { color: var(--text); font-size: 12px; line-height: 1.4; }
.alice-guideline-grid small { color: var(--muted); font-size: 10px; }
.alice-guidelines > p { margin: 15px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.55; }

html[data-theme="dark"] .alice-hero {
  border-color: #714054;
  background:
    radial-gradient(circle at 92% 14%, rgba(255,255,255,.06) 0 76px, transparent 77px),
    linear-gradient(135deg, #36242d 0%, #482936 56%, #542b3c 100%);
}
html[data-theme="dark"] .alice-hero h1 { color: #f1a3c1; }
html[data-theme="dark"] .alice-hero p { color: #d6b8c4; }
html[data-theme="dark"] .alice-current-status { border-color: rgba(255,255,255,.10); background: rgba(28,18,23,.52); color: #edc2d2; }
html[data-theme="dark"] .alice-event-icon.sleep { background: #342d50; color: #baaaf0; }
html[data-theme="dark"] .alice-event-icon.wake { background: #493d25; color: #efc46d; }
html[data-theme="dark"] .alice-event-icon.diaper { background: #253e37; color: #83c9b3; }
html[data-theme="dark"] .alice-event-icon.weight { background: #263a48; color: #8ec3e3; }
html[data-theme="dark"] .alice-event-icon.walk { background: #303d26; color: #a9cf83; }
html[data-theme="dark"] .alice-event-icon.supplement { background: #402d4b; color: #d2a3e9; }
html[data-theme="dark"] .alice-event-icon.bath { background: #263f43; color: #8ed1dc; }
html[data-theme="dark"] .alice-event-icon.massage { background: #493726; color: #edbd82; }

@supports (-webkit-touch-callout: none) {
  .alice-entry-form input[type="datetime-local"] {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-inline-size: 0 !important;
    padding-inline: 10px;
    -webkit-appearance: none;
    appearance: none;
  }
  .alice-entry-form input[type="datetime-local"]::-webkit-date-and-time-value {
    min-width: 0;
    margin: 0;
    text-align: left;
  }
}

@media (max-width: 1180px) {
  .alice-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .alice-metric:nth-child(4),
  .alice-metric:nth-child(5) { min-height: 170px; }
  .alice-stat-details { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  body.alice-page .layout { margin: 0; padding: 12px; }
  .alice-hero {
    min-height: 0;
    padding: 21px;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 16px;
    border-radius: 20px;
  }
  .alice-monogram { width: 72px; height: 72px; border-width: 4px; border-radius: 23px; font-size: 38px; }
  .alice-hero h1 { font-size: 36px; }
  .alice-hero p { font-size: 12px; }
  .alice-current-status { grid-column: 1 / -1; width: 100%; min-width: 0; }
  .alice-tabs { width: 100%; margin: 12px 0; }
  .alice-tabs button { flex: 1; min-width: 0; }
  .alice-entry-card { padding: 17px; border-radius: 18px; }
  .alice-section-title { align-items: flex-start; flex-direction: column; gap: 4px; }
  .alice-section-title h2,
  .alice-history-head h2,
  .alice-stat-toolbar h2 { font-size: 20px; }
  .alice-event-types { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .alice-event-types button { min-height: 74px; }
  .alice-entry-form { padding: 15px; grid-template-columns: minmax(0, 1fr); }
  .alice-note-field,
  .alice-entry-error,
  .alice-save-event { grid-column: auto; }
  .alice-diaper-options { grid-template-columns: 1fr 1fr; }
  .alice-event { grid-template-columns: 42px minmax(0, 1fr) 32px; padding: 11px; gap: 10px; }
  .alice-event-icon { width: 42px; height: 42px; border-radius: 13px; }
  .alice-stat-toolbar { align-items: stretch; flex-direction: column; }
  .alice-periods { width: 100%; }
  .alice-periods button { flex: 1; min-width: 0; padding-inline: 6px; }
  .alice-metrics { grid-template-columns: 1fr 1fr; gap: 9px; }
  .alice-metric { min-height: 170px; padding: 14px; }
  .alice-metric.feeding { grid-column: 1 / -1; }
  .alice-metric > b { font-size: 27px; }
  .alice-weight-card,
  .alice-guidelines { padding: 17px; border-radius: 18px; }
  .alice-guideline-grid { grid-template-columns: 1fr; }
  .alice-weight-row { grid-template-columns: 44px minmax(52px, 1fr) 68px; }
  .alice-weight-row small { grid-column: 2 / 4; text-align: right; }
}

@media (max-width: 390px) {
  .alice-hero { grid-template-columns: 58px minmax(0, 1fr); padding: 17px; }
  .alice-monogram { width: 58px; height: 58px; border-radius: 19px; font-size: 31px; }
  .alice-hero h1 { font-size: 32px; }
  .alice-event-types button > strong { font-size: 11px; }
  .alice-diaper-options { grid-template-columns: 1fr; }
  .alice-metrics { grid-template-columns: 1fr; }
  .alice-metric.feeding { grid-column: auto; }
}
