/* MotherBotanist client portal.
   Same tokens as motherbotanist.com (assets/css/site.css): sand, moss, bark ink, one clay accent. */

:root {
  --bg: #f1efe7;
  --bg-2: #e7e4d9;
  --surface: #fbfaf6;
  --ink: #1a2118;
  --ink-2: #4b5447;
  --ink-3: #6f776a;
  --line: #d3cfc1;
  --line-2: #c3beae;
  --moss: #2c4029;
  --moss-2: #3e5839;
  --sage: #8e9c7f;
  --sage-soft: #dfe3d4;
  --clay: #a84b2b;
  --clay-hover: #8f3d21;
  --clay-soft: #f3e3db;
  --on-clay: #ffffff;
  --ochre: #8a6a1f;
  --ochre-soft: #efe4c6;
  --danger: #a3271f;
  --shadow-1: 0 1px 2px rgba(26, 33, 24, 0.08);
  --shadow-2: 0 2px 4px rgba(26, 33, 24, 0.06), 0 10px 24px -12px rgba(26, 33, 24, 0.22);
  --f-display: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-text: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 12px;
  --r-sm: 8px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #11150f;
  --bg-2: #161b14;
  --surface: #1c2219;
  --ink: #eaece2;
  --ink-2: #b2b9a8;
  --ink-3: #8a9280;
  --line: #2c3428;
  --line-2: #3a4335;
  --moss: #1f2e1d;
  --moss-2: #a9bd97;
  --sage: #9db08c;
  --sage-soft: #26321f;
  --clay: #d77a53;
  --clay-hover: #e5906b;
  --clay-soft: #3a2418;
  --on-clay: #1a110c;
  --ochre: #e0b65a;
  --ochre-soft: #352b13;
  --danger: #f08a7f;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 2px 4px rgba(0, 0, 0, 0.3), 0 12px 28px -14px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--f-text); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(26px, 3vw, 34px); }
h2 { font-size: 20px; }
p { margin: 0; }
a { color: var(--ink); text-underline-offset: 3px; text-decoration-color: var(--line-2); }
a:hover { text-decoration-color: var(--clay); }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--clay); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.right { text-align: right; }
.lead { font-size: 17px; color: var(--ink-2); margin: 10px 0 20px; max-width: 70ch; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

.wordmark { font-family: var(--f-display); font-weight: 680; font-size: 20px; letter-spacing: -0.02em; text-decoration: none; color: var(--ink); }
.wordmark span { color: var(--moss-2); }
:root[data-theme="light"] .wordmark span { color: var(--moss); }

/* Buttons and controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border-radius: var(--r-sm); border: 1px solid transparent; font: 600 14px/1 var(--f-text); text-decoration: none; cursor: pointer; transition: background-color 150ms var(--ease), border-color 150ms var(--ease); white-space: nowrap; }
.btn--small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn--lg { min-height: 50px; padding: 0 24px; font-size: 15px; }
.btn--block { width: 100%; }
.btn--primary { background: var(--clay); color: var(--on-clay); }
.btn--primary:hover { background: var(--clay-hover); }
.btn--ghost { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn--ghost:hover { background: var(--surface); border-color: var(--ink-3); }
.btn--danger { color: var(--danger); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn--danger { color: var(--danger); }
.theme-toggle { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-2); background: transparent; color: var(--ink); cursor: pointer; }
.theme-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: block; }

.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); min-width: 0; }
.field__label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field--wide { grid-column: 1 / -1; }
.field--end { align-self: end; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font: 400 15px/1.4 var(--f-text);
}
textarea { resize: vertical; }
input[type=file] { font: 400 13px var(--f-text); color: var(--ink-2); max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--clay); outline-offset: 0; border-color: transparent; }
input[type=checkbox] { accent-color: var(--clay); width: 16px; height: 16px; margin: 0; flex: none; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.stack { display: grid; gap: 14px; margin-top: 18px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span { display: inline-block; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 13px; font-weight: 500; color: var(--ink-2); background: var(--surface); transition: all 120ms var(--ease); }
.chip input:checked + span { background: var(--moss-2); border-color: var(--moss-2); color: #fff; }
:root[data-theme="dark"] .chip input:checked + span { color: #11150f; }
.chip input:focus-visible + span { outline: 2px solid var(--clay); outline-offset: 2px; }

/* Messages */
.error { margin-top: 14px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--clay-soft); color: var(--ink); font-size: 14px; }
.flash { margin-bottom: 18px; padding: 10px 14px; border-radius: var(--r-sm); background: var(--sage-soft); font-size: 14px; }
.dev-note { margin-top: 18px; padding: 10px 12px; border: 1px dashed var(--ochre); border-radius: var(--r-sm); background: var(--ochre-soft); font-size: 13px; }
.empty { padding: 22px 0; color: var(--ink-3); }
.note { margin-top: 14px; font-size: 14px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--ochre-soft); }

/* Sign-in and error pages */
.bare { min-height: 100vh; display: grid; grid-template-rows: 1fr auto; }
.bare__main { width: min(440px, 100% - 32px); margin: 0 auto; padding: 12vh 0 40px; display: grid; gap: 26px; align-content: start; }
.bare__foot { display: flex; justify-content: center; padding: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; box-shadow: var(--shadow-1); }
.card + .card, .card + .section, .section + .section { margin-top: 22px; }
.card h1 { font-size: 26px; margin-bottom: 8px; }
.card--narrow { max-width: 520px; }
.card--narrow > p { margin-top: 10px; }
details.card > summary { cursor: pointer; }

/* App frame */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--bg-2) 0 235px, var(--line) 235px 236px, transparent 236px); }
:root[data-theme="dark"] .app { background: linear-gradient(to right, var(--bg) 0 235px, var(--line) 235px 236px, transparent 236px); }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; padding: 22px 16px; border-right: 1px solid var(--line); background: var(--bg-2); }
:root[data-theme="dark"] .side { background: var(--bg); }
.side__client { margin-top: 2px; font-size: 13px; color: var(--ink-3); }
.side__nav { display: grid; gap: 2px; }
.side__nav a { padding: 9px 12px; border-radius: 8px; font-size: 14px; color: var(--ink-2); text-decoration: none; }
.side__nav a:hover { background: var(--surface); color: var(--ink); }
.side__nav a.is-active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }
.side__foot { margin-top: auto; display: grid; gap: 14px; }
.side__tech { display: flex; gap: 10px; align-items: center; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; }
.side__tech strong { display: block; font-weight: 600; }
.side__tech span:not(.avatar) { color: var(--ink-3); }
.avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--sage-soft); color: var(--moss-2); font: 600 12px var(--f-text); }
:root[data-theme="light"] .avatar { color: var(--moss); }
.side__me { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.side__email { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side__actions { display: flex; align-items: center; justify-content: space-between; }
.main { padding: 32px clamp(16px, 4vw, 48px) 80px; min-width: 0; max-width: 1240px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin-top: 4px; }
.crumbs { font-size: 13px; color: var(--ink-3); margin-bottom: 10px; }
.crumbs a { color: var(--ink-3); }
.section__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.eyebrow { margin: 24px 0 10px; font: 600 12px var(--f-text); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }

.search { display: flex; align-items: center; gap: 8px; width: min(420px, 100%); }
.search input { flex: 1; }

.summary { display: flex; gap: clamp(18px, 4vw, 40px); flex-wrap: wrap; padding: 14px 0; margin-bottom: 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.summary div { display: grid; }
.summary strong { font-family: var(--f-display); font-size: 26px; font-weight: 640; font-variant-numeric: tabular-nums; line-height: 1.2; }
.summary span { font-size: 13px; color: var(--ink-3); }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface); }
.table tr.is-retired { opacity: 0.55; }
.plant-cell { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.plant-cell strong { display: block; font-weight: 600; }
.plant-cell span span { font-size: 12px; color: var(--ink-3); }
.thumb { width: 42px; height: 42px; flex: none; border-radius: 8px; object-fit: cover; background: var(--bg-2); }
.thumb--empty { display: block; background: repeating-linear-gradient(45deg, var(--bg-2), var(--bg-2) 6px, var(--line) 6px, var(--line) 7px); }

.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--bg-2); color: var(--ink-2); vertical-align: middle; }
.pill--healthy { background: var(--sage-soft); color: var(--moss-2); }
:root[data-theme="light"] .pill--healthy { color: var(--moss); }
.pill--watch { background: var(--ochre-soft); color: var(--ochre); }
.pill--treated { background: var(--clay-soft); color: var(--clay); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }

/* Plant and species profile */
.profile { display: grid; grid-template-columns: minmax(240px, 380px) minmax(0, 1fr); gap: clamp(20px, 4vw, 44px); margin-top: 18px; align-items: start; }
.cover { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--r); background: var(--bg-2); }
.cover--empty { display: grid; place-items: center; color: var(--ink-3); font-size: 14px; }
.latin { font-style: italic; color: var(--ink-3); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; margin: 14px 0 0; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; }
.weeks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.weeks figure { margin: 0; }
.weeks img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.weeks figcaption { font-size: 11px; color: var(--ink-3); margin-top: 3px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); display: grid; gap: 18px; }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: -24px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 0 3px var(--bg); }
.timeline__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.timeline p { margin-top: 6px; font-size: 14px; color: var(--ink-2); }
.plain-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; }

/* Visits */
.visit-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.visit-card { display: flex; gap: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); text-decoration: none; transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease); }
.visit-card:hover { border-color: var(--line-2); box-shadow: var(--shadow-2); }
.visit-card__date { display: grid; align-content: start; min-width: 64px; }
.visit-card__date strong { font-family: var(--f-display); font-size: 18px; font-weight: 640; }
.visit-card__date span { font-size: 12px; color: var(--ink-3); }
.visit-card__body { display: grid; gap: 2px; font-size: 14px; }
.visit-card__body > span { color: var(--ink-2); }
.visit-card__summary { margin-top: 4px; color: var(--ink-3) !important; }
.records { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.record { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.record__img { position: relative; display: block; aspect-ratio: 4 / 3; background: var(--bg-2); }
.record__img img { width: 100%; height: 100%; object-fit: cover; }
.record__stock { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 6px; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 11px; }
.record__body { padding: 12px 14px 14px; display: grid; gap: 4px; }
.record__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.record__head a { text-decoration: none; }
.record p { font-size: 14px; color: var(--ink-2); }

/* Library */
.library { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.lib-card { display: grid; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); text-decoration: none; transition: box-shadow 150ms var(--ease); }
.lib-card:hover { box-shadow: var(--shadow-2); }
.lib-card__img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.lib-card__body { display: grid; gap: 2px; padding: 12px 14px 14px; font-size: 13px; }
.lib-card__body strong { font-size: 15px; font-weight: 600; }
.lib-card__body em { color: var(--ink-3); }
.lib-card__body span { margin-top: 6px; color: var(--ink-2); }

/* People */
.people { list-style: none; margin: 0 0 8px; padding: 0; border-top: 1px solid var(--line); }
.people li { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(180px, 1.4fr) auto auto; gap: 4px 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.people li > span:nth-child(2) { color: var(--ink-2); overflow-wrap: anywhere; }

/* Visit report form */
.visit-form { display: grid; gap: 14px; margin-top: 18px; }
.visit-form .card + .card { margin-top: 0; }
.plant-entry { margin: 0; min-width: 0; }
.plant-entry__head { display: flex; align-items: center; gap: 12px; }
.plant-entry__head > div { display: grid; flex: 1; min-width: 0; }
.plant-entry__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 14px; }
.plant-entry:has(input[name=include]:not(:checked)) .plant-entry__grid { display: none; }
.plant-entry:has(input[name=include]:not(:checked)) { opacity: 0.6; }
.sticky-save { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 14px 0; background: linear-gradient(to top, var(--bg) 70%, transparent); }

@media (max-width: 860px) {
  .app, :root[data-theme="dark"] .app { grid-template-columns: 1fr; background: none; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side__top { display: flex; align-items: baseline; gap: 10px; flex: 1; min-width: 0; }
  .side__client { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side__nav { order: 3; width: 100%; display: flex; gap: 4px; overflow-x: auto; }
  .side__nav a { padding: 7px 12px; white-space: nowrap; }
  .side__foot { margin: 0; display: flex; }
  .side__tech, .side__email { display: none; }
  .side__me { padding: 0; border: 0; }
  .side__actions { gap: 12px; }
  .main { padding-top: 22px; }
  .profile { grid-template-columns: 1fr; }
  .cover { aspect-ratio: 4 / 3; }
  .people li { grid-template-columns: 1fr auto; }
  .people li > span:nth-child(2) { grid-column: 1; }
  .table th:nth-child(4), .table td:nth-child(4) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Roles and roster */
.roster { display: grid; gap: 10px; margin: 12px 0 4px; }
.roster .check { align-items: flex-start; font-size: 14px; color: var(--ink); }
.roster .check input { margin-top: 3px; }
.inline-form { display: flex; align-items: center; gap: 8px; }
.inline-form select { width: auto; min-height: 34px; padding: 4px 10px; font-size: 14px; }
form.card .field--end { margin-top: 12px; justify-self: start; }
.table-wrap + .card, .table-wrap + .section { margin-top: 22px; }
