:root {
    color-scheme: light;
    --ink: #14131b;
    --muted: #6f6a7d;
    --soft: #f8f6fb;
    --screen: #fbf9ff;
    --paper: rgba(255, 255, 255, 0.88);
    --paper-solid: #ffffff;
    --line: rgba(38, 31, 61, 0.09);
    --purple: #6f4fe7;
    --purple-dark: #4c32b7;
    --purple-soft: #eee8ff;
    --modal-bg: #ffffff;
    --modal-text: #14131b;
    --modal-muted: #6f6a7d;
    --modal-input-bg: #fbf9ff;
    --modal-input-border: rgba(111, 79, 231, 0.22);
    --modal-secondary-bg: #f3efff;
    --modal-backdrop: rgba(20, 19, 27, 0.38);
    --green: #28b45b;
    --danger: #c5525b;
    --shadow: 0 18px 50px rgba(42, 31, 80, 0.11);
    --shadow-soft: 0 10px 26px rgba(42, 31, 80, 0.08);
    --radius-xl: 25px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --safe-top: max(34px, env(safe-area-inset-top));
    --safe-bottom: max(14px, env(safe-area-inset-bottom));
    --tg-header-offset: clamp(18px, 4.5dvh, 44px);
    --app-max-width: 460px;
    --tg-viewport-height: 100dvh;
}

:root[data-theme="light"] {
    --ink: #14131b;
    --muted: #6f6a7d;
    --screen: #fbf9ff;
    --paper: rgba(255, 255, 255, 0.88);
    --paper-solid: #ffffff;
    --line: rgba(38, 31, 61, 0.09);
    --purple: #6f4fe7;
    --purple-dark: #4c32b7;
    --purple-soft: #eee8ff;
    --modal-bg: #ffffff;
    --modal-text: #14131b;
    --modal-muted: #6f6a7d;
    --modal-input-bg: #fbf9ff;
    --modal-input-border: rgba(111, 79, 231, 0.22);
    --modal-secondary-bg: #f3efff;
    --modal-backdrop: rgba(20, 19, 27, 0.38);
}

:root[data-theme="dark"] {
    --ink: #f8fafc;
    --muted: #94a3b8;
    --screen: #0f172a;
    --paper: rgba(17, 24, 39, 0.88);
    --paper-solid: #111827;
    --line: rgba(148, 163, 184, 0.14);
    --purple: #a78bfa;
    --purple-dark: #c4b5fd;
    --purple-soft: rgba(139, 92, 246, 0.18);
    --modal-bg: #111827;
    --modal-text: #f8fafc;
    --modal-muted: #cbd5e1;
    --modal-input-bg: #0f172a;
    --modal-input-border: rgba(167, 139, 250, 0.35);
    --modal-secondary-bg: rgba(167, 139, 250, 0.15);
    --modal-backdrop: rgba(2, 6, 23, 0.62);
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
    --shadow-soft: 0 10px 26px rgba(0, 0, 0, 0.18);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    min-height: 100%;
    background: var(--screen);
}

body {
    min-width: 320px;
    min-height: 100dvh;
    height: 100dvh;
    margin: 0;
    overflow: hidden;
    background:
        radial-gradient(circle at 88% 7%, rgba(245, 211, 143, 0.32), transparent 27%),
        radial-gradient(circle at -9% 55%, rgba(111, 79, 231, 0.12), transparent 32%),
        linear-gradient(180deg, #fffefe 0%, #f8f4ff 48%, #ffffff 100%);
    color: var(--ink);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] body {
    background:
        radial-gradient(circle at 84% 4%, rgba(139, 92, 246, 0.18), transparent 30%),
        radial-gradient(circle at 2% 55%, rgba(59, 130, 246, 0.10), transparent 34%),
        linear-gradient(180deg, #0f172a 0%, #111827 55%, #0f172a 100%);
}

button,
input,
textarea {
    font: inherit;
}

button {
    color: inherit;
}

svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.ambient {
    position: fixed;
    z-index: 0;
    border-radius: 50%;
    pointer-events: none;
}

.ambient-one {
    top: 40px;
    right: -84px;
    width: 210px;
    height: 210px;
    background: rgba(244, 201, 124, 0.23);
    filter: blur(24px);
}

.ambient-two {
    bottom: 110px;
    left: -120px;
    width: 250px;
    height: 250px;
    background: rgba(111, 79, 231, 0.10);
    filter: blur(20px);
}

.app-shell {
    position: relative;
    z-index: 1;
    width: min(100%, var(--app-max-width));
    max-width: var(--app-max-width);
    min-height: min(100dvh, var(--tg-viewport-height));
    max-height: min(100dvh, var(--tg-viewport-height));
    margin: 0 auto;
    overflow-x: hidden;
    overflow-y: auto;
    padding: calc(var(--safe-top) + var(--tg-header-offset)) 18px calc(92px + var(--safe-bottom));
    scrollbar-width: none;
}

.app-shell::-webkit-scrollbar {
    display: none;
}

.splash {
    display: grid;
    min-height: 72dvh;
    place-content: center;
    justify-items: center;
    gap: 16px;
    color: var(--muted);
}

.brand-mark {
    display: grid;
    width: 76px;
    height: 76px;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(145deg, #8f73ff, #5e43d7);
    box-shadow: var(--shadow);
    color: white;
    font-size: 34px;
    font-weight: 900;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px 42px;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin-bottom: 20px;
    padding-top: 2px;
}

.top-title {
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink);
    cursor: pointer;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.045em;
    line-height: 1.12;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-icon-button,
.round-add-button,
.icon-button {
    display: grid;
    place-items: center;
    border: 0;
    cursor: pointer;
}

.top-icon-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    padding: 9px;
}

.avatar {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 28% 24%, #d7c9ff, #8a6be7 72%);
    box-shadow: 0 10px 24px rgba(92, 66, 177, 0.22);
    color: white;
    cursor: pointer;
    font-weight: 900;
}

.hero {
    margin-bottom: 15px;
}

.hero-label {
    margin-bottom: 6px;
    color: var(--ink);
    font-size: 21px;
    font-weight: 900;
    letter-spacing: -0.045em;
}

.hero h2 {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.family-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    min-height: 72px;
    margin-bottom: 14px;
    padding: 13px 13px 13px 17px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--paper);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.family-card strong,
.family-card span {
    display: block;
}

.family-card strong {
    overflow: hidden;
    margin-bottom: 4px;
    font-size: 16px;
    font-weight: 900;
    letter-spacing: -0.03em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.family-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.members-stack {
    display: flex;
    align-items: center;
}

.stack-avatar,
.stack-add {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    background: linear-gradient(135deg, #9f83ff, #5f43d1);
    box-shadow: 0 8px 16px rgba(38, 28, 75, 0.14);
    color: white;
    font-size: 12px;
    font-weight: 900;
}

.stack-avatar + .stack-avatar,
.stack-add {
    margin-left: -10px;
}

.stack-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stack-avatar.tone-1 {
    background: linear-gradient(135deg, #f6b0d0, #8a69d5);
}

.stack-avatar.tone-2 {
    background: linear-gradient(135deg, #ffc875, #9b6cff);
}

.stack-add {
    border: 0;
    background: #f1eef6;
    color: var(--ink);
    cursor: pointer;
    padding: 10px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 24px;
}

.stat-card {
    display: grid;
    min-height: 102px;
    align-content: center;
    justify-items: center;
    gap: 5px;
    padding: 12px 7px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--paper);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    text-align: center;
    backdrop-filter: blur(18px);
}

.stat-icon {
    display: grid;
    width: 29px;
    height: 29px;
    place-items: center;
    color: var(--purple);
}

.stat-icon.success {
    color: var(--green);
}

.stat-number {
    color: var(--ink);
    font-size: 20px;
    font-weight: 950;
    line-height: 1;
}

.stat-label {
    overflow: hidden;
    max-width: 100%;
    color: var(--ink);
    font-size: 11px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.today-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 16px;
}

.summary-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    min-height: 58px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--paper);
    box-shadow: var(--shadow-soft);
    color: var(--ink);
    cursor: pointer;
    text-align: left;
    backdrop-filter: blur(18px);
}

.summary-emoji {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 12px;
    background: var(--purple-soft);
    font-size: 17px;
}

.summary-title {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.summary-card strong {
    color: var(--ink);
    font-size: 20px;
    font-weight: 950;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 12px;
}

.section-heading h2 {
    margin-bottom: 0;
    font-size: 19px;
    font-weight: 900;
    letter-spacing: -0.04em;
}

.round-add-button {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    padding: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-soft);
    color: var(--purple);
}

.round-add-button.large {
    width: 40px;
    height: 40px;
    padding: 9px;
}

.agenda-card {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

.agenda-row,
.item-row,
.reminder-card,
.memory-card,
.empty-card {
    border: 1px solid var(--line);
    background: var(--paper);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.agenda-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 59px;
    padding: 11px 13px;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
}

.agenda-icon {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    color: var(--purple);
}

.agenda-icon.success {
    color: var(--green);
}

.agenda-body {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.agenda-body strong {
    overflow: hidden;
    font-size: 14px;
    font-weight: 850;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agenda-body small,
.agenda-meta {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.memory-promo {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 66px;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 78px;
    margin: 14px 0 4px;
    padding: 15px 17px;
    border: 1px solid rgba(111, 79, 231, 0.10);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #f0e8ff 0%, #dfceff 100%);
    box-shadow: var(--shadow-soft);
    color: var(--purple-dark);
    cursor: pointer;
    text-align: left;
}

.memory-promo strong,
.memory-promo small {
    display: block;
}

.memory-promo strong {
    margin-bottom: 5px;
    font-size: 15px;
    font-weight: 900;
}

.memory-promo small {
    color: #5f5680;
    font-size: 12px;
    font-weight: 650;
}

.memory-promo-icon {
    display: grid;
    width: 62px;
    height: 52px;
    place-items: center;
    color: var(--purple);
    filter: drop-shadow(0 10px 18px rgba(89, 55, 180, 0.20));
}

.page-title {
    min-width: 0;
    margin: 0;
}

.page-title .eyebrow {
    display: none;
}

.page-title h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 950;
    letter-spacing: -0.045em;
}

.page-title p:last-child {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.section-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
    margin-bottom: 12px;
}

.filter-row {
    display: flex;
    gap: 8px;
    margin: 0 0 13px;
    overflow-x: auto;
    scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
    display: none;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    min-height: 32px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: #f1eef8;
    color: #756e86;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
}

.filter-pill.active {
    background: var(--purple-soft);
    color: var(--purple);
}

.filter-pill.danger {
    background: rgba(197, 82, 91, 0.11);
    color: var(--danger);
}

.filter-pill.compact {
    height: 34px;
    min-height: 34px;
    padding: 0 11px;
}

.list-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: transparent;
}

.list-card + .list-card {
    margin-top: 10px;
}

.list-card-head {
    display: none;
}

.item-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 62px;
    margin-bottom: 8px;
    padding: 12px 12px;
    border-radius: var(--radius-md);
    text-align: left;
}

.item-main {
    display: grid;
    min-width: 0;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.check {
    display: grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border: 1.6px solid #b9b3c7;
    border-radius: 6px;
    color: transparent;
    font-size: 13px;
}

.item-row.done .check {
    border-color: var(--green);
    color: var(--green);
}

.item-body {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.item-title {
    overflow: hidden;
    font-size: 14px;
    font-weight: 850;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-subtitle {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-row.done .item-title {
    color: #8d879b;
    text-decoration: line-through;
}

.item-menu {
    width: 22px;
    height: 22px;
    color: #9b95aa;
}

.item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mini-action {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: var(--purple-soft);
    color: var(--purple);
    cursor: pointer;
    font-size: 16px;
    font-weight: 900;
    line-height: 1;
}

.mini-action.danger {
    background: rgba(197, 82, 91, 0.12);
    color: var(--danger);
}

.category-row {
    display: flex;
    gap: 8px;
    margin: 0 0 10px;
    overflow-x: auto;
    scrollbar-width: none;
}

.category-row::-webkit-scrollbar {
    display: none;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    min-height: 32px;
    padding: 0 11px;
    border: 0;
    border-radius: 999px;
    background: #f1eef8;
    color: #756e86;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.category-pill.active {
    background: var(--purple-soft);
    color: var(--purple);
}

.text-button {
    padding: 8px 0;
    border: 0;
    background: none;
    color: var(--purple);
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
}

.primary-button,
.secondary-button,
.danger-button {
    min-height: 50px;
    padding: 0 17px;
    border: 0;
    border-radius: 18px;
    font-weight: 900;
    cursor: pointer;
}

.primary-button {
    flex: 1;
    background: linear-gradient(135deg, #7d5cf0, #6044d7);
    box-shadow: 0 15px 30px rgba(91, 64, 207, 0.25);
    color: white;
}

.secondary-button {
    background: var(--modal-secondary-bg);
    color: var(--purple);
}

.danger-button {
    background: #fff0f1;
    color: var(--danger);
}

.icon-button {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border-radius: 13px;
    background: rgba(197, 82, 91, 0.10);
    color: var(--danger);
    font-size: 20px;
}

.empty-card {
    padding: 30px 20px;
    border-radius: var(--radius-lg);
    text-align: center;
}

.empty-icon {
    display: grid;
    width: 58px;
    height: 58px;
    margin: 0 auto 15px;
    place-items: center;
    border-radius: 19px;
    background: var(--purple-soft);
    color: var(--purple);
    font-size: 26px;
}

.empty-card h3 {
    margin-bottom: 7px;
    font-size: 17px;
}

.empty-card p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

:root[data-theme="dark"] .empty-card p {
    color: #cbd5e1;
}

.memory-grid {
    display: grid;
    gap: 8px;
}

.memory-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.memory-search.single {
    grid-template-columns: 1fr;
}

.memory-search input {
    width: 100%;
    height: 43px;
    border: 0;
    outline: none;
    border-radius: 13px;
    background: #f1f0f5;
    color: var(--ink);
    font-size: 14px;
    padding: 0 14px;
}

.memory-search input:focus {
    box-shadow: 0 0 0 3px rgba(111, 79, 231, 0.10);
}

.memory-result-label {
    margin: 0 2px 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.memory-card {
    position: relative;
    min-height: 57px;
    padding: 14px 14px 14px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
}

.memory-card p {
    margin: 8px 0 11px;
}

.memory-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--purple-soft);
    color: var(--purple);
    font-size: 12px;
    font-weight: 850;
}

.reminder-card {
    display: grid;
    grid-template-columns: 45px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    padding: 12px;
    border-radius: var(--radius-md);
}

.settings-card,
.activity-list,
.people-list {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.settings-row,
.activity-row,
.person-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 62px;
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--paper);
    box-shadow: var(--shadow-soft);
    color: var(--ink);
    text-align: left;
    backdrop-filter: blur(18px);
}

.settings-row {
    cursor: pointer;
}

.person-card {
    grid-template-columns: 46px minmax(0, 1fr) auto;
    cursor: pointer;
}

.person-avatar {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: linear-gradient(135deg, #9f83ff, #5f43d1);
    color: white;
    font-size: 14px;
    font-weight: 900;
}

.person-avatar.large {
    width: 64px;
    height: 64px;
    font-size: 20px;
}

.person-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.person-avatar.tone-1 {
    background: linear-gradient(135deg, #f6b0d0, #8a69d5);
}

.person-avatar.tone-2 {
    background: linear-gradient(135deg, #ffc875, #9b6cff);
}

.person-info {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.person-info strong,
.person-info small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-row strong,
.settings-row small,
.activity-row strong,
.activity-row small {
    display: block;
}

.settings-row strong,
.activity-row strong {
    margin-bottom: 3px;
    font-size: 14px;
    font-weight: 850;
}

.settings-row small,
.activity-row small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.theme-switch {
    display: grid;
    width: 54px;
    height: 30px;
    justify-items: start;
    align-items: center;
    padding: 3px;
    border-radius: 999px;
    background: var(--purple-soft);
}

.theme-switch span {
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 50%;
    background: var(--paper-solid);
    box-shadow: var(--shadow-soft);
    font-size: 14px;
}

.theme-switch.dark {
    justify-items: end;
}

.chevron {
    color: var(--muted);
    font-size: 24px;
    line-height: 1;
}

.history-heading {
    margin-top: 8px;
}

:root[data-theme="dark"] .filter-pill,
:root[data-theme="dark"] .category-pill,
:root[data-theme="dark"] .memory-search input {
    background: rgba(31, 41, 55, 0.88);
    color: var(--muted);
}

:root[data-theme="dark"] .filter-pill.active,
:root[data-theme="dark"] .category-pill.active {
    background: var(--purple-soft);
    color: var(--purple);
}

:root[data-theme="dark"] .filter-pill.danger {
    background: rgba(248, 113, 113, 0.14);
    color: #fca5a5;
}

:root[data-theme="dark"] .bottom-nav {
    background: rgba(17, 24, 39, 0.88);
}

:root[data-theme="dark"] .avatar {
    background: radial-gradient(circle at 28% 24%, #c4b5fd, #6d4ee6 72%);
}

.reminder-time {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 13px;
    background: var(--purple-soft);
    color: var(--purple);
    font-size: 11px;
    font-weight: 900;
    text-align: center;
}

.reminder-info {
    min-width: 0;
}

.reminder-info strong,
.reminder-info span {
    display: block;
}

.reminder-info strong {
    overflow: hidden;
    margin-bottom: 3px;
    font-size: 14px;
    font-weight: 850;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reminder-info span {
    color: var(--muted);
    font-size: 12px;
}

.bottom-nav {
    position: fixed;
    z-index: 20;
    right: auto;
    bottom: var(--safe-bottom);
    left: 50%;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 2px;
    width: min(calc(100vw - 24px), calc(var(--app-max-width) - 24px));
    min-height: 70px;
    padding: 8px 8px 7px;
    border: 1px solid rgba(255, 255, 255, 0.84);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 18px 44px rgba(33, 24, 65, 0.13);
    backdrop-filter: blur(22px);
    transform: translateX(-50%);
}

.nav-button {
    display: grid;
    min-width: 0;
    place-items: center;
    align-content: center;
    gap: 4px;
    padding: 4px 1px;
    border: 0;
    border-radius: 17px;
    background: transparent;
    color: #575166;
    cursor: pointer;
}

.nav-button.active {
    color: var(--purple);
}

.nav-icon {
    display: grid;
    width: 23px;
    height: 23px;
    place-items: center;
}

.nav-label {
    overflow: hidden;
    max-width: 100%;
    font-size: 10px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sheet {
    position: fixed;
    z-index: 50;
    inset: 0;
    visibility: hidden;
    pointer-events: none;
}

.sheet.open {
    visibility: visible;
    pointer-events: auto;
}

.sheet-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    border: 0;
    background: var(--modal-backdrop);
    opacity: 0;
    transition: opacity 180ms ease;
}

.sheet.open .sheet-backdrop {
    opacity: 1;
}

.sheet-panel {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    width: min(100%, var(--app-max-width));
    max-height: 88dvh;
    margin: 0 auto;
    overflow: auto;
    padding: 10px 20px calc(22px + var(--safe-bottom));
    border-radius: 30px 30px 0 0;
    border: 1px solid var(--line);
    background: var(--modal-bg);
    box-shadow: 0 -24px 80px rgba(34, 26, 65, 0.22);
    color: var(--modal-text);
    transform: translateY(102%);
    transition: transform 220ms cubic-bezier(.2, .8, .2, 1);
}

.sheet.open .sheet-panel {
    transform: translateY(0);
}

.sheet-handle {
    width: 42px;
    height: 5px;
    margin: 0 auto 20px;
    border-radius: 999px;
    background: var(--modal-input-border);
}

.sheet-title {
    margin-bottom: 7px;
    color: var(--modal-text);
    font-size: 24px;
    letter-spacing: -0.04em;
}

.sheet-subtitle {
    margin-bottom: 20px;
    color: var(--modal-muted);
    font-size: 14px;
    line-height: 1.45;
}

.field {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.field label {
    color: var(--modal-text);
    font-size: 13px;
    font-weight: 900;
}

.field input,
.field textarea {
    width: 100%;
    border: 1.5px solid var(--modal-input-border);
    outline: none;
    border-radius: 18px;
    background: var(--modal-input-bg);
    color: var(--modal-text);
    font-size: 16px;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field input::placeholder,
.field textarea::placeholder {
    color: var(--modal-muted);
    opacity: 0.85;
}

.field input {
    height: 54px;
    padding: 0 15px;
}

.field textarea {
    min-height: 112px;
    padding: 14px 15px;
    resize: vertical;
}

.field input:focus,
.field textarea:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 4px rgba(111, 79, 231, 0.10);
}

.sheet-actions {
    display: flex;
    gap: 10px;
}

.sheet-actions button {
    min-height: 50px;
}

.invite-panel {
    display: grid;
}

.invite-code {
    display: grid;
    min-height: 86px;
    margin: 4px 0 18px;
    place-items: center;
    border: 1.5px dashed rgba(111, 79, 231, 0.35);
    border-radius: 22px;
    background: var(--purple-soft);
    color: var(--purple);
    font-size: 31px;
    font-weight: 950;
    letter-spacing: 0.09em;
}

.invite-actions {
    display: grid;
    gap: 10px;
}

.invite-actions button {
    width: 100%;
}

.invite-hint {
    margin: 16px 0 0;
    color: var(--modal-muted);
    font-size: 12px;
    line-height: 1.45;
}

.quick-add-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.quick-add-card {
    display: grid;
    min-height: 112px;
    place-items: center;
    gap: 9px;
    border: 1px solid var(--modal-input-border);
    border-radius: 22px;
    background: var(--modal-input-bg);
    color: var(--modal-text);
    cursor: pointer;
    text-align: center;
}

.quick-add-card span {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    color: var(--purple);
}

.quick-add-card strong {
    font-size: 14px;
    font-weight: 900;
}

.profile-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.primary-button.full {
    width: 100%;
    margin-bottom: 16px;
}

.profile-memory {
    display: grid;
    gap: 12px;
}

.profile-memory-group {
    padding: 14px;
    border: 1px solid var(--modal-input-border);
    border-radius: 20px;
    background: var(--modal-input-bg);
}

.profile-memory-group h3 {
    margin-bottom: 10px;
    color: var(--modal-text);
    font-size: 15px;
}

.profile-memory-group ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding-left: 18px;
    color: var(--modal-text);
    font-size: 14px;
    line-height: 1.4;
}

.toast {
    position: fixed;
    z-index: 80;
    top: calc(var(--safe-top) + 8px);
    left: 50%;
    max-width: calc(100vw - 32px);
    padding: 11px 16px;
    border-radius: 15px;
    background: var(--ink);
    box-shadow: var(--shadow);
    color: white;
    font-size: 13px;
    font-weight: 800;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -16px);
    transition: 180ms ease;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.error-card {
    margin-top: 20vh;
    padding: 24px;
    border-radius: var(--radius-xl);
    background: var(--paper-solid);
    box-shadow: var(--shadow);
    text-align: center;
}

@media (max-width: 360px) {
    .app-shell {
        padding-right: 12px;
        padding-left: 12px;
    }

    .stats {
        gap: 6px;
    }

    .stat-card {
        min-height: 94px;
        padding-right: 4px;
        padding-left: 4px;
    }

    .stat-label,
    .nav-label {
        font-size: 9px;
    }
}

@media (min-width: 700px) {
    body {
        display: grid;
        place-items: start center;
        padding: 0;
        overflow: hidden;
    }

    .app-shell {
        min-height: min(100dvh, var(--tg-viewport-height));
        max-height: min(100dvh, var(--tg-viewport-height));
        background:
            radial-gradient(circle at 88% 7%, rgba(245, 211, 143, 0.24), transparent 27%),
            radial-gradient(circle at -9% 55%, rgba(111, 79, 231, 0.10), transparent 32%),
            var(--screen);
        border-radius: 34px;
        box-shadow: 0 35px 100px rgba(67, 47, 119, 0.12);
    }

    :root[data-theme="dark"] .app-shell {
        background:
            radial-gradient(circle at 84% 4%, rgba(139, 92, 246, 0.16), transparent 30%),
            radial-gradient(circle at 2% 55%, rgba(59, 130, 246, 0.09), transparent 34%),
            var(--screen);
    }

    .sheet-panel {
        max-height: min(720px, 88dvh);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
