:root {
    --emaus-green-950: #0f3d2c;
    --emaus-green-900: #124c36;
    --emaus-green-700: #277158;
    --emaus-sage-100: #edf2e9;
    --emaus-cream: #f8f5ee;
    --emaus-paper: #fffdf9;
    --emaus-terracotta: #ca5b2a;
    --emaus-ink: #1f2925;
    --emaus-muted: #68736d;
    --emaus-border: #dfe5df;
    --emaus-shadow: 0 22px 60px rgba(16, 58, 42, .12);
}

* { box-sizing: border-box; }

body {
    color: var(--emaus-ink);
    background: var(--emaus-cream);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: var(--emaus-green-700); }

.auth-page { min-height: 100vh; }

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(320px, 46%) 1fr;
}

.auth-brand {
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 4rem;
    color: #fff;
    background:
        radial-gradient(circle at 15% 20%, rgba(255,255,255,.12), transparent 30%),
        linear-gradient(145deg, var(--emaus-green-950), var(--emaus-green-700));
}

.auth-brand::after {
    content: "";
    position: absolute;
    width: 26rem;
    height: 26rem;
    right: -10rem;
    bottom: -10rem;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 50%;
    box-shadow: 0 0 0 4rem rgba(255,255,255,.035), 0 0 0 8rem rgba(255,255,255,.025);
}

.brand-content { position: relative; z-index: 1; max-width: 34rem; }
.brand-logo { width: 7rem; height: 7rem; border-radius: 50%; object-fit: cover; margin-bottom: 2.5rem; box-shadow: 0 12px 35px rgba(0,0,0,.2); }
.eyebrow { margin-bottom: .75rem; font-size: .75rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.brand-content h1 { max-width: 30rem; margin-bottom: 1.25rem; font-size: clamp(2.6rem, 5vw, 4.6rem); line-height: .98; letter-spacing: -.045em; }
.brand-copy { max-width: 30rem; margin: 0; color: rgba(255,255,255,.78); font-size: 1.15rem; line-height: 1.7; }

.auth-panel { display: grid; place-items: center; padding: 3rem 2rem; }
.auth-card { width: min(100%, 29rem); }
.auth-card h2 { margin-bottom: .75rem; font-size: 2.25rem; letter-spacing: -.035em; }
.auth-intro { margin-bottom: 2rem; color: var(--emaus-muted); }
.mobile-brand { display: none; align-items: center; gap: .8rem; margin-bottom: 2rem; color: var(--emaus-green-950); font-size: 1.35rem; font-weight: 800; }
.mobile-brand img { width: 3rem; height: 3rem; border-radius: 50%; object-fit: cover; }
.form-label { font-weight: 700; }
.form-control { border-color: var(--emaus-border); background: var(--emaus-paper); }
.form-control:focus { border-color: var(--emaus-green-700); box-shadow: 0 0 0 .25rem rgba(39, 113, 88, .13); }
.otp-input { max-width: 14rem; letter-spacing: .35em; font-weight: 800; }
.btn-emaus { border-color: var(--emaus-green-900); color: #fff; background: var(--emaus-green-900); font-weight: 750; }
.btn-emaus:hover, .btn-emaus:focus { border-color: var(--emaus-green-950); color: #fff; background: var(--emaus-green-950); }
.auth-help { margin: 1.75rem 0 0; color: var(--emaus-muted); font-size: .88rem; text-align: center; }

.app-header {
    min-height: 4.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .65rem clamp(1rem, 4vw, 3rem);
    border-bottom: 1px solid var(--emaus-border);
    background: rgba(255, 253, 249, .94);
}

.app-brand { display: flex; align-items: center; gap: .7rem; color: var(--emaus-green-950); text-decoration: none; }
.app-brand img { width: 3.1rem; height: 3.1rem; border-radius: 50%; object-fit: cover; }
.app-brand span { display: flex; flex-direction: column; line-height: 1.05; }
.app-brand strong { font-size: 1.25rem; }
.app-brand small { margin-top: .25rem; color: var(--emaus-muted); font-size: .65rem; letter-spacing: .1em; text-transform: uppercase; }
.app-header-actions { display: flex; align-items: center; gap: 1rem; }
.app-header-actions form { margin: 0; }
.retreat-switcher { padding: .55rem .8rem; border: 1px solid var(--emaus-border); border-radius: .7rem; color: var(--emaus-ink); background: #fff; text-decoration: none; font-weight: 650; }
.user-name { color: var(--emaus-muted); }
.app-main { width: min(100% - 2rem, 80rem); margin: 0 auto; padding: clamp(2rem, 5vw, 4rem) 0; }
.page-heading { margin-bottom: 2rem; }
.page-heading h1 { margin-bottom: .65rem; font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -.045em; }
.page-heading p:last-child { color: var(--emaus-muted); font-size: 1.05rem; }
.narrow-heading { max-width: 42rem; }

.retreat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
.retreat-more { margin-top: 1.5rem; }
.retreat-more > summary { display: inline-flex; align-items: center; width: fit-content; padding: .6rem 1rem; cursor: pointer; }
.retreat-more[open] > summary { margin-bottom: 1.5rem; }
.retreat-more + .form-actions { margin-top: 2rem; }
.retreat-card { position: relative; display: block; cursor: pointer; }
.retreat-card input { position: absolute; opacity: 0; pointer-events: none; }
.retreat-card-body { min-height: 12rem; display: flex; flex-direction: column; align-items: flex-start; gap: .45rem; padding: 1.4rem; border: 2px solid transparent; border-radius: 1.1rem; background: var(--emaus-paper); box-shadow: 0 8px 30px rgba(16, 58, 42, .07); transition: border-color .18s ease, transform .18s ease; }
.retreat-card-body > img { width: 2.75rem; height: 3.5rem; object-fit: contain; align-self: flex-end; margin-bottom: -3.4rem; }
.retreat-card-body > img.retreat-logo-wide { width: 6.875rem; }
.retreat-card-body strong { margin-top: .8rem; font-size: 1.18rem; }
.retreat-card-body span:not(.status-pill), .retreat-card-body small { color: var(--emaus-muted); }
.retreat-card:hover .retreat-card-body { transform: translateY(-2px); }
.retreat-card input:focus-visible + .retreat-card-body, .retreat-card input:checked + .retreat-card-body { border-color: var(--emaus-green-700); }
.status-pill { display: inline-flex; padding: .3rem .65rem; border-radius: 999px; color: #80501e; background: #fff0d7; font-size: .75rem; font-weight: 750; }
.status-pill.active { color: var(--emaus-green-950); background: var(--emaus-sage-100); }
.form-actions { display: flex; justify-content: flex-end; margin-top: 1.5rem; }
.empty-state { padding: 3rem; border: 1px dashed var(--emaus-border); border-radius: 1rem; background: rgba(255,255,255,.5); text-align: center; }

.retreat-hero { display: flex; align-items: center; justify-content: space-between; gap: 2rem; margin-bottom: 1.5rem; padding: clamp(1.5rem, 4vw, 2.5rem); border-radius: 1.25rem; color: #fff; background: linear-gradient(130deg, var(--emaus-green-950), var(--emaus-green-700)); box-shadow: var(--emaus-shadow); }
.retreat-hero h2 { margin: 1rem 0 .35rem; font-size: clamp(1.7rem, 4vw, 2.5rem); }
.retreat-hero p { margin: 0; color: rgba(255,255,255,.75); }
.retreat-meta { min-width: 10rem; padding-left: 2rem; border-left: 1px solid rgba(255,255,255,.3); }
.retreat-meta span, .retreat-meta strong { display: block; }
.retreat-meta span { color: rgba(255,255,255,.68); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; }
.retreat-meta strong { margin-top: .35rem; font-size: 1.1rem; }
.foundation-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.foundation-card { padding: 1.5rem; border: 1px solid var(--emaus-border); border-radius: 1rem; background: var(--emaus-paper); }
.foundation-number { color: var(--emaus-terracotta); font-size: .8rem; font-weight: 800; letter-spacing: .12em; }
.foundation-card h3 { margin: 1.5rem 0 .65rem; font-size: 1.15rem; }
.foundation-card p { margin: 0; color: var(--emaus-muted); line-height: 1.6; }

@media (max-width: 800px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-panel { align-items: start; padding: 2rem 1.25rem; }
    .mobile-brand { display: flex; }
    .auth-card { padding-top: 1rem; }
    .app-header { align-items: flex-start; }
    .app-header-actions { gap: .5rem; }
    .user-name { display: none; }
    .retreat-switcher { max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .foundation-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
    .app-brand small { display: none; }
    .app-brand img { width: 2.6rem; height: 2.6rem; }
    .retreat-hero { align-items: flex-start; flex-direction: column; }
    .retreat-meta { width: 100%; padding: 1rem 0 0; border-top: 1px solid rgba(255,255,255,.3); border-left: 0; }
    .form-actions .btn { width: 100%; }
}

.auth-page.auth-minimal{background:#f4f5f6}.auth-minimal .auth-shell{grid-template-columns:1fr;min-height:100vh;min-height:100svh}.auth-minimal .auth-panel{align-items:center;padding:1.5rem 1rem}.auth-minimal .auth-card{width:min(100%,25rem);padding:2rem;border:1px solid #e1e4e8;border-radius:.8rem;background:#fff;box-shadow:0 8px 30px rgb(0 0 0 / 5%)}.auth-minimal .auth-card h2{font-size:1.65rem;margin-bottom:1.5rem;color:#252b33}.auth-minimal .form-control-lg{font-size:1rem;min-height:2.75rem}.auth-minimal .form-control:focus{border-color:#7e8792;box-shadow:0 0 0 .2rem rgb(71 85 105 / 12%)}.auth-minimal .btn-emaus{background:#35404d;border-color:#35404d;font-size:1rem}.auth-minimal .btn-emaus:hover{background:#252b33;border-color:#252b33}

.auth-token-row { display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: .75rem; }
.auth-token-icon { display: block; width: 32px; height: 32px; object-fit: contain; }
.auth-token-row .otp-input { width: 100%; max-width: none; min-width: 0; }

.access-badge { flex: 0 0 auto; padding: .45rem .75rem; border-radius: 999px; font-size: .72rem; font-weight: 800; }
.access-badge.write { color: var(--emaus-green-950); background: var(--emaus-sage-100); }
.access-badge.read { color: #73521f; background: #fff0d7; }

[data-retreat-selection] .retreat-card { touch-action: manipulation; }

.resource-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.25rem; }
.resource-heading .eyebrow { margin-bottom: .35rem; color: var(--emaus-green-700); }
.resource-heading h1 { margin: 0; font-size: clamp(1.7rem,3vw,2.35rem); letter-spacing: -.035em; }
.resource-heading p:last-child { margin: .45rem 0 0; color: var(--emaus-muted); }

.resource-heading > .access-badge { margin-inline-start: auto; align-self: flex-end; }
.people-heading-actions { display: flex; align-items: center; gap: .75rem; margin-inline-start: auto; }
@media (max-width: 560px) {
    .resource-heading { align-items: flex-start; flex-direction: column; gap: .75rem; }
    .people-heading-actions { width: 100%; justify-content: space-between; }
}

.retreat-context-heading{display:flex;align-items:center;justify-content:space-between;gap:.75rem;width:100%;margin-bottom:.45rem}
.retreat-context-heading .retreat-heading-name{min-width:0;overflow-wrap:anywhere;margin:0;color:var(--emaus-green-700)}
.retreat-context-heading .access-badge{margin:0;display:inline-flex;align-items:center;justify-content:center}
.retreat-access-icon{display:none;width:1.1rem;height:1.1rem;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.retreat-context-heading .access-badge:focus-visible{outline:2px solid currentColor;outline-offset:2px}
@media(max-width:600px){
 .retreat-context-heading .retreat-access-text{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
 .retreat-context-heading .retreat-access-icon{display:block}
 .retreat-context-heading .access-badge{min-width:2.4rem;min-height:2.1rem;padding:.45rem .65rem}
}
