/* =========================================================
   Wellness Tracking - Design System
   Clean clinical surfaces - measured color - practical density
   ========================================================= */

/* ---------- 1. Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&display=swap');

/* ---------- 2. Design Tokens ---------- */
:root {
    /* Brand palette */
    --sage-50:  #f0fdfa;
    --sage-100: #ccfbf1;
    --sage-200: #99f6e4;
    --sage-300: #5eead4;
    --sage-400: #2dd4bf;
    --sage-500: #14b8a6;
    --sage-600: #0d9488;
    --sage-700: #0f766e;
    --sage-800: #115e59;
    --sage-900: #134e4a;

    --cream:    #f7f8fb;
    --cream-2:  #eef3f1;
    --ink:      #18231f;
    --ink-2:    #2d3d37;
    --muted:    #60706a;
    --muted-2:  #8b9893;
    --line:     #dfe7e4;
    --line-2:   #edf2f0;

    --coral:    #fb7185;
    --coral-2:  #f43f5e;
    --amber:    #f59e0b;
    --lilac:    #a78bfa;
    --sky:      #38bdf8;

    /* Semantic */
    --primary:        var(--sage-600);
    --primary-hover:  var(--sage-700);
    --primary-soft:   var(--sage-50);
    --accent:         var(--coral);
    --success:        #10b981;
    --warning:        var(--amber);
    --danger:         #ef4444;
    --info:           var(--sky);

    /* Surfaces */
    --bg:             var(--cream);
    --surface:        #ffffff;
    --surface-2:      #fcfdfb;

    /* Effects */
    --radius-sm: 6px;
    --radius:    8px;
    --radius-lg: 8px;
    --radius-xl: 8px;

    --shadow-xs: 0 1px 2px rgba(15, 42, 38, 0.04);
    --shadow-sm: 0 2px 8px rgba(15, 42, 38, 0.06);
    --shadow:    0 8px 24px rgba(15, 42, 38, 0.08);
    --shadow-lg: 0 24px 60px -20px rgba(15, 42, 38, 0.18);

    /* Type */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Fraunces', 'Inter', Georgia, serif;

    /* Motion */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- 3. Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body.app-body {
    background:
        linear-gradient(180deg, #ffffff 0, var(--cream) 360px),
        var(--cream);
    background-attachment: fixed;
}

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

a { color: var(--primary); text-decoration: none; transition: color 0.2s var(--ease); }
a:hover { color: var(--primary-hover); text-decoration: none; }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    color: var(--ink);
    margin: 0 0 0.4em;
    letter-spacing: 0;
    line-height: 1.2;
    font-weight: 600;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; color: var(--ink-2); }

::selection { background: var(--sage-200); color: var(--sage-900); }

/* ---------- Public homepage ---------- */
.home-body {
    background: var(--cream);
    color: var(--ink);
}

.home-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 24px;
    padding: 16px 32px;
    color: #fff;
    background: linear-gradient(180deg, rgba(10, 36, 32, 0.72), rgba(10, 36, 32, 0));
}
.home-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
}
.home-brand:hover { color: #fff; }
.home-brand__mark {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(12px);
}
.home-brand__mark svg { width: 20px; height: 20px; }
.home-nav__links {
    display: flex;
    justify-content: center;
    gap: 24px;
}
.home-nav__links a {
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.9rem;
    font-weight: 600;
}
.home-nav__links a:hover { color: #fff; }
.home-nav__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.home-hero {
    position: relative;
    min-height: 92vh;
    display: flex;
    align-items: center;
    overflow: hidden;
    background: #153c37;
}
.home-hero__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}
.home-hero__overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(11, 35, 31, 0.92) 0%, rgba(11, 35, 31, 0.78) 36%, rgba(11, 35, 31, 0.16) 72%),
        linear-gradient(180deg, rgba(11, 35, 31, 0.26) 0%, rgba(11, 35, 31, 0.08) 54%, rgba(247, 248, 251, 1) 100%);
}
.home-hero__content {
    position: relative;
    z-index: 1;
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto;
    padding: 110px 0 76px;
}
.home-eyebrow {
    margin: 0 0 12px;
    color: var(--sage-200);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.home-hero h1 {
    max-width: 620px;
    color: #fff;
    font-size: clamp(3rem, 7vw, 6.2rem);
    line-height: 0.96;
    margin: 0 0 20px;
}
.home-hero__copy {
    max-width: 560px;
    color: rgba(255, 255, 255, 0.86);
    font-size: 1.12rem;
    margin-bottom: 26px;
}
.home-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 34px;
}
.home-hero__metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 170px));
    gap: 12px;
}
.home-hero__metrics span {
    min-height: 82px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(14px);
    font-size: 0.82rem;
}
.home-hero__metrics strong {
    display: block;
    color: #fff;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.home-section {
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto;
    padding: 78px 0;
    min-width: 0;
}
.home-section--intro { padding-top: 68px; }
.home-section__head {
    max-width: 720px;
    margin-bottom: 28px;
}
.home-section__head .home-eyebrow,
.home-split .home-eyebrow,
.home-panel .home-eyebrow {
    color: var(--primary);
}
.home-section h2,
.home-split h2,
.home-panel h2 {
    font-size: clamp(2rem, 4vw, 3.1rem);
    line-height: 1.04;
    margin-bottom: 14px;
}
.home-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
}
.home-feature {
    min-height: 250px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}
.home-feature__icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: var(--sage-700);
    background: var(--sage-50);
    margin-bottom: 18px;
}
.home-feature__icon svg { width: 21px; height: 21px; }
.home-feature h3 {
    font-family: var(--font-sans);
    font-size: 1.05rem;
    margin-bottom: 8px;
}
.home-feature p { color: var(--muted); margin: 0; }

.home-split {
    display: grid;
    grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
    gap: 42px;
    align-items: start;
    border-top: 1px solid var(--line);
    min-width: 0;
}
.home-split__content {
    position: sticky;
    top: 96px;
    min-width: 0;
    /* Avoid an orphaned pinned column when the right column is much taller.
       Align the sticky content with the top of the first flow step. */
    align-self: start;
}
.home-split p {
    max-width: 520px;
    color: var(--muted);
}
.home-flow {
    display: grid;
    gap: 14px;
    min-width: 0;
}
.home-flow__item {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 4px 16px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    min-width: 0;
    box-shadow: var(--shadow-xs);
}
.home-flow__item span {
    grid-row: 1 / span 2;
    grid-column: 1;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--ink);
    color: #fff;
    font-weight: 800;
    font-size: 0.8rem;
}
.home-flow__item strong {
    grid-column: 2;
    display: block;
    margin-bottom: 0;
    color: var(--ink);
    font-size: 1rem;
    overflow-wrap: break-word;
}
.home-flow__item p {
    grid-column: 2;
    margin: 0;
    color: var(--muted);
    overflow-wrap: break-word;
}

@media (min-width: 769px) and (max-width: 1120px) {
    .home-section {
        width: min(1000px, calc(100% - 40px));
    }

    .home-split {
        grid-template-columns: 1fr;
        gap: 26px;
    }

    .home-split__content {
        position: static;
        max-width: 760px;
    }

    .home-split p {
        max-width: 680px;
    }

    .home-flow {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .home-flow__item {
        grid-template-columns: 1fr;
        align-content: start;
    }
}

@media (min-width: 769px) and (max-width: 920px) {
    .home-flow {
        grid-template-columns: 1fr;
    }

    .home-flow__item {
        grid-template-columns: 52px minmax(0, 1fr);
    }
}

.home-operations {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    align-items: stretch;
    padding-bottom: 92px;
}
.home-panel {
    padding: 34px;
    border-radius: 8px;
    background: #173f3b;
}
.home-panel h2 { color: #fff; }
.home-panel p:not(.home-eyebrow) {
    color: rgba(255, 255, 255, 0.78);
    margin-bottom: 0;
}
.home-ops-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.home-ops-grid div {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}
.home-ops-grid strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1rem;
}
.home-ops-grid span {
    color: var(--muted);
    font-size: 0.9rem;
}
.home-footer {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 24px 32px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    background: #fff;
    font-size: 0.86rem;
}

/* ---------- 4. App Shell (sidebar + topbar) ---------- */
.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbf9 100%);
    border-right: 1px solid var(--line);
    padding: 24px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 12px;
    border-bottom: 1px solid var(--line-2);
    margin-bottom: 6px;
    text-decoration: none;
    min-width: 0;
}
.app-brand__mark {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--sage-500), var(--sage-700));
    display: grid; place-items: center;
    color: #fff;
    box-shadow: 0 6px 16px -6px rgba(13, 148, 136, 0.5);
    flex: 0 0 36px;
}
.app-brand__text {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
}
.app-brand__name {
    display: block;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1.15;
    color: var(--ink);
    letter-spacing: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}
.app-brand__tag {
    display: block;
    font-size: 0.7rem;
    line-height: 1.3;
    color: var(--muted-2);
    font-family: var(--font-sans);
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    max-width: 100%;
    overflow-wrap: anywhere;
}
.app-brand__mark svg { width: 20px; height: 20px; }

@media (min-width: 769px) and (max-width: 1080px) {
    .app-shell {
        grid-template-columns: 232px minmax(0, 1fr);
    }

    .app-sidebar {
        padding: 22px 14px;
    }

    .app-brand {
        gap: 8px;
        padding-inline: 6px;
    }

    .app-brand__name {
        font-size: 1.08rem;
    }

    .app-brand__tag {
        font-size: 0.65rem;
    }

    .app-nav a {
        padding-inline: 10px;
    }
}

.app-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.app-nav__section {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-2);
    padding: 14px 12px 6px;
    font-weight: 600;
}
.app-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--ink-2);
    font-weight: 500;
    font-size: 0.92rem;
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.app-nav a:hover { background: var(--sage-50); color: var(--sage-800); text-decoration: none; }
.app-nav a.is-active {
    background: var(--sage-50);
    color: var(--sage-800);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px var(--sage-100);
}
.app-nav a svg { width: 18px; height: 18px; stroke-width: 1.8; flex-shrink: 0; }

.app-sidebar__user {
    border-top: 1px solid var(--line-2);
    padding-top: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.app-sidebar__avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sage-300), var(--sage-600));
    color: #fff;
    display: grid; place-items: center;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.app-sidebar__user-info { flex: 1; min-width: 0; }
.app-sidebar__user-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--ink);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.app-sidebar__user-role {
    font-size: 0.72rem;
    color: var(--muted-2);
    text-transform: capitalize;
}
.app-sidebar__logout {
    color: var(--muted);
    padding: 8px;
    border-radius: 8px;
    transition: all 0.15s var(--ease);
}
.app-sidebar__logout:hover { background: #fef2f2; color: var(--danger); }
.app-sidebar__logout svg { width: 18px; height: 18px; }

/* Main column */
.app-main-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 32px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}
.app-topbar__title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--ink);
    margin: 0;
}
.app-topbar__greeting {
    display: block;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 500;
    letter-spacing: 0.02em;
}
.app-topbar__actions { display: flex; align-items: center; gap: 10px; }
.app-topbar__menu-btn {
    display: none;
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
}

.app-main {
    padding: 32px;
    max-width: 1240px;
    width: 100%;
    margin: 0 auto;
    flex: 1;
}

.app-flashes {
    padding: 18px 32px 0;
}
.app-flashes:empty { display: none; }
.app-flashes .alert { margin-bottom: 0; }

/* ---------- 5. Cards & Surfaces ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-xs);
    transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}
.card--hover:hover { box-shadow: var(--shadow); }
.card--soft { background: var(--surface-2); }
.card__header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
    min-width: 0;
}
.card__title { font-size: 1rem; font-weight: 600; color: var(--ink); margin: 0; }
.card__subtitle { font-size: 0.85rem; color: var(--muted); margin: 0; }

/* Hero card (used on dashboard top) */
.hero-card {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 88% 16%, rgba(251, 191, 36, 0.26), transparent 24%),
        radial-gradient(circle at 76% 82%, rgba(56, 189, 248, 0.22), transparent 28%),
        linear-gradient(135deg, #173f3b 0%, var(--sage-700) 55%, #1f5963 100%);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-xl);
    padding: 34px 36px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 28px;
}
.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
    gap: 28px;
    align-items: stretch;
}
.hero-card::after {
    content: "";
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 34%;
    background:
        linear-gradient(135deg, transparent 0 42%, rgba(255,255,255,0.12) 42% 43%, transparent 43% 100%),
        linear-gradient(45deg, transparent 0 56%, rgba(255,255,255,0.10) 56% 57%, transparent 57% 100%);
    pointer-events: none;
}
.hero-card__content,
.hero-card__summary {
    position: relative;
    z-index: 1;
}
.hero-card__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.16);
    backdrop-filter: blur(8px);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 12px;
}
.hero-card__title {
    font-family: var(--font-display);
    font-size: clamp(1.7rem, 2.5vw, 2.3rem);
    color: #fff;
    margin: 0 0 8px;
    font-weight: 600;
    overflow-wrap: anywhere;
}
.hero-card__subtitle {
    color: rgba(255,255,255,0.85);
    font-size: 1rem;
    max-width: 680px;
    margin: 0;
}
.hero-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}
.hero-card__summary {
    display: grid;
    gap: 10px;
    align-self: stretch;
}
.hero-card__summary div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
}
.hero-card__summary span {
    font-family: var(--font-display);
    font-size: 1.8rem;
    line-height: 1;
    font-weight: 700;
    color: #fff;
}
.hero-card__summary small {
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.25;
    text-align: right;
    text-transform: uppercase;
}
.hero-card__quote {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.18);
    font-style: italic;
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: rgba(255,255,255,0.92);
    max-width: 560px;
}

/* ---------- 6. Stat Grid ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
    margin: 0 0 28px;
}
.stat-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 22px 22px 20px;
    box-shadow: var(--shadow-xs);
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
    overflow: hidden;
    min-width: 0;
}
.stat-card::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 3px;
    background: linear-gradient(90deg, var(--sage-500), var(--sky), var(--coral));
    opacity: 0.8;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card__icon {
    width: 42px; height: 42px;
    border-radius: 8px;
    display: grid; place-items: center;
    color: #fff;
    margin-bottom: 14px;
}
.stat-card__icon--sage   { background: linear-gradient(135deg, var(--sage-500), var(--sage-700)); }
.stat-card__icon--coral  { background: linear-gradient(135deg, #fda4af, var(--coral-2)); }
.stat-card__icon--lilac  { background: linear-gradient(135deg, #c4b5fd, var(--lilac)); }
.stat-card__icon--amber  { background: linear-gradient(135deg, #fcd34d, #d97706); }
.stat-card__icon--sky    { background: linear-gradient(135deg, #7dd3fc, #0284c7); }
.stat-card__icon svg { width: 20px; height: 20px; }
.stat-card__label {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 6px;
    overflow-wrap: anywhere;
}
.stat-card__value {
    display: block;
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
    letter-spacing: 0;
}
.stat-card__note {
    display: block;
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.35;
}
.stat-card__delta {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    color: var(--success);
    font-weight: 600;
}
.stat-card__delta--down { color: var(--danger); }

/* ---------- 7. Buttons ---------- */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0;
    transition: transform 0.15s var(--ease), background 0.15s var(--ease), box-shadow 0.15s var(--ease);
    text-decoration: none;
    line-height: 1.2;
}
button:hover, .btn:hover {
    background: var(--primary-hover);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px -6px rgba(13, 148, 136, 0.5);
}
button:active, .btn:active { transform: translateY(0); }
button:disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

button svg, .btn svg { width: 16px; height: 16px; }

.btn--secondary {
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-xs);
}
.btn--secondary:hover { background: var(--cream-2); color: var(--ink); border-color: var(--sage-200); }

.btn--light {
    background: #fff;
    color: var(--sage-800);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.35);
}
.btn--light:hover {
    background: var(--sage-50);
    color: var(--sage-900);
    border-color: #fff;
}

.btn--glass {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.24);
    box-shadow: none;
}
.btn--glass:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.38);
    box-shadow: none;
}

.btn--ghost {
    background: transparent;
    color: var(--ink-2);
    padding: 8px 12px;
}
.btn--ghost:hover { background: var(--sage-50); color: var(--sage-800); box-shadow: none; transform: none; }

.btn--danger { background: var(--danger); }
.btn--danger:hover { background: #dc2626; box-shadow: 0 6px 14px -6px rgba(239, 68, 68, 0.5); }

.btn--sm { padding: 6px 12px; font-size: 0.82rem; border-radius: 8px; }
.btn--lg { padding: 14px 24px; font-size: 1rem; border-radius: 8px; }

.btn--block { width: 100%; }

/* ---------- 8. Forms ---------- */
label {
    display: block;
    font-size: 0.82rem;
    color: var(--ink-2);
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: 0.005em;
}

input, select, textarea {
    width: 100%;
    padding: 11px 14px;
    border-radius: 8px;
    border: 1.5px solid var(--line);
    background: var(--surface);
    font-family: var(--font-sans);
    font-size: 0.92rem;
    color: var(--ink);
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--sage-400);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.15);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { margin-bottom: 16px; }
.form-help { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }

/* Password field with show/hide toggle */
.password-field { position: relative; }
.password-field input { padding-right: 44px; }
.password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.password-toggle:hover { color: var(--ink); background: var(--surface-2, rgba(0, 0, 0, 0.04)); }
.password-toggle:focus-visible {
    outline: none;
    color: var(--ink);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.25);
}
.password-toggle svg {
    width: 18px;
    height: 18px;
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.password-toggle svg[hidden] { display: none; }
.password-toggle__hide { display: none; }
.password-toggle[aria-pressed="true"] .password-toggle__hide { display: block; }
.password-toggle[aria-pressed="true"] .password-toggle__show { display: none; }

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}
.inline-form input, .inline-form select { width: auto; flex: 1 1 160px; }
.inline-form button { flex-shrink: 0; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.form-grid .form-group { margin-bottom: 0; }
.form-grid__actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.member-form-card { margin-bottom: 24px; }

/* ---------- 9. Tables ---------- */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.data-table th, .data-table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--line-2);
}
.data-table thead th {
    background: var(--cream-2);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 700;
    border-bottom: 1px solid var(--line);
}
.data-table tbody tr { transition: background 0.12s var(--ease); }
.data-table tbody tr:hover { background: var(--sage-50); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table td a { font-weight: 500; }
.data-table .actions { display: flex; gap: 6px; justify-content: flex-end; }

.row-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.row-actions form { margin: 0; }

/* Icon-only action buttons in tables */
.btn--icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius);
    background: var(--sage-50);
    color: var(--sage-700);
    border: 1px solid var(--line);
    transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.btn--icon svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}
.btn--icon:hover {
    background: var(--sage-100);
    color: var(--sage-800);
    border-color: var(--sage-300);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px -4px rgba(13, 148, 136, 0.35);
}
.btn--icon-edit {
    color: var(--amber);
    background: #fffbeb;
    border-color: #fde68a;
}
.btn--icon-edit:hover {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
    box-shadow: 0 4px 10px -4px rgba(245, 158, 11, 0.35);
}
.data-table__th-actions {
    text-align: right;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    background: var(--sage-100);
    color: var(--sage-800);
}
.badge--coral { background: #ffe4e6; color: #be123c; }
.badge--amber { background: #fef3c7; color: #92400e; }
.badge--lilac { background: #ede9fe; color: #6d28d9; }
.badge--sky   { background: #e0f2fe; color: #075985; }
.badge--muted { background: var(--cream-2); color: var(--muted); }

/* Detail grid (order view / detail pages) */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    padding: 24px;
}
.detail-grid__item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.detail-grid__item--full {
    grid-column: 1 / -1;
}
.detail-grid__label {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 700;
}
.detail-grid__value {
    font-size: 0.95rem;
    color: var(--ink);
    line-height: 1.5;
}
.page-header__actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ---------- 10. Alerts ---------- */
.alert {
    max-width: 1200px;
    margin: 0 auto 16px;
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert::before {
    content: ""; width: 8px; height: 8px; border-radius: 50%;
    flex-shrink: 0;
}
.alert--success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert--success::before { background: var(--success); }
.alert--error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert--error::before { background: var(--danger); }
.alert--warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert--warning::before { background: var(--amber); }
.alert--info    { background: #f0f9ff; color: #075985; border-color: #bae6fd; }
.alert--info::before { background: var(--info); }

/* ---------- 11. Page headers ---------- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin: 4px 0 22px;
}
.page-header h1 { margin: 0; }
.page-header__subtitle {
    color: var(--muted);
    font-size: 0.95rem;
    margin: 4px 0 0;
}

/* ---------- 12. Pagination ---------- */
.pagination {
    display: flex;
    gap: 6px;
    margin-top: 20px;
    justify-content: center;
}
.pagination a {
    padding: 8px 14px;
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink-2);
    border: 1px solid var(--line);
    font-weight: 500;
    font-size: 0.85rem;
    min-width: 38px;
    text-align: center;
    transition: all 0.15s var(--ease);
}
.pagination a:hover { background: var(--sage-50); border-color: var(--sage-200); color: var(--sage-800); }
.pagination a.is-active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ---------- 13. Detail list (key/value pairs) ---------- */
.detail-list {
    display: grid;
    grid-template-columns: 160px 1fr;
    row-gap: 14px;
    column-gap: 18px;
    margin: 0;
}
.detail-list dt {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.detail-list dd { margin: 0; color: var(--ink); font-weight: 500; }

/* ---------- 14. Auth pages (split-screen) ---------- */
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
}
.auth-aside {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(135deg, #173f3b 0%, var(--sage-700) 52%, #205e69 100%);
    color: #fff;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.auth-aside::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(135deg, transparent 0 48%, rgba(255,255,255,0.08) 48% 49%, transparent 49% 100%),
        linear-gradient(45deg, transparent 0 62%, rgba(255,255,255,0.06) 62% 63%, transparent 63% 100%);
    pointer-events: none;
}
.auth-aside > * { position: relative; z-index: 1; }
.auth-aside__brand {
    display: flex; align-items: center; gap: 12px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.3rem;
}
.auth-aside__brand-mark {
    width: 42px; height: 42px;
    border-radius: 8px;
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(10px);
    display: grid; place-items: center;
}
.auth-aside__brand-mark svg { width: 22px; height: 22px; }
.auth-aside__hero h1 {
    color: #fff;
    font-size: 2.4rem;
    line-height: 1.1;
    margin: 0 0 16px;
    max-width: 460px;
}
.auth-aside__hero p {
    color: rgba(255,255,255,0.85);
    font-size: 1.02rem;
    max-width: 460px;
}
.auth-aside__features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 28px;
    max-width: 460px;
}
.auth-aside__feature {
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.16);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 14px 16px;
}
.auth-aside__feature-title {
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 2px;
}
.auth-aside__feature-desc {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.78);
    line-height: 1.4;
}
.auth-aside__footer {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.65);
}

.auth-main {
    background: var(--cream);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
}
.auth-card {
    width: 100%;
    max-width: 400px;
}
.auth-card .alert {
    margin: 0 0 18px;
    max-width: none;
}
.auth-card__head { margin-bottom: 28px; }
.auth-card__eyebrow {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 8px;
}
.auth-card h1 {
    font-size: 1.75rem;
    margin: 0 0 6px;
}
.auth-card__sub {
    color: var(--muted);
    font-size: 0.95rem;
    margin: 0;
}
.auth-card form { display: flex; flex-direction: column; gap: 4px; }
.auth-card .form-group { margin-bottom: 14px; }
.auth-card .btn--lg { margin-top: 8px; }
.auth-card__divider {
    display: flex; align-items: center; gap: 10px;
    color: var(--muted-2);
    font-size: 0.78rem;
    margin: 20px 0 14px;
}
.auth-card__divider::before, .auth-card__divider::after {
    content: ""; flex: 1; height: 1px; background: var(--line);
}
.auth-card__alt-link {
    text-align: center;
    margin-top: 18px;
    font-size: 0.88rem;
    color: var(--muted);
}
.auth-card__alt-link a { font-weight: 600; }

/* Password field with toggle (visual hint; JS handled in main.js) */
.input-with-icon { position: relative; }
.input-with-icon input { padding-right: 42px; }
.input-with-icon__btn {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    background: transparent; border: none; color: var(--muted);
    padding: 6px; border-radius: 6px; cursor: pointer;
}
.input-with-icon__btn:hover { background: var(--cream-2); color: var(--ink); }

/* Admin login variant (subtle differentiation) */
.auth-body--admin .auth-aside {
    background:
        linear-gradient(135deg, #21302c 0%, #115e59 56%, #743f50 100%);
}

/* ---------- 15. Error / Maintenance pages ---------- */
.error-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 40px 24px;
}
.error-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: 56px 48px;
    box-shadow: var(--shadow-lg);
    max-width: 480px;
    width: 100%;
}
.error-card__eyebrow {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 8px;
}
.error-card h1 {
    font-size: 4rem;
    margin: 0 0 8px;
    background: linear-gradient(135deg, var(--sage-700), var(--sage-500));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.error-card h2 {
    font-size: 1.5rem;
    margin: 0 0 12px;
    color: var(--ink);
}
.error-card p {
    color: var(--muted);
    margin-bottom: 24px;
}
.error-card .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- 16. Log viewer ---------- */
.log-viewer {
    background: #0f1f1c;
    color: #99f6e4;
    padding: 18px 20px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    max-height: 70vh;
    border: 1px solid #134e4a;
}

/* ---------- 17. Admin quick links ---------- */
.admin-quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 8px;
}
.admin-quick-links .btn {
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-xs);
    padding: 16px 18px;
    justify-content: flex-start;
    font-weight: 600;
}
.admin-quick-links .btn:hover {
    background: var(--sage-50);
    border-color: var(--sage-200);
    color: var(--sage-800);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* ---------- 18. Wellness cards (dashboard additions) ---------- */
.wellness-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
    gap: 18px;
    margin-bottom: 28px;
    align-items: start;
}

.checkin-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-xs);
    min-width: 0;
}
.checkin-card h3 {
    margin: 0 0 4px;
    font-size: 1.15rem;
}
.checkin-card__sub {
    color: var(--muted);
    font-size: 0.88rem;
    margin: 0 0 18px;
}
.mood-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.mood-btn {
    background: var(--cream-2);
    border: 1.5px solid var(--line);
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--ink-2);
    cursor: pointer;
    transition: all 0.15s var(--ease);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.mood-btn:hover { background: var(--sage-50); border-color: var(--sage-300); color: var(--sage-800); }
.mood-btn svg { width: 18px; height: 18px; }

.activity-list { display: flex; flex-direction: column; gap: 12px; }
.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--line);
    min-width: 0;
}
.activity-item:last-child { border-bottom: none; }
.activity-item__icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: var(--sage-50);
    color: var(--sage-700);
    display: grid; place-items: center;
    flex-shrink: 0;
}
.activity-item__icon svg { width: 18px; height: 18px; }
.activity-item__body { flex: 1; min-width: 0; }
.activity-item__title {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--ink);
    overflow-wrap: anywhere;
}
.activity-item__time {
    display: block;
    font-size: 0.78rem;
    color: var(--muted-2);
    overflow-wrap: anywhere;
}

.empty-state {
    padding: 18px;
    color: var(--muted);
}
.empty-state h3 {
    font-family: var(--font-sans);
    font-size: 0.98rem;
    margin: 0 0 4px;
    color: var(--ink);
}
.empty-state p {
    color: var(--muted);
    margin-bottom: 14px;
}
.empty-state--table {
    padding: 24px 12px;
    text-align: center;
}

@media (min-width: 769px) and (max-width: 1080px) {
    .dashboard-hero {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .hero-card__summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .hero-card__summary div {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .hero-card__summary small {
        text-align: left;
    }

    .wellness-grid {
        grid-template-columns: 1fr;
    }

    .stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* Section title */
.section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 12px 0 14px;
}
.section-title h2 { font-size: 1.15rem; margin: 0; }
.section-title__link { font-size: 0.85rem; color: var(--primary); font-weight: 600; }

/* Checkin card accent variant */
.checkin-card--accent {
    background:
        linear-gradient(135deg, #173f3b 0%, var(--sage-700) 55%, #1f5963 100%);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
}
.checkin-card--accent h3 {
    color: #fff;
}
.checkin-card--accent .checkin-card__sub {
    color: rgba(255,255,255,0.78);
}

/* Focus list (Today's priorities) */
.focus-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.focus-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.12);
    transition: background 0.15s var(--ease);
}
.focus-item:hover {
    background: rgba(255,255,255,0.18);
}
.focus-item__bullet {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.focus-item--primary .focus-item__bullet { background: var(--sage-300); }
.focus-item--warning .focus-item__bullet { background: var(--amber); }
.focus-item--info    .focus-item__bullet { background: var(--sky); }
.focus-item__body {
    flex: 1;
    min-width: 0;
}
.focus-item__title {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    color: #fff;
    line-height: 1.3;
}
.focus-item__desc {
    display: block;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.72);
    margin-top: 2px;
    line-height: 1.35;
}
.focus-item__action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 6px;
    background: rgba(255,255,255,0.12);
    color: #fff;
    transition: background 0.15s var(--ease);
}
.focus-item__action:hover {
    background: rgba(255,255,255,0.24);
    color: #fff;
}
.focus-item__action svg {
    width: 14px;
    height: 14px;
}

/* ---------- 19. Old selectors kept for backward compatibility ---------- */
/* These were used before the redesign; keep them styled so older pages still look good. */
.app-header {
    display: none; /* Replaced by sidebar/topbar */
}
.app-footer {
    margin-top: 40px;
    padding: 24px 32px;
    color: var(--muted);
    font-size: 0.82rem;
    text-align: center;
    border-top: 1px solid var(--line);
}

/* ---------- 20. Utility classes ---------- */
.text-muted { color: var(--muted); }
.text-muted-2 { color: var(--muted-2); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.font-display { font-family: var(--font-display); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 16px; }

/* ---------- 21. Animations ---------- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.4s var(--ease) both; }
.fade-up-delay-1 { animation-delay: 0.06s; }
.fade-up-delay-2 { animation-delay: 0.12s; }
.fade-up-delay-3 { animation-delay: 0.18s; }

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

/* ---------- 22. Order product picker ---------- */
.order-products {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.order-products__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.order-products__head h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
}
.order-products__hint {
    margin: 4px 0 0;
    font-size: 0.82rem;
    color: var(--muted);
}
.order-products__banner {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    background: var(--sage-50);
    color: var(--ink-2);
    border: 1px solid var(--sage-200);
}
.order-products__banner--warn {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}
.order-products__search {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.order-products__search-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink-2);
}
.order-products__search-field {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.order-products__search-field:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(13, 148, 136, 0.2);
}
.order-products__search-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--muted);
}
.order-products__search-input {
    flex: 1;
    min-width: 0;
    padding: 10px 0;
    border: none;
    background: transparent;
    font-size: 0.88rem;
    font-family: var(--font-sans);
    color: var(--ink);
    outline: none;
}
.order-products__search-input::placeholder {
    color: var(--muted);
}
.order-products__search-input::-webkit-search-cancel-button {
    display: none;
}
.order-products__search-clear {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}
.order-products__search-clear:hover {
    background: var(--sage-50);
    color: var(--ink);
}
.order-products__search-result {
    margin: 0;
    font-size: 0.78rem;
    color: var(--muted);
}
.order-product-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 360px;
    overflow: auto;
    padding: 4px;
    margin: 0 -4px;
}
.order-product-row {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.order-product-row.is-selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(13, 148, 136, 0.2);
}
.order-product-row__thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--cream-2);
    border: 1px solid var(--line);
}
.order-product-row__thumb--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.7rem;
}
.order-product-row__meta {
    min-width: 0;
}
.order-product-row__name {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.order-product-row__detail {
    margin: 2px 0 0;
    font-size: 0.78rem;
    color: var(--muted);
}
.order-product-row__detail strong {
    color: var(--ink-2);
    font-weight: 600;
}
.qty-stepper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--cream-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 2px;
}
.qty-stepper button {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    box-shadow: none;
    font-size: 1.1rem;
    line-height: 1;
}
.qty-stepper button:hover {
    background: var(--sage-50);
    color: var(--sage-800);
    box-shadow: none;
    transform: none;
}
.qty-stepper button:disabled {
    opacity: 0.4;
}
.qty-stepper__value {
    width: 40px;
    text-align: center;
    border: none;
    background: transparent;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--ink);
    font-family: var(--font-sans);
    -moz-appearance: textfield;
}
.qty-stepper__value::-webkit-outer-spin-button,
.qty-stepper__value::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.order-total-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--sage-50);
    border: 1px solid var(--sage-200);
}
.order-total-bar__label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ink-2);
}
.order-total-bar__value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--sage-900);
    font-variant-numeric: tabular-nums;
}
.order-total-bar__value span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    margin-right: 4px;
}

@media (max-width: 560px) {
    .order-product-row {
        grid-template-columns: 40px 1fr;
        grid-template-rows: auto auto;
    }
    .order-product-row .qty-stepper {
        grid-column: 2;
        justify-self: start;
    }
}
