/* ─────────────────────────────────────────────────────────────────────
   Shelterbelt Porosity Analyzer — field journal × scientific instrument
   Typography: Fraunces (display, variable opsz) + Instrument Sans (body)
              + JetBrains Mono (data)
   Palette: warm paper, ink, moss, ochre, weathered sky
   ───────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght,SOFT,WONK@0,9..144,200..900,0..100,0..1;1,9..144,200..900,0..100,0..1&family=Instrument+Sans:ital,wght@0,400..700;1,400..700&family=JetBrains+Mono:ital,wght@0,400..700;1,400..700&display=swap');

:root {
    /* palette */
    --paper:     #f3efe2;
    --paper-2:   #ece6d2;
    --paper-3:   #e3dbc0;
    --ink:       #14130d;
    --ink-2:     #2d2a1e;
    --ink-3:     #5b574a;
    --muted:     #85806e;
    --hair:      #cfc7ad;
    --hair-soft: #ded6bc;
    --moss:      #35482f;
    --moss-2:    #4e6546;
    --moss-3:    #778a70;
    --ochre:     #a86a23;
    --ochre-2:   #c58537;
    --sky:       #5c7d8f;
    --sky-2:     #8ba6b4;
    --alert:     #7d2323;
    --success:   #3e5b2d;

    /* type */
    --ff-display: "Fraunces", "Playfair Display", Georgia, serif;
    --ff-body:    "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
    --ff-mono:    "JetBrains Mono", ui-monospace, monospace;

    /* spacing */
    --s1: 0.25rem; --s2: 0.5rem;  --s3: 0.75rem; --s4: 1rem;
    --s5: 1.5rem;  --s6: 2rem;    --s7: 3rem;    --s8: 5rem;
    --s9: 8rem;    --s10: 12rem;

    /* hairlines */
    --hl: 1px solid var(--hair);
    --hl-soft: 1px solid var(--hair-soft);
    --hl-ink: 1px solid var(--ink);

    /* container */
    --measure: 72ch;
    --wide: 1180px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    font-family: var(--ff-body);
    font-size: 17px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--paper);
    font-feature-settings: "ss01", "cv11";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* subtle paper grain */
    background-image:
        radial-gradient(circle at 20% 30%, rgba(86,70,30,0.035) 0, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(53,72,47,0.03) 0, transparent 45%);
    background-attachment: fixed;
}

/* grain overlay via SVG noise */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.08;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.8 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ─── Typography ─────────────────────────────────────────────────── */

h1, h2, h3, h4, h5 {
    font-family: var(--ff-display);
    font-weight: 400;
    color: var(--ink);
    margin: 0 0 var(--s4);
    letter-spacing: -0.01em;
    font-variation-settings: "opsz" 72, "SOFT" 30, "WONK" 0;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4.2rem);
    line-height: 1.02;
    letter-spacing: -0.025em;
    font-variation-settings: "opsz" 144, "SOFT" 40, "WONK" 1;
}

h2 {
    font-size: clamp(1.6rem, 2.5vw, 2.1rem);
    line-height: 1.1;
    font-variation-settings: "opsz" 96, "SOFT" 30, "WONK" 0;
}

h3 { font-size: 1.3rem; line-height: 1.2; }
h4 { font-size: 1.1rem; line-height: 1.3; font-family: var(--ff-body); font-weight: 600; letter-spacing: 0; }

p { margin: 0 0 var(--s4); }

em { font-style: italic; font-family: var(--ff-display); font-variation-settings: "opsz" 72, "SOFT" 100; }

a {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: var(--hair);
    transition: text-decoration-color 0.2s;
}
a:hover { text-decoration-color: var(--ink); }

small, .small { font-size: 0.82rem; }

::selection { background: var(--ochre); color: var(--paper); }

/* Small-caps section marker */
.label, .eyebrow {
    font-family: var(--ff-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.num {
    font-family: var(--ff-mono);
    font-feature-settings: "tnum";
}

/* ─── Layout primitives ──────────────────────────────────────────── */

.container {
    width: 100%;
    max-width: var(--wide);
    margin: 0 auto;
    padding: var(--s6) var(--s5) var(--s8);
}

.container-narrow {
    max-width: 520px;
}

.page-header {
    padding-top: var(--s6);
    padding-bottom: var(--s6);
    border-bottom: var(--hl);
    margin-bottom: var(--s7);
    display: flex;
    flex-direction: column;
    gap: var(--s2);
}
.page-header h1 { margin: 0; }
.page-header .lede {
    color: var(--ink-3);
    font-size: 1.05rem;
    max-width: 60ch;
    margin: 0;
}

.lede {
    font-size: 1.2rem;
    color: var(--ink-3);
    line-height: 1.5;
    margin-bottom: var(--s6);
    max-width: 60ch;
}

/* ─── Top navigation ─────────────────────────────────────────────── */

.topnav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--s4) var(--s6);
    border-bottom: var(--hl);
    background: var(--paper);
    position: relative;
    z-index: 10;
    gap: var(--s4);
    flex-wrap: wrap;
}

.topnav .brand {
    font-family: var(--ff-display);
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: -0.015em;
    text-decoration: none;
    color: var(--ink);
    font-variation-settings: "opsz" 48, "SOFT" 30;
    display: inline-flex;
    align-items: center;
    gap: var(--s2);
}
.topnav .brand .brand-mark { color: var(--moss); flex-shrink: 0; }
.topnav .brand:hover .brand-mark { color: var(--ochre); transition: color 0.2s; }

.topnav .nav-links {
    display: flex;
    align-items: center;
    gap: var(--s5);
    flex-wrap: wrap;
}
.topnav .nav-links a {
    color: var(--ink-3);
    text-decoration: none;
    font-size: 0.93rem;
    font-weight: 500;
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.topnav .nav-links a:hover { color: var(--ink); }
.topnav .nav-links a.active {
    color: var(--ink);
    border-bottom-color: var(--ink);
}
.topnav .nav-links a.primary-link {
    background: var(--ink);
    color: var(--paper);
    padding: 8px 14px;
    border: 1px solid var(--ink);
    border-bottom: 1px solid var(--ink);
}
.topnav .nav-links a.primary-link:hover {
    background: var(--moss);
    border-color: var(--moss);
    color: var(--paper);
}

.tier-badge {
    font-family: var(--ff-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 2px 8px;
    border: var(--hl-ink);
    border-radius: 0;
    color: var(--ink);
    background: transparent;
    font-weight: 500;
}
.tier-badge.tier-free  { border-color: var(--muted); color: var(--muted); }
.tier-badge.tier-pro   { background: var(--ochre); color: var(--paper); border-color: var(--ochre); }
.tier-badge.tier-admin { background: var(--moss); color: var(--paper); border-color: var(--moss); }

.quota-pill {
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    color: var(--ink-3);
    padding: 2px 10px;
    border: var(--hl);
    background: var(--paper-2);
    letter-spacing: 0.02em;
}

/* ─── Buttons / links ────────────────────────────────────────────── */

button, a.primary-link, a.ghost-link {
    font-family: var(--ff-body);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

a.primary-link {
    display: inline-block;
    background: var(--ink);
    color: var(--paper);
    text-decoration: none;
    padding: 12px 22px;
    border: 1px solid var(--ink);
    border-radius: 0;
    letter-spacing: 0.01em;
}
a.primary-link:hover {
    background: var(--moss);
    border-color: var(--moss);
    color: var(--paper);
}

a.ghost-link {
    display: inline-block;
    color: var(--ink);
    text-decoration: none;
    padding: 12px 22px;
    border: var(--hl-ink);
    background: transparent;
    border-radius: 0;
}
a.ghost-link:hover { background: var(--paper-2); }

button {
    padding: 10px 18px;
    border: var(--hl);
    background: var(--paper);
    color: var(--ink);
    border-radius: 0;
}
button:hover:not(:disabled) {
    border-color: var(--ink);
}
button:disabled { opacity: 0.5; cursor: not-allowed; }

button.primary {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
    font-size: 1.05rem;
    padding: 14px 28px;
    width: 100%;
    font-weight: 500;
    letter-spacing: 0.02em;
}
button.primary:hover:not(:disabled) {
    background: var(--moss);
    border-color: var(--moss);
}

/* ─── Homepage ───────────────────────────────────────────────────── */

.hero {
    padding: var(--s9) var(--s5) var(--s8);
    border-bottom: var(--hl);
    background: linear-gradient(180deg, transparent 0%, rgba(207,199,173,0.2) 100%);
    position: relative;
    overflow: hidden;
}
.hero-inner {
    max-width: var(--wide);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--s5);
    position: relative;
    z-index: 1;
}
.hero-eyebrow {
    display: flex;
    align-items: center;
    gap: var(--s3);
    margin-bottom: var(--s5);
}
.hero-eyebrow::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--hair);
    max-width: 240px;
}
.hero h1 {
    font-size: clamp(3rem, 7.5vw, 6.2rem);
    line-height: 0.98;
    letter-spacing: -0.035em;
    max-width: 16ch;
    margin-bottom: var(--s5);
}
.hero h1 em {
    color: var(--moss);
    font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
}
.hero-sub {
    font-family: var(--ff-body);
    font-size: clamp(1.1rem, 1.6vw, 1.3rem);
    max-width: 58ch;
    color: var(--ink-2);
    line-height: 1.5;
    margin-bottom: var(--s6);
}
.hero-cta {
    display: flex;
    gap: var(--s3);
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: var(--s4);
}
.hero-note {
    font-family: var(--ff-mono);
    font-size: 0.8rem;
    color: var(--muted);
    letter-spacing: 0.03em;
}

/* Decorative mask pattern in hero corner */
.hero-decor {
    position: absolute;
    right: -50px;
    top: 50%;
    transform: translateY(-50%);
    width: 380px;
    height: 380px;
    opacity: 0.5;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 30% 40%, var(--ink) 4px, transparent 5px),
        radial-gradient(circle at 60% 20%, var(--ink) 3px, transparent 4px),
        radial-gradient(circle at 75% 55%, var(--ink) 5px, transparent 6px),
        radial-gradient(circle at 15% 75%, var(--ink) 3px, transparent 4px),
        radial-gradient(circle at 45% 85%, var(--ink) 4px, transparent 5px),
        radial-gradient(circle at 85% 80%, var(--ink) 2px, transparent 3px),
        radial-gradient(circle at 25% 15%, var(--ink) 2px, transparent 3px);
    background-size: 100% 100%;
}

/* Features: editorial numbered grid */
.section {
    padding: var(--s9) var(--s5);
    border-bottom: var(--hl);
}
.section-inner {
    max-width: var(--wide);
    margin: 0 auto;
}
.section-head {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: var(--s6);
    margin-bottom: var(--s7);
    align-items: baseline;
}
.section-head .eyebrow { align-self: start; padding-top: var(--s3); border-top: var(--hl-ink); }
.section-head h2 {
    max-width: 18ch;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0;
    border-top: var(--hl);
    border-left: var(--hl);
}
.feature-card {
    grid-column: span 4;
    padding: var(--s6) var(--s5);
    border-bottom: var(--hl);
    border-right: var(--hl);
    display: flex;
    flex-direction: column;
    gap: var(--s3);
    position: relative;
    transition: background 0.2s;
}
.feature-card:hover { background: var(--paper-2); }
.feature-num {
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    color: var(--muted);
    letter-spacing: 0.08em;
}
.feature-card h3 {
    font-family: var(--ff-display);
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1.15;
    margin: 0 0 var(--s2);
    font-variation-settings: "opsz" 48, "SOFT" 40;
}
.feature-card p {
    color: var(--ink-3);
    font-size: 0.95rem;
    margin: 0;
}

/* ─── Features arranged into 4 thematic groups ───────────────────── */
.features-groups {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: var(--hl);
}
.feature-group {
    padding: var(--s6) var(--s6);
    border-right: var(--hl);
    border-bottom: var(--hl);
    display: flex;
    flex-direction: column;
    gap: var(--s3);
    background: var(--paper);
    transition: background 0.2s;
}
.feature-group:nth-child(2n) { border-right: none; }
.feature-group:nth-last-child(-n+2) { border-bottom: none; }
.feature-group:hover { background: var(--paper-2); }
.feature-group .feature-num {
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    color: var(--ochre);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: var(--s2);
}
.feature-group h3 {
    font-family: var(--ff-display);
    font-size: 1.8rem;
    font-weight: 400;
    line-height: 1.05;
    margin: 0 0 var(--s3);
    font-variation-settings: "opsz" 96, "SOFT" 50;
    color: var(--ink);
}
.feature-group .feature-group-lede {
    color: var(--ink-3);
    font-size: 0.95rem;
    line-height: 1.55;
    margin: 0 0 var(--s5);
    max-width: 42ch;
}
.feature-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
    border-top: var(--hl);
}
.feature-group ul li {
    padding: var(--s3) 0;
    border-bottom: var(--hl);
    color: var(--ink-3);
    font-size: 0.92rem;
    display: flex;
    gap: var(--s3);
    align-items: baseline;
}
.feature-group ul li:last-child { border-bottom: none; }
.feature-group ul li::before {
    content: "—";
    color: var(--moss-3);
    font-family: var(--ff-mono);
    flex-shrink: 0;
}
.feature-group ul li strong {
    color: var(--ink);
    font-weight: 600;
    margin-right: 4px;
}

@media (max-width: 720px) {
    .features-groups { grid-template-columns: 1fr; }
    .feature-group { border-right: none; }
    .feature-group:nth-last-child(-n+2):not(:last-child) { border-bottom: var(--hl); }
}

/* How it works: big numerals */
.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: var(--hl);
}
.steps li {
    padding: var(--s6) var(--s5) var(--s7);
    border-right: var(--hl);
    position: relative;
    counter-increment: step;
}
.steps li:last-child { border-right: none; }
.steps li::before {
    content: counter(step, decimal-leading-zero);
    display: block;
    font-family: var(--ff-display);
    font-size: 4rem;
    font-weight: 300;
    color: var(--moss);
    line-height: 0.8;
    margin-bottom: var(--s4);
    font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
}
.steps { counter-reset: step; }
.steps li strong {
    display: block;
    font-family: var(--ff-display);
    font-size: 1.4rem;
    font-weight: 400;
    font-variation-settings: "opsz" 48, "SOFT" 40;
    margin-bottom: var(--s3);
    color: var(--ink);
}
.steps li p {
    color: var(--ink-3);
    font-size: 0.95rem;
    margin: 0;
}

/* Who's it for: editorial list */
.who-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-width: 78ch;
}
.who-list li {
    padding: var(--s5) 0;
    border-bottom: var(--hl);
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: var(--s5);
    align-items: baseline;
}
.who-list li:first-child { border-top: var(--hl); }
.who-list li strong {
    font-family: var(--ff-display);
    font-weight: 400;
    font-size: 1.15rem;
    font-variation-settings: "opsz" 48;
}
.who-list li span {
    color: var(--ink-3);
    font-size: 0.98rem;
}

/* CTA band: typographic */
.cta-band {
    padding: var(--s9) var(--s5);
    background: var(--ink);
    color: var(--paper);
    text-align: center;
    border-bottom: var(--hl);
    position: relative;
    overflow: hidden;
}
.cta-band::before,
.cta-band::after {
    content: "";
    position: absolute;
    left: var(--s6);
    right: var(--s6);
    height: 1px;
    background: rgba(243,239,226,0.15);
}
.cta-band::before { top: var(--s5); }
.cta-band::after { bottom: var(--s5); }
.cta-band h2 {
    color: var(--paper);
    font-size: clamp(2rem, 4vw, 3.2rem);
    font-variation-settings: "opsz" 144, "SOFT" 60, "WONK" 1;
    max-width: 18ch;
    margin: 0 auto var(--s4);
}
.cta-band p {
    font-family: var(--ff-mono);
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    color: var(--paper-3);
    margin-bottom: var(--s5);
}
.cta-band a.primary-link {
    background: var(--paper);
    color: var(--ink);
    border-color: var(--paper);
    padding: 14px 28px;
}
.cta-band a.primary-link:hover {
    background: var(--ochre);
    border-color: var(--ochre);
    color: var(--paper);
}

/* Footer */
.site-footer {
    padding: var(--s6) var(--s5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--s4);
    max-width: var(--wide);
    margin: 0 auto;
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    color: var(--muted);
    letter-spacing: 0.02em;
}
.site-footer a { color: var(--muted); text-decoration-color: var(--hair); }
.site-footer .dot { opacity: 0.4; }

.legal { max-width: 720px; }
.legal h1 { font-family: var(--ff-display, serif); font-size: 2.4rem; margin: 0 0 var(--s3); }
.legal h2 { font-family: var(--ff-display, serif); font-size: 1.25rem; margin: var(--s6) 0 var(--s3); }
.legal p, .legal li { line-height: 1.6; }
.legal-meta { color: var(--muted); font-family: var(--ff-mono); font-size: 0.82rem; margin-bottom: var(--s5); }
.legal-list { padding-left: var(--s5); }
.legal-list li { margin-bottom: var(--s2); }
.legal a { color: var(--ochre, var(--ink)); }

.danger-zone { margin-top: var(--s7, 3rem); padding: var(--s5); border: 1px dashed var(--hair); border-radius: 6px; }
.danger-zone .danger-note { color: var(--muted); font-size: 0.92rem; margin-bottom: var(--s4); line-height: 1.5; }
.danger-actions { display: flex; gap: var(--s3); flex-wrap: wrap; }
.ghost-btn, .danger-btn { padding: 0.55rem 1.1rem; font-family: var(--ff-mono); font-size: 0.82rem; letter-spacing: 0.04em; border-radius: 4px; cursor: pointer; background: transparent; }
.ghost-btn { border: 1px solid var(--hair); color: var(--ink); }
.ghost-btn:hover { background: var(--paper); }
.danger-btn { border: 1px solid #b54a3a; color: #b54a3a; }
.danger-btn:hover { background: #b54a3a; color: #fff; }
.danger-btn:disabled, .ghost-btn:disabled { opacity: 0.55; cursor: wait; }

.confirm-tips { padding-left: var(--s5); margin: var(--s4) 0; color: var(--muted); font-size: 0.92rem; line-height: 1.55; }
.confirm-tips li { margin-bottom: var(--s2); }

.conf-badge { display: inline-block; padding: 2px 8px; border-radius: 3px; font-family: var(--ff-mono); font-size: 0.72rem; letter-spacing: 0.04em; }
.conf-yes { background: #e2ecdd; color: #35482f; }
.conf-no  { background: #f3e0d5; color: #a86a23; }

/* ─── Auth pages ─────────────────────────────────────────────────── */

.auth-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: calc(100vh - 70px);
    border-top: var(--hl);
}
.auth-side {
    padding: var(--s8) var(--s7);
    border-right: var(--hl);
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--paper-2);
    position: relative;
}
.auth-side-title {
    font-family: var(--ff-display);
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1;
    margin-bottom: var(--s5);
    font-variation-settings: "opsz" 144, "SOFT" 60, "WONK" 1;
}
.auth-side-title em { color: var(--moss); }
.auth-side-sub {
    color: var(--ink-3);
    max-width: 32ch;
    margin-bottom: var(--s6);
}
.auth-side-notes {
    font-family: var(--ff-mono);
    font-size: 0.8rem;
    color: var(--ink-3);
    letter-spacing: 0.02em;
    line-height: 1.8;
}
.auth-side-notes span {
    display: block;
    padding: var(--s2) 0;
    border-bottom: var(--hl);
}
.auth-side-notes span:last-child { border-bottom: none; }

.auth-main {
    padding: var(--s8) var(--s7);
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.auth-card {
    max-width: 380px;
    margin: 0 auto;
    width: 100%;
}
.auth-card h1 {
    font-size: 2rem;
    margin-bottom: var(--s2);
}
.auth-card .lede { font-size: 1rem; margin-bottom: var(--s6); }
.auth-card form {
    display: flex;
    flex-direction: column;
    gap: var(--s5);
}
.auth-card label {
    display: flex;
    flex-direction: column;
    gap: var(--s2);
}
.auth-card label span {
    font-family: var(--ff-mono);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.auth-card label small {
    font-family: var(--ff-mono);
    font-size: 0.75rem;
    color: var(--muted);
    letter-spacing: 0.02em;
}
.auth-card input {
    font-family: var(--ff-body);
    font-size: 1.05rem;
    padding: 10px 0;
    border: none;
    border-bottom: var(--hl-ink);
    background: transparent;
    color: var(--ink);
    border-radius: 0;
}
.auth-card input:focus {
    outline: none;
    border-bottom-color: var(--moss);
}
.auth-card .primary {
    margin-top: var(--s3);
    width: 100%;
    padding: 14px;
}
.auth-alt {
    margin-top: var(--s5);
    padding-top: var(--s5);
    border-top: var(--hl);
    font-size: 0.92rem;
    color: var(--ink-3);
}

/* ─── Pricing ────────────────────────────────────────────────────── */

.pricing-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: var(--hl-ink);
    margin-bottom: var(--s8);
}
.pricing-card {
    padding: var(--s7) var(--s6);
    background: var(--paper);
    border-right: var(--hl);
    position: relative;
    display: flex;
    flex-direction: column;
}
.pricing-card:last-child { border-right: none; }
.pricing-card-featured {
    background: var(--ink);
    color: var(--paper);
}
.pricing-card-featured h2,
.pricing-card-featured .price-amount,
.pricing-card-featured .features-list li { color: var(--paper); }
.pricing-card-featured .price-period,
.pricing-card-featured .tier-sub,
.pricing-card-featured .hint { color: var(--paper-3); }
.pricing-card-featured a.primary-link {
    background: var(--paper);
    color: var(--ink);
    border-color: var(--paper);
}
.pricing-card-featured a.primary-link:hover {
    background: var(--ochre);
    border-color: var(--ochre);
    color: var(--paper);
}

.pricing-card .badge {
    position: absolute;
    top: var(--s4);
    right: var(--s4);
    font-family: var(--ff-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ochre);
    border: 1px solid var(--ochre);
    padding: 3px 8px;
}
.pricing-card h2 {
    font-size: 2.2rem;
    margin: 0 0 var(--s2);
}
.tier-sub {
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    color: var(--muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: var(--s5);
}
.price { margin: 0 0 var(--s6); display: flex; align-items: baseline; gap: var(--s2); }
.price-amount {
    font-family: var(--ff-display);
    font-size: 4rem;
    font-weight: 300;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variation-settings: "opsz" 144, "SOFT" 60, "WONK" 1;
}
.price-period {
    font-family: var(--ff-mono);
    font-size: 0.85rem;
    color: var(--muted);
    letter-spacing: 0.02em;
}

.features-list {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--s6);
    flex: 1;
}
.features-list li {
    padding: var(--s3) 0;
    border-bottom: 1px solid rgba(207,199,173,0.35);
    font-size: 0.95rem;
    display: flex;
    align-items: baseline;
    gap: var(--s3);
}
.features-list li::before {
    content: "—";
    color: var(--moss-3);
    font-family: var(--ff-mono);
    flex-shrink: 0;
}
.features-list li.no::before { content: "×"; color: var(--muted); }
.pricing-card-featured .features-list li { border-bottom-color: rgba(243,239,226,0.12); }
.pricing-card-featured .features-list li::before { color: var(--ochre-2); }

.pricing-card .hint {
    margin: var(--s3) 0 0;
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    color: var(--muted);
    letter-spacing: 0.02em;
    text-align: center;
}

.faq { max-width: 72ch; }
.faq details {
    border-bottom: var(--hl);
    padding: var(--s5) 0;
}
.faq details:first-of-type { border-top: var(--hl); }
.faq summary {
    cursor: pointer;
    font-family: var(--ff-display);
    font-size: 1.25rem;
    font-weight: 400;
    font-variation-settings: "opsz" 48;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--s4);
    text-transform: none;
    letter-spacing: 0;
    color: var(--ink);
    padding: 0;
}
.faq summary::before { content: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: "+";
    font-family: var(--ff-mono);
    font-size: 1.3rem;
    color: var(--muted);
    line-height: 1;
    transition: transform 0.2s;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details[open] summary { margin-bottom: var(--s3); }
.faq p {
    color: var(--ink-3);
    margin: 0;
    max-width: 58ch;
}

/* ─── App (Analyzer) ─────────────────────────────────────────────── */

.step {
    border: var(--hl);
    background: var(--paper);
    padding: var(--s6);
    margin-bottom: var(--s5);
    position: relative;
}
.step::before {
    content: "";
    position: absolute;
    top: -1px;
    left: -1px;
    width: 3px;
    height: 50px;
    background: var(--moss);
}
.step h2 {
    display: flex;
    align-items: baseline;
    gap: var(--s4);
    margin-bottom: var(--s5);
    padding-bottom: var(--s4);
    border-bottom: var(--hl);
    font-size: 1.5rem;
}
.step h2 .step-num {
    font-family: var(--ff-mono);
    font-size: 0.8rem;
    color: var(--ochre);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.step h2 .step-title-text {
    font-family: var(--ff-display);
    font-variation-settings: "opsz" 72, "SOFT" 50;
}

.hint {
    font-family: var(--ff-body);
    color: var(--ink-3);
    font-size: 0.95rem;
    margin: 0 0 var(--s4);
}
.hint strong { color: var(--ink); font-weight: 600; }

/* Dropzone */
.dropzone {
    display: block;
    border: 2px dashed var(--hair);
    padding: var(--s7) var(--s5);
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--paper-2);
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--moss);
    background: rgba(78,101,70,0.06);
}
.dropzone-inner strong {
    display: block;
    font-family: var(--ff-display);
    font-size: 1.4rem;
    font-weight: 400;
    margin-bottom: var(--s2);
    font-variation-settings: "opsz" 48;
}
.dropzone-inner span {
    color: var(--ink-3);
    display: block;
    margin-bottom: var(--s3);
}
.dropzone-inner small {
    font-family: var(--ff-mono);
    font-size: 0.75rem;
    color: var(--muted);
    letter-spacing: 0.03em;
}

.file-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s2);
    margin-top: var(--s4);
}
.chip {
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    background: var(--paper-2);
    border: var(--hl);
    padding: 4px 10px;
    color: var(--ink-3);
    letter-spacing: 0.01em;
}

/* Preview + cutoff band — wrap shrinks to fit the (possibly downscaled) image
   so the cutoff band overlay sits exactly on the photo, never on letterbox. */
.preview-wrap {
    position: relative;
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto var(--s4);
    background: var(--ink);
    border: var(--hl-ink);
    overflow: hidden;
    user-select: none;
}
.preview-wrap img {
    display: block;
    max-width: 100%;
    max-height: 60vh;
    width: auto;
    height: auto;
}
.cutoff-band {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(53,72,47,0.55);
    border-top: 2px solid var(--ochre);
    pointer-events: none;
    backdrop-filter: saturate(0.4);
}
.cutoff-handle {
    position: absolute;
    left: 50%;
    top: -14px;
    transform: translateX(-50%);
    width: 72px;
    height: 26px;
    background: var(--ochre);
    border: 1px solid var(--ochre);
    cursor: ns-resize;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    color: var(--paper);
    font-family: var(--ff-mono);
    font-size: 0.85rem;
    letter-spacing: 0.04em;
}
.cutoff-handle::before {
    content: "";
    width: 22px;
    height: 8px;
    border-top: 2px solid var(--paper);
    border-bottom: 2px solid var(--paper);
    border-radius: 0;
    display: block;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s5);
    flex-wrap: wrap;
    padding-top: var(--s4);
    border-top: var(--hl);
}
.settings-options {
    border-top: none;
    padding-top: var(--s2);
    justify-content: flex-start;
    gap: var(--s6);
}
.settings-options label { gap: var(--s2); }
[hidden] { display: none !important; }

/* ─── Thumbnail strip (per-image cutoff mode) ────────────────────── */
.thumb-strip {
    display: flex;
    gap: var(--s2);
    overflow-x: auto;
    padding: var(--s3) 0;
    margin-top: var(--s3);
    border-top: var(--hl);
    scrollbar-width: thin;
    scrollbar-color: var(--hair) transparent;
    animation: fadeUp 0.3s ease both;
}
.thumb-strip::-webkit-scrollbar { height: 6px; }
.thumb-strip::-webkit-scrollbar-thumb { background: var(--hair); border-radius: 3px; }

.thumb-item {
    position: relative;
    flex: 0 0 86px;
    width: 86px;
    height: 64px;
    padding: 0;
    border: 1.5px solid var(--hair);
    background: var(--paper-2);
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s, transform 0.15s;
    border-radius: 0;
}
.thumb-item:hover { border-color: var(--ink-3); transform: translateY(-1px); }
.thumb-item.is-active {
    border-color: var(--ochre);
    border-width: 2px;
    box-shadow: 0 0 0 2px var(--ochre-2);
}
.thumb-img {
    display: block;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}
.thumb-cutoff {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: var(--ink);
    color: var(--ochre-2);
    font-family: var(--ff-mono);
    font-size: 0.65rem;
    padding: 1px 5px;
    letter-spacing: 0.04em;
    line-height: 1.3;
    border-radius: 0;
}
.thumb-item.is-active .thumb-cutoff {
    background: var(--ochre);
    color: var(--ink);
}
.settings-row > span { font-family: var(--ff-mono); font-size: 0.9rem; color: var(--ink-3); }
.settings-row > span strong { color: var(--ochre); font-weight: 600; }
.settings-row label {
    display: flex; align-items: center; gap: var(--s2);
    font-size: 0.95rem;
    cursor: pointer;
    color: var(--ink-3);
}
.settings-row input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--moss);
}

#step-analyze button.primary { font-family: var(--ff-body); }
#step-analyze #quota-note {
    margin-top: var(--s4);
    font-family: var(--ff-mono);
    font-size: 0.8rem;
    color: var(--muted);
    letter-spacing: 0.02em;
    text-align: center;
}

/* Loader: pulsing treeline bars (replaces the old indeterminate progress bar). */
.loader-bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    height: 56px;
    margin: var(--s5) 0 var(--s2);
}
.loader-bars span {
    display: inline-block;
    width: 6px;
    background: var(--moss);
    border-radius: 1px;
    transform-origin: bottom center;
    animation: loaderBarPulse 1.4s ease-in-out infinite;
}
.loader-bars span:nth-child(1)  { height: 36%; animation-delay: 0.00s; background: var(--moss); }
.loader-bars span:nth-child(2)  { height: 60%; animation-delay: 0.08s; background: var(--moss-2); }
.loader-bars span:nth-child(3)  { height: 84%; animation-delay: 0.16s; background: var(--moss); }
.loader-bars span:nth-child(4)  { height: 92%; animation-delay: 0.24s; background: var(--moss-2); }
.loader-bars span:nth-child(5)  { height: 100%; animation-delay: 0.32s; background: var(--moss); }
.loader-bars span:nth-child(6)  { height: 78%; animation-delay: 0.40s; background: var(--moss-2); }
.loader-bars span:nth-child(7)  { height: 100%; animation-delay: 0.48s; background: var(--moss); }
.loader-bars span:nth-child(8)  { height: 88%; animation-delay: 0.56s; background: var(--moss-2); }
.loader-bars span:nth-child(9)  { height: 60%; animation-delay: 0.64s; background: var(--moss); }
.loader-bars span:nth-child(10) { height: 72%; animation-delay: 0.72s; background: var(--moss-2); }
.loader-bars span:nth-child(11) { height: 48%; animation-delay: 0.80s; background: var(--moss); }
.loader-bars span:nth-child(12) { height: 32%; animation-delay: 0.88s; background: var(--moss-2); }
@keyframes loaderBarPulse {
    0%, 100% { transform: scaleY(0.35); opacity: 0.55; }
    50%      { transform: scaleY(1);    opacity: 1;    }
}
@media (prefers-reduced-motion: reduce) {
    .loader-bars span { animation: none; opacity: 0.7; }
}

/* Results metrics — editorial */
.metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border: var(--hl-ink);
    margin-bottom: var(--s6);
}
.metric {
    padding: var(--s5) var(--s4);
    border-right: var(--hl);
    border-bottom: var(--hl);
    background: var(--paper);
    display: flex;
    flex-direction: column;
    gap: var(--s2);
}
.metric:last-child { border-right: none; }
.metric-headline {
    grid-column: 1 / -1;
    padding: var(--s6);
    background: var(--ink);
    color: var(--paper);
    text-align: center;
    border-bottom: var(--hl-ink);
}
.metric-value {
    font-family: var(--ff-display);
    font-size: 2.5rem;
    font-weight: 300;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--ink);
    font-variation-settings: "opsz" 144, "SOFT" 60, "WONK" 1;
    font-feature-settings: "tnum";
}
.metric-headline .metric-value {
    font-size: clamp(4rem, 8vw, 6.5rem);
    color: var(--paper);
}
.metric-headline .metric-value::after { content: ""; }
.metric-label {
    font-family: var(--ff-mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}
.metric-headline .metric-label { color: var(--paper-3); font-size: 0.82rem; }
.metric-sub {
    font-family: var(--ff-mono);
    font-size: 0.72rem;
    color: var(--muted);
    letter-spacing: 0.02em;
    line-height: 1.4;
}
.metric-headline .metric-sub { color: var(--paper-3); }

/* Consistency metric states */
.metric-consistency .metric-value {
    font-family: var(--ff-display);
    font-variation-settings: "opsz" 72, "SOFT" 50;
    font-size: 2.2rem;
}
.consistency-tight .metric-value     { color: var(--moss); }
.consistency-mixed .metric-value     { color: var(--ochre); }
.consistency-scattered .metric-value { color: var(--alert); }
.consistency-scattered { background: #fbf3ed; }

/* Scatter warning banner above the headline metric */
.scatter-warning {
    grid-column: 1 / -1;
    background: #fbecd9;
    border: 2px solid var(--ochre);
    color: var(--ink);
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--s4);
    align-items: start;
    padding: var(--s5) var(--s6);
    font-family: var(--ff-body);
    font-size: 0.95rem;
    line-height: 1.5;
}
.scatter-warning .scatter-icon {
    font-size: 1.6rem;
    color: var(--ochre);
    line-height: 1;
    margin-top: 2px;
}
.scatter-warning strong { color: var(--alert); font-weight: 600; }

/* ─── In-page toast (replaces alert()) ───────────────────────────── */
.app-toast {
    position: fixed;
    bottom: var(--s5);
    right: var(--s5);
    max-width: 380px;
    padding: var(--s4) var(--s5);
    background: var(--ink);
    color: var(--paper);
    border-left: 3px solid var(--moss);
    font-family: var(--ff-body);
    font-size: 0.95rem;
    line-height: 1.45;
    box-shadow: 0 12px 32px rgba(0,0,0,0.22);
    z-index: 2000;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}
.app-toast.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.app-toast.toast-error { border-left-color: var(--alert); }
.app-toast.toast-success { border-left-color: var(--success); }
@media (max-width: 600px) {
    .app-toast { left: var(--s4); right: var(--s4); max-width: none; }
}

/* ─── Heatmap legend + per-photo toggle ──────────────────────────── */
.heatmap-legend {
    grid-column: 1 / -1;            /* span the full mask grid row */
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--s3);
    padding: var(--s3) var(--s4);
    margin-bottom: 0;
    background: var(--paper-2);
    border: var(--hl);
    font-size: 0.85rem;
    font-family: var(--ff-body);
}
.heatmap-legend .label { margin-right: var(--s3); }
.legend-swatch {
    display: inline-block;
    width: 14px; height: 14px;
    border: 1px solid rgba(0,0,0,0.15);
    margin-left: var(--s3);
}
.swatch-dense   { background: rgb(200, 40, 40); }
.swatch-optimal { background: rgb(60, 180, 60); }
.swatch-open    { background: rgb(40, 120, 200); }
.legend-text { color: var(--ink-3); margin-right: var(--s2); }
.legend-aside {
    margin-left: auto;
    color: var(--muted);
    font-family: var(--ff-mono);
    font-size: 0.72rem;
    letter-spacing: 0.02em;
}

.mask-toggle {
    margin-top: var(--s2);
    padding: 4px 10px;
    font-family: var(--ff-mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    background: var(--paper);
    border: var(--hl);
    color: var(--ink-3);
    cursor: pointer;
    width: 100%;
    text-align: center;
}
.mask-toggle:hover { color: var(--ink); border-color: var(--ink); }

/* Weak spots — appearing both in the per-photo block and the summary section */
.weak-spots {
    list-style: none;
    padding: 0;
    margin: var(--s2) 0 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.weak-spot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s2) var(--s3);
    padding: 6px 8px;
    border: 1px solid var(--hair);
    background: var(--paper);
    font-size: 0.78rem;
    font-family: var(--ff-body);
}
.weak-spot-pos { flex: 1 1 auto; min-width: 0; }
.weak-spot-pct { margin-left: auto; white-space: nowrap; }
.weak-spot-tag {
    font-family: var(--ff-mono);
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    padding: 1px 6px;
    color: var(--paper);
}
.weak-spot-too-dense .weak-spot-tag { background: var(--alert); }
.weak-spot-too-open  .weak-spot-tag { background: var(--sky); }
.weak-spot-severity {
    font-family: var(--ff-mono);
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    padding: 1px 6px;
    border: 1px solid currentColor;
    text-transform: uppercase;
    font-weight: 600;
}
.severity-severe .weak-spot-severity  { color: var(--alert); }
.severity-moderate .weak-spot-severity { color: var(--ochre); }
.severity-minor .weak-spot-severity    { color: var(--ink-3); }
.weak-spot-pos { color: var(--ink-3); text-transform: capitalize; }
.weak-spot-pct {
    font-family: var(--ff-mono);
    font-weight: 600;
    color: var(--ink);
}
.weak-spot-too-dense .weak-spot-pct { color: var(--alert); }
.weak-spot-too-open  .weak-spot-pct { color: var(--sky); }

/* Weak spots summary section near the top of results */
.weak-spots-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--s4);
    margin-top: var(--s3);
}
.weak-summary-item {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: var(--s4);
    padding: var(--s4);
    background: var(--paper);
    border: var(--hl);
    align-items: start;
}
.weak-summary-item img {
    width: 100%;
    height: auto;
    border: 1px solid var(--ink);
}
.weak-summary-item h4 {
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    margin: 0 0 var(--s2);
    word-break: break-all;
    line-height: 1.3;
    color: var(--ink-3);
    font-weight: 500;
}

/* Editable usage cell in admin */
.usage-input {
    width: 80px;
    padding: 4px 8px;
    font-family: var(--ff-mono);
    font-size: 0.85rem;
    border: var(--hl);
    background: var(--paper);
    color: var(--ink);
    text-align: right;
    -moz-appearance: textfield;
}
.usage-input::-webkit-outer-spin-button,
.usage-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.usage-input:focus { outline: none; border-color: var(--moss); background: var(--paper-2); }

/* ─── File chip with remove (×) button ───────────────────────────── */
.chip-removable {
    display: inline-flex;
    align-items: center;
    gap: var(--s2);
    padding-right: 4px;
}
.chip-name { display: inline-block; }
.chip-size { color: var(--muted); font-size: 0.72rem; margin-left: 2px; }
.chip-remove {
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 1.05rem;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 50%;
    margin-left: 2px;
}
.chip-remove:hover { background: var(--alert); color: var(--paper); }
.chip-clear-all {
    margin-left: var(--s3);
    padding: 4px 12px;
    border: 1px dashed var(--hair);
    background: transparent;
    color: var(--ink-3);
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    cursor: pointer;
}
.chip-clear-all:hover { border-color: var(--alert); color: var(--alert); }

/* ─── Tree height field ──────────────────────────────────────────── */
.height-field {
    display: flex;
    align-items: center;
    gap: var(--s3);
    flex-wrap: wrap;
}
.height-label {
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    color: var(--ink-3);
    text-transform: uppercase;
}
.height-input-wrap {
    display: inline-flex;
    align-items: baseline;
    border: var(--hl);
    background: var(--paper);
    padding: 0 var(--s2);
}
.height-input-wrap input {
    font: inherit;
    font-family: var(--ff-mono);
    font-size: 0.95rem;
    border: none;
    background: transparent;
    width: 80px;
    padding: 6px 4px;
    text-align: right;
    -moz-appearance: textfield;
}
.height-input-wrap input::-webkit-outer-spin-button,
.height-input-wrap input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.height-input-wrap input:focus { outline: none; }
.height-input-wrap:focus-within { border-color: var(--moss); }
.height-unit { font-family: var(--ff-mono); font-size: 0.8rem; color: var(--muted); padding-right: var(--s2); }
.height-input-wrap input.invalid { color: var(--alert); }
.height-input-wrap:has(input.invalid) { border-color: var(--alert); }
.height-error {
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    color: var(--alert);
    margin-left: var(--s3);
}

/* ─── Batch warning banner (above the analyze button) ────────────── */
.batch-warning {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--s4);
    align-items: start;
    padding: var(--s4) var(--s5);
    margin-bottom: var(--s4);
    background: #fbf3ed;
    border: 2px solid var(--ochre);
    border-left-width: 4px;
}
.batch-warning-icon {
    font-size: 1.6rem;
    color: var(--ochre);
    line-height: 1;
    margin-top: 2px;
}
.batch-warning-headline {
    font-family: var(--ff-display);
    font-size: 1.1rem;
    font-variation-settings: "opsz" 48;
    margin: 0 0 var(--s2);
    color: var(--ink);
}
.batch-warning-headline strong { color: var(--alert); font-weight: 600; }
.batch-warning-text {
    color: var(--ink-3);
    font-size: 0.92rem;
    margin: 0 0 var(--s3);
}
.batch-warning-cta {
    display: inline-block;
    background: var(--ink);
    color: var(--paper);
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid var(--ink);
    font-weight: 500;
}
.batch-warning-cta:hover { background: var(--moss); border-color: var(--moss); color: var(--paper); }

/* ─── Progress text under the analyze button ─────────────────────── */
.progress-text {
    margin-top: var(--s2);
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    color: var(--ink-3);
    letter-spacing: 0.02em;
    text-align: center;
}

/* ─── Comparison validity warning ────────────────────────────────── */
.compare-validity {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--s4);
    align-items: start;
    padding: var(--s4) var(--s5);
    background: #fbf3ed;
    border: 1px solid var(--ochre);
    margin: var(--s4) 0;
}
.compare-validity-icon { font-size: 1.4rem; color: var(--ochre); line-height: 1; margin-top: 2px; }
.compare-validity-headline { font-weight: 600; margin: 0 0 var(--s2); color: var(--ink); }
.compare-validity-list {
    margin: 0 0 var(--s3);
    padding-left: var(--s5);
    font-size: 0.92rem;
    color: var(--ink-3);
    line-height: 1.5;
}
.compare-validity-list li { padding: 4px 0; }
.compare-validity-list strong { color: var(--ink); }
.compare-validity-tip {
    margin: 0;
    font-size: 0.85rem;
    color: var(--ink-3);
    font-style: italic;
}

/* ─── Recommended next steps section ─────────────────────────────── */
.recommendations {
    margin-top: var(--s5);
    padding: var(--s5) var(--s6);
    background: var(--paper);
    border: 2px solid var(--moss);
    border-left-width: 6px;
}
.recommendations .subhead { margin-top: 0; color: var(--moss); }
.recommendations-list {
    margin: 0;
    padding-left: var(--s5);
    color: var(--ink-2);
    font-size: 0.98rem;
    line-height: 1.6;
}
.recommendations-list li {
    padding: var(--s2) 0;
    border-bottom: var(--hl);
}
.recommendations-list li:last-child { border-bottom: none; }
.recommendations-list li strong { color: var(--alert); font-weight: 600; }

.leaf-state-note {
    margin-top: var(--s5);
    padding: var(--s4) var(--s5);
    background: var(--paper);
    border: var(--hl-ink);
    border-left: 4px solid var(--ochre, var(--moss));
    color: var(--ink-2);
    font-size: 0.95rem;
    line-height: 1.55;
}
.leaf-state-note strong { color: var(--ink); font-weight: 600; }
.leaf-state-note em { font-style: italic; }

/* ─── Capture guide modal ────────────────────────────────────────── */
.capture-guide {
    border: var(--hl-ink);
    background: var(--paper);
    padding: 0;
    max-width: 820px;
    width: 92vw;
    max-height: 92vh;
    box-shadow: 0 20px 60px rgba(0,0,0,0.28);
    animation: modalIn 0.3s cubic-bezier(0.22, 0.61, 0.36, 1) both;
    overflow: hidden;
}
.capture-guide::backdrop {
    background: rgba(20,19,13,0.55);
    backdrop-filter: blur(2px);
    animation: backdropIn 0.3s ease both;
}
.capture-guide-inner {
    padding: var(--s5) var(--s6) var(--s4);
    display: flex;
    flex-direction: column;
    gap: var(--s4);
    max-height: 92vh;
}
.capture-guide-head { padding-bottom: var(--s3); border-bottom: var(--hl); }
.capture-guide-head h2 {
    font-size: clamp(1.5rem, 2.4vw, 2rem);
    line-height: 1.05;
    margin: var(--s2) 0 0;
    letter-spacing: -0.01em;
}
.capture-guide-head h2 em { color: var(--moss); }
.capture-guide-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s3);
}
.capture-card {
    padding: 0;
    border: var(--hl);
    background: var(--paper);
    display: flex;
    flex-direction: column;
}
.capture-icon {
    color: var(--moss);
    background: var(--paper-2);
    border-bottom: var(--hl);
    padding: var(--s4);
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 7;    /* tall enough to make the diagram the hero */
}
.capture-icon svg { width: 100%; height: 100%; display: block; }
.capture-card h3 {
    font-family: var(--ff-display);
    font-size: 1.15rem;
    font-weight: 500;
    margin: 0;
    padding: var(--s3) var(--s4) 4px;
    line-height: 1.15;
    font-variation-settings: "opsz" 48;
}
.capture-card p {
    margin: 0;
    padding: 0 var(--s4) var(--s4);
    color: var(--ink-3);
    font-size: 0.92rem;
    line-height: 1.45;
}

.capture-guide-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s4);
    padding-top: var(--s3);
    border-top: var(--hl);
    flex-wrap: wrap;
}
.capture-guide-dontshow {
    display: inline-flex;
    align-items: center;
    gap: var(--s2);
    font-size: 0.88rem;
    color: var(--ink-3);
    cursor: pointer;
}
.capture-guide-dontshow input { cursor: pointer; }
.capture-guide-foot .primary {
    width: auto;
    padding: 10px 24px;
    font-size: 0.95rem;
}

@media (max-width: 720px) {
    .capture-guide-grid { grid-template-columns: 1fr; }
    .capture-card { grid-template-columns: 72px 1fr; gap: var(--s3); }
}

/* ─── Wind impact section ────────────────────────────────────────── */
.wind-impact {
    margin-top: var(--s5);
    padding-top: var(--s5);
    border-top: var(--hl);
}
.wind-grid {
    display: flex;
    flex-direction: column;
    border: var(--hl-ink);
    background: var(--paper);
}
.wind-card {
    padding: var(--s5) var(--s6);
    background: var(--ink);
    color: var(--paper);
    border-bottom: var(--hl-ink);
}
.wind-cat-optimal           { background: var(--moss); }
.wind-cat-dense             { background: var(--alert); }
.wind-cat-moderately-dense  { background: #6e3a23; }
.wind-cat-slightly-open     { background: var(--ochre); }
.wind-cat-too-open          { background: var(--sky); }
.wind-cat-label {
    font-family: var(--ff-mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.8;
    margin-bottom: var(--s2);
}
.wind-cat-value {
    font-family: var(--ff-display);
    font-size: 2rem;
    font-weight: 400;
    line-height: 1;
    margin-bottom: var(--s3);
    font-variation-settings: "opsz" 96, "SOFT" 50;
}
.wind-cat-note { font-size: 0.95rem; opacity: 0.95; line-height: 1.5; }
.wind-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--s4);
    align-items: baseline;
    padding: var(--s4) var(--s6);
    border-bottom: var(--hl);
}
.wind-row:last-child { border-bottom: none; }
.wind-row-hint { color: var(--muted); font-style: italic; }
.wind-label {
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    color: var(--ink-3);
}
.wind-value {
    font-family: var(--ff-display);
    font-size: 1.6rem;
    font-weight: 400;
    font-variation-settings: "opsz" 72;
    color: var(--ink);
}
.wind-unit {
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    color: var(--muted);
    margin-left: 6px;
    letter-spacing: 0.02em;
}
.wind-value-hint { color: var(--muted); font-size: 0.85rem; }

/* ─── Compare batches (dashboard) ────────────────────────────────── */
.compare-bar {
    display: flex;
    align-items: center;
    gap: var(--s4);
    padding: var(--s3) var(--s5);
    background: var(--ink);
    color: var(--paper);
    margin-bottom: var(--s3);
    font-size: 0.92rem;
    flex-wrap: wrap;
}
.compare-bar strong { color: var(--ochre-2); }
.compare-bar button {
    font: inherit;
    padding: 6px 14px;
    background: transparent;
    color: var(--paper);
    border: 1px solid var(--paper-3);
    cursor: pointer;
}
.compare-bar button.primary {
    background: var(--ochre);
    border-color: var(--ochre);
    color: var(--ink);
}
.compare-bar button.primary:disabled { opacity: 0.4; cursor: not-allowed; }
.compare-check { width: 16px; height: 16px; cursor: pointer; }
.batches-table th:first-child, .batches-table td:first-child { width: 32px; text-align: center; padding-left: var(--s3); padding-right: var(--s3); }

.compare-result {
    margin-top: var(--s6);
    padding: var(--s6);
    border: 2px solid var(--ochre);
    background: var(--paper);
}
.compare-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: var(--s5);
    align-items: stretch;
    margin: var(--s5) 0;
}
.compare-col {
    padding: var(--s4);
    background: var(--paper-2);
    border: var(--hl);
}
.compare-col .label { display: block; margin-bottom: var(--s2); }
.compare-date {
    font-family: var(--ff-mono);
    font-size: 0.85rem;
    color: var(--ink-3);
    margin-bottom: var(--s3);
}
.compare-stat {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: var(--s2) 0;
    border-top: var(--hl);
    font-size: 0.92rem;
}
.compare-stat span { color: var(--ink-3); }
.compare-stat .num {
    font-family: var(--ff-display);
    font-size: 1.2rem;
    font-variation-settings: "opsz" 48;
}
.compare-arrow {
    align-self: center;
    font-family: var(--ff-mono);
    font-size: 1.6rem;
    color: var(--ochre);
}
.compare-headline {
    background: var(--ink);
    color: var(--paper);
    padding: var(--s4) var(--s5);
    font-family: var(--ff-display);
    font-size: 1.3rem;
    font-variation-settings: "opsz" 72;
    display: flex;
    align-items: baseline;
    gap: var(--s3);
    flex-wrap: wrap;
}
.compare-headline.delta-up    { background: #6e3a23; }
.compare-headline.delta-down  { background: var(--moss); }
.compare-headline.delta-flat  { background: var(--ink-2); }
.compare-headline strong { color: var(--ochre-2); }
.compare-headline-aside {
    font-family: var(--ff-mono);
    font-size: 0.85rem;
    color: var(--paper-3);
    margin-left: auto;
}
.visually-hidden {
    position: absolute;
    left: -9999px;
}

/* ─── Admin delete button ────────────────────────────────────────── */
.user-delete-btn {
    font-family: var(--ff-mono);
    font-size: 0.72rem;
    padding: 4px 10px;
    border: 1px solid var(--alert);
    background: transparent;
    color: var(--alert);
    letter-spacing: 0.04em;
    cursor: pointer;
}
.user-delete-btn:hover:not(:disabled) {
    background: var(--alert);
    color: var(--paper);
}

@media (max-width: 720px) {
    .compare-grid { grid-template-columns: 1fr; }
    .compare-arrow { transform: rotate(90deg); justify-self: center; }
}

/* Results table */
.table-wrap {
    overflow: visible;
    border: var(--hl);
    background: var(--paper);
}
@media (max-width: 720px) {
    .table-wrap { overflow-x: auto; overflow-y: visible; }
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    font-family: var(--ff-body);
}
th, td {
    padding: var(--s3) var(--s4);
    text-align: left;
    border-bottom: var(--hl);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
td:first-child { font-family: var(--ff-mono); font-size: 0.85rem; }
th {
    font-family: var(--ff-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 500;
    background: var(--paper-2);
}
tbody tr:hover { background: var(--paper-2); }
tbody tr:last-child td { border-bottom: none; }

.status {
    font-family: var(--ff-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 2px 8px;
    border: 1px solid transparent;
}
.status.valid   { background: transparent; color: var(--moss); border-color: var(--moss-3); }
.status.warning { background: var(--ochre); color: var(--paper); border-color: var(--ochre); }
.status.invalid { background: transparent; color: var(--alert); border-color: var(--alert); }

/* ─── Decisive status pills (Use / Use with caution / Retake) ──── */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-family: var(--ff-mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    white-space: nowrap;
    border: 1px solid transparent;
    line-height: 1.4;
}
.status-pill .status-icon {
    font-size: 0.75rem;
    line-height: 1;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
}
.status-pill.status-valid {
    background: transparent;
    color: var(--success);
    border-color: var(--success);
}
.status-pill.status-valid .status-icon { background: var(--success); color: var(--paper); }
.status-pill.status-warning {
    background: var(--ochre);
    color: var(--paper);
    border-color: var(--ochre);
}
.status-pill.status-warning .status-icon { background: var(--paper); color: var(--ochre); }
.status-pill.status-invalid {
    background: transparent;
    color: var(--alert);
    border-color: var(--alert);
}
.status-pill.status-invalid .status-icon { background: var(--alert); color: var(--paper); }

/* Hide the text when the column is narrow (zones table) — icon-only. */
#results-table.has-zones .status-pill .status-text { display: none; }
#results-table.has-zones .status-pill { padding: 4px 6px; }

/* Confidence cell with "reduced due to..." tooltip */
.conf-value {
    font-family: var(--ff-mono);
    cursor: help;
}
.conf-value[title] { border-bottom: 1px dotted var(--hair); }
.conf-value .conf-note { color: var(--ochre); margin-left: 4px; font-weight: bold; }
.conf-value:hover { color: var(--ochre); }

.actions { margin: var(--s4) 0; }

/* Details/summary polish */
details {
    border-top: var(--hl);
    margin-top: var(--s5);
    padding-top: var(--s4);
}
details summary {
    cursor: pointer;
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
    font-weight: 500;
    list-style: none;
    padding: var(--s2) 0;
}
details summary::-webkit-details-marker { display: none; }
details summary::before {
    content: "▸ ";
    display: inline-block;
    margin-right: var(--s2);
    transition: transform 0.15s;
}
details[open] summary::before { transform: rotate(90deg); }
details > *:not(summary) { margin-top: var(--s3); }

/* Flagged items */
.flagged-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: var(--hl);
    margin-top: var(--s3);
}
.flagged-item {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: var(--s5);
    padding: var(--s5);
    background: var(--paper);
    border-bottom: var(--hl);
    align-items: start;
}
.flagged-item:last-child { border-bottom: none; }
.flagged-item img {
    width: 100%;
    height: auto;
    border: 1px solid var(--ink);
    filter: saturate(0.85);
}
.flagged-item h4 {
    font-family: var(--ff-display);
    font-size: 1.15rem;
    font-weight: 400;
    font-variation-settings: "opsz" 48;
    margin: 0 0 var(--s2);
}
.flagged-item p {
    font-family: var(--ff-mono);
    font-size: 0.8rem;
    color: var(--ink-3);
    margin: 0 0 var(--s3);
    letter-spacing: 0.01em;
}
.flagged-item ul {
    margin: 0;
    padding-left: var(--s5);
    color: var(--ink-3);
    font-size: 0.9rem;
}
.flagged-item ul li { padding: 2px 0; }

/* Mask grid: bigger cards, 2-up on desktop, single column on mobile. */
.masks-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: var(--s4);
    margin-top: var(--s4);
}
.mask-item {
    margin: 0;
    border: var(--hl);
    padding: var(--s4);
    background: var(--paper);
    display: flex;
    flex-direction: column;
    gap: var(--s3);
    transition: border-color 0.15s;
}
.mask-item:hover { border-color: var(--moss-3); }
.mask-item figcaption {
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    color: var(--ink-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 0.01em;
    padding-bottom: var(--s2);
    border-bottom: var(--hl);
}
.mask-item figcaption strong { color: var(--ink); font-weight: 600; }
.mask-item img {
    width: 100%;
    display: block;
    border: 1px solid var(--ink);
}

.mask-wrap { position: relative; }
.mask-with-zones .mask-wrap { border: 1px solid var(--ink); }
.mask-with-zones .mask-wrap img { border: none; }

.zone-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.zone-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-top: 1px dashed var(--ochre);
    mix-blend-mode: difference;
    opacity: 0.95;
}
.zone-line-1 { top: 33.333%; }
.zone-line-2 { top: 66.667%; }

.zone-label {
    position: absolute;
    right: 4px;
    font-family: var(--ff-mono);
    font-size: 0.62rem;
    letter-spacing: 0.04em;
    color: var(--paper);
    background: rgba(20,19,13,0.78);
    padding: 1px 5px;
    line-height: 1.4;
    white-space: nowrap;
}
.zone-label .zone-tag { color: var(--ochre-2); margin-right: 4px; font-weight: 600; }
.zone-label-top { top: 4px; }
.zone-label-mid { top: calc(33.333% + 4px); }
.zone-label-bot { top: calc(66.667% + 4px); }

/* ─── Dashboard / Admin ──────────────────────────────────────────── */

.profile-card {
    border: var(--hl);
    padding: var(--s6);
    margin-bottom: var(--s6);
    background: var(--paper);
}
.profile-row {
    display: grid;
    grid-template-columns: 2fr 1fr 2fr auto;
    gap: var(--s5);
    align-items: end;
}
.profile-label {
    font-family: var(--ff-mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: var(--s2);
}
.profile-value {
    font-family: var(--ff-display);
    font-size: 1.3rem;
    font-weight: 400;
    font-variation-settings: "opsz" 48;
    line-height: 1.2;
}
.profile-value strong {
    font-weight: 400;
    color: var(--ochre);
}
.profile-actions { text-align: right; }
.profile-actions a.primary-link { padding: 10px 20px; font-size: 0.9rem; }

.dashboard-table { width: 100%; border-collapse: collapse; }
.dashboard-table th, .dashboard-table td {
    padding: var(--s3) var(--s4);
    border-bottom: var(--hl);
    text-align: left;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.dashboard-table th {
    font-family: var(--ff-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 500;
    background: var(--paper-2);
}
.dashboard-table td:first-child { font-family: var(--ff-mono); font-size: 0.85rem; }
.dashboard-table tbody tr:hover { background: var(--paper-2); }
.dashboard-table button {
    padding: 4px 10px;
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    letter-spacing: 0.03em;
}
.dashboard-table .tier-select {
    font-family: var(--ff-body);
    padding: 4px 8px;
    border: var(--hl);
    background: var(--paper);
    font-size: 0.9rem;
}

.admin-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    margin-bottom: var(--s6);
    border: var(--hl-ink);
}
.admin-summary .metric {
    border-right: var(--hl);
    border-bottom: none;
    text-align: left;
    padding: var(--s5) var(--s4);
    background: var(--paper);
}
.admin-summary .metric:last-child { border-right: none; }

.empty-state {
    border: 1px dashed var(--hair);
    padding: var(--s7);
    text-align: center;
    color: var(--muted);
    font-family: var(--ff-body);
    background: transparent;
}

.error, .success {
    font-family: var(--ff-mono);
    font-size: 0.88rem;
    padding: var(--s2) 0;
    letter-spacing: 0.01em;
}
.error { color: var(--alert); }
.success { color: var(--success); }

/* Boxed inline form error — used on login / signup to replace the native
   browser validation tooltip, which doesn't match the site theme. */
.form-error {
    font-family: var(--ff-mono);
    font-size: 0.85rem;
    line-height: 1.45;
    letter-spacing: 0.01em;
    color: var(--ink);
    background: color-mix(in srgb, var(--alert, #b54a3a) 10%, var(--paper));
    border: 1px solid color-mix(in srgb, var(--alert, #b54a3a) 35%, transparent);
    border-left: 3px solid var(--alert, #b54a3a);
    padding: var(--s3) var(--s4);
    border-radius: 3px;
    margin: var(--s3) 0 0;
    animation: form-error-in 140ms ease-out;
}
.form-error a { color: var(--ink); text-decoration-color: var(--alert, #b54a3a); }
@keyframes form-error-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.form-success {
    font-family: var(--ff-mono);
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--moss, #35482f);
    background: color-mix(in srgb, var(--moss, #35482f) 10%, var(--paper));
    border: 1px solid color-mix(in srgb, var(--moss, #35482f) 30%, transparent);
    border-left: 3px solid var(--moss, #35482f);
    padding: var(--s3) var(--s4);
    border-radius: 3px;
    margin: var(--s3) 0 0;
    animation: form-error-in 140ms ease-out;
}

/* 6-digit verification code input — large monospaced letters, wide tracking. */
.code-input {
    font-family: var(--ff-mono, 'JetBrains Mono', monospace);
    font-size: 1.75rem;
    letter-spacing: 0.45em;
    text-align: center;
    padding: var(--s4) var(--s3);
    text-indent: 0.45em; /* counter letter-spacing on left */
}
.code-input:focus {
    outline: 2px solid var(--ochre, #a86a23);
    outline-offset: 2px;
}
.code-input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: var(--paper);
}
.code-timer {
    margin-left: var(--s2);
    font-family: var(--ff-mono, monospace);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--muted);
    text-transform: none;
    font-weight: 400;
}
.code-timer--warn { color: var(--ochre, #a86a23); }
.code-timer--expired { color: var(--alert, #b54a3a); }

/* Text-link-style button — matches <a> under .auth-alt without the <form> inside the <p> */
.link-btn {
    background: transparent;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--ink, inherit);
    text-decoration: underline;
    text-decoration-color: var(--hair, #d9d2bf);
    cursor: pointer;
}
.link-btn:hover { text-decoration-color: currentColor; }
.link-btn:disabled { opacity: 0.6; cursor: wait; text-decoration: none; }

/* OAuth button (Google) — sits above the email/password form on /login + /signup */
.oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--s3);
    width: 100%;
    padding: 0.8rem 1rem;
    margin: var(--s5) 0 0;
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--hair, #d9d2bf);
    border-radius: 6px;
    font-family: var(--ff-body, system-ui, sans-serif);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(20, 19, 13, 0.04);
    transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
.oauth-btn:hover {
    background: var(--paper);
    border-color: var(--ink-3, #a8a292);
    box-shadow: 0 1px 3px rgba(20, 19, 13, 0.08);
}
.oauth-btn:disabled { opacity: 0.65; cursor: wait; box-shadow: none; }
.oauth-btn svg { flex: none; }

.oauth-divider {
    display: flex;
    align-items: center;
    gap: var(--s3);
    margin: var(--s5) 0 var(--s4);
    color: var(--muted);
    font-family: var(--ff-mono, monospace);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.oauth-divider::before,
.oauth-divider::after {
    content: '';
    flex: 1;
    border-top: 1px solid var(--hair, #e4dfcc);
}
.oauth-divider span { padding: 0 var(--s3); }

/* Monthly / Annual toggle on pricing page */
.billing-toggle {
    display: inline-flex;
    gap: 2px;
    padding: 4px;
    margin: 0 auto var(--s5);
    background: var(--paper);
    border: var(--hl-ink, 1px solid #d9d2bf);
    border-radius: 999px;
    font-family: var(--ff-mono, monospace);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
}
.billing-toggle { display: flex; justify-content: center; max-width: 340px; }
.billing-tab {
    padding: 0.55rem 1.4rem;
    background: transparent;
    border: none;
    border-radius: 999px;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    letter-spacing: inherit;
    transition: background 140ms ease, color 140ms ease;
}
.billing-tab:hover { color: var(--ink); }
.billing-tab.active {
    background: var(--ink);
    color: var(--paper);
}
.save-badge {
    display: inline-block;
    margin-left: var(--s2);
    padding: 2px 6px;
    background: var(--moss, #35482f);
    color: var(--paper);
    border-radius: 3px;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
}
.billing-tab.active .save-badge { background: var(--ochre, #a86a23); }
.price-note {
    display: block;
    margin-top: var(--s2);
    font-size: 0.78rem;
    color: var(--muted);
    font-family: var(--ff-mono, monospace);
    letter-spacing: 0.02em;
}

/* Subscription renewal/status note under the dashboard profile card */
.profile-sub-note {
    margin-top: var(--s3);
    padding: var(--s3) var(--s4);
    font-family: var(--ff-mono, monospace);
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    color: var(--muted);
    background: var(--paper);
    border: 1px solid var(--hair, #e4dfcc);
    border-left: 3px solid var(--moss, #35482f);
    border-radius: 3px;
}
.profile-sub-note--warn { border-left-color: var(--alert, #b54a3a); color: var(--ink); }

/* Subscription panel on the dashboard */
.billing-panel {
    margin-top: var(--s4);
    padding: var(--s4) var(--s5);
    background: var(--paper);
    border: 1px solid var(--hair, #e4dfcc);
    border-radius: 4px;
}
.billing-panel__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--s5);
    flex-wrap: wrap;
}
.billing-plan {
    font-family: var(--ff-display, Georgia, serif);
    font-size: 1.25rem;
    line-height: 1.3;
    color: var(--ink);
    margin-top: 2px;
}
.billing-amount {
    font-family: var(--ff-mono, monospace);
    font-size: 0.95rem;
    color: var(--muted);
    letter-spacing: 0.02em;
}
.billing-actions {
    display: flex;
    gap: var(--s3);
    flex-wrap: wrap;
}
.billing-status {
    margin-top: var(--s4);
    padding-top: var(--s3);
    border-top: 1px dashed var(--hair, #e4dfcc);
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--muted);
}
.billing-status strong { color: var(--ink); }
.billing-status--warn { color: var(--ink); }
.billing-status--warn strong { color: var(--alert, #b54a3a); }

/* Success toast (Pro welcome) reuses existing .app-toast base but add success variant */
.app-toast.toast-success {
    background: var(--moss, #35482f);
    color: #fff;
}
.loading { font-family: var(--ff-mono); color: var(--muted); font-size: 0.85rem; letter-spacing: 0.02em; }
.row-status { font-family: var(--ff-mono); font-size: 0.78rem; color: var(--moss); letter-spacing: 0.02em; }

/* ─── Subhead ─────────────────────────────────────────────────────── */
.subhead {
    font-family: var(--ff-display);
    font-size: 1.4rem;
    font-weight: 400;
    margin: var(--s6) 0 var(--s4);
    font-variation-settings: "opsz" 72, "SOFT" 40;
}

/* ─── Step animation: collapse Step 1 once files are picked ─────── */

.step-body {
    overflow: hidden;
    transition: max-height 0.45s cubic-bezier(0.22, 0.61, 0.36, 1),
                opacity 0.3s ease,
                padding 0.3s ease,
                margin 0.3s ease;
    max-height: 800px;
    opacity: 1;
}
.step-collapsed .step-body {
    max-height: 0;
    opacity: 0;
    padding: 0;
    margin: 0;
}
.step-summary {
    margin-top: var(--s4);
    padding: var(--s3) var(--s4);
    border: var(--hl);
    background: var(--paper-2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--ff-mono);
    font-size: 0.88rem;
    color: var(--ink-3);
    letter-spacing: 0.01em;
    animation: fadeUp 0.35s 0.1s both;
}
.step-summary .num { color: var(--ink); font-weight: 600; }
.step-summary-edit {
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    padding: 4px 10px;
    border: var(--hl);
    background: var(--paper);
    color: var(--ink-3);
    cursor: pointer;
}
.step-summary-edit:hover { color: var(--ink); border-color: var(--ink); }

.step-anim-in {
    animation: fadeUp 0.5s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Help icon + tooltips ───────────────────────────────────────── */

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 1px solid var(--muted);
    border-radius: 50%;
    margin-left: var(--s2);
    color: var(--muted);
    font-family: var(--ff-mono);
    font-size: 0.7rem;
    cursor: help;
    position: relative;
    line-height: 1;
    user-select: none;
    transition: all 0.15s;
}
.help-icon:hover, .help-icon:focus-visible {
    color: var(--paper);
    background: var(--moss);
    border-color: var(--moss);
    outline: none;
}
.help-tip {
    position: absolute;
    bottom: calc(100% + 10px);
    right: -8px;
    width: 280px;
    background: var(--ink);
    color: var(--paper);
    padding: var(--s3) var(--s4);
    font-family: var(--ff-body);
    font-size: 0.85rem;
    line-height: 1.45;
    letter-spacing: 0;
    text-transform: none;
    text-align: left;
    border-radius: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.18s, transform 0.18s;
    z-index: 50;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.help-tip::after {
    content: "";
    position: absolute;
    bottom: -6px;
    right: 14px;
    width: 12px; height: 12px;
    background: var(--ink);
    transform: rotate(45deg);
}
.help-icon:hover .help-tip,
.help-icon:focus-visible .help-tip {
    opacity: 1;
    transform: translateY(0);
}

/* ─── Reason chips with hover tooltip in result table ────────────── */

.reason-chip {
    position: relative;
    display: inline-block;
    padding: 2px 8px;
    margin: 2px 4px 2px 0;
    border-bottom: 1px dotted var(--muted);
    font-size: 0.85rem;
    cursor: help;
    color: var(--ink-3);
    transition: color 0.15s;
    white-space: nowrap;
}
/* Results table: tighter padding, wrapping for the long columns. */
#results-table { table-layout: fixed; width: 100%; }
#results-table th, #results-table td {
    padding: var(--s3) var(--s3);
    overflow: hidden;
}
#results-table th:nth-child(1), #results-table td:nth-child(1) {
    overflow-wrap: anywhere;
    white-space: normal;
    font-size: 0.78rem;
}
#results-table th:last-child, #results-table td:last-child {
    white-space: normal;
    line-height: 1.9;
    overflow: visible; /* let tooltips escape */
}
/* Default layout (no zones): 5 columns. Photo wider, status a bit wider to
   fit its pill. Notes gets the rest. */
#results-table:not(.has-zones) th:nth-child(1), #results-table:not(.has-zones) td:nth-child(1) { width: 28%; }
#results-table:not(.has-zones) th:nth-child(2), #results-table:not(.has-zones) td:nth-child(2) { width: 9%; }
#results-table:not(.has-zones) th:nth-child(3), #results-table:not(.has-zones) td:nth-child(3) { width: 13%; }
#results-table:not(.has-zones) th:nth-child(4), #results-table:not(.has-zones) td:nth-child(4) { width: 9%; }
/* (notes = remaining ~41%) */

/* With zones: 8 columns. Tighten everything to keep notes column readable. */
#results-table.has-zones { font-size: 0.85rem; }
#results-table.has-zones th, #results-table.has-zones td { padding: var(--s3) 8px; }
#results-table.has-zones th:nth-child(1), #results-table.has-zones td:nth-child(1) { width: 22%; }
#results-table.has-zones th:nth-child(2), #results-table.has-zones td:nth-child(2),
#results-table.has-zones th:nth-child(3), #results-table.has-zones td:nth-child(3),
#results-table.has-zones th:nth-child(4), #results-table.has-zones td:nth-child(4) { width: 9%; }
#results-table.has-zones th:nth-child(5), #results-table.has-zones td:nth-child(5),
#results-table.has-zones th:nth-child(6), #results-table.has-zones td:nth-child(6),
#results-table.has-zones th:nth-child(7), #results-table.has-zones td:nth-child(7) { width: 7%; }
/* (notes = remaining 30%) */
.reason-chip:hover, .reason-chip:focus-visible {
    color: var(--ochre);
    outline: none;
}
.reason-tip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: 320px;
    background: var(--ink);
    color: var(--paper);
    padding: var(--s4);
    font-family: var(--ff-body);
    font-size: 0.85rem;
    line-height: 1.5;
    letter-spacing: 0;
    text-transform: none;
    text-align: left;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.18s, transform 0.18s;
    z-index: 50;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    white-space: normal;
}
.reason-tip::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 18px;
    width: 12px; height: 12px;
    background: var(--ink);
    transform: rotate(45deg);
}
.reason-tip strong {
    display: block;
    font-family: var(--ff-display);
    font-weight: 400;
    font-size: 1.05rem;
    margin-bottom: var(--s2);
    color: var(--ochre-2);
    font-variation-settings: "opsz" 48;
}
.reason-tip-explain { display: block; margin-bottom: var(--s2); color: var(--paper); }
.reason-tip-suggest { display: block; color: var(--paper-3); font-size: 0.82rem; }
.reason-tip-suggest em {
    font-family: var(--ff-mono);
    font-style: normal;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ochre-2);
    margin-right: var(--s2);
}
.reason-chip:hover .reason-tip,
.reason-chip:focus-visible .reason-tip {
    opacity: 1;
    transform: translateY(0);
}
/* If the chip is near the right edge of the table, anchor tooltip to right */
td:last-child .reason-tip {
    left: auto;
    right: 0;
}
td:last-child .reason-tip::after {
    left: auto;
    right: 18px;
}

/* Extended explanation in the Flagged section */
.flagged-explain { display: block; color: var(--ink-3); font-family: var(--ff-body); font-size: 0.88rem; margin-top: var(--s2); }
.flagged-suggest { display: block; color: var(--ink-2); font-family: var(--ff-body); font-size: 0.88rem; margin-top: var(--s1); }
.flagged-suggest em {
    font-family: var(--ff-mono);
    font-style: normal;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ochre);
    margin-right: var(--s2);
}
.flagged-item ul li { padding: var(--s3) 0; border-bottom: var(--hl); margin-bottom: 0; }
.flagged-item ul li:last-child { border-bottom: none; }

/* ─── Action row with multiple buttons ───────────────────────────── */
.actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s4);
    flex-wrap: wrap;
}
.actions-right {
    display: flex;
    align-items: center;
    gap: var(--s3);
    flex-wrap: wrap;
}
button.secondary {
    font-family: var(--ff-body);
    background: var(--paper);
    color: var(--ink);
    border: var(--hl-ink);
    padding: 10px 18px;
}
button.secondary:hover:not(:disabled) {
    background: var(--ink);
    color: var(--paper);
}

/* ─── Inline expandable batch detail row ─────────────────────────── */

.batches-table .batch-row.is-open { background: var(--paper-2); }
.batches-table .batch-row.is-open td { border-bottom: none; }
.batch-detail-row td {
    padding: 0 !important;
    background: var(--paper-2);
    border-bottom: var(--hl) !important;
}
.batch-detail-inner {
    overflow: hidden;
    transition: max-height 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
    padding: 0;
}
.batch-detail-inner > * { padding: 0 var(--s5); }
.batch-detail-inner > *:first-child { padding-top: var(--s4); }
.batch-detail-inner > *:last-child { padding-bottom: var(--s5); }
.batch-detail-meta {
    font-family: var(--ff-mono);
    font-size: 0.85rem;
    color: var(--ink-3);
    letter-spacing: 0.01em;
}
.batch-detail-meta strong { color: var(--ochre); font-weight: 600; }
.batch-detail-inner .table-wrap {
    border: var(--hl);
    background: var(--paper);
}
.batch-toggle {
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    padding: 4px 10px;
}

/* ─── Generic page fade-in ───────────────────────────────────────── */

main.container, header.hero, .auth-wrap {
    animation: pageEnter 0.5s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
@keyframes pageEnter {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.metric { animation: fadeUp 0.5s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
.metric:nth-child(1) { animation-delay: 0.05s; }
.metric:nth-child(2) { animation-delay: 0.12s; }
.metric:nth-child(3) { animation-delay: 0.19s; }
.metric:nth-child(4) { animation-delay: 0.26s; }
.metric:nth-child(5) { animation-delay: 0.33s; }

/* ─── Trial banner (anonymous mode) ──────────────────────────────── */
.trial-banner {
    background: var(--ochre);
    color: var(--paper);
    padding: var(--s3) var(--s5);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--s3);
    flex-wrap: wrap;
    font-family: var(--ff-body);
    font-size: 0.92rem;
    border-bottom: 1px solid var(--ochre);
    animation: fadeUp 0.4s 0.1s both;
}
/* The [hidden] attribute is overridden by display: flex above without this. */
.trial-banner[hidden] { display: none; }
.trial-banner .trial-mark {
    font-family: var(--ff-mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: var(--ink);
    color: var(--ochre-2);
    padding: 2px 8px;
}
.trial-banner .trial-message strong { font-weight: 600; }
.trial-banner .trial-cta {
    color: var(--paper);
    text-decoration: underline;
    text-decoration-color: rgba(243,239,226,0.4);
    text-underline-offset: 3px;
    font-weight: 500;
}
.trial-banner .trial-cta:hover {
    text-decoration-color: var(--paper);
}

/* ─── Trial-finished modal ───────────────────────────────────────── */
.trial-modal {
    border: var(--hl-ink);
    background: var(--paper);
    padding: 0;
    max-width: 460px;
    width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: modalIn 0.3s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.trial-modal::backdrop {
    background: rgba(20,19,13,0.55);
    backdrop-filter: blur(2px);
    animation: backdropIn 0.3s ease both;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes backdropIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.trial-modal-inner {
    padding: var(--s7) var(--s6) var(--s6);
    text-align: left;
}
.trial-modal-inner h2 {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    line-height: 1.05;
    margin: var(--s3) 0 var(--s4);
    letter-spacing: -0.015em;
}
.trial-modal-inner h2 em { color: var(--ochre); }
.trial-modal-inner p {
    color: var(--ink-3);
    margin-bottom: var(--s5);
}
.trial-modal-inner p strong { color: var(--ink); font-weight: 600; }
.trial-modal-actions {
    display: flex;
    gap: var(--s3);
    align-items: center;
    flex-wrap: wrap;
}
.trial-modal-actions .primary-link { flex: 1 1 auto; text-align: center; }
.trial-modal-actions .ghost-link {
    border: none;
    background: transparent;
    text-decoration: underline;
    text-decoration-color: var(--hair);
    text-underline-offset: 3px;
    padding: 12px 16px;
    cursor: pointer;
    color: var(--ink-3);
    font-size: 1rem;
    font-family: var(--ff-body);
}
.trial-modal-actions .ghost-link:hover { color: var(--ink); text-decoration-color: var(--ink); }

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

/* ─── Mobile ─────────────────────────────────────────────────────── */

@media (max-width: 900px) {
    .hero { padding: var(--s7) var(--s5) var(--s8); }
    .hero-decor { display: none; }
    .section { padding: var(--s8) var(--s5); }
    .section-head { grid-template-columns: 1fr; gap: var(--s4); }
    .features-grid { grid-template-columns: 1fr; }
    .feature-card { grid-column: span 1; }
    .steps { grid-template-columns: 1fr; }
    .steps li { border-right: none; border-bottom: var(--hl); }
    .who-list li { grid-template-columns: 1fr; gap: var(--s2); }
    .pricing-grid { grid-template-columns: 1fr; }
    .pricing-card { border-right: none; border-bottom: var(--hl); }
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-side { display: none; }
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .admin-summary { grid-template-columns: repeat(2, 1fr); }
    .admin-summary .metric:nth-child(2) { border-right: none; }
    .admin-summary .metric:nth-child(-n+2) { border-bottom: var(--hl); }
    .profile-row { grid-template-columns: 1fr 1fr; }
    .profile-actions { grid-column: 1 / -1; text-align: left; }
    .topnav { padding: var(--s3) var(--s4); }
    .topnav .nav-links { gap: var(--s3); font-size: 0.85rem; }
}

@media (max-width: 560px) {
    .metrics { grid-template-columns: 1fr; }
    .metric { border-right: none; }
    .flagged-item { grid-template-columns: 1fr; }
}
