/* ==================================================================
   PsiLab — public site styles
   Warm & personal: earthy palette, soft shapes, editorial serif.
   ================================================================== */

:root {
    /* Palette — warm, earthy, calming */
    --sand-50:  #faf6f1;
    --sand-100: #f3ebe1;
    --sand-200: #e7d9c9;
    --clay-300: #d9b99c;
    --terra-400:#c78a63;
    --terra-500:#b06a44;   /* primary accent */
    --terra-600:#8f5334;
    --sage-400: #9caf88;
    --sage-500: #7d9268;
    --ink-700:  #4a3f36;
    --ink-800:  #3a322b;
    --ink-900:  #2b241f;   /* headings / body text */

    --bg:        var(--sand-50);
    --surface:   #ffffff;
    --text:      var(--ink-900);
    --text-soft: #6b5f54;
    --accent:    var(--terra-500);
    --accent-ink:var(--terra-600);

    /* Borders that ARE the affordance (empty fields, icon-only buttons) need
       3:1 against their fill — sand-200 only manages 1.4:1. Dividers and card
       edges stay on sand-200, where nothing depends on seeing them. */
    --line-control: #8f8175;   /* 3.8:1 on white, 3.5:1 on sand-50 */
    --focus:        var(--terra-500);  /* 4.2:1 on white, 3.9:1 on sand-50 */

    /* Semantic status — one ink + one wash per meaning, each pairing >=5.3:1.
       The earth palette yields to convention here because these must read the
       same way they do everywhere else. Every one is paired with a text label:
       colour is never the only carrier of state. */
    --success:      #2f6b34;  --success-wash: #eaf4ea;   /* 5.7:1 */
    --caution:      #8a5a1a;  --caution-wash: #fdf3e3;   /* 5.4:1 */
    --danger:       #a12b2b;  --danger-wash:  #fdecec;   /* 6.4:1 */
    --danger-deep:  #841f1f;                             /* danger, pressed */
    --info:         #2b5a8c;  --info-wash:    #e6f0fa;   /* 6.2:1 */
    /* The readable step of the sage family — social rate is a rate, not a
       success, so it stays in the brand's counter-voice instead. */
    --sage-600:     #4a6b2f;  --sage-wash:    #eef3ea;   /* 5.4:1 */

    /* External platform marks: deliberately outside the semantic system. */
    --platform-instagram: #9c3768;  --platform-instagram-wash: #fbe6ef;
    --platform-linkedin:  #2b5a8c;  --platform-linkedin-wash:  #e6f0fa;

    /* Billing identity (appointment cards + badges): team light blue,
       private/social pink. Same ink/wash discipline as the semantic set. */
    --billing-team-wash: #e6f0fa;  --billing-team-line: #b9d1ea;
    --billing-pink-wash: #fbe6ef;  --billing-pink-line: #edc4d6;

    --font-serif: "Fraunces", Georgia, "Times New Roman", serif;
    --font-sans:  "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

    /* Type scale — roles, not sizes. Every font-size in this sheet is one of
       these, except glyphs sized to fit a circular mark (see "Mark glyphs").
       The root is 120%, so 1rem = 19.2px: body is 19.6px, micro 15.4px.
       Twelve near-identical values used to live between 0.72 and 1.02rem —
       0.9/0.92/0.95/0.96/0.98 are the same size to the eye but were five
       separate decisions. A role a reader cannot distinguish is not a role. */
    --text-display:     clamp(2.4rem, 5.5vw, 4rem);      /* one per page — the hero */
    --text-headline:    clamp(1.8rem, 4vw, 2.9rem);      /* section titles */
    --text-headline-sm: clamp(1.6rem, 3.4vw, 2.4rem);    /* a deliberately quieter section */
    --text-page:        clamp(1.6rem, 3vw, 2.2rem);      /* page title in the back-office */
    --text-quote:       clamp(1.5rem, 3vw, 2.1rem);      /* someone speaking */
    --text-quote-sm:    clamp(1.2rem, 2.4vw, 1.6rem);    /* …in a tighter frame */
    --text-stat:        2rem;      /* the one headline number, on the dashboard */
    --text-title:       1.3rem;    /* card, panel, subsection, marketing row */
    --text-lead:        1.18rem;   /* opening paragraphs and section subtitles */
    --text-body:        1.02rem;   /* running text */
    --text-ui:          0.96rem;   /* buttons, nav, options — operated, not read */
    --text-secondary:   0.9rem;    /* captions, helper text, field labels, tables */
    --text-micro:       0.8rem;    /* badges, timestamps, dense admin metadata */
    --text-label:       0.75rem;   /* the uppercase eyebrow and brand role */

    /* Shape scale. Radius encodes role: pills are standalone actions, small
       rectangles are controls inside a working surface, generous rounds are
       surfaces, circles are identity. Nothing here is 0 — the floor is 4px. */
    --radius-xs:    4px;     /* inline code, the smallest shape in the system */
    --radius-sm:    8px;     /* toolbar controls, tabs, list options */
    --radius-md:    10px;    /* form fields, menu rows, alert blocks */
    --radius-tile:  12px;    /* small filled tiles: icon squares, day-column cards */
    --radius:       18px;    /* the card and panel default */
    --radius-lg:    28px;    /* large surfaces: hero photo, portrait, auth card */
    --radius-pill:  999px;   /* actions that stand alone */
    --radius-round: 50%;     /* identity: the Ψ mark, avatars, dots */
    --shadow:    0 18px 40px -24px rgba(74, 63, 54, 0.45);
    --shadow-sm: 0 6px 18px -12px rgba(74, 63, 54, 0.4);

    --container: 1140px;
    --gap:       clamp(1rem, 3vw, 2rem);
}

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
    scroll-behavior: smooth; -webkit-text-size-adjust: 100%;
    font-size: 120%;      /* +20% lettering site-wide (rem-based) */
    color-scheme: light;  /* the palette is light-only; keep UA controls out of dark mode */
}
body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--bg);
    line-height: 1.65;
    font-size: var(--text-body);
    -webkit-font-smoothing: antialiased;
    overflow-x: clip; /* contain the off-canvas mobile nav without breaking sticky header */
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
ul.bullet-list { list-style: disc; padding-left: 1.5rem; }
h1, h2, h3 {
    font-family: var(--font-serif); font-weight: 500; line-height: 1.12;
    color: var(--ink-900); margin: 0; letter-spacing: -0.01em;
    text-wrap: balance;   /* no one-word last line on a two-line heading */
}

/* One branded focus ring for everything the UA would otherwise draw its own on.
   :where() keeps specificity at 0, so any component can still override it. */
:where(a, button, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

/* ---------- Layout ---------- */
.container { width: min(var(--container), 92%); margin-inline: auto; }
.container.narrow { width: min(760px, 92%); }

/* Accessibility: keyboard skip link (visible only when focused). */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 200; background: var(--ink-900); color: #fff; padding: 0.7rem 1.1rem; border-radius: 0 0 var(--radius-md) 0; }
.skip-link:focus { left: 0; }
.section { padding: clamp(3.5rem, 8vw, 6.5rem) 0; }
.center { text-align: center; }

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: var(--text-label);
    font-weight: 600;
    /* Dusk Clay, not the accent: at 14.4px this is small text, and the lighter
       clay reads 3.9:1 against sand. Same rule as every other clay-coloured word. */
    color: var(--accent-ink);
    margin: 0 0 0.9rem;
}
.section-title { font-size: var(--text-headline); }
.section-sub { color: var(--text-soft); font-size: var(--text-lead); margin: 0.9rem 0 0; text-wrap: pretty; }
.section-head { max-width: 620px; margin-bottom: clamp(2rem, 4vw, 3rem); }
.subheading { font-family: var(--font-serif); font-size: var(--text-title); margin: 2.2rem 0 0.8rem; }
.lead { font-size: var(--text-lead); color: var(--ink-700); text-wrap: pretty; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.6rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: var(--text-ui);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    cursor: pointer; border: 1px solid transparent;
}
/* Colour shifts stay here; the lift lives in the (hover: hover) block below. */
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--ink-800); border-color: var(--sand-200); }
.btn-ghost:hover { background: var(--surface); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-deep); }
.btn-help { padding: 0.35rem 0.7rem; font-size: var(--text-micro); font-weight: 600; border: 1px solid var(--sand-200); border-radius: var(--radius-pill); color: var(--text-soft); }
.btn-help:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--sand-50) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.25s ease, background 0.25s ease;
}
.site-header.is-scrolled { border-color: var(--sand-200); background: color-mix(in srgb, var(--sand-50) 96%, transparent); }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 0.85rem 0; }

.brand { display: inline-flex; align-items: center; gap: 0.7rem; }

/* ---------- Mark glyphs ----------
   The Ψ and the avatar initials are sized to fit their circle, so their
   font-size tracks the mark's diameter (28 → 110px) rather than the reading
   ramp. Same for the 404 numeral and the carousel chevrons. These are the only
   literal font-sizes left in the sheet, and they are geometry, not typography. */
.brand-mark {
    display: grid; place-items: center;
    width: 42px; height: 42px; border-radius: var(--radius-round);
    background: linear-gradient(140deg, var(--clay-300), var(--terra-500));
    color: #fff; font-family: var(--font-serif); font-size: 1.3rem; font-weight: 600;
    box-shadow: var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--font-serif); font-weight: 600; font-size: var(--text-body); color: var(--ink-900); }
.brand-role { font-size: var(--text-label); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-soft); }

.header-actions { display: flex; align-items: center; gap: 0.8rem; }

.site-nav ul { display: flex; align-items: center; gap: 1.6rem; }
.site-nav a { font-weight: 500; font-size: var(--text-ui); color: var(--ink-800); position: relative; padding: 0.2rem 0; }
.site-nav a:hover { color: var(--accent-ink); }
.site-nav a.is-active::after {
    content: ""; position: absolute; left: 0; bottom: -2px; height: 2px; width: 100%;
    background: var(--accent); border-radius: 2px;   /* half of a 2px bar: rounded ends, not a shape step */
}
.nav-cta a {
    background: var(--ink-900); color: #fff; padding: 0.55rem 1.1rem; border-radius: var(--radius-pill);
    transition: background 0.18s ease, transform 0.18s ease;
}
.nav-cta a:hover { background: var(--accent); }
.nav-lang a {
    border: 1px solid var(--sand-200); border-radius: var(--radius-pill); padding: 0.35rem 0.7rem;
    font-size: var(--text-micro); font-weight: 600; letter-spacing: 0.05em; color: var(--text-soft);
}
.nav-lang a:hover { border-color: var(--accent); color: var(--accent-ink); }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 0.4rem; }
.nav-toggle span { width: 26px; height: 2px; background: var(--ink-800); border-radius: 2px; /* rounded bar ends */ transition: transform 0.25s ease, opacity 0.2s ease; }

/* ---------- Hero ---------- */
.hero { padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(3rem, 6vw, 5rem); overflow: hidden; }
.hero-inner { display: grid; grid-template-columns: 1.1fr 0.9fr; align-items: center; gap: clamp(2rem, 5vw, 4rem); }
.hero-title { font-size: var(--text-display); margin-top: 0.4rem; }
.hero-subtitle { font-size: var(--text-lead); color: var(--ink-700); margin: 1.4rem 0 2rem; max-width: 30ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; }

.hero-visual { position: relative; display: grid; place-items: center; min-height: 360px; }
/* The silhouette is a fixed irregular ellipse; the drift is transform-only, so
   the whole 14s loop composites on the GPU. Animating border-radius instead
   repaints this blurred ~105,000px² area every frame, in the first viewport. */
.hero-blob {
    position: absolute; inset: 0; margin: auto;
    width: 92%; aspect-ratio: 1;
    background: radial-gradient(circle at 30% 30%, var(--clay-300), var(--terra-400) 55%, var(--terra-500));
    border-radius: 42% 58% 55% 45% / 48% 42% 58% 52%;
    filter: blur(2px); opacity: 0.9;
    animation: blob 14s ease-in-out infinite;
    will-change: transform;   /* a known, continuous animation — the one case for it */
}
.hero-photo {
    position: relative; z-index: 1;
    width: 74%; aspect-ratio: 4/5;
    border-radius: var(--radius-lg);
    background: linear-gradient(160deg, var(--sand-100), var(--sand-200));
    display: grid; place-items: center;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.photo-placeholder { font-family: var(--font-serif); font-size: 4rem; color: color-mix(in srgb, var(--terra-500) 55%, #fff); }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Rotating an irregular silhouette reads as a morph, because the outline the
   eye tracks keeps changing — without touching a paint property. */
@keyframes blob {
    0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
    50%      { transform: translateY(-14px) rotate(6deg) scale(1.03); }
}

/* ---------- Intro ---------- */
.intro { background: var(--surface); }
.intro-inner { max-width: 780px; }
.intro .section-title { font-size: var(--text-headline-sm); }
.intro .lead { margin-top: 1.2rem; }

/* ---------- Cards ---------- */
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.card-grid--wide { grid-template-columns: 1fr 1fr; }
.card-grid--centered { grid-template-columns: 1fr; max-width: 480px; margin: 0 auto; }
.card {
    background: var(--surface); border: 1px solid var(--sand-200);
    border-radius: var(--radius); padding: 1.8rem 1.6rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card-icon {
    display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--radius-tile);
    background: var(--sand-100); color: var(--accent-ink); margin-bottom: 1.1rem;
}
.card-icon svg { width: 24px; height: 24px; }
.card-title { font-size: var(--text-title); margin-bottom: 0.5rem; }
.card-body { color: var(--text-soft); margin: 0; font-size: var(--text-ui); }

/* ---------- Approach ---------- */
.approach { background: linear-gradient(180deg, var(--sand-50), var(--sand-100)); }
.approach-inner { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.check-list { margin-top: 1.4rem; display: grid; gap: 0.7rem; }
.check-list li { position: relative; padding-left: 1.9rem; color: var(--ink-700); }
.check-list li::before {
    content: ""; position: absolute; left: 0; top: 0.35em;
    width: 1.1rem; height: 1.1rem; border-radius: var(--radius-round);
    background: var(--sage-500);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E") center/0.8rem no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E") center/0.8rem no-repeat;
}
/* No italic: only Fraunces roman is loaded, so `font-style: italic` made the
   browser shear the roman — visibly wrong on a high-contrast serif. The quote
   is already marked by the serif, the size, Dusk Clay, and the rule. */
.approach-quote blockquote {
    margin: 0; font-family: var(--font-serif); font-size: var(--text-quote);
    color: var(--terra-600); line-height: 1.3;
    border-left: 3px solid var(--clay-300); padding-left: 1.4rem;
}

/* ---------- About ---------- */
.page-hero { padding-bottom: 0; }
.about-grid { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.about-portrait {
    aspect-ratio: 4/5; border-radius: var(--radius-lg);
    background: linear-gradient(160deg, var(--sand-100), var(--clay-300));
    display: grid; place-items: center; box-shadow: var(--shadow); position: sticky; top: 100px;
    overflow: hidden;
}
.about-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Contact CTA ---------- */
.contact-cta { background: var(--ink-900); color: var(--sand-100); }
.contact-cta .section-title { color: #fff; }
.contact-cta .section-sub { color: var(--sand-200); }
.contact-inner { max-width: 720px; text-align: center; margin-inline: auto; }
.contact-links { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 2.2rem 0 1.4rem; }
.contact-link {
    display: flex; align-items: center; gap: 1rem; text-align: left;
    padding: 1.1rem 1.3rem; border-radius: var(--radius);
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
    transition: transform 0.2s ease, background 0.2s ease;
}
.contact-link:hover { background: rgba(255,255,255,0.11); }
.contact-link-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-tile); flex: none; }
.contact-link-icon svg { width: 24px; height: 24px; }
/* The two literals below are Instagram's and LinkedIn's own brand marks, used
   at full strength because a visitor recognises the channel by its colour.
   They are the only colours in the stylesheet outside the token system. */
.contact-link--ig .contact-link-icon { background: linear-gradient(135deg, #f9ce34, #ee2a7b 55%, #6228d7); color: #fff; }
.contact-link--tree .contact-link-icon { background: var(--sage-500); color: #fff; }
.contact-link--linkedin .contact-link-icon { background: #0a66c2; color: #fff; }
.contact-link--podcast .contact-link-icon { background: linear-gradient(135deg, var(--terra-400), var(--terra-500)); color: #fff; }
.contact-link-text { display: flex; flex-direction: column; line-height: 1.2; }
.contact-link-text strong { font-size: var(--text-ui); }
.contact-link-text small { color: var(--sand-200); font-size: var(--text-micro); margin-top: 0.15rem; }
.contact-note { color: var(--sand-200); font-size: var(--text-secondary); margin: 0; }

/* ---------- Footer ---------- */
.site-footer { background: var(--sand-100); border-top: 1px solid var(--sand-200); padding-top: 3rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap; padding-bottom: 1.8rem; }
.footer-brand { display: flex; align-items: center; gap: 0.9rem; }
.footer-name { font-family: var(--font-serif); font-weight: 600; margin: 0; }
.footer-name-legal { font-family: var(--font-sans); font-weight: 400; font-size: var(--text-micro); color: var(--text-soft); letter-spacing: 0.02em; white-space: nowrap; }
.footer-made { margin: 0.15rem 0 0; color: var(--text-soft); font-size: var(--text-secondary); }
.footer-links { display: flex; gap: 1rem 1.4rem; flex-wrap: wrap; }
.footer-links a { color: var(--ink-700); font-weight: 500; }
.footer-links a:hover { color: var(--accent-ink); }
.footer-bottom { border-top: 1px solid var(--sand-200); padding: 1.2rem 0; }
.footer-bottom p { margin: 0; font-size: var(--text-secondary); color: var(--text-soft); }

/* ---------- Error pages ---------- */
.error-page { min-height: 100dvh; display: grid; place-items: center; padding: 2rem; }
.error-code { font-family: var(--font-serif); font-size: clamp(4rem, 12vw, 7rem); color: var(--clay-300); margin: 0; line-height: 1; }
.error-page .lead { margin: 0.6rem 0 1.8rem; }
.error-ref { font-size: var(--text-secondary); color: var(--text-soft); margin: 0 0 1.6rem; }
.error-ref code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; background: var(--sand-100); padding: 0.1rem 0.4rem; border-radius: var(--radius-xs); }

/* ---------- Maintenance ---------- */
.maintenance { min-height: 100dvh; display: grid; place-items: center; text-align: center; padding: 2rem; background: var(--surface); }
.maintenance-inner { max-width: 34rem; }
.maintenance-mark {
    display: inline-grid; place-items: center; width: 68px; height: 68px;
    border-radius: var(--radius-round); background: var(--terra-500); color: #fff;
    font-family: var(--font-serif); font-size: 2rem; font-weight: 600; margin-bottom: 1.6rem;
}
.maintenance h1 { font-size: var(--text-headline); margin-bottom: 0.8rem; }
.maintenance .lead { color: var(--ink-700); margin: 0; }
.maintenance-contact { margin-top: 1.8rem; }
.maintenance-contact a { color: var(--accent-ink); font-weight: 500; }

/* ---------- Reveal on scroll ---------- */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
[data-reveal].is-visible { opacity: 1; transform: none; }

/* ---------- Private area (auth + admin) ---------- */
.auth-body, .admin-body { background: var(--surface); }
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 2rem; }
.auth-card { width: min(400px, 100%); background: #fff; border: 1px solid var(--sand-200); border-radius: var(--radius-lg); padding: 2.2rem; box-shadow: var(--shadow); }
.auth-brand { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--font-serif); font-weight: 600; color: var(--ink-900); margin-bottom: 1.4rem; }
.auth-title { font-size: var(--text-page); margin-bottom: 1.2rem; }
.auth-help { color: var(--text-soft); margin-bottom: 1.2rem; }
.auth-alt { margin-top: 1.2rem; font-size: var(--text-secondary); color: var(--text-soft); }

.field { display: block; margin-bottom: 1.1rem; }
/* Fields with a validation message use <div class="field"><label for>…; checkbox
   rows keep the wrapping <label class="field field-check"> with an inner <span>. */
.field > label, .field span { display: block; font-size: var(--text-secondary); font-weight: 500; margin-bottom: 0.35rem; }
.field input, .field select, .field textarea { width: 100%; padding: 0.7rem 0.85rem; border: 1px solid var(--line-control); border-radius: var(--radius-md); font: inherit; background: var(--surface); }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
.field [aria-invalid="true"] { border-color: var(--danger); }
.field textarea { resize: vertical; min-height: 6rem; }
/* Inherits the 0.9rem label size above — kept, since shrinking error text is
   the wrong direction. (An 0.82rem here never applied: `.field span` wins.) */
.field-error { color: var(--danger); margin-top: 0.3rem; }
.field-check { display: flex; align-items: flex-start; gap: 0.6rem; }
.field-check input[type="checkbox"] { width: auto; margin-top: 0.2rem; flex: none; }
.field-check span { margin-bottom: 0; font-weight: 500; }
.field-check span small { display: block; font-weight: 400; margin-top: 0.15rem; }
.field-check-sm { margin: 0.4rem 0; font-size: var(--text-secondary); }
.field-check-sm span { font-weight: 400; }

.radio-group { display: flex; flex-direction: column; gap: 0.4rem; }
.radio { display: flex; align-items: flex-start; gap: 0.6rem; cursor: pointer; }
.radio input[type="radio"] { width: auto; margin-top: 0.2rem; flex: none; }
.radio span { margin-bottom: 0; font-weight: 500; }

.field-hint { font-size: var(--text-secondary); color: var(--text-soft); margin-top: 0.3rem; font-weight: 400; }

.btn-block { width: 100%; justify-content: center; }
.stack { display: grid; gap: 0.4rem; }

.form-error { background: var(--danger-wash); color: var(--danger); padding: 0.7rem 0.9rem; border-radius: var(--radius-md); margin-bottom: 1rem; font-size: var(--text-secondary); }
.form-success { background: var(--success-wash); color: var(--success); padding: 0.7rem 0.9rem; border-radius: var(--radius-md); margin-bottom: 1rem; font-size: var(--text-secondary); }
.form-warning { background: var(--caution-wash); color: var(--caution); padding: 0.7rem 0.9rem; border-radius: var(--radius-md); margin-bottom: 1rem; font-size: var(--text-secondary); }
/* The "send the payment email?" follow-up shown after confirming a session. */
.payment-prompt p { margin: 0 0 10px; }
/* The Google Calendar page's stacked sections and the setup checklist. */
.google-block { margin-top: 1.5rem; }
.google-block-sm { margin-top: 1rem; }
.google-block-lg { margin-top: 2rem; }
.google-steps { line-height: 1.8; }
.payment-prompt form { margin: 0; }

/* Back-office: left sidebar + content */
.admin-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100dvh; }
.admin-sidebar { background: #fff; border-right: 1px solid var(--sand-200); display: flex; flex-direction: column; gap: 1.6rem; padding: 1.6rem 1rem; position: sticky; top: 0; height: 100dvh; }
.admin-identity { display: flex; align-items: center; gap: 0.8rem; padding: 0.2rem 0.4rem; }
.admin-avatar { width: 46px; height: 46px; border-radius: var(--radius-round); overflow: hidden; flex: none; display: grid; place-items: center; background: var(--terra-500); color: #fff; font-family: var(--font-serif); font-size: 1.3rem; font-weight: 600; }
.admin-avatar img { width: 100%; height: 100%; object-fit: cover; }
.admin-identity-text { display: flex; flex-direction: column; line-height: 1.2; }
.admin-name { font-family: var(--font-serif); font-weight: 600; color: var(--ink-900); }
.admin-role { font-size: var(--text-micro); color: var(--text-soft); }
.admin-menu { display: flex; flex-direction: column; gap: 0.2rem; }
.admin-menu a { padding: 0.6rem 0.8rem; border-radius: var(--radius-md); color: var(--ink-700); font-weight: 500; }
.admin-menu a:hover { background: var(--sand-100); }
.admin-menu a.is-active { background: color-mix(in srgb, var(--terra-400) 18%, #fff); color: var(--accent-ink); }
.admin-sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 1rem; }
.admin-lang { display: flex; align-items: center; gap: 0.4rem; font-size: var(--text-secondary); color: var(--text-soft); }
.admin-lang a { color: var(--text-soft); padding: 0.15rem 0.4rem; border-radius: var(--radius-sm); }
.admin-lang a.is-active { color: var(--accent-ink); font-weight: 600; }
.admin-logout button { width: 100%; background: none; border: 1px solid var(--sand-200); border-radius: var(--radius-md); padding: 0.6rem 0.8rem; cursor: pointer; font: inherit; color: var(--ink-700); text-align: left; }
.admin-logout button:hover { border-color: var(--terra-400); color: var(--accent-ink); }
.admin-content { padding: 2.6rem clamp(1.2rem, 4vw, 3rem); max-width: 1040px; }
.admin-content-wide { max-width: none; }
.admin-content-center { width: 100%; margin-inline: auto; }
.admin-content-wide .admin-panel { max-width: 820px; margin-inline: auto; }
.admin-content-wide .recovery-box { max-width: 820px; margin-inline: auto; }
/* Only a heading placed directly in the wide container (Security) - Calendar/
   Marketing headings live inside .admin-head and are unaffected. */
.admin-content-wide > .admin-h1 { max-width: 820px; margin-inline: auto; text-align: center; }
.admin-h1 { font-size: var(--text-page); margin-bottom: 0.8rem; }
.admin-lead { color: var(--text-soft); margin: 0; }
.admin-empty { margin-top: 2.5rem; display: grid; place-items: center; gap: 0.6rem; text-align: center; color: var(--text-soft); padding: 3rem 1rem; border: 1px dashed var(--sand-200); border-radius: var(--radius); }
.admin-empty-mark { font-family: var(--font-serif); font-size: 2.4rem; color: color-mix(in srgb, var(--terra-500) 45%, #fff); }

/* Analytics dashboard */
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.admin-head .admin-h1 { margin-bottom: 0; }
.range-tabs { display: flex; gap: 0.3rem; }
.range-tabs a { padding: 0.35rem 0.7rem; border-radius: var(--radius-sm); font-size: var(--text-secondary); font-weight: 500; color: var(--ink-700); border: 1px solid var(--sand-200); }
.range-tabs a.is-active { background: var(--ink-900); color: #fff; border-color: var(--ink-900); }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--gap); margin: 1.6rem 0; }
.stat { background: #fff; border: 1px solid var(--sand-200); border-radius: var(--radius); padding: 1.3rem 1.4rem; }
.stat-num { display: block; font-family: var(--font-serif); font-size: var(--text-stat); font-weight: 600; color: var(--ink-900); line-height: 1.1; font-variant-numeric: tabular-nums; text-align: center; }
.stat-label { display: block; margin-top: 0.3rem; font-size: var(--text-secondary); color: var(--text-soft); }
.analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--gap); }
.analytics-grid .admin-panel { margin-top: 0; max-width: none; }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--text-secondary); }
.data-table td { padding: 0.45rem 0.2rem; border-bottom: 1px solid var(--sand-100); }
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-700); font-weight: 500; }
.data-table tr:last-child td { border-bottom: 0; }
.muted { color: var(--text-soft); font-size: var(--text-secondary); }
.analytics-note { margin-top: 1.6rem; font-size: var(--text-micro); }
.admin-panel { background: #fff; border: 1px solid var(--sand-200); border-radius: var(--radius); padding: 1.6rem; margin-top: 1.6rem; max-width: 560px; }
.admin-panel h2 { font-size: var(--text-title); margin-bottom: 1rem; }
.mfa-status { font-weight: 500; margin-bottom: 1rem; }
.mfa-status.is-on { color: var(--success); }
.mfa-status.is-off { color: var(--text-soft); }
.mfa-setup { display: grid; gap: 1rem; padding-left: 1.2rem; }
.mfa-secret { display: inline-block; background: var(--sand-100); padding: 0.3rem 0.6rem; border-radius: var(--radius-sm); letter-spacing: 0.12em; margin-top: 0.4rem; font-family: ui-monospace, Menlo, Consolas, monospace; }
.recovery-box { background: var(--sand-100); border: 1px solid var(--sand-200); border-radius: var(--radius); padding: 1.4rem; margin-bottom: 1.6rem; }
.recovery-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.5rem; margin-top: 0.8rem; list-style: none; }
.recovery-list code { display: block; background: #fff; border: 1px solid var(--sand-200); border-radius: var(--radius-sm); padding: 0.4rem 0.6rem; text-align: center; letter-spacing: 0.08em; }

/* ---------- Patients (Phase 7) ---------- */
.patient-toolbar { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-top: 1.8rem; margin-bottom: 1.6rem; }
.patient-toolbar input[type="search"] { padding: 0.6rem 0.85rem; border: 1px solid var(--line-control); border-radius: var(--radius-md); font: inherit; min-width: 220px; max-width: 100%; }
.patient-toolbar select { padding: 0.6rem 0.85rem; border: 1px solid var(--line-control); border-radius: var(--radius-md); font: inherit; background: var(--surface); max-width: 100%; }
/* Filter button uses the rounded-rectangle shape of the other tabs, not the pill .btn shape. */
.patient-toolbar .btn { border-radius: var(--radius-sm); }

.patient-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--gap); }
.patient-card { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; text-align: center; background: #fff; border: 1px solid var(--sand-200); border-radius: var(--radius); padding: 1.4rem 1rem; color: inherit; }
.patient-card:hover { border-color: var(--terra-400); }
/* Imported / unfinished profiles: red border so the missing contact
   details are visible at a glance in the grid. */
.patient-card--incomplete { border: 2px solid var(--danger); }
.patient-card--incomplete:hover { border-color: var(--danger-deep); }
.patient-card-avatar { width: 72px; height: 72px; border-radius: var(--radius-round); overflow: hidden; display: grid; place-items: center; background: var(--terra-500); color: #fff; font-family: var(--font-serif); font-size: 1.5rem; font-weight: 600; flex: none; }
.patient-card-avatar img { width: 100%; height: 100%; object-fit: cover; }
.patient-card-name { font-weight: 500; color: var(--ink-900); }

.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: var(--radius-pill); font-size: var(--text-micro); font-weight: 600; }
.badge-active { background: var(--success-wash); color: var(--success); }
.badge-paused { background: var(--caution-wash); color: var(--caution); }
.badge-archived { background: var(--sand-100); color: var(--text-soft); }
.badge-incomplete { background: var(--danger-wash); color: var(--danger); }

.patient-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.patient-header .patient-card-avatar { width: 56px; height: 56px; font-size: 1.2rem; }
.patient-header-name { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.patient-header-title { margin-bottom: 0; }

.patient-tabs { display: flex; gap: 0.3rem; border-bottom: 1px solid var(--sand-200); margin-bottom: 1.6rem; flex-wrap: wrap; }
.patient-tabs a { padding: 0.6rem 0.9rem; color: var(--text-soft); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.patient-tabs a.is-active { color: var(--accent-ink); border-bottom-color: var(--accent); }

.pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1.8rem; }
.pagination-status { font-size: var(--text-secondary); color: var(--text-soft); }
.btn.is-disabled { opacity: 0.4; pointer-events: none; }

.upload-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }
.confirm-delete summary { cursor: pointer; color: var(--danger); font-size: var(--text-secondary); list-style: none; }
.confirm-delete summary::-webkit-details-marker { display: none; }
.confirm-delete[open] summary { margin-bottom: 0.5rem; }
.confirm-delete form { display: flex; align-items: center; gap: 0.6rem; }

.note-item { border: 1px solid var(--sand-200); border-radius: var(--radius); padding: 1.1rem 1.3rem; margin-bottom: 1rem; }
.note-item-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 0.5rem; }
.note-item-date { font-weight: 600; color: var(--ink-900); }
.note-item-body { white-space: pre-wrap; color: var(--ink-700); }
.note-actions { margin-top: 0.8rem; display: flex; gap: 0.8rem; align-items: center; }
.note-actions details summary { cursor: pointer; color: var(--accent-ink); font-size: var(--text-secondary); list-style: none; }
.note-actions details summary::-webkit-details-marker { display: none; }
.note-actions details form { margin-top: 0.8rem; }

/* Session record (patient notes): the writing surface for a session —
   a centered panel at the system's reading measure, with a textarea tall
   enough to write in comfort. Inline edits get the same room to write. */
.session-record { max-width: 760px; margin-inline: auto; }
.session-record textarea { min-height: 15rem; }
.session-record input[type="date"] { max-width: 12rem; }
.note-item textarea { min-height: 10rem; }

/* ---------- Calendar (Phase 8) ---------- */
/* Create/edit appointment form — centered and compact; the patient field is
   30px wider than the other fields (440px vs 410px), all centered on screen. */
.admin-content.calendar-form-page { max-width: 680px; margin-inline: auto; }
.calendar-form-page .admin-h1 { text-align: center; }
.calendar-form { gap: 0.9rem; }
.calendar-form .field { margin-bottom: 0; }        /* spacing comes from the .stack/.field-row gap */
.calendar-form > .field:not(.patient-field),
.calendar-form > .field-row,
.calendar-form > .channel-group,
.calendar-form > .form-actions { width: 492px; max-width: 100%; margin-inline: auto; }
.channel-group { display: grid; gap: 0.35rem; }
.channel-group .field-check { margin: 0; }
.patient-field { width: 528px; max-width: 100%; margin-inline: auto; }   /* ~36px wider than the rest */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.calendar-form .form-actions { display: flex; gap: 0.6rem; margin-top: 0.4rem; justify-content: center; }

/* Searchable patient dropdown (progressive enhancement over the native <select>). */
.combobox { position: relative; }
.combobox-input { width: 100%; padding: 0.7rem 0.85rem; border: 1px solid var(--line-control); border-radius: var(--radius-md); font: inherit; background: var(--surface); }
.combobox-input:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
.combobox-panel { position: absolute; z-index: 20; left: 0; right: 0; margin-top: 0.3rem; background: var(--surface); border: 1px solid var(--sand-200); border-radius: var(--radius-md); box-shadow: var(--shadow); overflow: hidden; }
.combobox-options { max-height: 25rem; overflow-y: auto; margin: 0; padding: 0.3rem; list-style: none; }
.combobox-pinned { margin: 0; padding: 0.3rem; list-style: none; border-top: 1px solid var(--sand-200); }
.combobox-option { padding: 0.5rem 0.6rem; border-radius: var(--radius-sm); cursor: pointer; font-size: var(--text-ui); }
.combobox-option:hover, .combobox-option.is-active { background: var(--sand-100); }
.calendar-nav { display: flex; align-items: center; gap: 0.8rem; margin-top: 1.8rem; margin-bottom: 1.6rem; flex-wrap: wrap; }
/* Week-nav buttons use the rounded-rectangle shape of the Marketing tabs, not the pill .btn shape. */
.calendar-nav .btn { border-radius: var(--radius-sm); }
.calendar-week-label { font-weight: 500; color: var(--ink-900); }

.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.8rem; align-items: start; }
.calendar-day { background: #fff; border: 1px solid var(--sand-200); border-radius: var(--radius); padding: 0.8rem 0.1rem; min-height: 120px; }
.calendar-day.is-today { background: color-mix(in srgb, var(--terra-400) 6%, #fff); border-color: color-mix(in srgb, var(--terra-400) 35%, var(--sand-200)); }
.calendar-day-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 0.6rem; }
.calendar-day-name { font-weight: 600; color: var(--ink-900); }
.calendar-day.is-today .calendar-day-name { color: var(--accent-ink); }
.calendar-day-date { font-size: var(--text-micro); color: var(--text-soft); }
.calendar-day-add { display: block; text-align: center; border: 1px dashed var(--sand-200); border-radius: var(--radius-md); padding: 0.3rem; margin-bottom: 0.6rem; color: var(--text-soft); font-size: var(--text-secondary); }
.calendar-day-add:hover { border-color: var(--terra-400); color: var(--accent-ink); }
.calendar-day-empty { font-size: var(--text-micro); margin: 0; }

.appointment-card { background: var(--sand-50); border: 1px solid var(--sand-200); border-radius: var(--radius-tile); padding: 0.7rem 0.8rem; margin-bottom: 0.6rem; font-size: var(--text-secondary); }
/* Billing identity on the cards: team reads light blue, private/social pink.
   Wash + slightly stronger border of the same hue; the badge label always
   names the type, so colour is never the only carrier of meaning. */
.appointment-card-team { background: var(--billing-team-wash); border-color: var(--billing-team-line); }
.appointment-card-private,
.appointment-card-social { background: var(--billing-pink-wash); border-color: var(--billing-pink-line); }
.appointment-card-who { display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin-bottom: 0.3rem; }
.appointment-name { font-weight: 700; color: var(--ink-900); text-align: center; }
.appointment-time { color: var(--text-soft); font-variant-numeric: tabular-nums; margin-bottom: 0.4rem; text-align: center; }
.appointment-badges { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.appointment-actions { display: flex; align-items: center; justify-content: center; gap: 0.5rem; font-size: var(--text-micro); }
/* The actions read as buttons, not as body text: a border + padding gives
   them a tappable chip shape. */
.appointment-actions > a,
.appointment-move-trigger { border: 1px solid var(--terra-400); border-radius: var(--radius-sm); padding: 0.25rem 0.6rem; background: none; cursor: pointer; color: var(--accent-ink); font: inherit; font-size: var(--text-micro); }
/* Move form lives in a native <dialog>, so its fields stack full-width with room to breathe. */
.move-dialog .field { margin-bottom: 0.9rem; }
.move-dialog .confirm-dialog-actions { margin-top: 1.3rem; }

.badge-billing-private,
.badge-billing-social { background: var(--billing-pink-wash); color: var(--platform-instagram); }
.badge-billing-team { background: var(--billing-team-wash); color: var(--info); }
.badge-status-scheduled { background: var(--sand-100); color: var(--text-soft); }
.badge-status-confirmed { background: var(--success-wash); color: var(--success); }
.badge-status-completed { background: var(--info-wash); color: var(--info); }
.badge-status-cancelled { background: var(--danger-wash); color: var(--danger); }
.badge-status-no_show { background: var(--caution-wash); color: var(--caution); }

.conflict-actions form { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; padding: 0.8rem; border: 1px solid var(--sand-200); border-radius: var(--radius); }

/* ---------- Marketing (Phase 9) ---------- */
.marketing-add { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.marketing-tabs { margin: 1.8rem 0 1.6rem; }
.marketing-tabs a { padding: 0.5rem 1rem; font-size: var(--text-ui); }

.marketing-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.2rem; padding: 1.3rem 0; border-bottom: 1px solid var(--sand-100); flex-wrap: wrap; }
.marketing-row:last-child { border-bottom: 0; }
.marketing-row-main { flex: 1 1 320px; min-width: 0; display: flex; gap: 0.9rem; align-items: center; }
.marketing-row-body { min-width: 0; }
.marketing-row-badges { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.marketing-row-title { display: block; font-size: var(--text-title); font-weight: 600; color: var(--ink-900); margin-bottom: 0.4rem; }
.marketing-row-preview { margin: 0; overflow-wrap: anywhere; font-size: var(--text-body); line-height: 1.5; }
.marketing-row-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.marketing-row-actions > form { display: contents; }

dialog.confirm-dialog {
    border: none; border-radius: var(--radius); padding: 1.7rem;
    max-width: 420px; width: calc(100% - 2.4rem);
    box-shadow: var(--shadow);
}
dialog.confirm-dialog::backdrop { background: rgba(43, 36, 31, 0.55); }
.confirm-dialog-title { margin-bottom: 0.6rem; }
.confirm-dialog p { color: var(--text-soft); margin: 0 0 1.5rem; }
.confirm-dialog-actions { display: flex; justify-content: flex-end; gap: 0.7rem; }

.marketing-platform-icon {
    display: flex; align-items: center; justify-content: center; flex: none;
    width: 88px; height: 88px; border-radius: var(--radius-round);
}
.marketing-platform-icon svg { width: 44px; height: 44px; }
.marketing-platform-icon.platform-instagram { background: var(--platform-instagram-wash); color: var(--platform-instagram); }
.marketing-platform-icon.platform-linkedin { background: var(--platform-linkedin-wash); color: var(--platform-linkedin); }
.marketing-platform-icon.platform-internal { background: var(--sand-100); color: var(--ink-700); }
.badge-marketing-draft { background: var(--sand-100); color: var(--text-soft); }
.badge-marketing-published { background: var(--success-wash); color: var(--success); }

.marketing-cover-preview { display: block; width: 100%; max-width: 260px; border-radius: var(--radius-md); margin-bottom: 0.6rem; border: 1px solid var(--sand-200); }

/* ---------- Admin welcome screen ---------- */
.welcome-overlay {
    position: fixed; inset: 0; z-index: 500;
    display: flex; align-items: center; justify-content: center;
    padding: 2rem;
    background: linear-gradient(160deg, var(--sand-50), var(--sand-100) 65%, color-mix(in srgb, var(--terra-400) 14%, var(--sand-100)));
    animation: welcome-fade 5.5s ease forwards;
    cursor: pointer;
}
.welcome-card { text-align: center; max-width: 460px; display: flex; flex-direction: column; align-items: center; gap: 1.1rem; }
.welcome-avatar {
    width: 110px; height: 110px; border-radius: var(--radius-round); overflow: hidden; flex: none;
    display: grid; place-items: center;
    background: var(--terra-500); color: #fff;
    font-family: var(--font-serif); font-size: 2.4rem; font-weight: 600;
    box-shadow: var(--shadow);
}
.welcome-avatar img { width: 100%; height: 100%; object-fit: cover; }
.welcome-greeting { font-family: var(--font-serif); font-size: var(--text-title); color: var(--ink-900); margin: 0; }
.welcome-quote {
    font-family: var(--font-serif); font-size: var(--text-quote-sm);
    color: var(--terra-600); line-height: 1.5; margin: 0;
    text-wrap: balance;
}
.welcome-continue {
    margin-top: 0.4rem; padding: 0.55rem 1.3rem; border-radius: var(--radius-pill);
    border: 1px solid var(--sand-200); color: var(--ink-700); font-size: var(--text-secondary); font-weight: 500;
    cursor: pointer;
}
.welcome-continue:hover { border-color: var(--terra-400); color: var(--accent-ink); }
@keyframes welcome-fade {
    0%, 80% { opacity: 1; visibility: visible; pointer-events: auto; }
    100% { opacity: 0; visibility: hidden; pointer-events: none; }
}
/* Same 5.5s dismissal with no perceptible motion — see the reduced-motion block. */
@keyframes welcome-step {
    from { opacity: 1; visibility: visible; pointer-events: auto; }
    to   { opacity: 0; visibility: hidden; pointer-events: none; }
}

/* ---------- Cookie consent ---------- */
.consent { position: fixed; left: 0; right: 0; bottom: 0; z-index: 150; background: var(--ink-900); color: var(--sand-100); box-shadow: 0 -10px 30px -20px rgba(43, 36, 31, 0.6); }
.consent[hidden] { display: none; }
.consent-inner { display: flex; align-items: center; gap: 1rem 2rem; flex-wrap: wrap; padding: 1.1rem 0; }
.consent-text { flex: 1 1 360px; }
.consent-msg { margin: 0; font-size: var(--text-ui); line-height: 1.5; }
.consent-msg a { color: #fff; text-decoration: underline; }
.consent-prefs { margin-top: 0.9rem; padding-top: 0.9rem; border-top: 1px solid rgba(255,255,255,0.16); }
.consent-prefs[hidden] { display: none; }
.consent-essential { margin: 0 0 0.6rem; font-size: var(--text-micro); color: var(--sand-200); }
.consent-toggle { display: flex; gap: 0.6rem; align-items: flex-start; font-size: var(--text-secondary); }
.consent-toggle input { margin-top: 0.25rem; }
.consent-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.consent-actions .btn { padding: 0.55rem 1.2rem; }
.consent-link { background: none; border: 0; color: var(--sand-200); cursor: pointer; font: inherit; text-decoration: underline; padding: 0.3rem 0.4rem; }
.consent-link:hover { color: #fff; }

/* ---------- Legal pages ---------- */
.legal h2 { font-family: var(--font-serif); font-size: var(--text-title); margin: 2rem 0 0.6rem; }
.legal p, .legal li { line-height: 1.7; }
.legal ul { padding-left: 1.2rem; margin: 0.6rem 0; }
/* Same caution family as .form-warning — it was a third, near-identical amber. */
.legal-notice { background: var(--caution-wash); border: 1px solid color-mix(in srgb, var(--caution) 32%, var(--caution-wash)); color: var(--caution); padding: 0.9rem 1.1rem; border-radius: var(--radius-md); margin-bottom: 1.6rem; font-size: var(--text-secondary); }
.legal-updated { color: var(--text-soft); font-size: var(--text-secondary); margin-top: 0; }
.table-scroll { overflow-x: auto; }
.legal-table { width: 100%; border-collapse: collapse; margin: 0.8rem 0; font-size: var(--text-secondary); }
.legal-table th, .legal-table td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--sand-200); }
.legal-table th { font-weight: 600; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.4rem 1.5rem; }
.footer-legal-links { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.footer-legal-links a, .footer-legal-links .consent-link { color: var(--text-soft); font-size: var(--text-secondary); }
.footer-legal-links a:hover, .footer-legal-links .consent-link:hover { color: var(--accent-ink); }

/* ---------- Real-content resilience ----------
   Patient names, post titles, emails and analytics paths are user data: they
   arrive long, unbroken, and in Portuguese (routinely ~30% longer than the
   English the layout was eyeballed with). Flex and grid children default to
   min-width:auto, so without these a single long token pushes its container
   wider than the screen. */
.brand-text, .admin-identity-text, .appointment-card-who > *, .field-row > * { min-width: 0; }
.patient-card, .marketing-row-actions { min-width: 0; }
.brand-name, .admin-name,
.patient-card-name, .appointment-name,
.marketing-row-title, .note-item-date,
.combobox-option, .data-table td, .stat-num { overflow-wrap: anywhere; }

/* Long quotes or a full move-form must not push their own actions off-screen. */
dialog.confirm-dialog { max-height: calc(100dvh - 3rem); overflow-y: auto; }
.combobox-options { max-height: min(25rem, 45vh); }

/* ---------- Responsive ---------- */

/* Tablet — keep the two-column hero but tighten it up. */
@media (max-width: 1024px) {
    .hero-inner { grid-template-columns: 1fr 0.85fr; gap: clamp(1.5rem, 4vw, 3rem); }
    .hero-visual { min-height: 320px; }
    .approach-inner { gap: 2rem; }
    .card-grid { grid-template-columns: 1fr 1fr; }
}

/* Mobile / small tablet — stack everything, switch to the drawer nav. */
@media (max-width: 860px) {
    .hero-inner { grid-template-columns: 1fr; }
    .hero-visual { order: -1; min-height: 260px; }
    .hero-photo { width: min(74%, 300px); }
    .hero-subtitle { max-width: none; }
    .approach-inner, .about-grid { grid-template-columns: 1fr; }
    .about-portrait { position: static; max-width: 320px; }
    .contact-links { grid-template-columns: 1fr; }

    .nav-toggle { display: flex; }
    .header-actions { margin-left: auto; }
    .site-nav {
        position: fixed; inset: 0 0 0 auto; width: min(320px, 80vw);
        background: var(--surface); box-shadow: var(--shadow);
        transform: translateX(100%); transition: transform 0.3s ease, visibility 0.3s;
        padding: 5rem 2rem 2rem;
        /* A closed drawer is off-screen but still in the tab order without this:
           Tab would move focus into a menu nobody can see. */
        visibility: hidden;
    }
    .site-nav.is-open { transform: none; visibility: visible; }
    .site-nav ul { flex-direction: column; align-items: flex-start; gap: 1.3rem; }
    body.nav-open { overflow: hidden; }
    .nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .nav-toggle.is-open span:nth-child(2) { opacity: 0; }
    .nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* Small phones — full-width actions, tighter chrome. */
@media (max-width: 520px) {
    .container { width: 94%; }
    .hero-actions { flex-direction: column; align-items: stretch; }
    .hero-actions .btn { width: 100%; justify-content: center; }
    .footer-inner { flex-direction: column; align-items: flex-start; gap: 1.2rem; }
    /* Own line here, so a long "CP … | ERS …" wraps instead of overflowing. */
    .footer-name-legal { display: block; margin-top: 0.15rem; white-space: normal; }
    .consent-actions { flex-direction: column; align-items: stretch; }
    .consent-actions .btn { width: 100%; justify-content: center; }
    .consent-link { align-self: flex-start; }
}

/* Back-office: stack the sidebar into a top bar on small screens. */
@media (max-width: 860px) {
    .admin-shell { grid-template-columns: 1fr; }
    .admin-sidebar {
        position: static; height: auto; flex-direction: row; flex-wrap: wrap;
        align-items: center; gap: 0.8rem 1rem;
        border-right: 0; border-bottom: 1px solid var(--sand-200);
    }
    .admin-menu { flex-direction: row; flex-wrap: wrap; gap: 0.3rem; }
    .admin-sidebar-foot { margin-top: 0; margin-left: auto; flex-direction: row; align-items: center; gap: 1rem; }
    .admin-logout button { width: auto; }
    .calendar-grid { grid-template-columns: 1fr; }
}

/* ---------- Input and device context ----------
   Viewport width says nothing about how the page is being touched, and this
   site's primary visitor is on a phone deciding whether to reach out. These
   query the input itself, and sit after the width breakpoints so they win. */

/* The lift is a pointer affordance. On touch there is no un-hover: :hover
   sticks after the tap and leaves the element raised until you tap something
   else. So the lift exists only where a real pointer does. */
@media (hover: hover) {
    .btn-primary:hover, .btn-ghost:hover, .btn-danger:hover { transform: translateY(-2px); }
    .nav-cta a:hover { transform: translateY(-1px); }
    .card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: transparent; }
    .contact-link:hover { transform: translateY(-3px); }
    .patient-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
}

/* Touch gets a press instead of a lift — the tap still gets an answer. */
@media (hover: none) {
    .btn:active, .contact-link:active, .card:active, .patient-card:active,
    .nav-cta a:active { transform: scale(0.985); }
}

/* Where a finger does the aiming, targets grow to 44px. Desktop keeps its
   density: this never fires for a mouse. */
@media (pointer: coarse) {
    .site-nav a, .footer-links a, .footer-legal-links a, .footer-legal-links .consent-link,
    .nav-lang a, .admin-menu a,
    .patient-tabs a, .range-tabs a, .marketing-tabs a,
    .appointment-actions > a, .appointment-move-trigger,
    .note-actions details summary, .confirm-delete summary {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    .site-nav a, .footer-links a, .admin-menu a { display: flex; }
    .nav-toggle { padding: 0.75rem 0.4rem; }
    .combobox-option { padding-block: 0.75rem; }
}

/* Notches and home indicators. viewport-fit=cover lets the page use the whole
   screen, so the fixed and full-bleed surfaces have to keep their own controls
   out of the inset areas. env() is 0 everywhere else. */
.container {
    padding-inline: max(0px, env(safe-area-inset-left)) max(0px, env(safe-area-inset-right));
}
.consent-inner { padding-bottom: max(1.1rem, env(safe-area-inset-bottom)); }
@media (max-width: 860px) {
    .site-nav {
        padding-right: max(2rem, env(safe-area-inset-right));
        padding-top: max(5rem, calc(4rem + env(safe-area-inset-top)));
    }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; scroll-behavior: auto; }
    [data-reveal] { opacity: 1; transform: none; }
    /* The welcome screen hides itself *through* its animation, so the blanket
       kill above would leave it covering the dashboard indefinitely. Swap the
       fade for a single step: it still clears after 5.5s, with nothing moving. */
    .welcome-overlay { animation: welcome-step 5.5s steps(1, end) forwards !important; }
}
