@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope-regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope-semibold.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope-bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0c0d10;
  --surface: #15171c;
  --surface-raised: #1c1f25;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f5f7;
  --muted: #949ba7;
  --accent: #8b7dff;
  --accent-strong: #a79cff;
  --success: #57d6a1;
  --danger: #ff6b7a;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

button, input { font: inherit; }
button { color: inherit; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ambient {
  position: fixed;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .12;
  pointer-events: none;
}
.ambient-one { background: var(--accent); top: -120px; right: -100px; }
.ambient-two { background: #4d9cff; bottom: 10%; left: -190px; }

.shell {
  width: min(100%, 680px);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px calc(104px + env(safe-area-inset-bottom));
  position: relative;
}

.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.brand-mark {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #0b0915;
  font-weight: 900;
  box-shadow: 0 8px 28px rgba(139, 125, 255, .26);
}
.brand-mark { width: 42px; height: 42px; border-radius: 14px; }
.brand-copy { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.brand-copy strong { font-size: 15px; }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.icon-button {
  width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); font-size: 22px; cursor: pointer;
}

.welcome { margin: 8px 2px 24px; }
h1, h2, p { margin-top: 0; }
h1 { margin: 8px 0 8px; font-size: clamp(30px, 8vw, 42px); line-height: 1.05; letter-spacing: -.04em; }
h2 { margin: 5px 0 0; font-size: 20px; letter-spacing: -.02em; }
.welcome p, .section-description { color: var(--muted); line-height: 1.55; font-size: 14px; }

.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.metric, .primary-link-card, .activity-list, .settings-group, .privacy-note, .link-card, .status-card {
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.metric { border-radius: 22px; padding: 16px; min-height: 116px; }
.reputation-card { grid-column: 1 / -1; display: flex; align-items: center; gap: 18px; }
.score-ring {
  --score: 0;
  width: 82px; height: 82px; border-radius: 50%; display: grid; place-content: center;
  background: conic-gradient(var(--accent) calc(var(--score) * 1%), rgba(255,255,255,.08) 0);
  position: relative; isolation: isolate;
}
.score-ring::after { content: ""; position: absolute; inset: 7px; background: var(--surface); border-radius: 50%; z-index: -1; }
.score-ring span { font-size: 24px; font-weight: 900; line-height: 1; }
.score-ring small { font-size: 10px; color: var(--muted); text-align: center; }
.metric-label { color: var(--muted); display: block; font-size: 12px; margin-bottom: 4px; }
.reputation-card strong { display: block; font-size: 19px; }
.reputation-card div > small { color: var(--muted); font-size: 11px; }
.compact-metric { display: flex; flex-direction: column; justify-content: space-between; }
.compact-metric strong { font-size: 28px; }
.compact-metric small { color: var(--muted); }
.metric-icon { color: var(--accent-strong); font-size: 21px; }

.primary-link-card { margin-top: 10px; padding: 20px; border-radius: 22px; }
.primary-link-card strong { display: block; margin: 8px 0 5px; font-size: 17px; }
.primary-link-card p { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.button-row { display: grid; grid-template-columns: 1fr; gap: 9px; margin-top: 16px; }
.button { border: 0; border-radius: 13px; padding: 12px 16px; font-weight: 750; cursor: pointer; transition: transform .15s ease, opacity .15s ease; }
.button:active { transform: scale(.98); }
.button:disabled { opacity: .45; cursor: wait; }
.button.primary { background: var(--accent); color: #0b0915; }
.button.secondary { background: var(--surface-raised); border: 1px solid var(--line); }
.button.small { padding: 9px 12px; font-size: 12px; }

.section-heading { display: flex; justify-content: space-between; align-items: center; margin: 30px 2px 13px; }
.page-heading { margin-top: 5px; }
.activity-list, .settings-group { border-radius: 20px; overflow: hidden; }
.activity-row, .setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 17px; border-bottom: 1px solid var(--line);
}
.activity-row:last-child, .setting-row:last-child { border-bottom: 0; }
.activity-row span { color: var(--muted); font-size: 13px; }

.view { display: none; animation: enter .2s ease; }
.view.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.bottom-nav {
  position: fixed; z-index: 20; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(100%, 680px); display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 9px 10px max(9px, env(safe-area-inset-bottom));
  background: rgba(12, 13, 16, .88); backdrop-filter: blur(22px); border-top: 1px solid var(--line);
}
.nav-item { border: 0; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10px; padding: 6px; cursor: pointer; }
.nav-item span { font-size: 21px; line-height: 1; }
.nav-item.active { color: var(--accent-strong); }

.setting-row { cursor: pointer; }
.setting-row span { display: flex; flex-direction: column; gap: 4px; }
.setting-row strong { font-size: 14px; }
.setting-row small { color: var(--muted); font-size: 11px; line-height: 1.35; }
input[type="checkbox"] { appearance: none; width: 46px; height: 27px; flex: 0 0 46px; border-radius: 99px; background: #30343d; position: relative; transition: background .2s ease; }
input[type="checkbox"]::after { content: ""; position: absolute; width: 21px; height: 21px; top: 3px; left: 3px; border-radius: 50%; background: #fff; transition: transform .2s ease; }
input[type="checkbox"]:checked { background: var(--accent); }
input[type="checkbox"]:checked::after { transform: translateX(19px); }

.privacy-note, .status-card { display: flex; gap: 14px; padding: 17px; border-radius: 20px; margin-top: 12px; }
.privacy-note > span { color: var(--success); font-size: 22px; }
.privacy-note strong { font-size: 14px; }
.privacy-note p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.status-card { align-items: flex-start; border-color: rgba(255, 107, 122, .24); margin: 0 0 18px; }
.status-card p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.status-dot { width: 10px; height: 10px; flex: 0 0 10px; margin-top: 5px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 16px var(--danger); }
.shield-mark { color: var(--accent-strong); font-size: 24px; }

.link-list { display: grid; gap: 10px; }
.link-card { border-radius: 20px; padding: 17px; }
.link-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.link-card h3 { margin: 0 0 5px; font-size: 16px; }
.link-card p { color: var(--muted); font-size: 11px; line-height: 1.45; }
.link-stats { display: flex; gap: 15px; color: var(--muted); font-size: 11px; margin: 15px 0; }
.link-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.state-pill { border-radius: 99px; padding: 5px 8px; background: rgba(87, 214, 161, .1); color: var(--success); font-size: 10px; font-weight: 800; }
.state-pill.off { background: rgba(255, 107, 122, .1); color: var(--danger); }

.inbox-heading { align-items: flex-end; }
.inbox-total {
  display: grid;
  min-width: 42px;
  height: 42px;
  padding: 0 11px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--accent-strong);
  font-weight: 850;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.search-box:focus-within {
  border-color: color-mix(in srgb, var(--accent) 52%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.search-box > span { color: var(--muted); font-size: 20px; }
.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}
.search-box input::placeholder { color: var(--muted); }
.search-clear {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: var(--surface-raised);
  color: var(--muted);
  font-size: 21px;
  cursor: pointer;
}
.field-hint { margin: 7px 4px 0; color: var(--danger); font-size: 11px; }

.mailbox-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 14px 0 12px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}
.mailbox-tab, .segment {
  min-height: 38px;
  padding: 7px 9px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}
.mailbox-tab.active, .segment.active {
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: 0 5px 18px rgba(0, 0, 0, .2);
}

.thread-list { display: grid; gap: 9px; min-height: 180px; }
.thread-card {
  width: 100%;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  color: var(--text);
  text-align: left;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.thread-card:active { transform: scale(.99); }
.thread-avatar {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-raised));
  color: var(--accent-strong);
  font-weight: 900;
}
.thread-copy { min-width: 0; }
.thread-title-row { display: flex; align-items: center; gap: 7px; }
.thread-title-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.thread-copy p { margin: 5px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11px; }
.thread-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; color: var(--muted); font-size: 9px; }
.unread-badge { min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 6px; border-radius: 99px; background: var(--accent); color: #0b0915; font-size: 10px; font-weight: 900; }
.intent-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--accent); }

.empty-state, .loading-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 9px;
  padding: 30px;
  border: 1px dashed var(--line);
  border-radius: 20px;
  color: var(--muted);
  text-align: center;
}
.empty-state strong { color: var(--text); }
.empty-state p { margin: 0; max-width: 290px; font-size: 12px; line-height: 1.5; }
.empty-mark { font-size: 29px; color: var(--accent-strong); }
.loading-dots { display: flex; gap: 5px; }
.loading-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1s ease-in-out infinite; }
.loading-dots i:nth-child(2) { animation-delay: .13s; }
.loading-dots i:nth-child(3) { animation-delay: .26s; }
@keyframes pulse { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }

body.sheet-open { overflow: hidden; }
.sheet { position: fixed; z-index: 50; inset: 0; display: flex; justify-content: center; align-items: flex-end; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .62); backdrop-filter: blur(8px); }
.sheet-panel {
  position: relative;
  width: min(100%, 680px);
  max-height: calc(100vh - max(12px, env(safe-area-inset-top)));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 18px max(22px, env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  background: var(--bg);
  box-shadow: 0 -20px 70px rgba(0, 0, 0, .45);
  animation: sheet-enter .22s ease;
}
@keyframes sheet-enter { from { transform: translateY(20px); opacity: .7; } to { transform: none; opacity: 1; } }
.sheet-header { position: sticky; z-index: 4; top: -18px; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 12px; margin: -2px -2px 16px; padding: 10px 2px 13px; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(18px); }
.sheet-header h2 { margin: 4px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.message-list { display: flex; flex-direction: column; gap: 8px; min-height: 180px; padding: 6px 0 18px; }
.message-row { display: flex; }
.message-row.me { justify-content: flex-end; }
.message-bubble { max-width: 84%; padding: 12px 14px 9px; border: 1px solid var(--line); border-radius: 18px 18px 18px 5px; background: var(--surface); }
.message-row.me .message-bubble { border-color: transparent; border-radius: 18px 18px 5px 18px; background: var(--accent); color: #0b0915; }
.message-bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.45; }
.message-bubble footer { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 6px; color: var(--muted); font-size: 9px; }
.message-row.me .message-bubble footer { color: rgba(11, 9, 21, .62); }
.card-trigger { padding: 3px 7px; border: 0; border-radius: 8px; background: var(--surface-raised); color: var(--accent-strong); font-size: 9px; font-weight: 800; cursor: pointer; }
.media-chip { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 5px; color: var(--accent-strong); font-size: 10px; font-weight: 750; }
.message-row.me .media-chip { color: #0b0915; }
.message-photo {
  position: relative;
  display: grid;
  width: min(62vw, 310px);
  min-height: 150px;
  margin: -6px -8px 8px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface-raised) 88%, var(--accent));
  color: var(--muted);
  cursor: pointer;
}
.message-photo-image { display: block; width: 100%; max-height: 340px; object-fit: cover; }
.message-photo-placeholder, .message-photo.failed { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 18px; font-size: 10px; line-height: 1.35; }
.message-photo-placeholder .icon, .message-photo.failed > .icon { width: 22px; height: 22px; }
.message-photo.loading { background: linear-gradient(105deg, var(--surface-raised) 25%, color-mix(in srgb, var(--accent) 15%, var(--surface-raised)) 42%, var(--surface-raised) 58%); background-size: 220% 100%; animation: photo-loading 1.4s linear infinite; }
@keyframes photo-loading { to { background-position-x: -220%; } }
.message-photo-open { position: absolute; right: 8px; bottom: 8px; padding: 5px 8px; border-radius: 9px; background: rgba(0,0,0,.62); color: #fff; font-size: 9px; font-weight: 700; backdrop-filter: blur(8px); }
.media-sheet { z-index: 70; align-items: stretch; }
.media-viewer-panel { width: 100%; max-width: none; height: 100%; max-height: none; border: 0; border-radius: 0; background: #050505; }
.media-viewer-header { color: #fff; background: rgba(5,5,5,.82); }
.media-viewer-stage { min-height: calc(100% - 74px); display: grid; place-items: center; }
.media-viewer-stage img { display: block; max-width: 100%; max-height: calc(100vh - 94px - env(safe-area-inset-bottom)); object-fit: contain; }
.thread-actions, .editor-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding-top: 12px; border-top: 1px solid var(--line); }

.card-sheet-panel { max-height: 100vh; border-radius: 0; }
.canvas-stage {
  width: min(100%, 340px);
  margin: 0 auto 20px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
#card-canvas { display: block; width: 100%; height: auto; border-radius: 15px; background: #1a0b0e; }
.editor-group { margin: 0 0 17px; padding: 0; border: 0; }
.editor-group legend { margin-bottom: 9px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.segmented-control { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.theme-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.theme-swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 3px; border: 1px solid transparent; border-radius: 13px; background: transparent; color: var(--muted); font-size: 9px; cursor: pointer; }
.theme-swatch span { width: 100%; height: 32px; border-radius: 10px; border: 1px solid rgba(255,255,255,.12); }
.theme-swatch.active { border-color: color-mix(in srgb, var(--accent) 52%, transparent); background: var(--surface); color: var(--text); }
.theme-swatch.inferno span { background: linear-gradient(145deg, #16080b, #9b2638); }
.theme-swatch.aurora span { background: linear-gradient(145deg, #111126, #805cff, #39c6b0); }
.theme-swatch.ocean span { background: linear-gradient(145deg, #071827, #176b89, #62c8d8); }
.theme-swatch.paper span { background: linear-gradient(145deg, #fffaf0, #e8ddce); }
.editor-note { margin: 13px 4px 0; color: var(--muted); font-size: 10px; line-height: 1.45; text-align: center; }

.error-screen { text-align: center; padding: 80px 20px; }
.error-mark { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 22px; background: rgba(255,107,122,.13); color: var(--danger); font-size: 28px; font-weight: 900; margin: 0 auto 20px; }
.error-screen h1 { font-size: 25px; }
.error-screen p { color: var(--muted); line-height: 1.5; }
.error-screen .button { margin-top: 10px; }

.toast { position: fixed; z-index: 30; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); padding: 11px 15px; border-radius: 12px; background: #f4f5f7; color: #111318; font-size: 12px; font-weight: 750; opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.hidden { display: none !important; }

@media (min-width: 600px) {
  .metric-grid { grid-template-columns: 2fr 1fr 1fr; }
  .reputation-card { grid-column: auto; }
  .shell { padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 390px) {
  .nav-item { font-size: 9px; }
  .theme-picker { gap: 4px; }
  .thread-card { grid-template-columns: 42px minmax(0, 1fr) auto; padding: 12px; }
  .thread-avatar { width: 42px; height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 2026 mobile refresh: Telegram-native surfaces, quiet hierarchy, no decorative glyphs. */
:root {
  color-scheme: light dark;
  --bg: var(--tg-theme-bg-color, #0e1116);
  --surface: var(--tg-theme-secondary-bg-color, #171b22);
  --surface-raised: color-mix(in srgb, var(--surface) 82%, var(--text) 6%);
  --line: color-mix(in srgb, var(--text) 11%, transparent);
  --text: var(--tg-theme-text-color, #f4f6f8);
  --muted: var(--tg-theme-hint-color, #8f98a6);
  --accent: var(--tg-theme-button-color, #4b9cff);
  --accent-strong: var(--tg-theme-link-color, #69adff);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --success: #3fc78d;
  --danger: #ff6678;
  --shadow: 0 8px 28px rgba(0, 0, 0, .16);
}

html { background: var(--bg); }
body {
  background: var(--bg);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html, body { height: 100%; overflow: hidden; }
body { min-height: 0; display: flex; flex-direction: column; }

.icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}

.shell {
  width: min(100%, 620px);
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: max(14px, env(safe-area-inset-top)) 16px 28px;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: calc(0px - max(14px, env(safe-area-inset-top)));
  min-height: 58px;
  margin: 0 -4px 20px;
  padding: 6px 4px 12px;
  background: var(--bg);
  box-shadow: 0 10px 14px var(--bg);
}

.user-avatar {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  color: var(--accent-strong);
  font-size: 17px;
  font-weight: 700;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-avatar-fallback, #user-avatar-fallback { display: grid; place-items: center; }
#user-avatar-fallback .icon { width: 23px; height: 23px; }
.brand-copy { gap: 1px; }
.brand-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.brand-copy span { color: var(--muted); font-size: 11px; }

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.icon-button:active { transform: scale(.94); background: var(--surface); color: var(--text); }

.welcome { margin: 2px 2px 22px; }
h1 { margin: 0 0 7px; font-size: clamp(29px, 8.4vw, 40px); line-height: 1.08; letter-spacing: -.035em; font-weight: 700; }
h2 { font-size: 19px; font-weight: 700; }
.welcome p, .section-description { margin-bottom: 0; font-size: 13px; line-height: 1.5; }
.eyebrow { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .12em; }

.metric, .primary-link-card, .activity-list, .settings-group, .privacy-note, .link-card, .status-card,
.choice-setting, .preset-card {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: none;
}
.metric { min-height: 105px; padding: 15px; border-radius: 18px; }
.reputation-card { gap: 15px; }
.score-ring { width: 74px; height: 74px; flex: 0 0 74px; background: conic-gradient(var(--accent) calc(var(--score) * 1%), var(--line) 0); }
.score-ring::after { background: var(--surface); }
.score-ring span { font-size: 21px; font-weight: 700; }
.reputation-card strong { font-size: 17px; font-weight: 700; }
.reputation-card div > small { display: block; max-width: 160px; margin-top: 3px; line-height: 1.3; }
.compact-metric strong { font-size: 26px; font-weight: 700; }
.metric-icon { width: 20px; height: 20px; color: var(--accent-strong); }

.primary-link-card { position: relative; overflow: hidden; margin-top: 10px; padding: 19px; border-radius: 18px; }
.primary-link-card::after {
  content: "";
  position: absolute;
  width: 130px;
  height: 130px;
  right: -66px;
  top: -76px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  pointer-events: none;
}
.primary-link-card strong { font-size: 16px; font-weight: 700; }
.primary-link-card p { margin-bottom: 0; }
.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  padding: 11px 15px;
  font-weight: 600;
  transition: transform .16s ease, opacity .16s ease, background .16s ease;
}
.button .icon { width: 18px; height: 18px; }
.button.primary { background: var(--accent); color: var(--button-text); }
.button.secondary { background: var(--surface-raised); }
.button.small { min-height: 40px; padding: 8px 12px; font-size: 12px; }

.section-heading { margin: 27px 2px 12px; }
.page-heading { margin-top: 0; }
.activity-list, .settings-group { border-radius: 17px; }
.activity-row, .setting-row { min-height: 58px; padding: 14px 15px; }
.activity-row strong { font-weight: 700; }

.bottom-nav {
  position: relative;
  left: auto;
  transform: none;
  flex: 0 0 auto;
  width: min(100%, 620px);
  bottom: 0;
  margin: 0 auto;
  padding: 5px 10px max(5px, env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  box-shadow: 0 -10px 32px rgba(0, 0, 0, .18);
  backdrop-filter: none;
}
.nav-item {
  min-height: 54px;
  gap: 3px;
  padding: 6px 4px;
  border-radius: 15px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  transition: color .18s ease, background .18s ease, transform .18s ease;
}
.nav-item .icon { width: 21px; height: 21px; }
.nav-item > span { font-size: 9px; line-height: 1.2; }
.nav-item.active { color: var(--accent-strong); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.nav-item:active { transform: scale(.95); }

.search-box { border-radius: 14px; background: var(--surface); }
.search-box > .icon { width: 19px; height: 19px; color: var(--muted); }
.mailbox-tabs { background: var(--surface); border-radius: 14px; }
.mailbox-tab, .segment { min-height: 40px; border-radius: 10px; font-weight: 600; }
.mailbox-tab.active, .segment.active { color: var(--text); background: var(--surface-raised); box-shadow: none; }
.thread-list { align-content: start; }
.thread-card { min-height: 76px; border-radius: 16px; background: var(--surface); }
.thread-avatar { background: color-mix(in srgb, var(--accent) 15%, var(--surface)); color: var(--accent-strong); }

.settings-group { margin-bottom: 12px; }
.setting-row strong { font-size: 13px; font-weight: 600; }
.setting-row small { font-size: 10px; }
input[type="checkbox"] { width: 44px; height: 26px; flex-basis: 44px; background: color-mix(in srgb, var(--muted) 26%, var(--surface)); }
input[type="checkbox"]::after { width: 20px; height: 20px; }
input[type="checkbox"]:checked::after { transform: translateX(18px); }

.choice-settings { display: grid; gap: 12px; }
.choice-setting { margin: 0; padding: 15px; border-radius: 17px; }
.choice-setting h2 { margin: 0; font-size: 13px; font-weight: 700; }
.choice-setting p { margin: 4px 0 12px; color: var(--muted); font-size: 10px; }
.segmented-control { border-radius: 13px; background: var(--bg); }
.segmented-control.four { grid-template-columns: repeat(4, 1fr); }
.segmented-control[data-setting-group="inbox_pause_hours"] { grid-template-columns: repeat(3, 1fr); }
.privacy-note { align-items: flex-start; border-radius: 17px; }
.privacy-note > .icon { width: 21px; height: 21px; flex: 0 0 21px; color: var(--success); }
.shield-mark { width: 25px; height: 25px; }

.link-card { border-radius: 17px; }
.link-card h3 { font-weight: 700; }
.state-pill { font-weight: 700; letter-spacing: .02em; }
.link-actions { gap: 7px; }

.sheet-panel { padding: 9px 16px max(22px, env(safe-area-inset-bottom)); background: var(--bg); }
.sheet-panel::before { width: 38px; height: 4px; background: var(--line); }
.sheet-header { min-height: 58px; }
.sheet-header h2 { margin-top: 1px; }
.message-bubble { background: var(--surface); }
.message-row.me .message-bubble { background: var(--accent); color: var(--button-text); }
.message-row.me .message-bubble footer { color: color-mix(in srgb, var(--button-text) 66%, transparent); }
.card-sheet-panel { background: var(--bg); }
.canvas-stage { border-radius: 18px; background: var(--surface); box-shadow: none; }
.theme-swatch.midnight span { background: linear-gradient(145deg, #071827, #173e66, #4b9cff); }

.create-link-panel {
  width: min(100%, 620px);
  height: 100%;
  max-height: 100%;
  border: 0;
  border-radius: 0;
  padding-top: max(10px, env(safe-area-inset-top));
}
#create-link-sheet .sheet-scrim { background: var(--bg); backdrop-filter: none; }
.create-link-panel::before { display: none; }
.create-link-panel .sheet-header { top: calc(-1 * max(10px, env(safe-area-inset-top))); }
.preset-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding-bottom: 6px; }
.preset-card {
  width: 100%;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.preset-card > .icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  padding: 9px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-strong);
}
.preset-card span { display: flex; flex-direction: column; gap: 3px; }
.preset-card strong { font-size: 12px; font-weight: 700; line-height: 1.25; }
.preset-card small { color: var(--muted); font-size: 10px; }
.preset-card:active { transform: scale(.985); background: var(--surface-raised); }
.preset-card:disabled { opacity: .5; }

.toast { max-width: calc(100% - 32px); border: 1px solid var(--line); background: var(--text); color: var(--bg); font-weight: 600; }

@media (max-width: 390px) {
  .shell { padding-left: 13px; padding-right: 13px; }
  .metric-grid { gap: 8px; }
  .metric { padding: 13px; }
  .nav-item span { font-size: 8px; }
  .segmented-control.four .segment { padding-inline: 4px; font-size: 10px; }
}
