/* MSOLE: photo hero, floating collage, image cards. */
:root {
  --bg: #f6f5f1;
  --white: #ffffff;
  --ink: #1f2522;
  --muted: #646c66;
  --line: #e2e0d8;
  --sage: #9db36b;
  --sage-deep: #6f8743;
  --sage-soft: #e9eedc;
  --dark: #1b1f1d;
  --font: "Figtree", "Segoe UI", system-ui, sans-serif;
  --gutter: clamp(18px, 4vw, 56px);
  --max: 1240px;
  --radius: 28px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 clamp(16px, 0.35vw + 14.5px, 18px) / 1.6 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.025em; line-height: 1.08; text-wrap: balance; }
.wrap { max-width: var(--max); margin: 0 auto; padding-inline: var(--gutter); }
.accent { color: var(--sage); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 15px 30px; border-radius: 999px; font: 600 16px/1 var(--font); text-decoration: none;
  background: var(--sage); color: var(--dark); transition: background 0.2s, transform 0.2s;
}
.btn:hover { background: #b0c582; transform: translateY(-1px); }
.btn-sm { padding: 11px 20px; font-size: 14px; }
.btn-dark { background: var(--dark); color: var(--white); }
.btn-dark:hover { background: #2c332f; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(246, 245, 241, 0.9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.site-header nav { max-width: 1440px; margin: 0 auto; padding: 12px var(--gutter); display: flex; align-items: center; gap: 26px; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; font-weight: 700; letter-spacing: 0.12em; font-size: 15px; text-decoration: none; }
.brand img { border-radius: 8px; }
.site-header nav > a:not(.brand):not(.btn) { font-size: 15px; font-weight: 500; text-decoration: none; opacity: 0.8; }
.site-header nav > a:not(.brand):not(.btn):hover { opacity: 1; }
.home .site-header { position: absolute; left: 0; right: 0; background: transparent; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; color: var(--white); }

/* Hero: the whole video below the header, request button centered on it */
.hero { background: #000; padding-top: 66px; }
.hero-frame { position: relative; width: min(100%, calc((100svh - 66px) * 16 / 9)); margin: 0 auto; }
.hero-video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.hero-request {
  position: absolute; left: 50%; bottom: clamp(16px, 5%, 52px); transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: clamp(12px, 1.2vw, 18px); white-space: nowrap; overflow: hidden;
  padding: clamp(8px, 0.7vw, 11px) clamp(8px, 0.7vw, 11px) clamp(8px, 0.7vw, 11px) clamp(18px, 1.8vw, 26px);
  border-radius: 999px; text-decoration: none; color: var(--white);
  font: 600 clamp(16px, 1.45vw, 22px) / 1 var(--font); letter-spacing: -0.01em;
  background: rgba(20, 24, 22, 0.42); border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 20px 50px -18px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: background 0.3s, border-color 0.3s, transform 0.3s;
}
/* light sweep */
.hero-request::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.22) 50%, transparent 70%);
  transform: translateX(-120%); animation: sweep 4.5s ease-in-out infinite 1.5s;
}
@keyframes sweep { 0% { transform: translateX(-120%); } 35%, 100% { transform: translateX(120%); } }
.hero-request .pulse { position: relative; width: 10px; height: 10px; border-radius: 50%; background: var(--sage); flex: none; }
.hero-request .pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--sage); animation: ring 2s ease-out infinite; }
@keyframes ring { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(3.2); opacity: 0; } }
.hero-request .arrow {
  display: grid; place-items: center; width: clamp(38px, 3.4vw, 50px); height: clamp(38px, 3.4vw, 50px); border-radius: 50%;
  background: var(--sage); color: var(--dark); flex: none; transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.hero-request:hover { background: rgba(20, 24, 22, 0.6); border-color: rgba(157, 179, 107, 0.7); transform: translate(-50%, -3px); }
.hero-request:hover .arrow { transform: translateX(4px) rotate(-8deg); }
.hero-request:focus-visible { outline: 3px solid var(--sage); outline-offset: 4px; }
@media (prefers-reduced-motion: reduce) {
  .hero-request::before, .hero-request .pulse::after { animation: none; }
}

/* Request dialog */
.request {
  width: min(680px, calc(100vw - 24px)); max-height: calc(100svh - 24px); padding: 0; border: 0; border-radius: var(--radius);
  background: var(--bg); color: var(--ink); box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.5);
}
.request::backdrop { background: rgba(15, 18, 16, 0.6); backdrop-filter: blur(4px); }
.request form, .request-done { padding: clamp(22px, 4vw, 36px); }
.request-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.request h2 { font-size: clamp(26px, 3vw, 34px); }
.request .close { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--sage-soft); color: var(--ink); font-size: 24px; line-height: 1; cursor: pointer; }
.request-hint { color: var(--muted); margin: 6px 0 22px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.fields label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.fields label b { color: var(--sage-deep); }
.fields .full { grid-column: 1 / -1; }
.fields input, .fields select, .fields textarea {
  width: 100%; font: 400 16px/1.4 var(--font); color: var(--ink); background: var(--white);
  border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; transition: border-color 0.15s, box-shadow 0.15s;
}
.fields textarea { resize: vertical; min-height: 110px; }
.fields input:focus, .fields select:focus, .fields textarea:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 4px var(--sage-soft); }
.fields input:user-invalid, .fields select:user-invalid, .fields textarea:user-invalid { border-color: #c0573f; }
.robot-check {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px;
  background: var(--white); border: 1.5px solid var(--line); max-width: 340px; transition: border-color 0.2s;
}
.robot-check[data-state="done"] { border-color: var(--sage); }
.rc-box {
  position: relative; display: grid; place-items: center; width: 30px; height: 30px; flex: none; padding: 0; cursor: pointer;
  border: 2px solid #b9bdb2; border-radius: 8px; background: var(--white); transition: border-color 0.2s, background 0.2s;
}
.rc-box:hover { border-color: var(--sage-deep); }
.rc-box:focus-visible { outline: 3px solid var(--sage-soft); outline-offset: 2px; }
.rc-spinner { display: none; width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--sage-soft); border-top-color: var(--sage-deep); animation: rc-spin 0.8s linear infinite; }
.rc-tick { display: none; width: 22px; height: 22px; fill: none; stroke: var(--white); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; }
.robot-check[data-state="checking"] .rc-box { border-color: transparent; cursor: progress; }
.robot-check[data-state="checking"] .rc-spinner { display: block; }
.robot-check[data-state="done"] .rc-box { background: var(--sage-deep); border-color: var(--sage-deep); cursor: default; }
.robot-check[data-state="done"] .rc-tick { display: block; animation: rc-draw 0.35s ease-out forwards; }
@keyframes rc-spin { to { transform: rotate(360deg); } }
@keyframes rc-draw { to { stroke-dashoffset: 0; } }
.rc-text { display: grid; gap: 2px; flex: 1; font-size: 15px; font-weight: 600; }
.rc-text small { font-size: 12px; font-weight: 400; color: var(--muted); }
.rc-badge { font-size: 10px; font-weight: 700; line-height: 1.2; letter-spacing: 0.06em; text-align: center; color: var(--sage-deep); opacity: 0.8; }
.fields .consent { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; color: var(--muted); }
.fields .consent input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--sage-deep); }
.fields .consent a { color: var(--sage-deep); }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-status { min-height: 24px; margin: 14px 0 0; font-size: 14px; color: var(--muted); }
.form-status.error { color: #b2442c; }
.request-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-top: 6px; }
.request-foot small { max-width: 320px; font-size: 12px; color: var(--muted); }
.request-foot small a { color: inherit; }
.request-foot .btn { border: 0; cursor: pointer; }
.request-foot .btn:disabled { opacity: 0.6; cursor: progress; }
.request-done { text-align: center; }
.request-done .done-mark { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--sage); color: var(--dark); font-size: 30px; margin-bottom: 18px; }
.request-done p { color: var(--muted); margin: 10px 0 26px; }
.request-done .btn { border: 0; cursor: pointer; }

/* Floating collage */
.collage { position: relative; height: clamp(820px, 150vh, 1350px); overflow: clip; }
.collage-center { position: sticky; top: 0; height: 100vh; display: grid; place-items: center; text-align: center; z-index: 2; pointer-events: none; }
.collage-center > div {
  pointer-events: auto; margin: 0 var(--gutter); padding: clamp(28px, 4vw, 48px) clamp(24px, 4vw, 56px);
  border-radius: var(--radius); background: rgba(246, 245, 241, 0.82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.collage-center h2 { font-size: clamp(34px, 4.6vw, 62px); max-width: 760px; margin: 0 auto 26px; }
.float-card {
  position: absolute; width: var(--w); left: var(--x); top: var(--y); margin: 0; z-index: 1;
  border-radius: 14px; overflow: hidden; background: var(--white);
  box-shadow: 0 30px 60px -28px rgba(20, 30, 24, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.04);
  will-change: transform;
}
.float-card img { width: 100%; }

/* News (home collage + /news/) */
.news-kicker { display: inline-block; padding: 6px 14px; border-radius: 999px; background: var(--sage-soft); color: var(--sage-deep); font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 16px; }
.collage-center h2 { margin-bottom: 16px; }
.news-latest { display: grid; gap: 4px; max-width: 520px; margin: 0 auto 24px; }
.news-latest[hidden] { display: none; }
.news-latest time { font-size: 13px; color: var(--muted); }
.news-latest a { font-size: clamp(17px, 1.4vw, 20px); font-weight: 600; text-decoration: none; color: var(--ink); }
.news-latest a:hover { color: var(--sage-deep); text-decoration: underline; }
.float-card.is-news { background: var(--dark); }
.float-card.is-news a { position: relative; display: block; }
.float-card.is-news img { aspect-ratio: 4 / 3; object-fit: cover; transition: transform 0.6s; }
.float-card.is-news a:hover img { transform: scale(1.04); }
.news-tag { position: absolute; left: 10px; bottom: 10px; padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.92); color: var(--ink); font-size: 12px; font-weight: 600; }
.news-list { display: grid; gap: 24px; }
.news-card { display: grid; grid-template-columns: 300px 1fr; gap: 26px; align-items: start; background: var(--white); border-radius: var(--radius); padding: 16px; border: 1px solid var(--line); }
.news-media { display: block; border-radius: 18px; overflow: hidden; background: var(--dark); }
.news-media img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform 0.6s; }
.news-media:hover img { transform: scale(1.04); }
.news-body { padding: 6px 10px 6px 0; }
.news-meta { font-size: 13px; color: var(--muted); margin: 0 0 8px !important; }
.news-card h2 { font-size: clamp(21px, 2vw, 26px); margin: 0 0 10px; }
.news-card h2 a { color: var(--ink); text-decoration: none; }
.news-card h2 a:hover { color: var(--sage-deep); }
.news-card p { color: var(--muted); }
.news-more { display: inline-flex; gap: 6px; margin-top: 8px; font-weight: 600; color: var(--sage-deep); text-decoration: none; }
.news-more:hover { text-decoration: underline; }
.news-empty { color: var(--muted); }

/* Image cards */
.plates { padding: clamp(80px, 10vw, 140px) 0; display: grid; gap: clamp(24px, 3vw, 36px); }
.plates-head { text-align: center; margin-bottom: clamp(20px, 3vw, 40px); }
.plates-head h2 { font-size: clamp(32px, 4vw, 52px); }
.card { display: grid; grid-template-columns: 1.15fr 1fr; align-items: center; gap: clamp(24px, 4vw, 64px); background: var(--white); border-radius: var(--radius); padding: clamp(16px, 2vw, 24px); }
.card.flip { grid-template-columns: 1fr 1.15fr; }
.card.flip > a { order: 2; }
.card > a { display: block; border-radius: 18px; overflow: hidden; background: var(--dark); }
.card > a img { width: 100%; transition: transform 1s cubic-bezier(0.2, 0.7, 0.2, 1); }
.card > a:hover img { transform: scale(1.03); }
.card.narrow > a { max-width: 420px; justify-self: center; }
.card .text { padding: clamp(8px, 2vw, 24px); }
.card .num { display: inline-block; padding: 6px 14px; border-radius: 999px; background: var(--sage-soft); color: var(--sage-deep); font-size: 13px; font-weight: 600; margin-bottom: 18px; }
.card h3 { font-size: clamp(26px, 2.6vw, 36px); margin-bottom: 14px; }
.card p { color: var(--muted); max-width: 460px; }

/* Research team */
.team { padding-bottom: clamp(80px, 10vw, 140px); }
.team-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(16px, 2vw, 28px); }
.member { margin: 0; background: var(--white); border-radius: var(--radius); padding: 14px 14px 22px; text-align: center; }
.member-photo { aspect-ratio: 4 / 5; border-radius: 18px; overflow: hidden; background: var(--sage-soft); }
.member-photo img { width: 100%; height: 100%; object-fit: cover; }
.member-photo.placeholder { display: grid; place-items: center; }
.member-photo.placeholder svg { width: 42%; fill: none; stroke: var(--sage-deep); stroke-width: 3; opacity: 0.55; }
.member figcaption { display: grid; gap: 4px; margin-top: 16px; }
.member figcaption b { font-size: 18px; font-weight: 600; }
.member figcaption span { font-size: 14px; color: var(--muted); }

/* Footer */
.site-footer { background: var(--dark); color: rgba(255, 255, 255, 0.7); border-radius: var(--radius) var(--radius) 0 0; }
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 30px; padding-top: 40px; padding-bottom: 44px; font-size: 14px; }
.site-footer .brand { color: var(--white); font-size: 18px; gap: 12px; }
.site-footer .brand img { border-radius: 12px; }
.site-footer a:not(.brand) { text-decoration: none; }
.site-footer a:not(.brand):hover { color: var(--white); }

/* Document pages (privacy, support, 404) */
.doc-hero { padding: clamp(60px, 8vw, 110px) 0 30px; }
.doc-hero .wrap { max-width: 900px; }
.doc-hero h1 { font-size: clamp(40px, 5.4vw, 68px); margin: 18px 0 14px; }
.doc-hero .lead { color: var(--muted); font-size: 1.1em; }
.doc-hero .hl { color: var(--sage-deep); }
.marker { display: inline-block; padding: 6px 14px; border-radius: 999px; background: var(--sage-soft); color: var(--sage-deep); font-size: 13px; font-weight: 600; }
.marker b { font-weight: 600; }
.updated { color: var(--muted); font-size: 14px; }
.doc { max-width: 900px; margin: 0 auto; padding: 0 var(--gutter) clamp(80px, 10vw, 130px); color: #3a413c; }
.doc h2 { font-size: clamp(22px, 2.2vw, 28px); color: var(--ink); margin: 44px 0 12px; }
.doc p { margin: 0 0 14px; }
.doc ul { padding-left: 22px; margin: 0 0 14px; }
.doc li { margin-bottom: 6px; }
.doc a { color: var(--sage-deep); }
.doc strong { color: var(--ink); }
.table-wrap { overflow-x: auto; margin: 16px 0; background: var(--white); border-radius: 18px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 0.94em; }
th, td { text-align: left; padding: 14px 16px; vertical-align: top; }
th { background: var(--sage-soft); }
tr + tr td { border-top: 1px solid var(--line); }
.contact-card { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; margin: 10px 0 30px; padding: 26px 28px; border-radius: var(--radius); background: var(--white); border: 1px solid var(--line); }
.contact-card b { display: block; font-size: 1.2em; }
.contact-card span { color: var(--muted); }

/* Reveal */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .float-card { transform: none !important; }
}

@media (max-width: 860px) {
  .card, .card.flip { grid-template-columns: 1fr; }
  .card.flip > a { order: 0; }
  .site-header nav > a.hide-sm { display: none; }
  .collage { height: 980px; }
  .fields { grid-template-columns: 1fr; }
  .news-card { grid-template-columns: 1fr; }
  .team-grid { grid-template-columns: 1fr 1fr; }
  .news-body { padding: 4px 6px 8px; }
}

/* ---------------------------------------------------------------------------
   Login (research dashboard)
   ------------------------------------------------------------------------- */
.restricted { display: flex; gap: 16px; align-items: flex-start; padding: 20px 22px; margin: 0 0 26px; border-radius: 20px; background: #fff7e6; border: 1px solid #f0d9a8; }
.restricted-icon { font-size: 24px; line-height: 1; }
.restricted b { display: block; color: var(--ink); margin-bottom: 4px; }
.restricted p { margin: 0 !important; color: #5c5240; }
.auth-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(18px, 3vw, 30px); }
.auth-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--sage-soft); margin-bottom: 20px; }
.auth-tabs button { border: 0; background: transparent; padding: 10px 18px; border-radius: 999px; font: 600 15px var(--font); color: var(--muted); cursor: pointer; }
.auth-tabs button[aria-selected="true"] { background: var(--white); color: var(--ink); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); }
.auth-form { display: grid; gap: 14px; }
.auth-form label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.auth-form input, .auth-form select, .auth-form textarea { width: 100%; font: 400 16px/1.4 var(--font); color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.auth-form input:focus, .auth-form select:focus, .auth-form textarea:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 4px var(--sage-soft); }
.auth-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.auth-form .check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--muted); }
.auth-form .check input { width: 20px; height: 20px; flex: none; margin-top: 2px; accent-color: var(--sage-deep); }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 4px; }
.auth-row .btn { border: 0; cursor: pointer; }
.auth-form :disabled { opacity: 0.6; }
.auth-notice { margin: 0 0 16px !important; padding: 12px 14px; border-radius: 12px; background: var(--sage-soft); color: var(--sage-deep); font-size: 15px; }
.auth-notice[data-kind="error"] { background: #fbe9e4; color: #9d3a22; }
.signed-in { font-size: 14px; color: var(--muted); }
.link { border: 0; background: none; padding: 0; font: inherit; color: var(--sage-deep); text-decoration: underline; cursor: pointer; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 0.92em; }
@media (max-width: 640px) { .auth-form .two { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------------------
   Research dashboard
   ------------------------------------------------------------------------- */
body.dash { background: #f1f2ee; }
.dash-gate[hidden] { display: none; }
.dash-gate { min-height: 100svh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--sage-soft); border-top-color: var(--sage-deep); animation: rc-spin 0.8s linear infinite; }
.dash-app { display: grid; grid-template-columns: 250px 1fr; min-height: 100svh; }
.dash-app[hidden] { display: none; }
.dash-side { position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column; gap: 18px; padding: 22px 18px; background: var(--dark); color: rgba(255, 255, 255, 0.75); }
.dash-side .brand { color: var(--white); margin: 0; }
.dash-side-label { margin: -6px 0 6px; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sage); }
.dash-nav { display: grid; gap: 2px; }
.dash-nav a { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 10px; text-decoration: none; font-size: 15px; font-weight: 500; }
.dash-nav a:hover { background: rgba(255, 255, 255, 0.07); color: var(--white); }
.badge { min-width: 22px; padding: 2px 7px; border-radius: 999px; background: var(--sage); color: var(--dark); font-size: 12px; font-weight: 700; text-align: center; }
.badge[hidden] { display: none; }
.dash-user { margin-top: auto; display: grid; gap: 4px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.12); font-size: 14px; }
.dash-user b { color: var(--white); }
.dash-user .btn { margin-top: 10px; justify-self: start; cursor: pointer; }
.btn-ghost { background: transparent; color: inherit; border: 1.5px solid currentColor; }
.btn-ghost:hover { background: rgba(157, 179, 107, 0.15); }
.admin-only { display: none !important; }
body.is-admin a.admin-only { display: flex !important; }
body.is-admin section.admin-only { display: block !important; }

.dash-main { padding: clamp(18px, 3vw, 36px); min-width: 0; }
.dash-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.dash-top h1 { font-size: clamp(28px, 3vw, 40px); }
.eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sage-deep); }
.dash-top-actions { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.dash-top-actions .btn, .row .btn { border: 0; cursor: pointer; }
.dash-error { padding: 14px 16px; border-radius: 12px; background: #fbe9e4; color: #9d3a22; }
.dash-error[hidden] { display: none; }
.dash-section { margin-bottom: clamp(28px, 4vw, 44px); scroll-margin-top: 20px; }
.section-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title h2 { font-size: 22px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.select { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.select select { font: 500 14px var(--font); padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--white); max-width: 420px; }

.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi { display: grid; gap: 4px; align-content: start; padding: 16px 18px; background: var(--white); border-radius: 18px; border: 1px solid rgba(0, 0, 0, 0.04); }
.kpi span { font-size: 12.5px; color: var(--muted); }
.kpi b { font: 600 clamp(24px, 2.2vw, 32px) / 1.1 "IBM Plex Mono", monospace; letter-spacing: -0.02em; }
.kpi b.small { font-size: clamp(16px, 1.3vw, 19px); padding-top: 6px; }
.kpi small { font-size: 11.5px; color: var(--muted); }
.panel { background: var(--white); border-radius: 20px; padding: 18px 20px; border: 1px solid rgba(0, 0, 0, 0.04); min-width: 0; }
.panel h2, .panel h3 { font-size: 16px; margin: 0 0 2px; }
.panel .muted { font-size: 13px; margin-bottom: 8px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.grid-maps { display: grid; grid-template-columns: minmax(300px, 0.9fr) 1.1fr; gap: 14px; margin-top: 14px; }
.stack { display: grid; gap: 14px; }
.chart { position: relative; height: 240px; }
.chart.tall { height: 300px; }
.maps .feet { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 12px; }
.foot { width: 100%; display: block; }
.scale { display: flex; align-items: center; gap: 10px; font: 500 12px "IBM Plex Mono", monospace; color: var(--muted); }
.scale i { flex: 1; height: 10px; border-radius: 99px; background: linear-gradient(90deg, #313695, #4575b4, #74add1, #abd9e9, #fee090, #fdae61, #f46d43, #a50026); }
.session-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 12px; font-size: 14px; color: var(--muted); }
.session-meta b { color: var(--ink); font-weight: 600; margin-right: 4px; }

.table-panel { overflow-x: auto; padding: 8px 6px; }
.table-panel h3 { padding: 10px 12px 4px; }
.table-panel.scroll { max-height: 460px; overflow-y: auto; }
.table-panel.scroll thead th { position: sticky; top: 0; z-index: 1; background: var(--white); }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; padding: 10px 12px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; background: transparent; border-bottom: 1px solid var(--line); }
.data-table td { padding: 10px 12px; border-top: 1px solid #f0efea; vertical-align: top; }
.data-table.compact td, .data-table.compact th { padding: 7px 10px; }
.data-table tbody tr[data-session] { cursor: pointer; }
.data-table tbody tr[data-session]:hover, .data-table tbody tr.active { background: var(--sage-soft); }
.data-table .empty { color: var(--muted); text-align: center; padding: 24px; }
.data-table .reason { max-width: 280px; color: var(--muted); }
.data-table .actions { white-space: nowrap; }
.data-table .actions .btn { border: 0; cursor: pointer; margin: 2px; }
.data-table .actions .btn-ghost { border: 1.5px solid var(--line); color: var(--ink); }
.file-name { word-break: break-all; }
.status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; text-transform: capitalize; }
.status.pending { background: #fff3d6; color: #8a6200; }
.status.approved { background: var(--sage-soft); color: var(--sage-deep); }
.status.rejected { background: #fbe9e4; color: #9d3a22; }
.status.admin { background: var(--dark); color: var(--white); }
.bucket-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.bucket-tabs button { border: 1px solid var(--line); background: var(--white); border-radius: 999px; padding: 8px 14px; font: 500 13px var(--font); cursor: pointer; color: var(--ink); }
.bucket-tabs button[aria-selected="true"] { background: var(--dark); color: var(--white); border-color: var(--dark); }
.file-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 12px; }
.file-gallery:empty { display: none; }
.file-gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: var(--white); }

@media (max-width: 1200px) { .kpis { grid-template-columns: repeat(3, 1fr); } .grid-maps, .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .dash-app { grid-template-columns: 1fr; }
  .dash-side { position: static; height: auto; }
  .dash-nav { grid-template-columns: repeat(2, 1fr); }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}

/* Dashboard: patient list and patient view */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dash-nav a.active { background: rgba(157, 179, 107, 0.18); color: var(--white); }
.dash-subnav { display: grid; gap: 1px; margin: 2px 0 8px 10px; padding-left: 10px; border-left: 2px solid rgba(157, 179, 107, 0.45); }
.dash-subnav-title { padding: 6px 10px 4px; font: 600 13px "IBM Plex Mono", monospace; color: var(--sage); }
.dash-subnav button { text-align: left; border: 0; background: none; color: rgba(255, 255, 255, 0.75); font: 500 14px var(--font); padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.dash-subnav button:hover { background: rgba(255, 255, 255, 0.07); color: var(--white); }
.back-link { display: inline-block; margin: -6px 0 16px; font-weight: 600; color: var(--sage-deep); text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.search input { font: 500 14px var(--font); padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--white); width: min(260px, 60vw); }
.search input:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 3px var(--sage-soft); }
.empty-state { padding: 34px; text-align: center; color: var(--muted); background: var(--white); border-radius: 20px; }

.patient-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.patient-card {
  display: grid; gap: 12px; padding: 18px; border-radius: 20px; background: var(--white);
  border: 1px solid rgba(0, 0, 0, 0.05); color: var(--ink); text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.patient-card:hover { transform: translateY(-3px); border-color: var(--sage); box-shadow: 0 18px 40px -24px rgba(20, 30, 24, 0.45); }
.patient-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.patient-code { font: 600 22px/1.1 "IBM Plex Mono", monospace; letter-spacing: -0.01em; }
.patient-feet { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 18px; border-radius: 14px; background: #f6f7f3; }
.patient-feet canvas { width: 100%; display: block; }
.patient-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0; }
.patient-stats dt { font-size: 11.5px; color: var(--muted); }
.patient-stats dd { margin: 0; font: 600 16px "IBM Plex Mono", monospace; }
.patient-last { margin: 0; font-size: 13px; color: var(--muted); }
.patient-last b { color: var(--ink); font-weight: 600; }
.patient-acts { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; }
.patient-acts span { padding: 3px 9px; border-radius: 999px; background: var(--sage-soft); color: var(--sage-deep); font-size: 12px; font-weight: 600; }
.files .table-panel { margin-top: 4px; }
.patient-feet.files-only { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 120px; color: var(--muted); text-align: left; font-size: 13px; }
.patient-feet.files-only span { font-size: 30px; }
.patient-feet.files-only p { margin: 0; }
.files-notice { padding: 14px 16px; margin: 0 0 18px; border-radius: 14px; background: #fff7e6; border: 1px solid #f0d9a8; color: #5c5240; font-size: 14px; }
.bucket-tabs button { display: inline-flex; align-items: center; gap: 7px; }
.bucket-tabs button.empty, .bucket-tabs button:disabled { background: #e9e9e6; color: #a3a6a0; border-color: #e1e1dd; cursor: not-allowed; text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, 0.18); }
.tab-count { min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--sage-soft); color: var(--sage-deep); font-size: 11.5px; font-weight: 700; text-align: center; }
.bucket-tabs button[aria-selected="true"] .tab-count { background: var(--sage); color: var(--dark); }
.tab-legend { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 12.5px; color: var(--muted); }
.tab-legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.tab-legend .dot.on { background: var(--sage); }
.tab-legend .dot.off { background: #d6d6d2; margin-left: 10px; }

/* File analysis dialog */
dialog.analysis { width: min(1240px, calc(100vw - 24px)); max-height: calc(100svh - 24px); padding: 0; border: 0; border-radius: 24px; background: #f1f2ee; color: var(--ink); }
dialog.analysis::backdrop { background: rgba(15, 18, 16, 0.6); backdrop-filter: blur(4px); }
.analysis-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 24px; background: var(--white); border-bottom: 1px solid var(--line); }
.analysis-head h2 { font-size: 18px; word-break: break-all; }
.analysis-head .eyebrow { margin-bottom: 2px; }
.analysis-head .btn { cursor: pointer; color: var(--ink); }
.analysis-body { display: grid; gap: 14px; padding: 20px 24px 28px; }
.analysis-body .grid-maps { margin-top: 0; }
.compact-kpis { grid-template-columns: repeat(4, 1fr); margin-bottom: 0; }
.dash-gate.inline { min-height: 220px; }
.imu-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.column-picker { display: flex; flex-wrap: wrap; gap: 6px 14px; max-height: 150px; overflow-y: auto; margin-bottom: 12px; padding: 10px 12px; border-radius: 12px; background: #f6f7f3; font-size: 13px; }
.column-picker label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.column-picker input { accent-color: var(--sage-deep); }
.meta-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px 18px; margin: 8px 0 0; }
.meta-list dt { font-size: 12px; color: var(--muted); }
.meta-list dd { margin: 0; font: 500 13.5px "IBM Plex Mono", monospace; word-break: break-all; }
@media (max-width: 860px) { .compact-kpis { grid-template-columns: repeat(2, 1fr); } }

/* Admin delete */
.patient-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -6px 0 16px; }
.patient-bar .back-link { margin: 0; }
.btn-danger { background: #b2442c; color: var(--white); border: 0; cursor: pointer; }
.btn-danger:hover { background: #963722; }
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }
.icon-danger { border: 0; background: transparent; cursor: pointer; font-size: 16px; padding: 4px 8px; border-radius: 8px; opacity: 0.55; transition: opacity 0.15s, background 0.15s; }
.icon-danger:hover { opacity: 1; background: #fbe9e4; }
.confirm-dialog { width: min(440px, calc(100vw - 24px)); padding: 26px; border: 0; border-radius: 22px; background: var(--white); color: var(--ink); text-align: center; }
.confirm-dialog::backdrop { background: rgba(15, 18, 16, 0.55); }
.confirm-icon { width: 52px; height: 52px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 50%; background: #fbe9e4; color: #b2442c; font-size: 24px; }
.confirm-dialog h2 { font-size: 20px; margin-bottom: 8px; }
.confirm-dialog p { color: var(--muted); margin: 0 0 16px; }
.confirm-dialog label { display: grid; gap: 8px; text-align: left; font-size: 14px; margin-bottom: 16px; }
.confirm-dialog input { font: 500 15px "IBM Plex Mono", monospace; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line); }
.confirm-dialog input:focus { outline: none; border-color: #b2442c; box-shadow: 0 0 0 3px #fbe9e4; }
.confirm-actions { display: flex; justify-content: center; gap: 10px; }
.confirm-actions .btn-ghost { color: var(--ink); border-color: var(--line); cursor: pointer; }
