/* ==========================================================================
   CalorieEon — warm health journal design system
   Canvas: #F6F2E9 · Ink: #173A32 · Coral: #F16F56 · Sage: #DDEBE1
   ========================================================================== */

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

:root {
    --canvas: #f6f2e9;
    --canvas-deep: #efe7d8;
    --surface: #fffdf8;
    --surface-soft: #fbf7ee;
    --surface-tint: #f7f2e6;
    --ink: #173a32;
    --ink-soft: #365148;
    --muted: #5e6a62;
    --muted-soft: #78847b;
    --coral: #f16f56;
    --coral-strong: #c2472f;
    --coral-deep: #c04a34;
    --coral-soft: #fbe4dd;
    --sage: #ddebe1;
    --sage-soft: #edf3ea;
    --sage-deep: #c5dccd;
    --gold: #e0b36a;
    --line: rgba(23, 58, 50, 0.13);
    --line-strong: rgba(23, 58, 50, 0.24);
    --glass: rgba(255, 253, 248, 0.72);
    --glass-strong: rgba(255, 253, 248, 0.9);
    --shadow-xs: 0 1px 2px rgba(23, 58, 50, 0.05);
    --shadow-sm: 0 6px 16px -10px rgba(23, 58, 50, 0.25);
    --shadow-md: 0 18px 40px -26px rgba(23, 58, 50, 0.38);
    --shadow-lg: 0 36px 80px -40px rgba(23, 58, 50, 0.45);
    --radius-xs: 10px;
    --radius-sm: 14px;
    --radius-md: 18px;
    --radius-lg: 24px;
    --radius-xl: 30px;
    --nav-h: 72px;
    --font-sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Source Han Sans SC",
        -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia,
        "Songti SC", serif;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --dur-1: 160ms;
    --dur-2: 240ms;
    --dur-3: 380ms;
}

html {
    background: var(--canvas);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100dvh;
    color: var(--ink);
    background:
        radial-gradient(1100px 700px at 6% -12%, #fdfaf1 0%, rgba(253, 250, 241, 0) 58%),
        radial-gradient(900px 720px at 102% 4%, rgba(241, 111, 86, 0.1) 0%, rgba(241, 111, 86, 0) 55%),
        radial-gradient(900px 900px at 50% 108%, rgba(197, 220, 205, 0.38) 0%, rgba(197, 220, 205, 0) 62%),
        var(--canvas-deep);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    opacity: 0.5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.05'/%3E%3C/svg%3E");
}

img,
svg {
    display: block;
    max-width: 100%;
}

a {
    color: var(--coral-strong);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

h1,
h2,
h3,
h4,
p {
    margin: 0;
}

ul,
ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

:focus-visible {
    outline: 2px solid var(--coral);
    outline-offset: 2px;
}

::selection {
    background: rgba(241, 111, 86, 0.22);
}

/* --------------------------------------------------------------------------
   Ambient desktop backdrop + app shell
   -------------------------------------------------------------------------- */

.ambient {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.ambient-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
}

.ambient-blob--sage {
    width: 44vw;
    height: 44vw;
    min-width: 420px;
    min-height: 420px;
    top: -16vh;
    left: -12vw;
    background: radial-gradient(circle at 40% 40%, rgba(197, 220, 205, 0.55), rgba(197, 220, 205, 0) 68%);
}

.ambient-blob--coral {
    width: 40vw;
    height: 40vw;
    min-width: 380px;
    min-height: 380px;
    right: -14vw;
    bottom: -18vh;
    background: radial-gradient(circle at 50% 50%, rgba(241, 111, 86, 0.16), rgba(241, 111, 86, 0) 70%);
}

.app-shell {
    position: relative;
    width: 100%;
    max-width: 480px;
    min-height: 100dvh;
    margin: 0 auto;
    background:
        radial-gradient(120% 60% at 50% 0%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 60%),
        var(--canvas);
}

.app-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
}

.app-main {
    position: relative;
    z-index: 1;
    padding: 10px 18px calc(var(--nav-h) + 40px);
}

body.auth-page .app-main {
    padding-bottom: 34px;
}

/* --------------------------------------------------------------------------
   Brand + header
   -------------------------------------------------------------------------- */

.app-header {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 62px;
    padding: 14px 18px 10px;
    background: linear-gradient(180deg, rgba(246, 242, 233, 0.96) 30%, rgba(246, 242, 233, 0.82) 100%);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    backdrop-filter: blur(16px) saturate(1.2);
}

.app-header::after {
    content: "";
    position: absolute;
    right: 18px;
    bottom: 0;
    left: 18px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(23, 58, 50, 0.1), transparent);
    opacity: 0;
    transition: opacity var(--dur-2) ease;
}

.app-header.is-stuck::after {
    opacity: 1;
}

.brand {
    position: relative;
    display: inline-flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 8px;
    color: var(--ink);
    text-decoration: none;
}

.brand:hover .brand-word {
    color: var(--coral-strong);
}

.brand-sun {
    position: absolute;
    top: -13px;
    right: -9px;
    width: 38px;
    height: 21px;
    color: var(--coral);
    pointer-events: none;
}

.brand-word {
    font-family: var(--font-display);
    font-size: 25px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.035em;
    transition: color var(--dur-2) ease;
}

.brand-tagline {
    display: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-actions:empty {
    display: none;
}


.icon-btn {
    position: relative;
    display: inline-grid;
    width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: rgba(255, 253, 248, 0.72);
    color: var(--ink);
    box-shadow: var(--shadow-xs);
    transition: transform var(--dur-1) var(--ease), background-color var(--dur-2) ease,
        box-shadow var(--dur-2) ease;
    -webkit-tap-highlight-color: transparent;
}

.icon-btn .ui-icon {
    width: 20px;
    height: 20px;
    --icon-fill: transparent;
}

.icon-btn:hover {
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.icon-btn:active {
    transform: scale(0.94);
}

.icon-btn--accent {
    border-color: transparent;
    background: var(--coral);
    color: var(--surface);
}

.icon-btn--accent .ui-icon {
    --icon-fill: transparent;
}

/* Large centered lockup (AI coach, profile, auth) */
.app-header--stacked {
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 30px 18px 6px;
    text-align: center;
}

.app-header--stacked .brand {
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.app-header--stacked .brand-sun {
    top: -17px;
    right: 4px;
    width: 52px;
    height: 28px;
}

.app-header--stacked .brand-word {
    font-size: 31px;
}

.app-header--stacked .brand-tagline {
    display: block;
    margin-top: 7px;
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
}

.app-header--stacked .header-actions {
    position: absolute;
    top: 18px;
    right: 18px;
}

/* --------------------------------------------------------------------------
   Typography helpers
   -------------------------------------------------------------------------- */

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--coral-strong);
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.eyebrow .ui-icon {
    width: 16px;
    height: 16px;
}

.page-heading {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 6px 2px 16px;
}

.page-heading h1,
.greeting h1 {
    color: var(--ink);
    font-size: clamp(25px, 7vw, 30px);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.045em;
}

.page-heading p,
.greeting p {
    max-width: 100%;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.6;
}

.title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.title-bar {
    width: 5px;
    height: 26px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--coral), #f49a74);
    box-shadow: 0 4px 10px -4px rgba(241, 111, 86, 0.6);
}

.hand-note {
    position: relative;
    display: inline-block;
    color: var(--ink-soft);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.hand-note::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -5px;
    left: 0;
    height: 5px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 6'%3E%3Cpath d='M2 4c26-3 52-3 78 0 14 1.5 26 1.2 38-.6' fill='none' stroke='%23B08A6B' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E")
        center / 100% 100% no-repeat;
}

.squiggle {
    position: relative;
    display: inline-block;
    padding-bottom: 4px;
    white-space: nowrap;
}

.squiggle::after {
    content: "";
    position: absolute;
    right: 2px;
    bottom: -5px;
    left: 2px;
    height: 8px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 140 8'%3E%3Cpath d='M2 5.5C30 2.5 58 2.5 84 5c18 1.7 36 1.1 54-1.5' fill='none' stroke='%23F16F56' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E")
        center / 100% 100% no-repeat;
    opacity: 0.9;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 22px 2px 10px;
}

.section-head h2 {
    color: var(--ink);
    font-size: 16.5px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.section-head__meta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
    text-decoration: none;
}

.section-head__meta strong {
    color: var(--ink);
    font-weight: 800;
}

.section-head__meta .ui-icon {
    width: 14px;
    height: 14px;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 11.5px;
}

.strong {
    font-weight: 800;
}

/* --------------------------------------------------------------------------
   Icons
   -------------------------------------------------------------------------- */

.ui-icon {
    width: 22px;
    height: 22px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    --icon-fill: #eaf1e9;
    --icon-accent: var(--coral);
    --icon-on-accent: var(--surface);
}

.icon-tile {
    display: grid;
    width: 44px;
    height: 44px;
    flex: none;
    place-items: center;
    border: 1px solid rgba(23, 58, 50, 0.12);
    border-radius: 14px;
    background: var(--sage-soft);
    color: var(--ink);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.icon-tile .ui-icon {
    width: 24px;
    height: 24px;
}

.icon-tile--coral {
    background: var(--coral-soft);
    color: var(--coral-strong);
}

.icon-tile--coral .ui-icon {
    --icon-fill: #fbe4dd;
    --icon-accent: #d9573f;
}

.icon-tile--sm {
    width: 36px;
    height: 36px;
    border-radius: 12px;
}

.icon-tile--sm .ui-icon {
    width: 20px;
    height: 20px;
}

/* --------------------------------------------------------------------------
   Bottom navigation
   -------------------------------------------------------------------------- */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    width: 100%;
    max-width: 480px;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(23, 58, 50, 0.12);
    background: rgba(249, 245, 236, 0.9);
    box-shadow: 0 -18px 40px -28px rgba(23, 58, 50, 0.45);
    -webkit-backdrop-filter: blur(24px) saturate(1.35);
    backdrop-filter: blur(24px) saturate(1.35);
    transform: translateX(-50%);
}

.nav-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 56px;
    padding: 6px 2px;
    border-radius: 16px;
    color: rgba(23, 58, 50, 0.6);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    transition: color var(--dur-2) ease, background-color var(--dur-2) ease,
        transform var(--dur-1) var(--ease);
    -webkit-tap-highlight-color: transparent;
}

.nav-item .ui-icon {
    width: 24px;
    height: 24px;
    --icon-fill: transparent;
    --icon-accent: currentColor;
    transition: transform var(--dur-2) var(--ease);
}

.nav-item:hover {
    color: var(--ink);
    background: rgba(255, 253, 248, 0.6);
}

.nav-item:active {
    transform: scale(0.95);
}

.nav-item.active {
    color: var(--ink);
    background: rgba(241, 111, 86, 0.12);
}

.nav-item.active .ui-icon {
    --icon-fill: #fbe4dd;
    --icon-accent: #d9573f;
    transform: translateY(-1px) scale(1.04);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-decoration: none;
    white-space: nowrap;
    transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-2) ease,
        background-color var(--dur-2) ease, border-color var(--dur-2) ease;
    -webkit-tap-highlight-color: transparent;
}

.btn .ui-icon {
    width: 19px;
    height: 19px;
    --icon-fill: transparent;
}

.btn-primary {
    border-color: rgba(255, 255, 255, 0.18);
    background: linear-gradient(180deg, #f4785f 0%, #ec6349 100%);
    color: var(--surface);
    box-shadow: 0 12px 24px -12px rgba(217, 87, 63, 0.7),
        inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.btn-primary:hover {
    box-shadow: 0 16px 28px -12px rgba(217, 87, 63, 0.72),
        inset 0 1px 0 rgba(255, 255, 255, 0.32);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: scale(0.975);
}

.btn-secondary {
    border-color: var(--line-strong);
    background: rgba(255, 253, 248, 0.78);
    color: var(--ink);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
    background: var(--surface);
    border-color: rgba(23, 58, 50, 0.36);
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: scale(0.975);
}

.btn-soft {
    border-color: transparent;
    background: var(--coral-soft);
    color: var(--coral-strong);
}

.btn-soft:hover {
    background: #fbd9cf;
}

.btn-ghost {
    border-color: transparent;
    background: transparent;
    color: var(--muted);
}

.btn-ghost:hover {
    color: var(--ink);
    background: rgba(23, 58, 50, 0.05);
}

.btn-danger {
    border-color: transparent;
    background: rgba(201, 95, 85, 0.12);
    color: #b04a41;
}

.btn-sm {
    min-height: 36px;
    padding: 0 14px;
    font-size: 12px;
}

.btn-lg {
    min-height: 52px;
    font-size: 15px;
}

.btn-block {
    width: 100%;
}

.btn:disabled,
.btn[disabled] {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.text-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border: 0;
    background: none;
    color: var(--coral-strong);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.text-link:hover {
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Cards, chips, lists
   -------------------------------------------------------------------------- */

.card {
    position: relative;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: linear-gradient(165deg, rgba(255, 253, 248, 0.97), rgba(250, 246, 236, 0.92));
    box-shadow: var(--shadow-xs), var(--shadow-md);
}

.card--flush {
    padding: 0;
    overflow: hidden;
}

.card--sage {
    border-color: rgba(23, 58, 50, 0.12);
    background: linear-gradient(160deg, rgba(237, 243, 234, 0.95), rgba(221, 235, 225, 0.78));
}

.card--coral {
    border-color: rgba(241, 111, 86, 0.22);
    background: linear-gradient(160deg, rgba(255, 246, 242, 0.97), rgba(251, 228, 221, 0.82));
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid rgba(23, 58, 50, 0.12);
    border-radius: 999px;
    background: rgba(255, 253, 248, 0.72);
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.chip .ui-icon {
    width: 14px;
    height: 14px;
    --icon-fill: transparent;
}

.chip--sage {
    border-color: transparent;
    background: var(--sage);
    color: var(--ink);
}

.chip--coral {
    border-color: transparent;
    background: var(--coral-soft);
    color: #a8402c;
}

.chip--ghost {
    background: transparent;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.divider {
    height: 1px;
    margin: 14px 0;
    border: 0;
    background: linear-gradient(90deg, transparent, rgba(23, 58, 50, 0.12), transparent);
}

.avatar {
    display: grid;
    width: 40px;
    height: 40px;
    flex: none;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--sage);
    color: var(--ink);
    font-weight: 800;
}

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

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

.empty-state {
    display: grid;
    gap: 8px;
    justify-items: center;
    padding: 30px 18px;
    color: var(--muted);
    text-align: center;
}

.empty-state .empty-icon {
    display: grid;
    width: 56px;
    height: 56px;
    place-items: center;
    border-radius: 20px;
    background: var(--sage-soft);
    color: var(--ink-soft);
}

.empty-state .empty-icon .ui-icon {
    width: 28px;
    height: 28px;
}

.empty-state .empty-title {
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
}

.empty-state .empty-subtitle {
    max-width: 28ch;
    font-size: 12px;
    line-height: 1.6;
}

.empty-state .btn {
    margin-top: 4px;
}

/* Progress */
.progress-track {
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(23, 58, 50, 0.09);
    box-shadow: inset 0 1px 2px rgba(23, 58, 50, 0.06);
}

.progress-bar,
.progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #f58a6a, var(--coral));
    box-shadow: 0 2px 8px -2px rgba(241, 111, 86, 0.6);
    transition: width 620ms var(--ease);
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.field {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 0 14px;
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: rgba(255, 253, 248, 0.72);
    transition: border-color var(--dur-2) ease, box-shadow var(--dur-2) ease,
        background-color var(--dur-2) ease;
}

.field:focus-within {
    border-color: var(--coral);
    background: var(--surface);
    box-shadow: 0 0 0 4px rgba(241, 111, 86, 0.13),
        0 10px 24px -18px rgba(241, 111, 86, 0.7);
}

.field > .ui-icon {
    width: 20px;
    height: 20px;
    color: var(--ink-soft);
    --icon-fill: transparent;
}

.field input {
    flex: 1;
    min-width: 0;
    padding: 15px 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
    font-size: 15px;
    line-height: 1.3;
}

.field input::placeholder {
    color: var(--muted-soft);
    font-weight: 500;
}

.field__divider {
    width: 1px;
    height: 18px;
    background: rgba(23, 58, 50, 0.14);
}

.field-toggle {
    display: grid;
    width: 34px;
    height: 34px;
    flex: none;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
}

.field-toggle:hover {
    color: var(--ink);
    background: rgba(23, 58, 50, 0.06);
}

.field-toggle .ui-icon {
    width: 19px;
    height: 19px;
    --icon-fill: transparent;
}

.form-group {
    display: grid;
    gap: 7px;
}

.form-group > label,
.form-label {
    color: var(--ink);
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.form-group > label .req {
    color: var(--coral);
}

.form-group input,
.form-group textarea,
.form-group select,
input[type="text"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea,
select {
    width: 100%;
    min-height: 50px;
    padding: 13px 14px;
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius-sm);
    outline: 0;
    background: rgba(255, 253, 248, 0.75);
    color: var(--ink);
    font-size: 14.5px;
    transition: border-color var(--dur-2) ease, box-shadow var(--dur-2) ease,
        background-color var(--dur-2) ease;
}

textarea {
    min-height: 120px;
    line-height: 1.65;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: var(--muted-soft);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--coral);
    background: var(--surface);
    box-shadow: 0 0 0 4px rgba(241, 111, 86, 0.13);
}

.field input,
.field input[type="text"],
.field input[type="tel"],
.field input[type="password"],
.field input[type="search"] {
    min-height: auto;
    padding: 15px 0;
    border: 0;
    border-radius: 0;
    outline: 0;
    background: transparent;
    box-shadow: none;
    font-size: 15px;
}

.field input:focus {
    border: 0;
    background: transparent;
    box-shadow: none;
}

.form-hint {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.55;
}

.error-message {
    color: #b04a41;
    font-size: 12px;
    font-weight: 600;
}

.form-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 13px;
    border: 1px solid rgba(201, 95, 85, 0.28);
    border-radius: var(--radius-sm);
    background: rgba(201, 95, 85, 0.08);
    color: #a3463d;
    font-size: 12.5px;
    font-weight: 600;
}

.form-error:empty {
    display: none;
}

/* --------------------------------------------------------------------------
   Toasts, modals, utility
   -------------------------------------------------------------------------- */

.toast-stack {
    position: fixed;
    left: 50%;
    bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom));
    z-index: 120;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(420px, calc(100vw - 32px));
    transform: translateX(-50%);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--glass-strong);
    box-shadow: var(--shadow-md);
    color: var(--ink);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.5;
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    backdrop-filter: blur(18px) saturate(1.2);
    animation: toast-in 320ms var(--ease) both;
    pointer-events: auto;
}

.toast .ui-icon {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    color: var(--coral-strong);
    --icon-fill: transparent;
}

.toast--success {
    border-color: rgba(111, 158, 127, 0.3);
}

.toast--success .ui-icon {
    color: #4f7d5f;
}

.toast--error {
    border-color: rgba(201, 95, 85, 0.3);
}

.toast--error .ui-icon {
    color: #b04a41;
}

.toast.is-leaving {
    animation: toast-out 220ms ease both;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 130;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(23, 58, 50, 0.42);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.modal.is-open,
.modal.active {
    display: flex;
}

.modal-content {
    position: relative;
    width: min(420px, 100%);
    padding: 22px;
    border: 1px solid var(--glass-strong);
    border-radius: var(--radius-xl);
    background: var(--glass-strong);
    box-shadow: var(--shadow-lg);
    animation: pop-in 320ms var(--ease) both;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: grid;
    width: 36px;
    height: 36px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    color: var(--ink);
}

.modal-close .ui-icon {
    width: 18px;
    height: 18px;
    --icon-fill: transparent;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
}

.hidden {
    display: none !important;
}

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(6px) scale(0.98);
    }
}

@keyframes pop-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes soft-pulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(241, 111, 86, 0.28);
    }
    50% {
        box-shadow: 0 0 0 7px rgba(241, 111, 86, 0);
    }
}

.rise {
    animation: rise-in 460ms var(--ease) both;
}

.rise--1 {
    animation-delay: 40ms;
}

.rise--2 {
    animation-delay: 90ms;
}

.rise--3 {
    animation-delay: 140ms;
}

.rise--4 {
    animation-delay: 190ms;
}

@media (min-width: 640px) {
    body {
        padding: 26px 0;
    }

    .app-shell {
        min-height: calc(100dvh - 52px);
        border-radius: 36px;
        box-shadow: 0 50px 120px -50px rgba(23, 58, 50, 0.5),
            0 0 0 1px rgba(255, 255, 255, 0.55);
    }

    .app-header {
        border-radius: 36px 36px 0 0;
    }

    .bottom-nav {
        bottom: 26px;
        width: min(448px, calc(100vw - 40px));
        border: 1px solid rgba(23, 58, 50, 0.13);
        border-radius: 24px;
    }

    .toast-stack {
        bottom: 112px;
    }

    .app-main {
        padding-right: 22px;
        padding-left: 22px;
    }
}

/* --------------------------------------------------------------------------
   App-height scroll shell
   The document stays at viewport height; only .app-main scrolls. This keeps
   the header and bottom navigation in place and avoids content bleeding
   through the sticky header on long pages.
   -------------------------------------------------------------------------- */

html,
body {
    height: 100%;
}

body {
    overflow: hidden;
}

.app-shell {
    display: flex;
    height: 100vh;
    height: var(--app-height, 100dvh);
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
}

.app-header {
    position: relative;
    top: auto;
    flex: 0 0 auto;
    background: linear-gradient(180deg, #fbf8f0 0%, var(--canvas) 100%);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.app-header::after {
    opacity: 0.55;
}

.app-main {
    flex: 1 1 auto;
    min-height: 0;
    padding-bottom: 24px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(23, 58, 50, 0.22) transparent;
}

.app-main::-webkit-scrollbar {
    width: 4px;
}

.app-main::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(23, 58, 50, 0.18);
}

.bottom-nav {
    position: relative;
    bottom: auto;
    left: auto;
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    transform: none;
}

@media (min-width: 640px) {
    body {
        height: 100dvh;
        padding: 26px 0;
    }

    .app-shell {
        height: calc(var(--app-height, 100dvh) - 52px);
        min-height: 0;
    }

    .app-main {
        padding-bottom: 24px;
    }

    .bottom-nav {
        bottom: auto;
        width: 100%;
        max-width: none;
        border-radius: 0 0 36px 36px;
    }

    .toast-stack {
        bottom: calc(26px + var(--nav-h) + 24px + env(safe-area-inset-bottom));
    }

    .compose-fab {
        bottom: calc(26px + var(--nav-h) + 20px + env(safe-area-inset-bottom));
    }
}

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