/*
 * Fishfolk: one hand-written stylesheet, phone width first.
 * Tokens below are the whole visual system: colours (light and dark), type scale, spacing, radii.
 * Every colour that carries meaning on a chart is named after that meaning and explained by a legend on the page.
 */

@font-face { font-family: "Fraunces Fallback"; src: local("Georgia"); size-adjust: 104%; }

:root {
  color-scheme: light dark;

  /* Surfaces and text */
  --bg: #edf5f4;
  --glow: #c9ebea;            /* the aqua light at the top of every page */
  --surface: #ffffff;
  --sunk: #f2f7f7;
  --track: #e0eaeb;
  --line: #d6e3e4;
  --line-soft: #e3eded;
  --text: #0f2a30;
  --muted: #4a6268;
  --primary: #0a6875;
  --primary-strong: #07525c;
  --on-primary: #ffffff;
  --primary-soft: #dcf0f1;
  --focus: #1f7bd1;
  --shadow-sm: 0 1px 2px rgb(15 42 48 / 0.06), 0 2px 6px -1px rgb(15 42 48 / 0.06);
  --shadow: 0 1px 2px rgb(15 42 48 / 0.04), 0 4px 12px -2px rgb(15 42 48 / 0.05), 0 18px 36px -16px rgb(15 42 48 / 0.12);
  --shadow-lift: 0 2px 4px rgb(15 42 48 / 0.05), 0 14px 32px -10px rgb(15 42 48 / 0.22);
  /* Primary buttons: a little light from above, and a glow of their own colour (white text stays above 4.5:1) */
  --btn: linear-gradient(180deg, #11808b 0%, #0a6875 100%);
  --btn-hover: linear-gradient(180deg, #0c707c 0%, #07525c 100%);
  --btn-glow: inset 0 1px 0 rgb(255 255 255 / 0.18), 0 6px 16px -6px rgb(10 104 117 / 0.6);

  /* Status: text colour on its soft background (all at least 4.5:1) */
  --ok: #17704a;      --ok-bg: #e2f3ea;      --ok-line: #9fd3b8;
  --warn: #8a4f00;    --warn-bg: #fcefd8;    --warn-line: #ecc27a;
  --bad: #b3261e;     --bad-bg: #fce9e7;     --bad-line: #efada7;
  --info: #2c5a96;    --info-bg: #e6eefa;    --info-line: #adc5ea;
  --none: #566a70;    --none-bg: #eaf0f1;    --none-line: #c9d5d8;

  /* The Supporter plan's own colour, plum, which no status uses: what a supporter has from it, and its previews */
  --supporter: #94306f; --supporter-bg: #f8e7f1; --supporter-line: #e6b3d2;

  /* Range bars (legend on every chart) */
  --comfort: #23855a;          /* comfortable: most sources agree */
  --acceptable: #a3d8bc;       /* acceptable: only some sources */
  --shared: #0a6875;           /* comfortable for every species */
  --shared-wash: rgb(10 104 117 / 0.10);
  --space-all: #23855a;
  --space-most: #6dbb93;
  --space-some: #d99a2b;
  --space-none: #d0493f;

  /* Species kinds */
  --fish: #1a6a8f;  --fish-bg: #dcedf6;
  --plant: #2d7134; --plant-bg: #e1f1e2;
  --coral: #b5430f; --coral-bg: #fce6dd;
  --inv: #6a3cae;   --inv-bg: #eee6fa;

  /* Water types, for the tank pictures */
  --water-freshwater: linear-gradient(180deg, #c4ece2 0%, #8fd2bf 55%, #5fb39e 100%);
  --water-brackish: linear-gradient(180deg, #dde9c6 0%, #a9c9a0 55%, #7fa88a 100%);
  --water-marine_fish_only: linear-gradient(180deg, #c6e6f8 0%, #78b5e0 55%, #3f7fbf 100%);
  --water-reef: linear-gradient(180deg, #c9e9fb 0%, #6fb4e6 50%, #3a6fb8 100%);
  --sand: linear-gradient(180deg, #f1e6c6 0%, #e2d0a2 100%);
  --pebble: #cdb788;
  --sand-marine: linear-gradient(180deg, #fbf8ef 0%, #ece4cf 100%);
  --pebble-marine: #d8cbaf;
  /* What lives in the pictures: decoration only, never a status */
  --art-fish: #ffffff;  --art-fish-fill: rgb(255 255 255 / 0.32);
  --art-fish-2: #fff6d6; --art-fish-2-fill: rgb(255 214 102 / 0.75);
  --art-fish-3: #fff1ec; --art-fish-3-fill: rgb(255 138 101 / 0.7);
  --art-fish-4: #f2fbff; --art-fish-4-fill: rgb(120 190 255 / 0.65);
  --art-plant: #1d6b3c; --art-plant-fill: #7fd39b;
  --art-wood: #6b4a2b;  --art-wood-fill: #b08a5e;
  --art-coral: #c2412a; --art-coral-fill: #ffa58c;
  --art-lps: #0f7a5c;   --art-lps-fill: #7ff0c8;
  --art-sps: #6a3cae;   --art-sps-fill: #c9a8ff;
  --art-inv: #c22f3a;   --art-inv-fill: #ff8f8f;
  --art-shell: #7a5418; --art-shell-fill: #f0cd84;
  --art-urchin: #5b2a86; --art-urchin-fill: #b48ae0;
  --art-anemone: #b0306a; --art-anemone-fill: #ff9fca;
  --art-rock: #b9a796;  --art-rock-line: #8a7663; --art-coralline: #d77fb0;
  --art-stone: #b4bec0; --art-stone-line: #78858a; --art-stone-shine: rgb(255 255 255 / 0.65);

  /* Type and space */
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Fraunces", "Fraunces Fallback", ui-serif, Georgia, "Times New Roman", serif;
  --fs-xs: 0.78rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.2rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 26px;
  --tap: 44px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #07161a;
    --glow: #0f3b42;
    --surface: #10252b;
    --sunk: #0c1d22;
    --track: #1e343a;
    --line: #22393f;
    --line-soft: #1b3036;
    --text: #e3eef0;
    --muted: #9db3b9;
    --primary: #56c6d4;
    --primary-strong: #7fd6e1;
    --on-primary: #062a30;
    --primary-soft: #133a42;
    --focus: #8cc8ff;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 16px 32px -14px rgb(0 0 0 / 0.55);
    --shadow-lift: 0 2px 4px rgb(0 0 0 / 0.3), 0 18px 36px -12px rgb(0 0 0 / 0.65);
    --btn: linear-gradient(180deg, #74d6e1 0%, #4fbfcc 100%);
    --btn-hover: linear-gradient(180deg, #8ddfe8 0%, #66cad6 100%);
    --btn-glow: inset 0 1px 0 rgb(255 255 255 / 0.25), 0 6px 18px -6px rgb(86 198 212 / 0.45);

    --ok: #6fd39f;   --ok-bg: #123526;   --ok-line: #24684a;
    --warn: #f2b65c; --warn-bg: #3a2a10; --warn-line: #7a5520;
    --bad: #ff8f84;  --bad-bg: #3d1714;  --bad-line: #7d3029;
    --info: #93b9f4; --info-bg: #16263d; --info-line: #2f4c78;
    --none: #a7b8bd; --none-bg: #1c2d32; --none-line: #36494f;

    --supporter: #f0a0cf; --supporter-bg: #351a2c; --supporter-line: #6e3559;

    --comfort: #3fb97f;
    --acceptable: #1f5e45;
    --shared: #56c6d4;
    --shared-wash: rgb(86 198 212 / 0.12);
    --space-all: #3fb97f;
    --space-most: #2a7a58;
    --space-some: #e0a33c;
    --space-none: #f0675c;

    --fish: #7cc4e6;  --fish-bg: #123547;
    --plant: #86cf8c; --plant-bg: #16331a;
    --coral: #ff9d73; --coral-bg: #3d1e12;
    --inv: #c4a5f5;   --inv-bg: #2a1c42;

    --water-freshwater: linear-gradient(180deg, #23605a 0%, #174541 55%, #0f302d 100%);
    --water-brackish: linear-gradient(180deg, #44573c 0%, #2d3f30 55%, #1e2c22 100%);
    --water-marine_fish_only: linear-gradient(180deg, #235480 0%, #163b5e 55%, #0d2740 100%);
    --water-reef: linear-gradient(180deg, #245a86 0%, #173e63 50%, #0e2843 100%);
    --sand: linear-gradient(180deg, #5a5038 0%, #463e2c 100%);
    --pebble: #6c6045;
    --sand-marine: linear-gradient(180deg, #6b675b 0%, #57534a 100%);
    --pebble-marine: #7f7a6b;
    --art-fish: rgb(225 243 247 / 0.9);  --art-fish-fill: rgb(225 243 247 / 0.14);
    --art-fish-2: #ffe7a3; --art-fish-2-fill: rgb(255 214 102 / 0.35);
    --art-fish-3: #ffc4b0; --art-fish-3-fill: rgb(255 138 101 / 0.35);
    --art-fish-4: #cfe8ff; --art-fish-4-fill: rgb(120 190 255 / 0.3);
    --art-plant: #8fe0a9; --art-plant-fill: rgb(79 186 116 / 0.4);
    --art-wood: #c49a6c;  --art-wood-fill: rgb(150 105 60 / 0.55);
    --art-coral: #ffab92; --art-coral-fill: rgb(255 120 90 / 0.35);
    --art-lps: #7ff0c8;   --art-lps-fill: rgb(60 220 160 / 0.3);
    --art-sps: #d2b6ff;   --art-sps-fill: rgb(160 110 255 / 0.35);
    --art-inv: #ff9c9c;   --art-inv-fill: rgb(255 100 100 / 0.35);
    --art-shell: #f0cd84; --art-shell-fill: rgb(220 170 80 / 0.35);
    --art-urchin: #d2b0f5; --art-urchin-fill: rgb(150 90 220 / 0.35);
    --art-anemone: #ffb0d4; --art-anemone-fill: rgb(255 110 170 / 0.35);
    --art-rock: #4e4640;  --art-rock-line: #6d635a; --art-coralline: #9a4f7a;
    --art-stone: #46504f; --art-stone-line: #6f7c7d; --art-stone-shine: rgb(255 255 255 / 0.18);
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: var(--fs-md)/1.5 var(--font);
  /* Light falling into the water from above: brightest under the header, gone a screen down. */
  background: radial-gradient(130% 440px at 50% -160px, var(--glow), transparent 78%) no-repeat, var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 { line-height: 1.25; margin: 0; }
/* Headings in Fraunces at its softest: rounded serifs, friendly rather than bookish. */
h1, h2 { font-family: var(--font-display); font-variation-settings: "SOFT" 100; text-wrap: balance; }
h1 { font-size: var(--fs-2xl); font-weight: 640; letter-spacing: -0.02em; line-height: 1.15; }
h2 { font-size: var(--fs-lg); font-weight: 620; letter-spacing: -0.01em; }
h3 { font-size: var(--fs-md); font-weight: 700; }
p { margin: 0; }
a { color: var(--primary); }
em { font-style: italic; }
ul { margin: 0; padding: 0; list-style: none; }

.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.num { font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
/* Anchored sections clear the sticky header */
[id] { scroll-margin-top: 72px; }
/* On the tank screen the tab bar sticks under the header too: an anchor lands below both (56px + about 64px). */
#tank-body [id] { scroll-margin-top: 128px; }

.icon {
  width: 1.25em; height: 1.25em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -0.25em;
}

/* ---------- Shell ---------- */

.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.site-header-inner { max-width: 1120px; margin: 0 auto; padding: 0 var(--s4); height: 56px; display: flex; align-items: center; }
.brand {
  display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap);
  color: var(--text); text-decoration: none;
  font-family: var(--font-display); font-variation-settings: "SOFT" 100; font-weight: 680; font-size: 1.35rem; letter-spacing: -0.02em;
}
/* The mark in its tile (brand() and Logo.kt): the primary button's colours in each theme, the fish in the button's text
   colour, and the water's surface a lighter band across the top. The corners are the logo's (15 on its 64 grid). */
.brand-mark {
  display: block; flex: none; width: 36px; height: 36px; border-radius: 23.4%; overflow: hidden;
  background: var(--btn); color: var(--on-primary); box-shadow: var(--btn-glow);
  transition: transform 0.25s;
}
.brand-mark .logo { display: block; width: 100%; height: 100%; }
/* The mark alone (logoMark()), in the colour of the text around it, sized like an icon. */
.logo { width: 1.25em; height: 1.25em; flex: none; fill: currentColor; vertical-align: -0.25em; }
.logo-surface { fill: #fff; fill-opacity: 0.2; }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.05); }

main { max-width: 1120px; margin: 0 auto; padding: var(--s4) var(--s4) 48px; }

/* The signed-in user's initial, opening their account page and sign-out. */
.user-menu { margin-left: auto; position: relative; }
.user-menu > summary { list-style: none; cursor: pointer; }
.user-menu > summary::-webkit-details-marker { display: none; }
.avatar {
  display: grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: 50%;
  background: linear-gradient(150deg, var(--surface), var(--primary-soft)); color: var(--primary);
  font-family: var(--font-display); font-variation-settings: "SOFT" 100; font-weight: 700; font-size: 1.15rem;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.user-menu[open] .avatar { background: var(--btn); color: var(--on-primary); border-color: transparent; }
.user-menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; padding: var(--s2);
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); box-shadow: var(--shadow-lift);
  transform-origin: top right; animation: pop 0.16s ease-out;
}
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(-4px); } to { opacity: 1; transform: none; } }
.user-menu-name { padding: var(--s2) var(--s3); font-weight: 700; overflow-wrap: anywhere; border-bottom: 1px solid var(--line); margin-bottom: var(--s1); }
.user-menu-item {
  display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: var(--tap); padding: 0 var(--s3);
  border: 0; border-radius: var(--r-sm); background: none; color: var(--text); font: inherit; text-align: left;
  text-decoration: none; cursor: pointer;
}
.user-menu-item:hover { background: var(--sunk); }
.user-menu-item .icon { color: var(--muted); }

/* The language switch (languageMenu): for signed-out visitors in the header, where the user menu would be, opening as a
   panel; signed-in users find it in their menu, where it opens in place. */
.lang-menu { position: relative; }
.lang-menu > summary { list-style: none; cursor: pointer; }
.lang-menu > summary::-webkit-details-marker { display: none; }
.lang-switch {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 var(--s2); border-radius: var(--r-sm);
  color: var(--primary); font-size: var(--fs-sm); font-weight: 650; text-decoration: none;
}
.lang-menu[open] > .lang-switch { background: var(--primary-soft); }
.lang-menu:not(.in-menu) > .lang-menu-list {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 180px; padding: var(--s2);
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); box-shadow: var(--shadow-lift);
  transform-origin: top right; animation: pop 0.16s ease-out;
}
/* In the user menu the names line up with the menu's words, past the globe. */
.lang-menu.in-menu > .lang-menu-list { padding-left: calc(1.25em + var(--s2)); }
.lang-menu.in-menu > summary > .icon:last-child { margin-left: auto; transition: transform 0.16s; }
.lang-menu.in-menu[open] > summary > .icon:last-child { transform: rotate(180deg); }
.lang-menu-item {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: var(--tap); padding: 0 var(--s3);
  border-radius: var(--r-sm); color: var(--text); text-decoration: none;
}
a.lang-menu-item:hover { background: var(--sunk); }
.lang-menu-item.current { color: var(--primary); font-weight: 700; }
.brand + .lang-menu { margin-left: auto; }

/* The way to the public species pages, for everyone. */
.nav-link {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s2); margin-left: auto; border-radius: var(--r-sm);
  color: var(--text); font-size: var(--fs-sm); font-weight: 650; text-decoration: none;
}
.nav-link:hover { background: var(--primary-soft); color: var(--primary); }
.nav-link + .user-menu, .nav-link + .lang-menu { margin-left: var(--s1); }
.lang-switch:hover { background: var(--primary-soft); }

/* The account screen. */
.account-title { margin: var(--s2) 0 var(--s4); }
.account-note { margin-bottom: var(--s3); }
.btn.danger { background: var(--bad); color: var(--bg); box-shadow: none; } /* --bad is dark in light mode and light in dark mode */
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 85%, black); }
.danger-zone .card-icon { background: var(--bad-bg); color: var(--bad); }
.danger-zone p { margin-bottom: var(--s3); }
.account-problem { margin-bottom: var(--s3); font-size: var(--fs-sm); }
.confirm { display: flex; gap: var(--s3); align-items: flex-start; min-height: var(--tap); margin-bottom: var(--s3); font-size: var(--fs-sm); line-height: 1.4; cursor: pointer; }
.confirm input { width: 22px; height: 22px; flex: none; margin: 0; accent-color: var(--bad); }

/* The landing page for signed-out visitors. */
.landing { max-width: 520px; margin: var(--s2) auto 0; }
.tank-art.landing-art { margin-bottom: var(--s6); border-radius: var(--r-xl); box-shadow: var(--shadow-lift), inset 0 0 0 1px rgb(255 255 255 / 0.3); }
.landing h1 { font-size: clamp(2.1rem, 8vw, 2.6rem); line-height: 1.08; letter-spacing: -0.025em; }
.landing-lead { color: var(--muted); margin-top: var(--s3); font-size: 1.12rem; line-height: 1.5; }
.landing-points { display: grid; gap: var(--s2); margin: var(--s5) 0 var(--s6); padding: 0; list-style: none; }
.landing-points li {
  display: flex; gap: var(--s3); align-items: center; line-height: 1.4; padding: 10px 14px 10px 10px;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-md); box-shadow: var(--shadow-sm);
}
.landing-points .icon {
  flex: none; width: 38px; height: 38px; padding: 8px; border-radius: 12px; color: var(--primary);
  background: linear-gradient(150deg, color-mix(in srgb, var(--primary-soft) 45%, var(--surface)), var(--primary-soft));
}
.landing-actions .btn { min-height: 52px; font-size: 1.05rem; }
.landing-notice { margin-bottom: var(--s4); font-size: var(--fs-sm); }
.landing-actions { display: grid; gap: var(--s3); }
.landing-signin { text-align: center; color: var(--muted); }
.landing-signin a { font-weight: 650; }
.landing-browse { margin-top: var(--s4); text-align: center; }
.landing-browse a { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); color: var(--primary); font-weight: 650; text-decoration: none; }
.landing-browse .icon { width: 18px; height: 18px; }
/*
 * On a wide screen the picture stands beside the words, so the way in is on the first screen of a short laptop. The
 * picture spans more rows than the words fill: the empty ones take no room.
 */
@media (min-width: 960px) {
  .landing { max-width: 1040px; margin-top: var(--s6); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 56px; }
  .landing > * { grid-column: 2; }
  .landing > .landing-art { grid-column: 1; grid-row: 1 / span 9; align-self: center; margin: 0; }
}

/* The error page, in place of Spring's whitelabel page. */
.error-page { max-width: 520px; margin: var(--s8) auto 0; text-align: center; }
.error-page .card-icon { width: 56px; height: 56px; margin: 0 auto var(--s4); border-radius: var(--r-lg); }
.error-page .card-icon .icon { width: 28px; height: 28px; }
.error-page h1 { font-size: var(--fs-2xl); line-height: 1.2; }
.error-page p { color: var(--muted); margin: var(--s2) 0 var(--s5); line-height: 1.45; }

/* A failed htmx request (app.js). The region is empty, and takes no space, until something fails; a tap dismisses it. */
.toast-region {
  position: fixed; left: var(--s4); right: var(--s4); bottom: calc(var(--s4) + env(safe-area-inset-bottom)); z-index: 30;
  max-width: 480px; margin: 0 auto;
}
.toast {
  padding: var(--s3) var(--s4); border-radius: var(--r-md); cursor: pointer;
  background: var(--bad-bg); color: var(--text); border: 1px solid var(--bad-line); border-left: 4px solid var(--bad);
  box-shadow: var(--shadow); font-size: var(--fs-sm); line-height: 1.4;
}

/* A thin bar at the top while any htmx request runs; it waits a moment so quick swaps do not flicker. */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 20; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  background-size: 50% 100%; background-repeat: no-repeat;
  opacity: 0; transition: opacity 0.15s;
  animation: progress 1s linear infinite;
}
.progress.htmx-request { opacity: 1; transition-delay: 0.15s; }
@keyframes progress { from { background-position: -50% 0; } to { background-position: 150% 0; } }

/* ---------- Building blocks ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card + .card, .stack > * + * { margin-top: var(--s4); }

.card-head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
/* A heading keeps at least its longest word, so a count beside it wraps instead of running over it. */
.card-head h2, .card-head h3, .card-head > div { flex: 1; min-width: min-content; }
.card-head > div p { overflow-wrap: anywhere; }
.card-head > .muted { text-align: right; }
/* A button straight after a paragraph keeps its distance. */
.card p + .btn, .card p + form { margin-top: var(--s3); }
.card-icon {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; flex: none;
  background: linear-gradient(150deg, color-mix(in srgb, var(--primary-soft) 45%, var(--surface)), var(--primary-soft));
  color: var(--primary); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 12%, transparent);
}
.card-icon .icon { width: 22px; height: 22px; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin: var(--s6) 0 var(--s3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); padding: 0 var(--s5); border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 700; letter-spacing: 0.005em; text-decoration: none; cursor: pointer;
  background: var(--btn); color: var(--on-primary); box-shadow: var(--btn-glow);
  transition: background-color 0.15s, box-shadow 0.15s, transform 0.08s;
}
.btn:hover { background: var(--btn-hover); }
.btn:active { transform: scale(0.97); }
.btn.secondary { background: var(--surface); color: var(--primary); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); }
.btn.block { width: 100%; }

/* Status pills: a word and an icon, never colour alone */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 700; line-height: 1.4; white-space: nowrap;
  background: var(--none-bg); color: var(--none); border: 1px solid var(--none-line);
}
.pill .icon { width: 15px; height: 15px; }
.ok { --tone: var(--ok); --tone-bg: var(--ok-bg); --tone-line: var(--ok-line); }
.warn { --tone: var(--warn); --tone-bg: var(--warn-bg); --tone-line: var(--warn-line); }
.bad { --tone: var(--bad); --tone-bg: var(--bad-bg); --tone-line: var(--bad-line); }
.info { --tone: var(--info); --tone-bg: var(--info-bg); --tone-line: var(--info-line); }
.none { --tone: var(--none); --tone-bg: var(--none-bg); --tone-line: var(--none-line); }
.pill.ok, .pill.warn, .pill.bad, .pill.info, .pill.none { background: var(--tone-bg); color: var(--tone); border-color: var(--tone-line); }

/* Species kind badge: a tile in its kind's colour, the animal's body faintly filled */
.kind {
  --k: var(--fish); --k-bg: var(--fish-bg);
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; flex: none;
  background: linear-gradient(150deg, color-mix(in srgb, var(--k-bg) 40%, var(--surface)), var(--k-bg));
  color: var(--k); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--k) 14%, transparent);
}
.kind .icon { width: 26px; height: 26px; }
.kind.fish .icon, .kind.plant .icon, .kind.invertebrate .icon { fill: color-mix(in srgb, currentColor 20%, transparent); }
.kind .icon.shape { fill: color-mix(in srgb, currentColor 20%, transparent); }
.kind .icon.shape .o { fill: none; }
.icon .eye { fill: currentColor; stroke: none; }
.kind.plant { --k: var(--plant); --k-bg: var(--plant-bg); }
.kind.coral { --k: var(--coral); --k-bg: var(--coral-bg); }
.kind.invertebrate { --k: var(--inv); --k-bg: var(--inv-bg); }
.kind.sm { width: 28px; height: 28px; border-radius: 9px; }
.kind.sm .icon { width: 18px; height: 18px; }

/* Disclosure rows (details/summary) */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.disclosure > summary {
  display: flex; align-items: center; gap: var(--s2); min-height: var(--tap);
  font-weight: 650; color: var(--text);
}
.disclosure > summary .chev { margin-left: auto; color: var(--muted); transition: transform 0.2s; }
.disclosure[open] > summary .chev { transform: rotate(180deg); }

/* ---------- Home ---------- */

.home-hero { padding: var(--s3) 0 var(--s5); }
.home-hero p { color: var(--muted); margin-top: var(--s2); max-width: 38em; }
.home-notice { margin-bottom: var(--s4); font-size: var(--fs-sm); }

.tank-cards { display: grid; gap: var(--s4); grid-template-columns: 1fr; }
@media (min-width: 640px) { .tank-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .tank-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.tank-card {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.tank-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.tank-card > a { display: block; color: inherit; text-decoration: none; border-radius: var(--r-lg); }
.tank-card > a:hover .tank-card-name { color: var(--primary); }
.tank-card > a:focus-visible { outline: none; }
.tank-card:has(> a:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.tank-card-body { padding: var(--s3) var(--s4) var(--s4); display: grid; gap: 6px; }
.tank-card-name { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-lg); }
.tank-card-name .icon { margin-left: auto; color: var(--muted); }
.tank-card-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: var(--fs-sm); }
.tank-card-facts span { display: inline-flex; align-items: center; gap: 5px; }
.tank-card-facts .icon { width: 16px; height: 16px; }
.tank-card .pill { justify-self: start; margin-top: 4px; }

/*
 * The tank pictures (TankScene.kt): water by type, light rays from the surface as bright as the tank's lamp, and sand,
 * here; everything in the water is an SVG over them, drawn from the stock and the equipment. The container takes the
 * tank's proportions from its style; the drawing keeps its own and stands centred on the sand when the box is wider.
 */
.tank-art {
  --water: var(--water-freshwater);
  position: relative; overflow: hidden; isolation: isolate; aspect-ratio: 21 / 10;
  background: var(--water);
}
.tank-art.water-brackish { --water: var(--water-brackish); }
.tank-art.water-marine_fish_only, .tank-art.water-marine { --water: var(--water-marine_fish_only); }
.tank-art.water-reef { --water: var(--water-reef); }
/* The sea's sand is white aragonite. */
.tank-art.water-marine_fish_only, .tank-art.water-marine, .tank-art.water-reef { --sand: var(--sand-marine); --pebble: var(--pebble-marine); }
.tank-art::before { /* the bright surface, and rays of light fading with depth */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0.85;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.55), transparent 12px),
    repeating-linear-gradient(104deg, transparent 0 26px, rgb(255 255 255 / 0.16) 26px 40px, transparent 40px 58px, rgb(255 255 255 / 0.08) 58px 66px, transparent 66px 96px);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgb(0 0 0 / 0.6) 45%, transparent 90%);
  mask-image: linear-gradient(180deg, #000 0%, rgb(0 0 0 / 0.6) 45%, transparent 90%);
}
.tank-art.light-low::before { opacity: 0.45; }
.tank-art.light-high::before { opacity: 1; filter: brightness(1.25); }
/* No lamp: no rays, and the water a shade darker. */
.tank-art.light-none::before { opacity: 1; background: rgb(0 25 35 / 0.16); -webkit-mask-image: none; mask-image: none; }
.tank-art::after { /* sand, with a few pebbles, over the bottom 12 % (the drawing's SAND line) */
  content: ""; position: absolute; left: -4%; right: -4%; bottom: 0; height: 12%; z-index: -1;
  background:
    radial-gradient(circle at 9% 72%, var(--pebble) 0 2px, transparent 2.6px),
    radial-gradient(circle at 27% 50%, var(--pebble) 0 2.6px, transparent 3.2px),
    radial-gradient(circle at 48% 78%, var(--pebble) 0 1.8px, transparent 2.4px),
    radial-gradient(circle at 71% 58%, var(--pebble) 0 2.4px, transparent 3px),
    radial-gradient(circle at 90% 74%, var(--pebble) 0 3px, transparent 3.6px),
    var(--sand);
  border-radius: 55% 45% 0 0 / 10px 7px 0 0;
}
.tank-art .scene { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 1px 1px rgb(0 20 30 / 0.18)); }
/* One line weight on screen for every figure, whatever its size: a neon and an oscar are drawn with the same pen. */
.scene path, .scene circle, .scene rect { vector-effect: non-scaling-stroke; stroke-width: 1.5px; stroke-linecap: round; stroke-linejoin: round; }
.scene g { stroke: currentColor; fill: var(--fill, none); }
.scene .o { fill: none; }
.scene .eye { fill: currentColor; stroke: none; }
.scene .f.t0 { color: var(--art-fish); --fill: var(--art-fish-fill); }
.scene .f.t1 { color: var(--art-fish-2); --fill: var(--art-fish-2-fill); }
.scene .f.t2 { color: var(--art-fish-3); --fill: var(--art-fish-3-fill); }
.scene .f.t3 { color: var(--art-fish-4); --fill: var(--art-fish-4-fill); }
.scene .inv { color: var(--art-inv); --fill: var(--art-inv-fill); }
.scene .shell { color: var(--art-shell); --fill: var(--art-shell-fill); }
.scene .star { color: var(--art-coral); --fill: var(--art-coral-fill); }
.scene .urchin { color: var(--art-urchin); --fill: var(--art-urchin-fill); }
.scene .anemone { color: var(--art-anemone); --fill: var(--art-anemone-fill); }
.scene .soft { color: var(--art-coral); --fill: var(--art-coral-fill); }
.scene .lps { color: var(--art-lps); --fill: var(--art-lps-fill); }
.scene .sps { color: var(--art-sps); --fill: var(--art-sps-fill); }
.scene .plant { color: var(--art-plant); --fill: var(--art-plant-fill); }
.scene .plant .wood { color: var(--art-wood); fill: var(--art-wood-fill); }
.scene .rock { color: var(--art-rock-line); fill: var(--art-rock); stroke: currentColor; }
.scene .rock.hole { fill: var(--art-rock-line); stroke: none; opacity: 0.6; }
.scene .rock.coralline { fill: none; stroke: var(--art-coralline); stroke-width: 3px; opacity: 0.8; }
.scene .driftwood { color: var(--art-wood); --fill: var(--art-wood-fill); }
.scene .stone { color: var(--art-stone-line); --fill: var(--art-stone); }
.scene .stone .shine { stroke: var(--art-stone-shine); }
.scene .gear { color: rgb(255 255 255 / 0.8); --fill: rgb(255 255 255 / 0.2); }
.scene .gear .flow { stroke-dasharray: 2 3; animation: flow 1.2s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -10; } }
.scene .swim { animation: drift var(--t, 7s) ease-in-out var(--d, 0s) infinite alternate; }
.scene .sway { transform-box: fill-box; transform-origin: 50% 100%; animation: sway var(--t, 5s) ease-in-out var(--d, 0s) infinite alternate; }
@keyframes drift { from { transform: translate(-3px, 1px); } to { transform: translate(3px, -1.5px); } }
@keyframes sway { from { transform: rotate(-2.5deg); } to { transform: rotate(2.5deg); } }
.scene .bubble { fill: rgb(255 255 255 / 0.25); stroke: rgb(255 255 255 / 0.85); stroke-width: 1px; opacity: 0; animation: rise var(--t, 3s) linear var(--d, 0s) infinite; }
@keyframes rise { 0% { transform: translate(0, 0); opacity: 0; } 10% { opacity: 1; } 85% { opacity: 0.9; } 100% { transform: translate(var(--wob, 0), var(--rise, -60px)); opacity: 0; } }
/* Without motion the bubbles stand still, spread up their stream. */
@media (prefers-reduced-motion: reduce) { .scene .bubble { animation: none; opacity: 0.85; transform: translateY(var(--rest, 0)); } }
.tank-art .art-chip {
  position: absolute; top: 10px; left: 12px; z-index: 2;
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 7px; border-radius: 999px;
  background: rgb(255 255 255 / 0.88); color: #0f2a30; font-size: var(--fs-xs); font-weight: 700;
  box-shadow: 0 1px 3px rgb(0 30 40 / 0.12); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.tank-art .art-chip .icon { width: 15px; height: 15px; }
@media (prefers-color-scheme: dark) {
  .tank-art::before {
    background:
      linear-gradient(180deg, rgb(255 255 255 / 0.14), transparent 12px),
      repeating-linear-gradient(104deg, transparent 0 26px, rgb(180 240 255 / 0.06) 26px 40px, transparent 40px 96px);
  }
  .tank-art.light-none::before { background: rgb(0 0 0 / 0.25); }
  .scene .bubble { stroke: rgb(220 245 250 / 0.6); fill: rgb(220 245 250 / 0.1); }
  .scene .gear { color: rgb(220 240 245 / 0.55); --fill: rgb(220 240 245 / 0.08); }
  .tank-art .art-chip { background: rgb(8 22 26 / 0.78); color: #e3eef0; }
}
/*
 * On the overview: the tank itself, as a picture to open the page with; on a wide screen no taller than a phone's. The
 * box keeps the full width (without it, the height limit would narrow it to the tank's proportions, leaving a gap beside
 * it on a tablet), and the drawing stands centred in the wider water.
 */
.tank-art.tank-scene { width: 100%; max-height: 300px; border-radius: var(--r-lg); box-shadow: var(--shadow), inset 0 0 0 1px rgb(255 255 255 / 0.25); margin-bottom: var(--s3); }
/* On a species page: the species, as many as it is kept with. */
.tank-art.species-art { width: 100%; max-height: 260px; border-radius: var(--r-lg); box-shadow: var(--shadow), inset 0 0 0 1px rgb(255 255 255 / 0.25); margin: var(--s1) 0 var(--s4); }

.empty-state { text-align: center; padding: var(--s6) var(--s4); }
.empty-state .card-icon { margin: 0 auto var(--s3); width: 64px; height: 64px; border-radius: 20px; }
.empty-state .card-icon .icon { width: 34px; height: 34px; fill: color-mix(in srgb, currentColor 15%, transparent); }
.empty-state p { color: var(--muted); margin-top: var(--s1); }
.empty-state .btn { margin-top: var(--s4); }

/* Add-a-tank panel */
.add-tank { margin-top: var(--s4); }
.add-tank > summary {
  display: flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 60px;
  border: 2px dashed color-mix(in srgb, var(--primary) 30%, var(--line)); border-radius: var(--r-lg); color: var(--primary); font-weight: 700;
  background: color-mix(in srgb, var(--surface) 50%, transparent); transition: background-color 0.15s, border-color 0.15s;
}
.add-tank > summary:hover { background: var(--primary-soft); border-color: var(--primary); }
.add-tank > summary .icon { width: 22px; height: 22px; padding: 3px; border-radius: 50%; background: var(--btn); color: var(--on-primary); stroke-width: 2.6; }
.add-tank[open] > summary { display: none; }
.add-tank .card h2 { margin-bottom: var(--s1); }

/* ---------- Forms ---------- */

.tank-form { display: grid; gap: var(--s4); }
.field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field-label { font-weight: 650; font-size: var(--fs-sm); padding: 0; }
.hint { color: var(--muted); font-size: var(--fs-xs); }
/* One height for every box and the buttons beside it (44px), and 16px text whatever surrounds it: iOS zooms in on less. */
.input, .select {
  width: 100%; min-width: 0; min-height: var(--tap); padding: 10px 12px; font: inherit; font-size: var(--fs-md); line-height: 1.25; color: var(--text);
  background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r-md);
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
/* One-line boxes are exactly a tap tall: a select would otherwise be 2px taller than a text box with the same padding. */
input.input, select.input, select.select { height: var(--tap); }
.input:hover, .select:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.input:focus, .select:focus { background: var(--surface); border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 35%, transparent); }
.input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
/* No spinner arrows: they crowd the unit, and nobody steps a lumen or a litre at a time. */
.input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.input[type="number"]::-webkit-inner-spin-button, .input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.with-unit { position: relative; }
.with-unit .input { padding-right: 40px; }
.with-unit .unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: var(--fs-sm); pointer-events: none; }
.dims { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); }
.dims label { display: grid; gap: 4px; font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.dims .input { font-weight: 400; }

.water-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
@media (min-width: 720px) { .water-picker { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.water-option { position: relative; display: grid; cursor: pointer; }
.water-option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.water-option span.tile {
  height: 100%; display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 10px; row-gap: 0;
  min-height: 64px; padding: 10px; border-radius: var(--r-md);
  border: 1.5px solid var(--line); background: var(--surface);
  transition: border-color 0.15s, background-color 0.15s;
}
.water-option .tile .icon {
  grid-row: span 2; width: 36px; height: 36px; padding: 7px; border-radius: 11px; color: #fff;
  background: var(--water-freshwater); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.3); stroke-width: 2.2;
}
.water-option:has(input[value="brackish"]) .tile .icon { background: var(--water-brackish); }
.water-option:has(input[value="marine_fish_only"]) .tile .icon { background: var(--water-marine_fish_only); }
.water-option:has(input[value="reef"]) .tile .icon { background: var(--water-reef); }
.water-option .tile b { font-size: var(--fs-sm); line-height: 1.25; }
.water-option .tile small { color: var(--muted); font-size: var(--fs-xs); line-height: 1.3; }
.water-option input:checked + .tile { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.water-option input:focus-visible + .tile { outline: 3px solid var(--focus); outline-offset: 2px; }

.more { border-top: 1px solid var(--line); }
.more:last-of-type { border-bottom: 1px solid var(--line); }
.more > summary small { font-weight: 400; color: var(--muted); }
.more > div { padding: 0 0 var(--s3); display: grid; gap: var(--s2); }

/* ---------- Tank page ---------- */

#tank-body { display: block; }

.back {
  display: inline-flex; align-items: center; gap: 2px; min-height: var(--tap); margin: -8px 0 0 -6px; padding-right: 8px;
  color: var(--muted); text-decoration: none; font-size: var(--fs-sm); font-weight: 600;
}
.back:hover { color: var(--primary); }

.hero { margin-bottom: var(--s4); }
.hero-title { display: flex; align-items: flex-start; gap: var(--s3); }
.hero-title h1 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.icon-btn {
  display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); flex: none; border-radius: 999px;
  color: var(--primary); background: var(--surface); border: 1px solid var(--line); text-decoration: none; box-shadow: var(--shadow-sm);
}
.icon-btn:hover { background: var(--primary-soft); }
.facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s2); }
.fact {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line-soft); font-size: var(--fs-sm); font-weight: 600; color: var(--text); box-shadow: var(--shadow-sm);
}
.fact .icon { width: 16px; height: 16px; color: var(--primary); }
.fact small { color: var(--muted); }

/* Overall status and the at-a-glance tiles */
.glance { margin-top: var(--s4); padding: 0; overflow: hidden; }
/* A glance that opens with a heading (a shared tank's tests) pads it as a card would, and parts it from the tiles as the
   status banner is parted; the banner pads itself. */
.glance > .card-head { margin: 0; padding: 18px 18px var(--s3); border-bottom: 1px solid var(--line-soft); }
/* The tiles' dividers on the last column and row would double the card's border: they run under it instead. */
.glance > .tiles { margin: 0 -1px -1px 0; }
.verdict-banner {
  display: flex; gap: var(--s3); align-items: center; padding: var(--s4);
  background: linear-gradient(135deg, var(--tone-bg) 30%, color-mix(in srgb, var(--tone-bg) 40%, var(--surface)));
  color: var(--text); border-bottom: 1px solid var(--tone-line);
}
/* The status's icon on a disc, ringed in its colour. */
.verdict-banner > .icon {
  width: 46px; height: 46px; padding: 10px; border-radius: 50%; flex: none;
  background: var(--surface); color: var(--tone); stroke-width: 2.2;
  box-shadow: 0 0 0 1px var(--tone-line), 0 6px 14px -6px color-mix(in srgb, var(--tone) 55%, transparent);
}
.verdict-banner h2 { color: var(--tone); font-size: 1.3rem; }
.verdict-banner p { font-size: var(--fs-sm); margin-top: 2px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--surface); }
/*
 * Wider, as many to a row as fit, and the last row's tiles share its width, so no empty cells are left at its end (a grid
 * left four and one). In the overview's column and on a species page the basis keeps three and four to a row.
 */
@media (min-width: 720px) { .tiles { display: flex; flex-wrap: wrap; } .tiles > .tile-link { flex: 1 1 150px; } }
@media (min-width: 960px) { .overview-status .tiles > .tile-link { flex-basis: 180px; } .species-glance .tiles > .tile-link { flex-basis: 130px; } }
.tile-link {
  display: grid; grid-template-columns: auto 1fr; grid-auto-rows: auto; align-content: start; column-gap: 10px;
  min-height: 88px; padding: 12px; background: var(--surface); color: var(--text); text-decoration: none;
  box-shadow: inset -1px 0 var(--line-soft), inset 0 -1px var(--line-soft);
  transition: background-color 0.15s;
}
.tile-link:hover { background: var(--sunk); }
.tile-link:focus-visible { outline-offset: -4px; border-radius: 10px; }
.tile-link > :not(.icon) { grid-column: 2; }
.tile-link > .icon {
  grid-column: 1; grid-row: 1 / span 4; width: 32px; height: 32px; padding: 6px; border-radius: 10px;
  color: var(--primary); background: var(--primary-soft);
}
.tile-link .tile-label { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; line-height: 1.3; }
.tile-link .tile-value { font-weight: 750; font-size: 1.05rem; font-variant-numeric: tabular-nums; line-height: 1.3; letter-spacing: -0.01em; }
.tile-link .tile-status { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 700; color: var(--tone, var(--muted)); margin-top: 2px; }
.tile-link .tile-status .icon { width: 14px; height: 14px; }
.tile-link .tile-reading { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 650; color: var(--tone, var(--muted)); }
.tile-link .tile-reading .icon { width: 14px; height: 14px; }
/* On a phone an odd last tile takes the whole row. */
.tiles .tile-link:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* Two columns on wide screens; one column, in reading order, on phones */
.tank-grid { display: grid; gap: var(--s4); grid-template-columns: minmax(0, 1fr); }
.tank-grid > .col > * + * { margin-top: var(--s4); }
@media (min-width: 960px) {
  .tank-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s5); align-items: start; }
  /* In a column, a few choices side by side would squeeze their words: two to a row, as on a phone. */
  .tank-grid .water-picker, .tank-grid .choices.swatches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* The More tab's settings card heads its own column; on a phone the grid's gap already parts it from the card above. */
.tank-grid > .col > .tank-settings:first-child { margin-top: 0; }

/*
 * The overview (TankViews, SharedTankViews): one column on a phone; on a wide screen the picture and its facts beside the
 * status, the tests to watch and the quick actions, so they share the first screen of a short laptop, then the checks
 * beside the law, each at a width that reads.
 */
/* An empty tank's invitation keeps the glance's distance from the facts above it. */
.overview-status > .empty-state { margin-top: var(--s4); }
@media (min-width: 960px) {
  .overview-top { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s5); align-items: start; margin-bottom: var(--s5); }
  .overview-status > :first-child { margin-top: 0; }
  .overview-status > .quick-actions:last-child { margin-bottom: 0; }
  /* A shared tank with no tests yet has the picture alone. */
  .overview-status:empty { display: none; }
  .overview-top > .overview-picture:only-child, .overview-top:has(> .overview-status:empty) > .overview-picture { grid-column: 1 / -1; }
  .overview-checks { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--s5); align-items: start; }
  .overview-checks > .card { margin-top: 0; }
  .overview-checks > :only-child { grid-column: 1 / -1; }
}

/* Stock */
.stock-list > li { position: relative; }
.stock-list > li + li::before { content: ""; position: absolute; top: 0; left: 0; right: 0; border-top: 1px solid var(--line); }
/* On a wide screen two species to a row, so each count sits near its name rather than a screen's width away. */
@media (min-width: 960px) {
  .stock-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--s8); }
  .stock-list > li:nth-child(2)::before { content: none; }
}
.stock-item { padding: 14px 0; border-radius: var(--r-md); }
.stock-item.flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0%, 25% { background: var(--primary-soft); box-shadow: 0 0 0 6px var(--primary-soft); } 100% { background: transparent; box-shadow: 0 0 0 6px transparent; } }
.stock-row { display: flex; align-items: center; gap: var(--s3); }
.who { flex: 1; min-width: 0; display: grid; }
/* The checks that name a species, under its row: small chips in their tier's tone, each leading to the checks. */
.stock-flags { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 0 56px; }
.stock-flags > li { display: flex; }
/* Why a typed count was not set, under its row. */
.stock-note { margin: 6px 0 0 56px; font-size: var(--fs-sm); }
.flag {
  display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 2px 10px 2px 7px; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 700; text-decoration: none; line-height: 1.2;
  background: var(--tone-bg); color: var(--tone); border: 1px solid var(--tone-line);
}
.flag .icon { width: 14px; height: 14px; }
.flag:hover { border-color: var(--tone); }
/* On a small phone the name gets the room: a smaller badge and closer gaps beside the stepper. */
@media (max-width: 380px) {
  .stock-row { gap: var(--s2); }
  .stock-row > .kind { width: 36px; height: 36px; border-radius: 11px; }
  .stock-row > .kind .icon { width: 22px; height: 22px; }
  .stock-flags, .stock-item .sexes, .stock-note { margin-left: 44px; }
  .stock-row input.n { width: 3.6ch; }
}
.who .common { font-weight: 700; font-size: 1.02rem; line-height: 1.3; overflow-wrap: anywhere; }
.who .sci { font-size: var(--fs-sm); color: var(--muted); line-height: 1.35; }
.who .former { font-size: var(--fs-xs); color: var(--muted); line-height: 1.35; }
.who .common a { color: inherit; text-decoration: none; }
.who .common a:hover { color: var(--primary); text-decoration: underline; }

.stepper { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 999px; background: var(--sunk); border: 1px solid var(--line-soft); flex: none; box-shadow: inset 0 1px 2px rgb(15 42 48 / 0.05); }
.stepper .n { min-width: 2.2ch; text-align: center; font-weight: 750; font-variant-numeric: tabular-nums; font-size: var(--fs-lg); }
/* The count can be typed: it looks like a box, so a school of twelve is typed rather than tapped up. */
input.n {
  width: 4.2ch; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font-family: inherit;
  text-align: center; -moz-appearance: textfield; appearance: textfield; cursor: text;
}
input.n:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
input.n::-webkit-outer-spin-button, input.n::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input.n:focus { background: var(--surface); outline: 2px solid var(--focus); }
.step {
  display: grid; place-items: center; width: var(--tap); height: var(--tap); padding: 0; border-radius: 999px; border: 0;
  background: transparent; color: var(--primary); cursor: pointer; transition: background-color 0.15s, transform 0.08s;
}
.step:hover { background: var(--primary-soft); }
.step:active { transform: scale(0.9); }
.step.plus { background: var(--btn); color: var(--on-primary); box-shadow: var(--btn-glow); }
.step.plus:hover { background: var(--btn-hover); }
.step.plus:disabled { background: transparent; box-shadow: none; }
.step:disabled { color: var(--line); cursor: default; background: transparent; transform: none; }
.step .icon { width: 20px; height: 20px; stroke-width: 2.4; }

.sexes { margin: 6px 0 0 56px; }
.sexes > summary { min-height: var(--tap); font-weight: 500; font-size: var(--fs-sm); color: var(--muted); gap: 6px; }
.sexes > summary .icon { width: 16px; height: 16px; }
.sexes > summary .chev { margin-left: 2px; }
.sex-grid { display: grid; gap: 6px; padding: 4px 0 2px; }
.sex-line { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.sex-line .sex-label { font-size: var(--fs-sm); }
.sex-grid .stepper .n { font-size: var(--fs-md); }

.empty-stock { display: flex; gap: var(--s3); align-items: center; padding: var(--s3); border-radius: var(--r-md); background: var(--sunk); color: var(--muted); font-size: var(--fs-sm); }
.empty-stock .kinds { display: flex; gap: 4px; }

/* Search */
.add-species { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line); }
.add-species label { display: block; font-weight: 650; font-size: var(--fs-sm); margin-bottom: 6px; }
.search-box { position: relative; }
.search-box > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 20px; height: 20px; }
.search-box .input { padding-left: 42px; padding-right: 42px; border-radius: 999px; min-height: 48px; height: 48px; background: var(--surface); box-shadow: var(--shadow-sm); }
.search-box input::-webkit-search-cancel-button { display: none; }
.spinner {
  position: absolute; right: 14px; top: 50%; width: 18px; height: 18px; margin-top: -9px;
  border: 2.5px solid var(--track); border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.7s linear infinite; opacity: 0; transition: opacity 0.1s;
}
.spinner.htmx-request { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

.results { margin-top: var(--s2); display: grid; gap: 6px; }
@media (min-width: 720px) { .results { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.results li { animation: rise 0.18s ease-out both; }
.results li:nth-child(2) { animation-delay: 0.02s; }
.results li:nth-child(3) { animation-delay: 0.04s; }
.results li:nth-child(n+4) { animation-delay: 0.06s; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.result {
  width: 100%; display: flex; align-items: center; gap: var(--s3); min-height: 64px; padding: 10px;
  text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-md);
  box-shadow: var(--shadow-sm); cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}
.result:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.card .result:not(:hover) { box-shadow: none; }
.result:active { transform: scale(0.99); }
.result .who .common { font-weight: 650; }
.result .add {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 999px; flex: none;
  background: var(--btn); color: var(--on-primary); box-shadow: var(--btn-glow);
}
.result .add .icon { width: 18px; height: 18px; stroke-width: 2.4; }
.result .in-tank { flex: none; font-size: var(--fs-xs); font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 2px 8px; border-radius: 999px; }
/* Two short lines at most, so a long name beside it keeps its room. */
.result .other-water { flex: none; max-width: 6.5em; font-size: var(--fs-xs); font-weight: 700; line-height: 1.25; text-align: center; color: var(--warn); background: var(--warn-bg); padding: 2px 8px; border-radius: var(--r-sm); }
.result .who .common { overflow-wrap: anywhere; }
.no-results { margin-top: var(--s2); padding: var(--s3); color: var(--muted); font-size: var(--fs-sm); text-align: center; background: var(--sunk); border-radius: var(--r-md); }

/* Findings */
.tier-group + .tier-group { margin-top: var(--s4); }
.tier-heading { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 750; color: var(--tone); margin-bottom: var(--s2); }
.tier-heading .icon { width: 18px; height: 18px; }
.findings { display: grid; gap: var(--s2); }
.finding { padding: 12px 14px 12px 16px; border-radius: var(--r-md); background: var(--sunk); border: 1px solid var(--line-soft); border-left: 4px solid var(--tone); }
.bad .finding { background: var(--tone-bg); border-color: var(--tone-line); border-left-color: var(--tone); } /* problems stay tinted: rare and high-certainty */
.finding .topic { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 750; color: var(--tone); text-transform: uppercase; letter-spacing: 0.04em; }
.finding .topic .count { font-weight: 600; letter-spacing: 0; text-transform: none; }
.finding ul { display: grid; gap: 6px; margin-top: 4px; }
.finding li { font-size: var(--fs-sm); line-height: 1.45; }
.finding ul.many li { padding-left: 14px; position: relative; }
.finding ul.many li::before { content: ""; position: absolute; left: 2px; top: 0.6em; width: 5px; height: 5px; border-radius: 50%; background: var(--tone); }
.notes > summary { font-size: var(--fs-sm); color: var(--info); }
.notes > summary .icon { width: 18px; height: 18px; }
.notes .findings { padding-bottom: 2px; }
.all-clear { display: flex; align-items: center; gap: var(--s2); color: var(--ok); font-weight: 650; font-size: var(--fs-sm); }

/* Water parameter cards */
.param .lead { display: grid; gap: 2px; }
.param .big { font-family: var(--font-display); font-variation-settings: "SOFT" 100; font-size: 1.75rem; font-weight: 640; font-variant-numeric: lining-nums tabular-nums; letter-spacing: -0.02em; line-height: 1.15; }
.param .lead p { font-size: var(--fs-sm); color: var(--muted); }
.param .aim { display: inline-flex; align-items: center; gap: 6px; margin-top: var(--s2); padding: 4px 12px 4px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--text); font-size: var(--fs-sm); }
.param .aim .icon { width: 16px; height: 16px; color: var(--primary); }
.limits { display: grid; gap: 6px; margin-top: var(--s3); }
.limit { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; font-size: var(--fs-sm); }
.limit > .icon { width: 18px; height: 18px; color: var(--primary); margin-top: 1px; }
.limit b { font-variant-numeric: tabular-nums; }
.callout { display: flex; gap: var(--s2); align-items: flex-start; margin-top: var(--s3); padding: 10px 12px; border-radius: var(--r-md); background: var(--tone-bg, var(--sunk)); border: 1px solid var(--tone-line, var(--line)); font-size: var(--fs-sm); }
.callout > .icon { width: 18px; height: 18px; color: var(--tone, var(--primary)); margin-top: 1px; }
.conflicts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s2); }
.conflict-pair { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--bad-bg); border: 1px solid var(--bad-line); font-size: var(--fs-xs); font-weight: 650; }
.conflict-pair .x { color: var(--bad); font-weight: 800; }
.param .missing { margin-top: var(--s3); font-size: var(--fs-xs); color: var(--muted); }

/* Range chart: rows stacked (label above bar) so bars get the full phone width */
.chart { position: relative; margin-top: var(--s4); }
.chart-rows { position: relative; display: grid; gap: 10px; }
.chart-row { position: relative; z-index: 1; }
.chart-row-head { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; font-size: var(--fs-xs); line-height: 1.35; margin-bottom: 3px; }
.chart-row-head .label { font-weight: 650; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.chart-row-head .meta { color: var(--muted); white-space: nowrap; }
.chart-row-head .value { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.chart-row-head .sets { color: var(--primary); font-weight: 700; white-space: nowrap; }
.track { position: relative; height: 12px; border-radius: 999px; background: var(--track); box-shadow: inset 0 1px 2px rgb(15 42 48 / 0.07); }
.track > span { position: absolute; top: 0; bottom: 0; border-radius: 999px; }
.track .acceptable { background: var(--acceptable); }
.track .comfort { background: var(--comfort); }
.track .shared { background: var(--shared); }
.track.gap { background: repeating-linear-gradient(135deg, var(--tone-bg) 0 5px, color-mix(in srgb, var(--tone) 40%, var(--tone-bg)) 5px 7px); }
.track .tick { width: 4px; margin-left: -2px; top: -4px; bottom: -4px; background: var(--text); border-radius: 2px; box-shadow: 0 0 0 2px var(--surface); }
.track .ring { width: 14px; height: 14px; margin-left: -7px; top: -1px; border-radius: 50%; background: var(--surface); border: 3px solid var(--text); }
.chart-row.tank .chart-row-head .label { font-weight: 800; }
.chart-row.tank .track { height: 16px; }
.chart-row.tank .track .tick { top: -3px; bottom: -3px; }
.chart-row.tank .track .ring { top: 1px; }
/* The shared band, repeated on every species bar, so the species whose edge meets it can be seen setting the limit */
.track .band { top: -5px; bottom: -5px; background: var(--shared-wash); border-left: 2px dashed var(--shared); border-right: 2px dashed var(--shared); border-radius: 0; }
.track .tank-mark { width: 3px; margin-left: -1.5px; top: -7px; bottom: -5px; background: var(--primary); border-radius: 2px; box-shadow: 0 0 0 1.5px var(--surface); }
.track .tank-mark::before { content: ""; position: absolute; top: -4px; left: -3.5px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 1.5px var(--surface); }
.chart.has-top { padding-top: 22px; }
.chart-top-label { position: absolute; top: -22px; transform: translateX(-50%); font-size: var(--fs-xs); font-weight: 750; color: var(--primary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart-top-label.to-left { transform: translateX(calc(-100% + 2px)); }
.chart-top-label.to-right { transform: translateX(-2px); }
.chart-scale { display: flex; justify-content: space-between; margin-top: 6px; font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
/* Each species' bars under the whole stock's: folded while every species shares a range. */
.species-rows { margin-top: var(--s2); }
.species-rows > summary { min-height: var(--tap); font-size: var(--fs-sm); font-weight: 600; color: var(--primary); gap: 6px; }
.species-rows > summary .chev { margin-left: 2px; color: var(--primary); }
.species-rows[open] > summary { margin-bottom: var(--s2); }
/* The water tab's one legend, above its cards. */
.legend.water-legend { margin: 0 0 var(--s4); padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: var(--s3); padding-top: var(--s3); border-top: 1px dashed var(--line); font-size: var(--fs-xs); color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 18px; height: 10px; border-radius: 999px; flex: none; }
.sw.comfort { background: var(--comfort); }
.sw.acceptable { background: var(--acceptable); }
.sw.shared { background: var(--shared); }
.sw.band { background: var(--shared-wash); border-left: 2px dashed var(--shared); border-right: 2px dashed var(--shared); border-radius: 0; height: 14px; }
.sw.tick { width: 4px; height: 14px; background: var(--text); border-radius: 2px; }
.sw.ring { width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--text); background: var(--surface); }
.sw.gap { background: repeating-linear-gradient(135deg, var(--tone-bg) 0 4px, color-mix(in srgb, var(--tone) 40%, var(--tone-bg)) 4px 6px); }
.sw.space-all { background: var(--space-all); }
.sw.space-most { background: var(--space-most); }
.sw.space-some { background: var(--space-some); }
.sw.space-none { background: var(--space-none); }
.sw.line { position: relative; width: 3px; height: 14px; margin: 0 4px; background: var(--primary); border-radius: 2px; }
.sw.line::before { content: ""; position: absolute; top: -3px; left: -3.5px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }

.unknown-params { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s3) var(--s4); font-size: var(--fs-sm); color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-lg); }
.unknown-params .icon { width: 18px; height: 18px; margin-top: 2px; }

/* Space */
.space .track .space-all { background: var(--space-all); }
.space .track .space-most { background: var(--space-most); }
.space .track .space-some { background: var(--space-some); }
.space .track .space-none { background: var(--space-none); }
.space .track .space-unknown { background: var(--none-line); }
.space-note { font-size: var(--fs-xs); color: var(--muted); margin-top: 8px; }
.space .chart-row-head { margin-bottom: 13px; } /* room for the tank marker's knob */
.space .chart-rows { gap: 14px; }
.space .chart-row-head .value { font-weight: 700; }
.space .chart-row-head .value.ok { color: var(--ok); }
.space .chart-row-head .value.warn { color: var(--warn); }
.space .chart-row-head .value.bad { color: var(--bad); }

/* Legal */
.legal .intro { font-size: var(--fs-sm); color: var(--muted); margin-bottom: var(--s3); }

/* Settings, in the More tab */
.tank-settings { margin-top: var(--s4); }
.tank-settings .tank-form { padding-bottom: var(--s4); }
.tank-delete { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); padding: var(--s3) 0 var(--s4); border-top: 1px solid var(--line); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- Water tests ---------- */

.tests .test-feedback { margin-bottom: var(--s3); font-size: var(--fs-sm); }
.tests .test-feedback ul { margin: 0; padding-left: var(--s4); }
.test-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s2); margin: 0 0 var(--s3); padding: 0; list-style: none; }
.test { padding: 10px 12px; border-radius: var(--r-md); background: var(--sunk); border: 1px solid var(--line); border-left: 4px solid var(--tone, var(--line)); }
/* A fine result is one line; the ones that say why stand out against it. */
/* One line: a fine result, and a reading shown without a verdict (a shared tank's). */
.test.fine, .test.plain { padding: 6px 12px; background: transparent; }
.test.warn, .test.bad { background: color-mix(in srgb, var(--tone-bg) 55%, var(--surface)); }
.test.none { opacity: 0.8; }
.test-head { display: flex; align-items: center; gap: var(--s2); }
.test-what { flex: 1; min-width: 0; }
.test-name { font-weight: 700; }
.test-value { font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.test-head .pill { flex: none; }
.tests .log-test { margin-bottom: var(--s3); }
.tests-watch .history-link { margin: 0; }
.test-message { font-size: var(--fs-sm); line-height: 1.45; margin-top: 4px; }
.test-meta { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
.log-test > summary { list-style: none; }
.log-test > summary::-webkit-details-marker { display: none; }
.log-test[open] > summary, .log-tap[open] > summary { margin-bottom: var(--s3); }
.test-form { display: grid; gap: var(--s3); }
.test-rows { display: grid; gap: var(--s2); }
/* The value box is the field that matters: the label column gives it room, and the units take a fixed 7rem. */
.test-row { display: grid; grid-template-columns: minmax(min-content, 0.7fr) minmax(0, 1.6fr); gap: var(--s2); align-items: center; }
.test-label { font-size: var(--fs-sm); font-weight: 600; }
.test-input { display: flex; gap: var(--s2); align-items: center; }
.test-input .input { min-width: 0; flex: 1; }
/* Every unit, chosen or fixed, takes the same width, so the value boxes line up and keep room for a few digits. */
.test-input .unit { flex: none; width: 7rem; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }
.test-input select.unit { font-size: var(--fs-md); color: var(--text); padding-left: 10px; padding-right: 6px; }
/* The tap water card: each measure on a line, then what the checks make of it. */
.tap-list { list-style: none; margin: var(--s2) 0 0; padding: 0; }
.tap-list li { display: flex; justify-content: space-between; gap: var(--s3); padding: 8px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.tap-list .test-value { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.tap-finding { margin: var(--s2) 0 0; padding: 8px 12px; border-radius: var(--r-md); font-size: var(--fs-sm); background: var(--warn-bg); border-left: 4px solid var(--warn); }
.tap-finding.info { background: var(--info-bg); border-left-color: var(--info); }
.tap .log-tap { margin-top: var(--s3); }
.test-row .chips { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; margin-top: -2px; }
.chip {
  min-height: 32px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--sunk); color: var(--text);
  font: inherit; font-size: var(--fs-sm); font-weight: 650; font-variant-numeric: tabular-nums; cursor: pointer;
}
.chip:hover { border-color: var(--primary); }
/*
 * A full tap's height to hit, around the smaller look of chips and of links that stand alone (WCAG 2.5.5): a finger on a
 * phone or a tablet finds them as easily as a button.
 */
.chip, .flag, .kind-chip, .period-chip, .timeline-all, .history-link a, .report-link a, .site-footer a { position: relative; }
.chip::after, .flag::after, .kind-chip::after, .period-chip::after, .timeline-all::after, .history-link a::after, .report-link a::after, .site-footer a::after {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: var(--tap); transform: translateY(-50%);
}
.chip[aria-pressed="true"] { background: var(--btn); border-color: transparent; color: var(--on-primary); box-shadow: var(--btn-glow); }
.test-when { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* Stock: after a change, the optional reasons for it, and what was noted. */
.stock-why { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-top: var(--s2); }
.stock-why-label { font-size: var(--fs-sm); font-weight: 650; }
.stock-why-label small { font-weight: 400; color: var(--muted); }
.why-chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.why-chips .kind-chip { padding: 0 var(--s3); cursor: pointer; font: inherit; font-size: var(--fs-sm); font-weight: 600; }
.stock-noted { display: flex; align-items: center; gap: 6px; margin-top: var(--s2); font-size: var(--fs-sm); color: var(--muted); }
.stock-noted .icon { width: 16px; height: 16px; color: var(--ok); }
.stock-item.gone .who { opacity: 0.7; }
.none-left { flex: none; font-size: var(--fs-sm); color: var(--muted); }

/* ---------- Timeline ---------- */

.timeline .water-feedback { margin-bottom: var(--s3); font-size: var(--fs-sm); }
.timeline .water-feedback ul { margin: 0; padding-left: var(--s4); }
.timeline-list { display: grid; gap: var(--s3); margin: 0 0 var(--s3); padding: 0; list-style: none; }
#timeline-pages > .timeline-list:last-child { margin-bottom: 0; }
.entry { position: relative; display: flex; gap: var(--s3); align-items: flex-start; }
.timeline-list > li + li .entry::before { /* the thread from one entry to the one before */
  content: ""; position: absolute; left: 15px; top: calc(-1 * var(--s3)); height: var(--s3); border-left: 2px solid var(--line);
}
.entry-icon {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 999px; flex: none;
  background: var(--primary-soft); color: var(--primary); box-shadow: 0 0 0 3px var(--surface);
}
.entry-icon .icon { width: 18px; height: 18px; }
.entry-body { min-width: 0; padding-top: 5px; }
.entry-text { line-height: 1.35; overflow-wrap: anywhere; }
.entry-meta { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
.timeline-all { display: inline-flex; align-items: center; gap: 4px; margin-bottom: var(--s3); font-size: var(--fs-sm); font-weight: 650; color: var(--primary); text-decoration: none; }
.timeline-all .icon { width: 16px; height: 16px; }
.timeline-all:hover { text-decoration: underline; }
.log-water > summary { list-style: none; }
.log-water > summary::-webkit-details-marker { display: none; }
.log-water[open] > summary { margin-bottom: var(--s3); }
.water-form { display: grid; gap: var(--s3); }
.water-amount { display: flex; gap: var(--s2); }
.water-amount .input:first-child { min-width: 0; flex: 1; }
.water-amount .unit { flex: none; width: 9em; }
.timeline-page h1 { margin-bottom: var(--s4); }
.timeline-more { margin-top: var(--s3); }
.timeline-start { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); }
.timeline-start .icon { width: 16px; height: 16px; }

/* Equipment: a row per item that opens its form, chips for the kinds to add, and the form itself. */
.gear {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-md); flex: none;
  background: var(--primary-soft); color: var(--primary);
}
.gear .icon { width: 20px; height: 20px; }
.equipment-empty { padding: var(--s3); border-radius: var(--r-md); background: var(--sunk); color: var(--muted); font-size: var(--fs-sm); line-height: 1.4; }
.equipment-list { margin: 0; padding: 0; list-style: none; }
.equipment-list > li + li { border-top: 1px solid var(--line); }
.equipment-row {
  display: flex; align-items: center; gap: var(--s3); min-height: 56px; padding: var(--s2) var(--s1);
  border-radius: var(--r-md); color: var(--text); text-decoration: none;
}
.equipment-row:hover { background: var(--sunk); }
.equipment-row .what { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.equipment-row .details { font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }
.equipment-row .edit { flex: none; width: 18px; height: 18px; color: var(--muted); }
.add-equipment { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line); }
.equipment-empty + .add-equipment { border-top: 0; padding-top: 0; }
.add-equipment-label { font-weight: 650; font-size: var(--fs-sm); margin-bottom: var(--s2); }
.equipment-kinds { display: flex; flex-wrap: wrap; gap: var(--s2); }
.kind-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 var(--s3) 0 10px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--text); font-size: var(--fs-sm); font-weight: 600; text-decoration: none;
}
.kind-chip .icon { width: 18px; height: 18px; color: var(--primary); }
.kind-chip:hover { border-color: var(--primary); background: var(--primary-soft); }
.equipment-form {
  display: grid; gap: var(--s4); margin: var(--s2) 0; padding: var(--s4);
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--sunk);
}
.equipment-list .equipment-form { margin: var(--s2) 0; }
.equipment-form-head { display: flex; align-items: center; gap: var(--s3); }
.equipment-form .input, .equipment-form .select { background: var(--surface); }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.form-actions .btn { flex: 1 1 auto; }
.btn.text-danger { flex: 0 0 auto; background: none; color: var(--bad); border-color: transparent; padding: 0 var(--s3); box-shadow: none; }
.tank-delete > .btn.text-danger, .card > a.btn.text-danger { margin-left: calc(-1 * var(--s3)); }
.account-devices .btn.text-danger, .passkey .btn.text-danger { margin-right: calc(-1 * var(--s3)); }
.btn.text-danger:hover { background: var(--bad-bg); }

/* One choice among a few: full-width rows, or colour swatches side by side. */
.choices { display: grid; gap: var(--s2); }
.choice {
  display: flex; align-items: center; gap: var(--s3); min-height: var(--tap); padding: var(--s2) var(--s3);
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
  font-size: var(--fs-sm); line-height: 1.3; cursor: pointer;
}
.choice input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--primary); }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.choices.swatches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 520px) { .choices.swatches { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.swatches .choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgb(0 0 0 / 0.15); }
/* The drop checker's own colours, which the keeper matches by eye. */
.swatch.drop-blue { background: #3d7fd9; }
.swatch.drop-green { background: #3fa66a; }
.swatch.drop-yellow { background: #e6c229; }
.swatch.drop-unknown { background: repeating-linear-gradient(45deg, var(--track) 0 3px, var(--surface) 3px 6px); }
/* The drop checker only means something with a pressurised cylinder. */
.equipment-form:not(:has(input[name="co2Source"][value="pressurised"]:checked)) .drop-field { display: none; }

/*
 * A field the browser refuses (a required choice left empty, a number out of range) once the user has touched it, and
 * one the server sent back with a problem.
 */
.input:user-invalid, .select:user-invalid, .input[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent); }
.choices:has(input:user-invalid) .choice { border-color: var(--bad-line); }

/* Data reports: the link under a tank's stock, and the form. */
.report-link { margin: var(--s3) 0 0; }
.report-link a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.report-link a:hover { color: var(--primary); }
.report-link .icon { width: 15px; height: 15px; }
textarea.input { resize: vertical; line-height: 1.45; }
.tank-form .confirm input { accent-color: var(--primary); }
#report-search-results:empty { display: none; }
.report-intro { margin: 0 0 var(--s4); }
.report-actions { display: grid; gap: var(--s2); margin-top: var(--s4); }

/* ---------- Species pages ---------- */

.index-search { margin-top: 0; padding-top: 0; border-top: 0; }
.species-kinds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); margin: var(--s4) 0 0; padding: 0; list-style: none; }
@media (min-width: 720px) { .species-kinds { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.species-kind {
  display: flex; align-items: center; gap: var(--s2); min-height: 56px; padding: 8px 10px; border-radius: var(--r-md);
  background: var(--surface); border: 1.5px solid var(--line-soft); color: var(--text); font-weight: 650; text-decoration: none;
  box-shadow: var(--shadow-sm); transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.species-kind:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.species-kind.current { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.species-kind-text { display: grid; min-width: 0; line-height: 1.25; }
.species-kind-text > span:first-child { font-size: var(--fs-sm); }
.species-kind .count { color: var(--muted); font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
.species-index .results { margin-top: var(--s4); }
a.result { text-decoration: none; }
a.result .chev { flex: none; width: 20px; height: 20px; color: var(--muted); }

.species-title { display: flex; align-items: flex-start; gap: var(--s3); }
.species-title h1 { overflow-wrap: anywhere; line-height: 1.12; }
/* The picture above shows the kind; the badge stays for screen readers, which the picture is hidden from. */
.species-art + .species-title > .kind { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.species-title .sci { color: var(--muted); margin-top: 2px; }
.species-title .former { color: var(--muted); font-size: var(--fs-sm); }
.species-glance .tile-link { min-height: 72px; }
/*
 * On a wide screen the picture stands beside the names, the water types and the tiles, so the first screen of a short
 * laptop holds them all. The last row takes what the picture adds below them, so they stay together at the top.
 */
@media (min-width: 960px) {
  .species-hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-rows: auto auto auto auto 1fr; column-gap: var(--s5); }
  .species-hero > * { grid-column: 2; }
  .species-hero > .back { grid-column: 1 / -1; justify-self: start; }
  .species-hero > .species-art { grid-column: 1; grid-row: 2 / -1; margin: 0; }
}
/* A card's one button need not run a laptop's width: it fits its words. */
@media (min-width: 720px) { .fit-invite .btn.block, .fit .btn.block { width: auto; } }
/* The fit check's findings two to a row, so their lines stay short. */
@media (min-width: 960px) { .fit .findings { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fit-invite, .fit { margin-bottom: var(--s4); }
.fit-invite .card-head, .fit .card-head { align-items: flex-start; }
.fit-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s2); margin-bottom: var(--s3); }
.fit-form .field { flex: 1 1 160px; }
.fit-form .fit-count { flex: 0 1 96px; }
.fit-form .btn { flex: none; }
.fit-summary { display: flex; align-items: center; gap: 6px; color: var(--ok); font-size: var(--fs-sm); font-weight: 650; }
/* The fit check's answer, as a strip in its tone under the question. */
.fit-verdict {
  display: flex; align-items: center; gap: var(--s2); margin: 0 0 var(--s3); padding: 10px 12px; border-radius: var(--r-md);
  background: var(--tone-bg); color: var(--tone); border: 1px solid var(--tone-line); font-weight: 750;
}
.fit-verdict .icon { width: 20px; height: 20px; }
.fit-solved { margin-bottom: var(--s3); }
.fit-solved ul, .fit-changes ul { display: grid; gap: 4px; margin: 0; padding-left: var(--s4); font-size: var(--fs-sm); line-height: 1.4; }
.fit-changes h3 { font-size: var(--fs-sm); margin: var(--s3) 0 var(--s1); }
.fit-add { margin-top: var(--s4); }
.species-water .chart { margin-top: 0; }
.species-water .chart-rows { gap: var(--s4); }
.species-water .chart-scale { margin-top: 4px; }
.species-space .limit { margin-bottom: var(--s2); }
.species-space .track .space-most { background: var(--space-most); }
.track .tolerated, .sw.tolerated { background: color-mix(in srgb, var(--acceptable) 40%, var(--track)); }
.trait-list { display: grid; margin: 0; padding: 0; list-style: none; }
.trait-list li { display: flex; justify-content: space-between; gap: var(--s3); padding: 10px 0; font-size: var(--fs-sm); }
.trait-list li + li { border-top: 1px solid var(--line); }
.trait-list .trait-label { color: var(--muted); }
.trait-list .trait-value { font-weight: 650; text-align: right; }
.legal-place + .legal-place { border-top: 1px solid var(--line); }
.legal-place > summary { min-height: 48px; }
.legal-place > summary h3 { font-size: var(--fs-md); }
.legal-place[open] > .rule-list { margin-bottom: var(--s3); }
.rule-list { display: grid; gap: 6px; margin: 0; padding-left: var(--s4); font-size: var(--fs-sm); line-height: 1.4; }
.legal-notes > summary { font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.legal-notes p { color: var(--muted); line-height: 1.45; }
.legal-notes p + p { margin-top: var(--s2); }
.sources { padding: 0 var(--s4); }
.sources > summary { min-height: 56px; gap: var(--s3); }
.sources > summary .card-icon { width: 32px; height: 32px; }
.source-list { display: grid; gap: var(--s3); margin: 0; padding: 0 0 var(--s4); list-style: none; }
.source-list li { display: grid; gap: 2px; font-size: var(--fs-sm); line-height: 1.4; }
.source-list a { color: var(--primary); overflow-wrap: anywhere; }
.report-link { margin-top: var(--s4); }

/* ---------- History of readings ---------- */

.history-title { margin: var(--s1) 0 var(--s3); }
.period-chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin: 0 0 var(--s4); padding: 0; list-style: none; }
.period-chip {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--s3); border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: var(--fs-sm); font-weight: 650; text-decoration: none;
}
.period-chip:hover { border-color: var(--primary); }
.period-chip.current { background: var(--btn); border-color: transparent; color: var(--on-primary); box-shadow: var(--btn-glow); }
.history-measure + .history-measure { margin-top: var(--s4); }
/*
 * The charts side by side on a wide screen, each about a phone's width: drawn across a laptop, a chart's points and lines
 * grew with it, and a short screen held one chart.
 */
@media (min-width: 720px) {
  .history-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
  .history-charts > .history-measure { margin-top: 0; }
}
@media (min-width: 1200px) { .history-charts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.history-head { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s2); }
.history-head h2 { font-size: var(--fs-md); margin-right: auto; }
.history-latest { font-weight: 750; font-variant-numeric: tabular-nums; }
.history-chart { position: relative; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.y-label { position: absolute; left: 2px; font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; pointer-events: none; }
.y-label.top { top: -2px; }
.y-label.bottom { bottom: 34px; }
.h-band { fill: var(--shared-wash); stroke: none; }
.h-band-line { stroke: var(--shared); stroke-width: 2; }
.h-limit { stroke: var(--bad); stroke-width: 1.5; stroke-dasharray: 5 4; }
.h-water { stroke: var(--primary); stroke-width: 2.5; stroke-linecap: round; }
.h-trend { stroke: var(--supporter); stroke-width: 2.5; stroke-dasharray: 0.1 5; stroke-linecap: round; } /* dotted, unlike the dashed limit */
.h-line { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linejoin: round; }
.h-point { fill: var(--tone, var(--muted)); stroke: var(--surface); stroke-width: 2; }
.sw.h-band { background: var(--shared-wash); border: 1px solid color-mix(in srgb, var(--shared) 35%, transparent); height: 12px; border-radius: 3px; }
.sw.h-limit { height: 0; border-top: 2px dashed var(--bad); border-radius: 0; }
.sw.h-water { width: 3px; height: 12px; background: var(--primary); border-radius: 2px; }
.sw.h-trend { height: 0; border-top: 3px dotted var(--supporter); border-radius: 0; }
.sw.h-point { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); }
.history-legend { margin-top: var(--s4); border-top: 0; padding-top: 0; }
.trend { display: flex; align-items: flex-start; gap: 6px; margin-top: var(--s3); font-size: var(--fs-sm); line-height: 1.4; }
.trend > .icon { flex: none; width: 16px; height: 16px; color: var(--supporter); margin-top: 2px; }
.trend.muted { color: var(--muted); }
.history-link { margin: 0 0 var(--s3); }
.history-link a { display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-weight: 650; text-decoration: none; }
.history-link .icon { width: 16px; height: 16px; }
.deaths, .supporter-preview { margin-top: var(--s4); }
.death + .death { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line); }
.death h3 { font-size: var(--fs-md); margin-bottom: var(--s1); }
.death ul { display: grid; gap: 4px; margin: 0; padding-left: var(--s4); font-size: var(--fs-sm); line-height: 1.4; }
.deaths .hint { margin-top: var(--s3); }
.supporter-preview .history-chart { margin-bottom: var(--s3); opacity: 0.85; }
.supporter-preview p { font-size: var(--fs-sm); line-height: 1.45; margin-bottom: var(--s3); }

/* ---------- Supporter plan ---------- */

/*
 * What a supporter has from the plan, and its previews, in the plan's colour: a card of its own (.supporter-feature),
 * or a part of a free card (.supporter-part). On the features themselves the mark says it in words too (supporterMark).
 */
.card.supporter-feature { border-color: var(--supporter-line); background: color-mix(in srgb, var(--supporter-bg) 45%, var(--surface)); }
.supporter-feature .card-icon { background: var(--supporter-bg); color: var(--supporter); }
.supporter-part {
  margin-top: var(--s3); padding: var(--s2) var(--s3); border-radius: var(--r-md); color: var(--text);
  border: 1px solid var(--supporter-line); background: color-mix(in srgb, var(--supporter-bg) 60%, var(--surface));
}
.supporter-part > .icon { color: var(--supporter); }
.marked { display: flex; align-items: flex-start; gap: var(--s2); }
.marked > .mark-text { flex: 1; min-width: 0; }
.pill.supporter { flex: none; background: var(--supporter-bg); color: var(--supporter); border-color: var(--supporter-line); }

.supporter-status { border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); }
.supporter-status .card-head { margin-bottom: 0; }
.supporter-status p { margin-top: var(--s2); }
.plain-list { display: grid; gap: 8px; margin: 0 0 var(--s3); padding-left: var(--s4); font-size: var(--fs-sm); line-height: 1.4; }
.plain-list .pill { margin-left: 6px; vertical-align: 1px; }
.supporter-cost { margin-top: var(--s4); text-align: center; }

/* ---------- Tank tabs ---------- */

/* Under the site header, which is 56px tall, and above the tab's content as it scrolls. */
.tank-tabs {
  position: sticky; top: 56px; z-index: 5; margin: 0 calc(-1 * var(--s4)) var(--s4); padding: var(--s2) var(--s4);
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 92%, transparent) 70%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
/*
 * One segmented control. Five tabs fit a 360px phone in either language; the row scrolls sideways rather than wrap if
 * they ever do not.
 */
.tank-tabs ul {
  display: flex; justify-content: space-between; gap: 2px; margin: 0; padding: 4px; list-style: none; overflow-x: auto; scrollbar-width: none;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: 999px; box-shadow: var(--shadow-sm);
}
.tank-tabs ul::-webkit-scrollbar { display: none; }
.tank-tabs li { flex: 1 0 auto; }
/* On a wide screen the tabs sit together at the start, not spread across a thousand pixels. */
@media (min-width: 720px) { .tank-tabs ul { display: inline-flex; gap: var(--s1); } .tank-tabs li { flex: none; } .tank-tab { padding: 0 var(--s4); } }
.tank-tab {
  display: flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0 8px; border-radius: 999px; white-space: nowrap;
  color: var(--muted); font-size: var(--fs-sm); font-weight: 700; text-decoration: none; transition: background-color 0.15s, color 0.15s;
}
.tank-tab:hover { color: var(--primary); background: var(--primary-soft); }
.tank-tab.current { background: var(--btn); color: var(--on-primary); box-shadow: var(--btn-glow); }
/* Sized by their labels, then sharing what is left, so a long label ("Mudança de água") keeps to one line. */
.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(max-content, 1fr)); gap: var(--s2); margin: var(--s4) 0; }
.quick-actions .btn { padding: 0 var(--s2); gap: 6px; font-size: var(--fs-sm); white-space: nowrap; }
@media (max-width: 340px) { .quick-actions { grid-template-columns: 1fr; } }
.quick-actions .btn .icon { width: 18px; height: 18px; }

/* ---------- Sharing ---------- */

.share-link { display: flex; gap: var(--s2); }
.share-link .input { flex: 1; min-width: 0; }
.share-actions { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); margin: var(--s3) calc(-1 * var(--s3)) 0; }
.btn.text-link { background: none; border-color: transparent; color: var(--primary); padding: 0 var(--s3); box-shadow: none; }
.btn.text-link:hover { background: var(--primary-soft); }
.shared-label { display: flex; align-items: center; gap: 6px; margin-bottom: var(--s1); color: var(--muted); font-size: var(--fs-sm); font-weight: 650; }
.shared-label .icon { width: 16px; height: 16px; }
.shared-count { margin-left: auto; font-size: var(--fs-lg); font-weight: 750; font-variant-numeric: tabular-nums; }
.shared-sexes { margin: 4px 0 0 56px; }
.shared-cta { margin-top: var(--s6); text-align: center; }
.shared-cta a { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); color: var(--primary); font-weight: 650; text-decoration: none; }
.shared-cta .logo { width: 24px; height: 24px; }

/* ---------- Reminders ---------- */

.reminders { margin-bottom: var(--s4); }
.reminder-form { display: grid; gap: var(--s2); }
.reminder-form > .btn { margin-top: var(--s1); }
.reminder-row { display: flex; align-items: center; gap: 8px; min-height: var(--tap); font-size: var(--fs-sm); cursor: pointer; }
.reminder-row input[type="checkbox"] { width: 20px; height: 20px; margin: 0; accent-color: var(--primary); }
.reminder-row .days { width: 64px; padding: 6px 8px; text-align: center; }
.push-device { display: grid; gap: var(--s2); margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--line); }
.push-status:empty { display: none; }
.account-devices { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); margin-top: var(--s3); }

/* ---------- Footer and legal pages ---------- */

.site-footer { position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2) var(--s5); max-width: 1120px; margin: var(--s4) auto 0; padding: var(--s8) var(--s4) calc(var(--s6) + env(safe-area-inset-bottom)); }
.site-footer::before { /* a small wave, in the colour of the lines */
  content: ""; position: absolute; top: 6px; left: 50%; width: 96px; height: 10px; margin-left: -48px; background: var(--line);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 10'%3E%3Cpath d='M1 5c6-5 10-5 16 0s10 5 16 0 10-5 16 0 10 5 16 0 10-5 16 0 10 5 14 0' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 10'%3E%3Cpath d='M1 5c6-5 10-5 16 0s10 5 16 0 10-5 16 0 10 5 16 0 10-5 16 0 10 5 14 0' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.site-footer a { color: var(--muted); font-size: var(--fs-sm); text-decoration: none; }
.site-footer a:hover { color: var(--primary); text-decoration: underline; }
.landing-legal { margin-top: var(--s3); text-align: center; }
.landing-legal a { color: var(--primary); }
/* Pages of one column, a form's or a text's width however wide the screen: the account, a data report, the legal pages, a tank's whole timeline. */
.legal-page, .form-page, .timeline-page { max-width: 720px; margin: 0 auto; }
.legal-page h1 { margin: var(--s2) 0 var(--s1); }
.legal-lead { font-size: var(--fs-lg); line-height: 1.45; margin: var(--s4) 0; }
.legal-section { margin-top: var(--s5); }
.legal-section h2 { font-size: var(--fs-lg); margin-bottom: var(--s2); }
.legal-section p, .legal-section li { line-height: 1.55; }
.legal-section p + p, .legal-section ul + p { margin-top: var(--s2); }
.legal-section ul { display: grid; gap: var(--s2); margin: var(--s2) 0; padding-left: var(--s5); list-style: disc; }


/* Signing in: one narrow column, the email first, then the other ways. */
.signin { max-width: 26rem; margin: var(--s6) auto; display: grid; gap: var(--s4); }
.signin::before {
  content: ""; width: 60px; height: 60px; border-radius: 19px; box-shadow: var(--btn-glow);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='rgba(255,255,255,0.18)' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.5 12c-2 3.3-5 5-8.3 5-3 0-5.4-1.6-7.2-5 1.8-3.4 4.2-5 7.2-5 3.3 0 6.3 1.7 8.3 5z'/%3E%3Cpath d='M5 12 2 8.5v7z'/%3E%3Cpath d='M9.5 9.3c.9 1.8.9 3.6 0 5.4'/%3E%3Cpath d='M16.3 11h.01'/%3E%3C/svg%3E") center / 36px no-repeat, linear-gradient(180deg, #11808b, #0a6875);
}
.signin h1 { margin: 0; }
.signin-lead { color: var(--muted); margin: 0; }
.signin-notice { margin: 0; }
.signin-other { display: grid; gap: var(--s2); }
.signin-other:not(:has(> :not([hidden]))) { display: none; }
.signin-google { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); }
.google-mark { display: inline-flex; }
.signin-or { display: flex; align-items: center; gap: var(--s3); color: var(--muted); font-size: var(--fs-sm); margin: 0; }
.signin-or::before, .signin-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.signin-form { display: grid; gap: var(--s3); }
input.signin-code { height: 56px; font-size: var(--fs-xl); letter-spacing: 0.3em; text-align: center; font-variant-numeric: tabular-nums; }
.signin-again { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: center; }
.signin-again form { margin: 0; }
.signin-legal { text-align: center; margin: 0; }
/* A one-field form with its button beside the box: the account's first name. */
.inline-form { display: flex; gap: var(--s2); }
.inline-form .input { flex: 1; min-width: 0; }
.inline-form .btn { flex: none; }
.account-name-card { margin-bottom: var(--s4); }
.passkeys { display: grid; gap: var(--s2); margin-bottom: var(--s3); }
.passkey { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); }
.passkey p { margin: 0; }
.passkey form { margin: 0; }
.bad-text { color: var(--bad); }

/* Shop links (docs/design/shop-links.md §3.6): one small, quiet line under the warning it follows. No card, border,
   background or colour of its own, so it never reads as an ad (owner decision, 2026-11-09). "How to fix?" opens the
   advice and the link in place, with no script; the link's "why?" opens its reason and the two small links beneath
   it; "Link not working?" is text, not a button. */
.shop-line { margin-top: var(--s1); font-size: var(--fs-xs); line-height: 1.45; color: var(--muted); }
.shop-line a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.shop-line a:hover { color: var(--text); }
.shop-line details { display: inline; }
.shop-line summary { display: inline; cursor: pointer; list-style: none; text-decoration: underline dotted; text-underline-offset: 2px; }
.shop-line summary::-webkit-details-marker { display: none; }
.shop-fix-body, .shop-reason-body { display: block; margin-top: 2px; }
.shop-fix-body > * + *, .shop-reason-body > * + * { margin-top: 2px; }
.shop-report { display: inline; }
.shop-report button {
  appearance: none; background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.shop-line :is(button, summary, a):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
/* Your account's shop card: the store, then its one box for no links, close to the Save under it. */
.account-shop .confirm { align-items: center; margin: var(--s3) 0 var(--s2); }
.account-shop .confirm input { accent-color: var(--primary); }
