/**
 * styles.css — Mobile-first layout for the gratitude journal scaffold.
 * Bottom nav stays thumb-friendly; content scrolls above it.
 */

*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --bg: #f6f4f1;
    --surface: #fff;
    --text: #1a1a1a;
    --muted: #6b6560;
    --accent: #2d6a4f;
    --accent-soft: #d8f3dc;
    --border: #e5e0d8;
    --nav-h: 3.5rem;
    --safe-bottom: env(safe-area-inset-bottom, 0);
    /* Matches Notes inner shell (`tn-max-w-2xl`); use for signed-in main column */
    --app-readable-max: 42rem;
    /* Thumbs in edit UI / legacy strips */
    --note-photo-preview-max-h: 11rem;
    --note-photo-preview-fit: contain;
    --note-photo-preview-radius: 0.4rem;
    /* Notes list + Today shared (`note_library_card` → `.today-note-photos--browse`) */
    --note-photo-browse-gap: 1.125rem;
    --note-photo-browse-row-gap: 1.25rem;
}

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100dvh;
}

.app {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding-bottom: calc(var(--nav-h) + var(--safe-bottom));
}

.top-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.top-bar__title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.top-bar__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.top-bar__auth {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.top-bar__auth a {
    color: var(--accent);
    text-decoration: none;
}

.top-bar__auth a:hover {
    text-decoration: underline;
}

.top-bar__tips-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: rgb(100 116 139 / 0.72);
    font-size: 1rem;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    transition:
        color 0.15s ease,
        background-color 0.15s ease;
}

.top-bar__tips-btn:hover {
    color: var(--accent);
    background: rgba(45, 106, 79, 0.07);
}

.top-bar__tips-btn:focus-visible {
    outline: 2px solid rgba(45, 106, 79, 0.42);
    outline-offset: 2px;
}

.top-bar__tips-icon {
    display: block;
    transform: translateY(-0.02em);
}

.main {
    flex: 1;
    padding: 1rem;
    max-width: var(--app-readable-max);
    margin: 0 auto;
    width: 100%;
}

/*
 * Signed-in app routes (body.th-app-shell): same readable column as Notes list —
 * max-width matches `tn-max-w-2xl`; horizontal padding matches Notes `px-4 sm:px-8`.
 * Notes itself uses `.tn-notes-shell` (full-bleed main + inner shell); excluded here.
 */
@media (min-width: 640px) {
    body.th-app-shell .main:not(.tn-notes-shell) {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Today form */
.flash {
    margin: 0 0 1rem;
    padding: 0.5rem 0.75rem;
    background: var(--accent-soft);
    border-radius: 0.5rem;
    font-size: 0.9rem;
}

.flash--error {
    background: #fde8e8;
    color: #7f1d1d;
}

.email-auth {
    max-width: 22rem;
}

.email-auth__headline {
    font-weight: 600;
    font-size: 1.25rem;
    line-height: 1.3;
    margin: 0 0 0.5rem;
}

.email-auth__headline--send {
    margin-top: 0;
}

.email-auth__hint {
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.email-auth__alt {
    margin: 1rem 0 0;
    font-size: 0.9rem;
}

.email-auth__secondary {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.email-auth__inline-form {
    margin: 0 0 0.65rem;
}

.email-auth__link-btn {
    display: inline;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    font: inherit;
    font-size: 0.9rem;
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
    width: auto;
    text-align: left;
}

.email-auth__link-btn:hover {
    text-decoration: none;
}

.email-auth__resend-details {
    margin: 0 0 0.65rem;
}

.email-auth__resend-summary {
    font-size: 0.9rem;
    color: var(--accent);
    cursor: pointer;
}

.email-auth__resend-summary:hover {
    text-decoration: underline;
}

.email-auth__resend-panel {
    margin-top: 0.75rem;
    padding: 0 0 0.25rem;
}

.note-form--compact .note-form__input {
    margin-bottom: 0.65rem;
}

.email-auth__email-readonly {
    margin: 0 0 1rem;
    padding: 0.65rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    word-break: break-all;
}

.email-auth__code-flash {
    margin-bottom: 0.75rem;
}

.email-auth__footnote {
    margin: 0;
    font-size: 0.9rem;
}

.note-form__label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.note-form__textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font: inherit;
    resize: vertical;
    min-height: 10rem;
    margin-bottom: 1rem;
    background: var(--surface);
}

.note-form__textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.note-form__input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font: inherit;
    background: var(--surface);
}

.note-form__input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn {
    display: inline-block;
    padding: 0.65rem 1.25rem;
    border-radius: 0.5rem;
    font: inherit;
    font-weight: 600;
    border: none;
    cursor: pointer;
    width: 100%;
}

.btn--primary {
    background: var(--accent);
    color: #fff;
}

.btn--primary:active {
    opacity: 0.92;
}

.btn--danger-secondary {
    background: var(--surface);
    color: #9a2842;
    border: 2px solid #c45c6f;
}

.btn--danger-secondary:active {
    opacity: 0.92;
}

.btn--danger-fill {
    background: #9a2842;
    color: #fff;
    border: 2px solid #9a2842;
}

.btn--danger-fill:active {
    opacity: 0.9;
}

.leave-group-section {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.delete-group-section {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.leave-group-form__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (min-width: 480px) {
    .leave-group-form__actions {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .leave-group-form__actions .btn {
        width: auto;
        min-width: 9rem;
    }

    .leave-group-form__cancel {
        flex: 0 0 auto;
    }
}

/* Today — composer first, calm sections below (not a feed) */
.today-section {
    margin-top: 1.35rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.today-section__heading {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 0.5rem;
}

.today-quiet {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.45;
}

.today-yours-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.today-quiet--below-composer {
    margin-bottom: 0;
}

.today-page-lede {
    margin-bottom: 0.875rem;
}

.today-lede-strong {
    font-weight: 600;
    color: var(--muted);
}

.today-yours-entry {
    margin: 0;
    padding: 0;
    list-style: none;
}

.today-note-update-form {
    margin-top: 0.45rem;
}

/* Photos + attach read as one media band for this entry */
.today-media-strip {
    margin-top: 0.85rem;
}

.today-media-strip .today-daily-card__gallery {
    margin-top: 0;
}

.today-entry-attachments {
    margin: 0;
    padding: 0;
    border: none;
}

.today-media-strip--has-photos .today-entry-attachments {
    margin-top: 0.45rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.today-entry-attachments__hint {
    margin: 0.2rem 0 0;
}

.today-entry-attachments__status {
    margin-top: 0.25rem;
}

.today-entry-attachments__cap {
    margin: 0;
}

.today-attach-photo__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    margin: 0;
    min-height: 2.35rem;
    padding: 0.28rem 0.2rem 0.28rem 0;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgb(100 116 139 / 0.96);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 0.35rem;
    transition:
        color 0.18s ease,
        opacity 0.18s ease;
}

.today-attach-photo__btn:hover {
    color: var(--accent);
}

.today-attach-photo__btn:focus-visible {
    outline: 2px solid rgba(45, 106, 79, 0.42);
    outline-offset: 3px;
}

.today-attach-photo__icon {
    display: inline-flex;
    opacity: 0.72;
    transition: opacity 0.18s ease;
}

.today-attach-photo__btn:hover .today-attach-photo__icon {
    opacity: 1;
}

.today-attach-photo__icon svg {
    display: block;
}

/* Writing continues inside the same card — one surface, not a nested panel */
.today-continue-compose {
    margin-top: 0;
    margin-left: -1rem;
    margin-right: -1rem;
    padding: 1rem 1rem 1rem;
    border-top: 1px solid rgba(45, 106, 79, 0.07);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.38) 0%, rgba(244, 249, 246, 0.92) 100%);
}

/* Default = idle (empty textarea); promoted rules override when there’s content */
.today-continue-submit {
    appearance: none;
    margin-top: 0.35rem;
    align-self: flex-start;
    padding: 0.15rem 0;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: rgb(100 116 139 / 0.58);
    background: none;
    border: none;
    border-radius: 0;
    opacity: 0.72;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: rgba(148, 163, 184, 0.35);
    text-underline-offset: 0.18em;
    box-shadow: none;
    transition:
        opacity 0.22s ease,
        color 0.22s ease,
        background-color 0.22s ease,
        border-color 0.22s ease,
        box-shadow 0.22s ease,
        margin-top 0.22s ease,
        padding 0.22s ease,
        font-size 0.22s ease,
        font-weight 0.22s ease,
        filter 0.22s ease;
}

.today-continue-submit:hover {
    opacity: 1;
    color: rgb(100 116 139 / 0.88);
    text-decoration-color: rgba(45, 106, 79, 0.38);
}

.today-continue-submit:focus-visible {
    outline: none;
    opacity: 1;
    color: var(--accent);
    text-decoration-color: rgba(45, 106, 79, 0.5);
    box-shadow: 0 2px 0 0 rgba(45, 106, 79, 0.32);
}

.today-add-thought__form:has(#add-thought-body:not(:placeholder-shown)) .today-continue-submit {
    margin-top: 0.85rem;
    padding: 0.52rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #fff;
    background: var(--accent);
    border: 1px solid transparent;
    border-radius: 0.55rem;
    opacity: 1;
    text-decoration: none;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.06),
        0 2px 8px rgba(45, 106, 79, 0.18);
}

.today-add-thought__form:has(#add-thought-body:not(:placeholder-shown)) .today-continue-submit:hover {
    filter: brightness(1.04);
}

.today-add-thought__form:has(#add-thought-body:not(:placeholder-shown)) .today-continue-submit:active {
    filter: brightness(0.97);
}

.today-add-thought__form:has(#add-thought-body:not(:placeholder-shown)) .today-continue-submit:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 3px rgba(45, 106, 79, 0.26),
        0 1px 2px rgba(15, 23, 42, 0.06),
        0 2px 8px rgba(45, 106, 79, 0.18);
}

.today-invite-wrap {
    position: relative;
    width: 100%;
    margin: 0 0 0.5rem;
}

.today-invite-wrap__glyph {
    position: absolute;
    left: 0.68rem;
    top: 0.72rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    color: var(--accent);
    opacity: 0.42;
    pointer-events: none;
}

.today-invite-wrap__glyph svg {
    display: block;
}

.today-invite-textarea {
    display: block;
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: 0.72rem 0.85rem 0.72rem 2.45rem;
    font-size: 1.0625rem;
    line-height: 1.55;
    font-family: inherit;
    color: var(--text);
    background-color: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: 0.7rem;
    resize: vertical;
    min-height: 5rem;
    transition:
        background-color 0.22s ease,
        border-color 0.22s ease,
        box-shadow 0.22s ease;
}

.today-invite-textarea::placeholder {
    color: var(--muted);
    opacity: 0.92;
    font-weight: 550;
    font-size: 1.085rem;
}

.today-invite-textarea:hover {
    border-color: #c8d9cf;
}

.today-invite-textarea:focus {
    outline: none;
    border-color: var(--accent);
    background-color: var(--surface);
    box-shadow:
        0 0 0 3px rgba(45, 106, 79, 0.22),
        0 1px 2px rgba(15, 23, 42, 0.06);
}

.today-invite-textarea--continue {
    min-height: 7rem;
    padding: 0.55rem 0.12rem 0.75rem;
    font-size: 1.085rem;
    line-height: 1.62;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.today-invite-textarea--continue:hover {
    border-color: transparent;
}

.today-invite-textarea--continue:focus {
    outline: none;
    border-color: transparent;
    background: rgba(255, 255, 255, 0.62);
    border-radius: 0.5rem;
    box-shadow: inset 0 0 0 1px rgba(45, 106, 79, 0.14);
}

.today-invite-textarea--continue::placeholder {
    font-size: 1.18rem;
    font-weight: 650;
    letter-spacing: -0.022em;
    line-height: 1.45;
    color: var(--text);
    opacity: 0.34;
}

.today-invite-wrap:focus-within .today-invite-wrap__glyph {
    opacity: 0.58;
}

.today-micro-confirm {
    margin: 0 0 0.5rem;
    padding: 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--accent);
    animation: today-micro-confirm-out 2.75s ease forwards;
}

@keyframes today-micro-confirm-out {
    0% {
        opacity: 0;
        transform: translateY(-3px);
    }
    10% {
        opacity: 1;
        transform: translateY(0);
    }
    72% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

.today-privacy-row {
    margin: 0.35rem 0 0;
    padding: 0;
}

/* Light separator before the promoted submit reads as “finish this beat” */
.today-add-thought__form:has(#add-thought-body:not(:placeholder-shown)) .today-privacy-row::after {
    content: '';
    display: block;
    margin-top: 0.55rem;
    width: 100%;
    max-width: 10rem;
    height: 1px;
    background: rgba(45, 106, 79, 0.1);
}

.today-helper {
    margin: 0.2rem 0 0;
    padding: 0;
    font-size: 0.7rem;
    font-weight: 400;
    line-height: 1.38;
    color: var(--muted);
}

.today-privacy-default {
    margin: 0.2rem 0 0 1.65rem;
    padding: 0;
    font-size: 0.6875rem;
    font-weight: 400;
    line-height: 1.42;
    color: var(--muted);
    transition:
        opacity 0.22s ease,
        max-height 0.28s ease,
        margin 0.22s ease;
    opacity: 1;
    max-height: 5rem;
}

.today-privacy-row:has(.today-thought-private-check input:checked) .today-privacy-default {
    opacity: 0;
    max-height: 0;
    margin-top: 0;
    overflow: hidden;
}

.today-helper--privacy-note {
    margin: 0;
    padding: 0;
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1.38;
    color: var(--muted);
    margin-left: 1.65rem;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition:
        opacity 0.22s ease,
        max-height 0.28s ease,
        margin-top 0.22s ease;
}

.today-privacy-row:has(.today-thought-private-check input:checked) .today-helper--privacy-note {
    opacity: 0.9;
    max-height: 2.75rem;
    margin-top: 0.2rem;
}

.today-privacy-reassurance {
    margin: 0.15rem 0 0 1.65rem;
    padding: 0;
    font-size: 0.68rem;
    font-weight: 400;
    font-style: italic;
    line-height: 1.35;
    color: var(--muted);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition:
        opacity 0.22s ease,
        max-height 0.28s ease;
}

.today-privacy-row:has(.today-thought-private-check input:checked) .today-privacy-reassurance {
    opacity: 0.82;
    max-height: 2.75rem;
}

.today-daily-card .share-fieldset__hint,
.today-daily-card .today-edit-note-hint {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--muted);
}

.today-fold {
    margin-top: 0.35rem;
}

.today-fold__summary {
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--muted);
    list-style: none;
}

.today-fold__summary::-webkit-details-marker {
    display: none;
}

.today-manage-details {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}

.today-manage-details__summary {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--muted);
}

.today-manage-details__body {
    padding-top: 0.35rem;
}

.today-note-meta-footer {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}

.today-daily-card {
    margin: 0;
    padding: 1rem 1rem 1.15rem;
    background: var(--surface);
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.045);
}

/* Focal surface for “today’s reflection” — slightly richer than page chrome */
.today-daily-card--reflection {
    background: linear-gradient(165deg, #ffffff 0%, #fafcfa 55%, #f7faf8 100%);
    box-shadow:
        0 1px 3px rgba(15, 23, 42, 0.07),
        0 0 0 1px rgba(45, 106, 79, 0.06);
}

.today-daily-card--reflection .today-thought-stream {
    gap: 1.35rem;
}

.today-daily-card--reflection .today-note-photos--daily {
    gap: 0.32rem;
    margin-top: 0.85rem;
}

.today-daily-card--reflection .today-note-photos--daily .today-note-photos__img {
    max-height: 6.75rem;
    border-radius: 0.5rem;
}

.today-daily-card--reflection .note-detail__thought-private {
    opacity: 0.72;
}

.today-daily-card--reflection .thought-reaction-add {
    transition:
        background-color 0.15s ease,
        opacity 0.15s ease,
        border-color 0.15s ease;
}

.today-daily-card--reflection .thought-reaction-add:hover {
    opacity: 1;
    background: var(--accent-soft);
    border-color: rgba(45, 106, 79, 0.35);
}

.today-daily-card__label {
    margin: 0 0 0.65rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.today-daily-card__content {
    margin: 0;
    padding: 0;
}

.today-daily-card__gallery {
    margin-top: 1rem;
}

.today-note-photos--daily {
    margin-top: 0;
}

.today-note-photos--daily .today-note-photos__item {
    flex: 1 1 44%;
    max-width: calc(50% - 0.25rem);
    min-width: 7rem;
}

.today-note-photos--daily .today-note-photos__img {
    width: 100%;
    max-height: 8.5rem;
    object-fit: cover;
}

.today-daily-card__context {
    margin: 0;
    padding: 0;
}

.today-daily-card__sharing {
    margin: 0;
}

.today-add-thought__form {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.today-yours-meta {
    margin: 0;
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.35;
}

.today-yours-meta--private {
    font-style: italic;
}

.note-form--compact .note-form__label:first-of-type {
    margin-top: 0;
}

.today-edit-media-fieldset {
    margin-top: 0.25rem;
}

.today-edit-existing-photos {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.today-edit-existing-photos__item {
    margin: 0;
}

.today-edit-existing-photos__label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--muted);
    cursor: pointer;
}

.today-edit-existing-photos__thumb {
    display: block;
    max-height: var(--note-photo-preview-max-h);
    width: auto;
    max-width: 100%;
    object-fit: var(--note-photo-preview-fit);
    border-radius: var(--note-photo-preview-radius);
    border: 1px solid var(--border);
}

.today-edit-existing-photos__hint {
    font-size: 0.72rem;
}

.today-edit-photo-cap-hint {
    margin-top: 0.35rem;
}

.today-edit-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.35rem;
}

.today-edit-inline-error {
    margin-top: 0;
}

.today-edit-note-hint {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.4;
}

.today-thought-stream {
    list-style: none;
    margin: 0;
    padding: 0;
    padding-inline-start: 0;
    margin-inline-start: 0;
    display: flex;
    flex-direction: column;
    gap: 1.85rem;
}

.today-thought {
    margin: 0;
    padding: 0;
    list-style: none;
}

.today-thought-readonly {
    margin: 0;
    padding: 0;
}

/* One vertical stack per thought: body → meta row → comments */
.thought-block {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.thought-block__text {
    margin: 0;
    padding: 0;
    width: 100%;
}

.thought-block__body {
    margin: 0;
}

.thought-block__meta {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.35rem 0.45rem;
    width: 100%;
    max-width: 100%;
    margin: 0.5rem 0 0;
    padding: 0;
    box-sizing: border-box;
}

.thought-block__actions {
    display: inline-flex;
    align-items: center;
    gap: 0.08rem;
    flex-shrink: 0;
}

.today-thought__body {
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
}

.today-thought__icon-btn {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    width: 2rem;
    height: 2rem;
    border: none;
    background: transparent;
    font: inherit;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.5;
    border-radius: 0.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition:
        opacity 0.15s ease,
        background-color 0.15s ease;
}

.today-thought__icon-btn:hover {
    opacity: 0.88;
    background: rgba(45, 106, 79, 0.08);
}

.today-thought__icon-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    opacity: 1;
}

.today-thought__icon-btn--danger {
    opacity: 0.46;
}

.today-thought__icon-btn--danger:hover {
    opacity: 0.88;
    background: rgba(154, 40, 66, 0.07);
}

.today-thought__time {
    font-size: 0.74rem;
    font-weight: 400;
    color: var(--muted);
}

.thought-reactions {
    display: inline-flex;
    align-items: center;
    gap: 0.22rem;
}

.thought-reactions__list {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.18rem;
}

.thought-reaction-pill {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 999px;
    color: var(--muted);
    font: inherit;
    font-size: 0.72rem;
    line-height: 1.2;
    padding: 0.15rem 0.4rem;
    cursor: pointer;
}

.thought-reaction-pill.is-active {
    border-color: var(--accent);
    color: var(--accent);
}

.thought-reaction-add {
    border: 1px solid var(--border);
    background: transparent;
    border-radius: 999px;
    color: var(--muted);
    font: inherit;
    font-size: 0.78rem;
    line-height: 1;
    width: 1.3rem;
    height: 1.3rem;
    padding: 0;
    cursor: pointer;
}

.thought-reaction-picker-wrap {
    position: fixed;
    z-index: 2;
}

.thought-reaction-picker-wrap[hidden] {
    display: none !important;
}

.thought-reaction-picker {
    max-width: min(22rem, 100%);
}

.today-thought__private-badge {
    font-size: 0.78rem;
    line-height: 1;
    opacity: 0.75;
}

.today-thought-private-check {
    margin-top: 0.5rem;
}

.today-thought-private-hint {
    margin-top: 0.25rem;
    margin-bottom: 0;
}

.note-detail__thought-private-wrap {
    margin-right: 0.25rem;
}

.note-detail__thought-private {
    font-size: 0.9rem;
}

@media (hover: hover) and (pointer: fine) {
    .thought-block__actions .today-thought__icon-btn {
        opacity: 0.4;
    }

    .today-thought:hover .thought-block__actions .today-thought__icon-btn,
    .today-thought:focus-within .thought-block__actions .today-thought__icon-btn {
        opacity: 0.58;
    }

    .today-thought:hover .thought-block__actions .today-thought__icon-btn:hover,
    .today-thought:focus-within .thought-block__actions .today-thought__icon-btn:hover {
        opacity: 0.92;
    }
}

.today-thought-delete-form {
    display: inline-flex;
    margin: 0;
    vertical-align: middle;
}

.today-thought-edit-error {
    margin-bottom: 0.5rem;
}

.today-thought-edit-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.35rem;
}

.today-note-meta-readonly {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.today-add-thought {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.btn--inline {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.note-detail__thoughts {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    padding-inline-start: 0;
    margin-inline-start: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.note-detail__thought {
    margin: 0;
    padding: 0;
    list-style: none;
}

.note-detail__thought-body {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.note-detail__thought-time {
    margin: 0;
    font-size: 0.74rem;
    font-weight: 400;
    color: var(--muted);
}

/* Quiet affirmations: indented once under the thought block only */
.thought-comments {
    margin: 0.45rem 0 0;
    padding: 0.15rem 0 0;
}

.thought-block .thought-comments {
    margin-left: 0;
    padding-left: 0.75rem;
}

.thought-comments__list {
    list-style: none;
    margin: 0 0 0.28rem;
    padding: 0;
    padding-inline-start: 0;
    display: flex;
    flex-direction: column;
    gap: 0.38rem;
}

.thought-comments__item {
    margin: 0;
}

.thought-comments__body {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.38;
    color: var(--muted);
    word-break: break-word;
}

.thought-comments__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    margin-top: 0.14rem;
}

.thought-comments__meta {
    margin: 0;
    font-size: 0.72rem;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.1rem;
    flex: 1;
    min-width: 0;
    opacity: 0.92;
}

.thought-comments__delete-form {
    display: inline-flex;
    margin: 0;
    flex-shrink: 0;
    align-items: center;
}

.thought-comments__icon-btn {
    margin: 0;
    padding: 0 0.22rem;
    min-width: 1.65rem;
    min-height: 1.45rem;
    border: none;
    background: transparent;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    opacity: 0.4;
    border-radius: 0.35rem;
}

.thought-comments__icon-btn:hover {
    opacity: 0.85;
    color: var(--text);
}

.thought-comments__icon-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    opacity: 1;
}

.thought-comments__icon-btn--remove {
    font-size: 1.2rem;
    font-weight: 400;
    line-height: 1;
}

.thought-comments__composer-wrap {
    margin-top: 0.18rem;
}

.thought-comments__composer-summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    min-height: 1.85rem;
    padding: 0.08rem 0.38rem;
    font-size: 0.76rem;
    color: var(--muted);
    cursor: pointer;
    list-style: none;
    border-radius: 0.4rem;
    opacity: 0.72;
}

.thought-comments__composer-summary:hover {
    opacity: 1;
}

.thought-comments__composer-icon {
    font-size: 0.95rem;
    line-height: 1;
}

.thought-comments__composer-label {
    font-size: 0.74rem;
    font-weight: 400;
}

.thought-comments__composer-summary::-webkit-details-marker {
    display: none;
}

.thought-comments__composer-wrap[open] .thought-comments__composer-summary {
    margin-bottom: 0.32rem;
    opacity: 1;
}

.thought-comments__textarea {
    font-size: 0.86rem;
}

.thought-comments__hint {
    margin: 0.12rem 0 0.25rem;
}

.thought-comments__submit {
    margin-top: 0.12rem;
}

.btn--ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
    box-shadow: none;
}

.btn--ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Notes library + filters */
.notes-filters {
    margin: 0 0 1.25rem;
    padding: 0 0 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.notes-filters__row {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.notes-filters__label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.notes-filters__select {
    font: inherit;
    padding: 0.5rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 0.45rem;
    background: var(--surface);
    color: var(--text);
}

.notes-filters__select:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.notes-empty {
    margin: 0.5rem 0 0;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.45;
}

.notes-library {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notes-library__card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    padding: 0.85rem 1rem;
}

.notes-library__date {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.notes-library__author {
    margin: 0 0 0.2rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
}

.notes-library__groups {
    margin: 0 0 0.45rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.notes-library__article {
    margin: 0;
    padding: 0;
}

.notes-library__header {
    margin: 0 0 0.25rem;
}

.notes-library__article .note-detail__thoughts {
    margin-top: 0.35rem;
    margin-bottom: 0.75rem;
}

.notes-library__permalink {
    margin: 0;
    font-size: 0.82rem;
}

.notes-library__permalink a {
    color: var(--accent);
    text-decoration: none;
}

.notes-library__permalink a:hover {
    text-decoration: underline;
}

.today-note-photos--notes {
    margin: 0.35rem 0 0.5rem;
}

/*
 * Browse previews — Notes page + Today “Shared with you” (note_library_card only).
 * Today — Yours uses `today-note-photos--daily` only; keep that compact separately.
 */
.today-note-photos.today-note-photos--browse {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--note-photo-browse-gap);
    row-gap: var(--note-photo-browse-row-gap);
    align-items: start;
    flex-wrap: unset !important;
}

@media (min-width: 768px) {
    .today-note-photos.today-note-photos--browse {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.today-note-photos--browse .today-note-photos__item--browse {
    flex: unset !important;
    min-width: 0 !important;
    max-width: none !important;
    border-radius: 0.65rem;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
}

.today-note-photos--browse .photo-lightbox-trigger {
    width: 100%;
    height: auto;
    min-height: 5rem;
    padding: 0.35rem;
    border-radius: inherit;
    box-sizing: border-box;
}

.today-note-photos--browse .today-note-photos__img {
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    object-position: center;
    border-radius: 0.45rem;
}

/* Today inline photos */
.today-note-photos {
    list-style: none;
    margin: 0.65rem 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.today-note-photos__item {
    margin: 0;
    flex: 1 1 42%;
    min-width: 6rem;
    max-width: 100%;
}

.today-note-photos__img {
    display: block;
    width: 100%;
    height: auto;
    max-height: var(--note-photo-preview-max-h);
    object-fit: var(--note-photo-preview-fit);
    border-radius: var(--note-photo-preview-radius);
    border: 1px solid var(--border);
    background: var(--bg);
}

/* Thumbnails: tap opens lightbox only (not navigation). Inner img ignores pointer so the button receives taps. */
.photo-lightbox-trigger {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    font: inherit;
    cursor: zoom-in;
    border-radius: var(--note-photo-preview-radius);
    text-align: inherit;
    -webkit-tap-highlight-color: transparent;
}

.photo-lightbox-trigger:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.photo-lightbox-trigger .today-note-photos__img,
.photo-lightbox-trigger .note-detail__photo {
    pointer-events: none;
}

.notes-library__card-photos {
    margin: 0 0 0.55rem;
}

.notes-library__card > .notes-library__card-photos {
    margin-top: 0;
}

.note-detail__photo-trigger {
    max-width: 36rem;
}

/* Full-screen image viewer (dialog); text stays on the page underneath. */
.photo-lightbox {
    padding: 0;
    border: none;
    margin: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    background: transparent;
    box-sizing: border-box;
}

.photo-lightbox::backdrop {
    background: rgba(18, 16, 14, 0.92);
    cursor: zoom-out;
}

.photo-lightbox__panel {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100dvh;
    padding: 3.25rem 0.75rem 1.25rem;
    box-sizing: border-box;
}

.photo-lightbox__img {
    display: block;
    max-width: 100%;
    max-height: calc(100dvh - 4.75rem);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 0.35rem;
    box-shadow: 0 0.25rem 2rem rgba(0, 0, 0, 0.35);
}

.photo-lightbox__close {
    position: fixed;
    top: max(0.65rem, env(safe-area-inset-top, 0px));
    right: max(0.65rem, env(safe-area-inset-right, 0px));
    z-index: 1;
    margin: 0;
    padding: 0.35rem 0.65rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 0.4rem;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font: inherit;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.photo-lightbox__close:hover {
    background: rgba(0, 0, 0, 0.55);
}

.photo-lightbox__close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.today-photo-status {
    margin: 0.35rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
    min-height: 1.25rem;
}

.today-photo-error {
    margin-top: 0.5rem;
}

.today-photo-error[hidden] {
    display: none !important;
}

/* Note detail + helpers */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.note-detail {
    margin-top: 0.25rem;
}

.note-detail__date {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.note-detail__author {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.note-detail__body {
    font-size: 1rem;
    line-height: 1.5;
    word-break: break-word;
}

.note-detail__photos {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.note-detail__photo {
    display: block;
    width: 100%;
    max-width: 36rem;
    height: auto;
    object-fit: contain;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background: var(--bg);
}

.note-detail__photo-item .photo-lightbox-trigger {
    border-radius: 0.5rem;
}

/* Notes list */
.empty-state {
    color: var(--muted);
    margin: 0;
}

.empty-state a {
    color: var(--accent);
}

.login-footnote {
    margin: 1.25rem 0 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--muted);
}

.login-footnote a {
    color: var(--accent);
}

/* Public home (/) — signed-out marketing shell for OAuth / store verification */
.public-home {
    max-width: 36rem;
    margin: 0 auto;
    padding: 1rem 1rem 2rem;
    border-radius: 1rem;
    background:
        linear-gradient(
            165deg,
            rgba(216, 243, 220, 0.85) 0%,
            rgba(216, 243, 220, 0.35) 38%,
            transparent 62%
        ),
        linear-gradient(180deg, rgba(255, 255, 255, 0.65) 0%, transparent 45%);
    border: 1px solid rgba(45, 106, 79, 0.12);
    box-shadow: 0 8px 28px rgba(45, 106, 79, 0.08);
}

.public-home__hero {
    text-align: center;
    margin-bottom: 1.75rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(45, 106, 79, 0.18);
}

.public-home__logo {
    display: block;
    width: 4.5rem;
    height: 4.5rem;
    margin: 0 auto 0.85rem;
    border-radius: 1rem;
    object-fit: cover;
    box-shadow:
        0 4px 16px rgba(45, 106, 79, 0.2),
        0 0 0 3px rgba(255, 255, 255, 0.9);
}

.public-home__brand {
    margin: 0;
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--accent);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.public-home__tagline {
    margin: 0.65rem 0 0;
    font-size: 0.98rem;
    line-height: 1.55;
    color: #234036;
    font-weight: 600;
    max-width: 28rem;
    margin-left: auto;
    margin-right: auto;
}

.public-home__tagline--secondary {
    margin-top: 0.5rem;
    font-weight: 400;
    color: var(--muted);
}

.public-home__section {
    margin-bottom: 1.35rem;
    padding: 0.85rem 0.9rem;
    background: rgba(255, 255, 255, 0.72);
    border-radius: 0.65rem;
    border: 1px solid rgba(45, 106, 79, 0.1);
}

.public-home__h2 {
    margin: 0 0 0.45rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
    padding-bottom: 0.25rem;
    border-bottom: 2px solid var(--accent-soft);
}

.public-home__section p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text);
}

.public-home__list {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text);
}

.public-home__list li {
    margin-bottom: 0.35rem;
}

.public-home__list li strong {
    color: #234036;
}

.public-home__section a {
    color: var(--accent);
    font-weight: 600;
}

.public-home__cta {
    margin: 1.75rem 0 0;
    text-align: center;
}

.public-home__cta .btn--primary {
    box-shadow: 0 4px 14px rgba(45, 106, 79, 0.28);
}

.note-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.note-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem;
}

.note-card__time {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.note-card__body {
    font-size: 0.95rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.note-card__badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 0.15rem 0.45rem;
    border-radius: 0.35rem;
    margin-bottom: 0.35rem;
}

.share-fieldset {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem 1rem;
    margin: 0 0 1rem;
    background: var(--surface);
}

.share-fieldset__legend {
    font-weight: 600;
    padding: 0 0.35rem;
}

.share-fieldset__hint {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.share-check {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    font-size: 0.95rem;
    cursor: pointer;
}

.share-check input {
    margin-top: 0.25rem;
}

.stack-actions {
    margin-bottom: 1rem;
}

.stack-top {
    margin-top: 1.25rem;
}

.sub-nav {
    margin: 0 0 1rem;
}

.sub-nav a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.sub-nav a:hover {
    text-decoration: underline;
}

.group-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.group-card {
    background: var(--surface);
    border: none;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.045);
}

.group-card__link {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.875rem 1rem;
    text-decoration: none;
    color: inherit;
}

.group-card__link:active {
    background: var(--bg);
}

.group-card__title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.group-card__name {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    font-size: 1rem;
}

.group-card__badge {
    flex-shrink: 0;
    min-width: 1.05rem;
    padding: 0.12rem 0.35rem;
    border-radius: 999px;
    background: var(--accent);
    color: var(--surface);
    font-size: 0.62rem;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: 0.02em;
    opacity: 0.88;
}

.group-card__meta {
    font-size: 0.8125rem;
    color: var(--muted);
}

.group-invites-pending__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.group-invites-pending__card {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.875rem 1rem;
    background: var(--surface);
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.045);
}

@media (min-width: 36rem) {
    .group-invites-pending__card {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.group-invites-pending__group {
    display: block;
    font-weight: 600;
    font-size: 1rem;
}

.group-invites-pending__meta {
    display: block;
    font-size: 0.8125rem;
    color: var(--muted);
    margin-top: 0.2rem;
}

.group-invites-pending__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.group-invites-pending__form {
    display: inline;
}

.detail-section {
    margin-bottom: 1.125rem;
}

.detail-section__title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.detail-section__subtitle {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem;
}

.group-detail-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.65rem;
}

.group-detail-header__title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.35rem;
    line-height: 1.25;
}

.group-detail-header__role {
    font-weight: 600;
    margin: 0 0 0.35rem;
}

.group-detail-header__helper {
    margin-bottom: 0;
}

.group-invitations-stack {
    margin-top: 1.25rem;
}

.group-lifecycle-delete {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.member-list,
.invite-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.member-list__item,
.invite-list__item {
    padding: 0.28rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9375rem;
}

.member-list__item:last-child,
.invite-list__item:last-child {
    border-bottom: none;
}

.member-list__primary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
}

.member-list__badge {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 0.15rem 0.45rem;
    border-radius: 0.35rem;
}

.member-list__meta {
    margin: 0.2rem 0 0;
    font-size: 0.8125rem;
    color: var(--muted);
    line-height: 1.35;
}

.member-list__item--admin {
    padding-bottom: 0.5rem;
}

.detail-section--highlight {
    scroll-margin-top: 4rem;
}

.muted-note {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.4;
}

.invite-request-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.invite-request-list__item {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.invite-request-list__item:last-child {
    border-bottom: none;
}

.invite-request-list__email {
    margin: 0;
    font-weight: 500;
    word-break: break-all;
}

.invite-request-list__meta {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
    color: var(--muted);
}

.invite-request-list__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.inline-form-row {
    display: inline;
    margin: 0;
}

.btn--small {
    font-size: 0.85rem;
    padding: 0.35rem 0.65rem;
}

.profile-block {
    margin: 0 0 1.25rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
}

.profile-block__label {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.25rem;
}

.profile-block__name {
    font-weight: 600;
    font-size: 1.1rem;
}

/* Me tab — calm sections */
.me-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.me-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.me-section__heading {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 0.85rem;
    color: var(--text);
}

.me-export-list {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.me-export-list__item {
    margin: 0;
    padding: 0.65rem 0 0;
    border-top: 1px solid var(--border);
}

.me-export-list__meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.me-export-list__status {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
}

.me-export-list__time {
    font-size: 0.78rem;
    color: var(--muted);
}

.me-export-list__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.45rem;
}

.me-export-list__delete-form {
    margin: 0;
    padding: 0;
    display: inline;
}

.me-export-list__download {
    margin-top: 0;
}

.me-export-list__err {
    margin: 0.35rem 0 0;
    font-size: 0.82rem;
}

.me-section__subheading {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 1.25rem 0 0.65rem;
    color: var(--text);
}

.me-dl {
    margin: 0 0 1.25rem;
}

.me-dl__row {
    display: grid;
    grid-template-columns: minmax(5rem, 7rem) 1fr;
    gap: 0.35rem 0.75rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
}

.me-dl__row:last-child {
    border-bottom: none;
}

.me-dl__dt {
    margin: 0;
    color: var(--muted);
    font-weight: 500;
}

.me-dl__dd {
    margin: 0;
    word-break: break-word;
}

.me-form .note-form__label {
    margin-top: 0.75rem;
}

.me-form .note-form__label:first-child,
.me-form .me-section__subheading + .note-form__label {
    margin-top: 0;
}

.me-form__select {
    margin-bottom: 0.35rem;
}

.me-check {
    display: flex;
    gap: 0.55rem;
    align-items: flex-start;
    margin: 0.85rem 0 0;
    font-size: 0.92rem;
    line-height: 1.4;
    color: var(--text);
    cursor: pointer;
}

.me-check input {
    margin-top: 0.2rem;
}

.me-form__submit {
    margin-top: 1rem;
}

.me-muted {
    margin: 0 0 0.85rem;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.45;
}

.me-muted em {
    font-style: italic;
}

.me-notifications__autosave {
    margin: 0.35rem 0 0.9rem;
}

.me-notifications__item {
    margin: 0.75rem 0 0;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 0.55rem;
}

.me-notifications__item .me-check {
    margin-top: 0;
}

.me-notifications__item .me-notifications__hint {
    margin: 0.4rem 0 0;
}

.me-notifications__hint {
    margin-top: 0.35rem;
}

.me-push-status {
    margin: 0.65rem 0 0;
    font-size: 0.88rem;
    color: var(--muted);
    min-height: 1.25rem;
}

.me-notifications__status {
    margin-top: 0.85rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.me-dialog {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.15rem;
    max-width: 22rem;
    background: var(--surface);
    color: var(--text);
}

.me-dialog::backdrop {
    background: rgba(0, 0, 0, 0.35);
}

.me-dialog__title {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.me-dialog__body {
    margin: 0 0 1rem;
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--muted);
}

.me-dialog__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Lightweight setup tips (header ⓘ → modal); not a full help center */
.th-setup-tips-dialog {
    position: relative;
    max-width: min(28rem, calc(100vw - 2rem));
    max-height: min(85vh, 38rem);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 1.15rem 1.25rem 1rem;
}

.th-setup-tips-dialog__x {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    z-index: 1;
    width: 2.25rem;
    height: 2.25rem;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0.35rem;
    background: transparent;
    color: var(--muted);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition:
        color 0.15s ease,
        background-color 0.15s ease;
}

.th-setup-tips-dialog__x:hover {
    color: var(--text);
    background: rgba(15, 23, 42, 0.06);
}

.th-setup-tips-dialog__x:focus-visible {
    outline: 2px solid rgba(45, 106, 79, 0.42);
    outline-offset: 2px;
}

.th-setup-tips-dialog__title {
    margin: 0 2.25rem 0.4rem 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
}

.th-setup-tips-dialog__lede {
    margin: 0 0 1rem;
    font-size: 0.875rem;
    line-height: 1.48;
    color: var(--muted);
}

.th-setup-tips__list {
    margin: 0;
    padding-left: 1.35rem;
}

.th-setup-tips__item {
    margin: 0 0 1rem;
    padding-left: 0.35rem;
}

.th-setup-tips__item:last-child {
    margin-bottom: 0;
}

.th-setup-tips__label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
    color: var(--text);
}

.th-setup-tips__text {
    margin: 0 0 0.45rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text);
}

.th-setup-tips__links {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.45;
}

.th-setup-tips__links a {
    color: var(--accent);
    text-decoration: none;
}

.th-setup-tips__links a:hover {
    text-decoration: underline;
}

.th-setup-tips__links-sep {
    color: var(--muted);
    padding: 0 0.35rem;
}

.th-setup-tips-dialog__footer {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}

/* Bottom navigation */
.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--nav-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    z-index: 20;
}

.bottom-nav__link {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.8rem;
}

.bottom-nav__link.is-active {
    color: var(--accent);
    box-shadow: inset 0 2px 0 var(--accent);
}

.bottom-nav__link:active {
    background: var(--bg);
}

.bottom-nav__labelWrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    max-width: 100%;
}

.bottom-nav__badge {
    flex-shrink: 0;
    min-width: 0.95rem;
    padding: 0.1rem 0.28rem;
    border-radius: 999px;
    background: var(--accent);
    color: var(--surface);
    font-size: 0.58rem;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: 0.01em;
    opacity: 0.82;
}

.bottom-nav__link.is-active .bottom-nav__badge {
    opacity: 0.9;
}

@media (min-width: 480px) {
    .btn {
        width: auto;
        min-width: 8rem;
    }
}

/* Static legal / policy pages */
.policy-doc {
    max-width: 40rem;
    margin: 0 auto;
    padding: 0 1rem 2rem;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text);
}

.policy-doc__meta {
    color: var(--muted);
    font-size: 0.88rem;
}

.policy-doc__rule {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.25rem 0;
}

.policy-doc__h2 {
    font-size: 1.1rem;
    margin: 1.35rem 0 0.5rem;
    font-weight: 700;
    color: var(--text);
}

.policy-doc__h3 {
    font-size: 1rem;
    margin: 1rem 0 0.4rem;
    font-weight: 600;
    color: var(--text);
}

.policy-doc ul {
    margin: 0.35rem 0 0.75rem;
    padding-left: 1.25rem;
}

.policy-doc li {
    margin-bottom: 0.35rem;
}

.policy-doc__table-wrap {
    overflow-x: auto;
    margin: 0.75rem 0 1rem;
    -webkit-overflow-scrolling: touch;
}

.policy-doc__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.35rem;
}

.policy-doc__table th,
.policy-doc__table td {
    padding: 0.45rem 0.55rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}

.policy-doc__table thead th {
    background: var(--bg);
    font-weight: 600;
}

.policy-doc__table tbody tr:last-child td {
    border-bottom: none;
}

.policy-doc code {
    font-size: 0.88em;
    background: var(--bg);
    padding: 0.08rem 0.28rem;
    border-radius: 0.2rem;
}

.policy-doc a {
    color: var(--accent);
}

.policy-doc__legal-note {
    margin-top: 1rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.policy-doc__footer-note {
    font-size: 0.9rem;
    color: var(--muted);
}

.policy-doc__copyright {
    margin: 0.75rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
    text-align: center;
}

/* Internal MCP token issuance (/internal/mcp/token/issue) */
.mcp-issue {
    max-width: 36rem;
    margin: 0 auto;
    padding: 0 0 1.5rem;
}

.mcp-issue-panel {
    margin-top: 1.25rem;
    padding: 1rem 1.1rem;
    background: var(--surface-elevated, #fff);
    border: 1px solid var(--hairline, rgba(0, 0, 0, 0.08));
    border-radius: 12px;
}

.mcp-issue-panel__title {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
}

.mcp-issue-lede,
.mcp-issue-help {
    margin: 0 0 0.75rem;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.mcp-issue-form.note-form {
    margin-top: 0.5rem;
}

.mcp-issue-success-banner {
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    background: rgba(45, 106, 79, 0.12);
    border: 1px solid rgba(45, 106, 79, 0.35);
    border-radius: 10px;
    font-size: 0.95rem;
    line-height: 1.45;
}

.mcp-issue-token-row {
    margin-top: 0.75rem;
}

.mcp-issue-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--muted);
}

.mcp-issue-token-field {
    width: 100%;
    box-sizing: border-box;
    padding: 0.65rem 0.75rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.85rem;
    border: 1px solid var(--hairline, rgba(0, 0, 0, 0.12));
    border-radius: 8px;
    background: var(--surface, #fafafa);
}

.mcp-issue-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.mcp-issue-op {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--hairline, rgba(0, 0, 0, 0.08));
}

.mcp-issue-op__label {
    margin: 0 0 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
}

.mcp-issue-op__hint {
    margin: 0.5rem 0 0;
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.4;
}

.mcp-issue-op__hint a {
    color: var(--accent);
}

.mcp-issue-footer-actions {
    margin-top: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.mcp-issue-metadata__loading,
.mcp-issue-metadata__empty {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.mcp-issue-meta-list {
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.mcp-issue-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--hairline, rgba(0, 0, 0, 0.06));
    font-size: 0.88rem;
    line-height: 1.45;
}

.mcp-issue-meta-row:last-child {
    border-bottom: none;
}

.mcp-issue-meta-row__main {
    flex: 1 1 12rem;
    min-width: 0;
}

.mcp-issue-meta-actions {
    flex: 0 0 auto;
}

.mcp-issue-meta-label {
    color: var(--muted);
    font-size: 0.85rem;
}
