@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap");

/* ReefDose v2 — premium reef command-center theme */

:root {
  /* Ocean Depths system */
  --bg: #04101d;
  --bg2: #061a2c;
  --card: rgba(9, 33, 56, 0.42);
  --card-solid: #0a2138;
  --glass: rgba(151, 204, 234, 0.05);
  --ink: #e8f4fb;
  --muted: #7fa8c4;
  --accent: #2dd4c8;          /* refined turquoise */
  --accent-soft: rgba(45, 212, 200, 0.14);
  --accent2: #ff8a5c;         /* coral orange, sparing */
  --good: #3ecf9a;
  --warn: #e8b04b;
  --danger: #e86a6a;
  --line: rgba(125, 180, 216, 0.13);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 14px 40px rgba(2, 8, 16, 0.5);
  --font-display: "Space Grotesk", "Sora", "Segoe UI Variable Display", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-num: "Space Grotesk", "Inter", system-ui, sans-serif;
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: linear-gradient(180deg, #0d4a5c 0%, #0a3242 15%, #071e2f 35%, #04121f 60%, #020a12 100%) fixed;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
  letter-spacing: 0.01em;
}

h1, h2, h3, .rs-verdict, .stat-num, .p-val, .rsp-val, .prof-name, h1#tank-name {
  font-family: var(--font-display);
  letter-spacing: -0.015em;
}
.rsp-val, .p-val, .stat-num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

#aq-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding: 20px 16px 10px;
}

.hero-media {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

#tank-img {
  width: 100%;
  height: auto;
  max-height: 46vh;
  min-height: 180px;
  object-fit: contain;
  background: #03182e;
  display: block;
  transition: transform 0.3s;
}

.img-edit {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(4, 16, 31, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(148, 197, 255, 0.25);
  font-size: 17px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-text {
  padding: 12px 6px 4px;
}

.hero-text h1 {
  margin: 0;
  font-size: 2rem;
  font-family: var(--font-display);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.hero-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- Pills ---------- */

.pill {
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid;
  display: inline-flex;
  align-items: center;
}

.pill.good {
  color: var(--good);
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.1);
}

.pill.warn {
  color: var(--warn);
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.1);
}

.pill.bad {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.1);
}

.pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  background: currentColor;
  animation: pulse 2s infinite;
}

/* ---------- XP badge ---------- */

.xp-badge {
  display: inline-block;
  background: linear-gradient(90deg, #22d3ee, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
  font-family: var(--font-display);
}

/* ---------- Layout ---------- */

main {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 14px 120px;
}

h2 {
  font-size: 1.12rem;
  margin: 22px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

h2::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), transparent);
}

/* ---------- Stat grid ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.stat {
  background: var(--card);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass);
  border-radius: 16px;
  padding: 12px 8px;
  text-align: center;
}

.stat-num {
  display: block;
  font-size: 1.45rem;
  font-weight: 800;
  background: linear-gradient(90deg, #e8f6ff, #8fc3e8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-family: var(--font-display);
}

.stat-label {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

/* ---------- Next dose ---------- */

.next-dose {
  background: var(--card);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass);
  border-left: 3px solid var(--accent2);
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.92rem;
  margin-top: 10px;
}

/* ---------- Alerts ---------- */

.alerts {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 8px;
}

.alerts li {
  background: rgba(248, 113, 113, 0.09);
  border: 1px solid rgba(248, 113, 113, 0.28);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.86rem;
}

/* ---------- Cards (today list) ---------- */

.cards {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 10px;
}

.card {
  background: linear-gradient(
    145deg,
    rgba(10, 44, 82, 0.72),
    rgba(7, 28, 51, 0.55)
  );
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass);
  border-radius: 18px;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.15s ease;
}

.card:active {
  transform: scale(0.98);
}

.card.done {
  opacity: 0.5;
}

.card .emoji {
  font-size: 1.5rem;
}

.card .body {
  flex: 1;
  min-width: 0;
}

.card .label {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card .sub {
  color: var(--muted);
  font-size: 0.82rem;
}

.card .ml {
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

.check {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid rgba(148, 197, 255, 0.3);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font-size: 1.2rem;
  flex: none;
  cursor: pointer;
}

.check.on {
  background: var(--good);
  border-color: var(--good);
  color: #04250f;
}

/* ---------- Parameter grid ---------- */

.param-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.pcard {
  background: var(--card);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass);
  border-radius: 16px;
  padding: 12px;
  position: relative;
}

.pcard .p-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pcard .p-val {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 4px 0;
  font-family: var(--font-display);
}

.pcard .p-unit {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: 3px;
  font-weight: 400;
}

.pcard.ok .p-val {
  color: var(--good);
}

.pcard.low .p-val,
.pcard.high .p-val {
  color: var(--danger);
}

.pcard.none .p-val {
  color: var(--muted);
}

.pcard .p-spark {
  margin-top: 6px;
}

.pcard .p-due {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.62rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.14);
  color: var(--warn);
}

.pcard .p-due.ok {
  background: rgba(52, 211, 153, 0.12);
  color: var(--good);
}

/* ---------- Test logger ---------- */

details#test-logger {
  background: var(--card);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass);
  border-radius: 16px;
  padding: 4px 12px;
  margin-top: 12px;
}

details#test-logger summary {
  padding: 10px 2px;
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  list-style: none;
}

details#test-logger summary::-webkit-details-marker {
  display: none;
}

details#test-logger form {
  padding-bottom: 12px;
}

.prow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.prow label {
  font-size: 0.72rem;
  color: var(--muted);
  display: block;
}

.prow label input {
  margin-top: 4px;
}

/* ---------- Chart tabs ---------- */

.chart-tabs {
  display: flex;
  gap: 6px;
  margin: 4px 0 12px;
}

.ctab {
  padding: 7px 14px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid rgba(148, 197, 255, 0.2);
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
}

.ctab.on {
  background: rgba(34, 211, 238, 0.15);
  border-color: var(--accent);
  color: var(--ink);
}

/* ---------- Chart grid ---------- */

.chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.chart-card {
  background: var(--card);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass);
  border-radius: 16px;
  padding: 12px;
}

.chart-card h3 {
  margin: 2px 0 8px;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.chart-card svg {
  width: 100%;
  height: auto;
}

/* ---------- Week grid ---------- */

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.day-col {
  background: var(--card);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass);
  border-radius: 12px;
  padding: 6px 2px;
  text-align: center;
  font-size: 0.68rem;
  color: var(--muted);
}

.day-col.today {
  outline: 2px solid var(--accent);
}

.day-col .d-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: center;
  margin-top: 4px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

/* ---------- Chips ---------- */

.chips {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: var(--card);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass);
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 0.85rem;
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.chip.off {
  opacity: 0.45;
  text-decoration: line-through;
}

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

input,
select,
textarea,
button {
  font: inherit;
  color: inherit;
}

input,
select,
textarea {
  width: 100%;
  box-sizing: border-box;
  background: rgba(3, 25, 48, 0.65);
  border: 1px solid rgba(148, 197, 255, 0.22);
  border-radius: 12px;
  padding: 9px 10px;
  font-size: 0.95rem;
  margin: 4px 0 10px;
}

input::placeholder {
  color: rgba(143, 195, 232, 0.55);
}

.noteslbl {
  font-size: 0.72rem;
  color: var(--muted);
  display: block;
}

.btn,
form button[type="submit"] {
  background: linear-gradient(135deg, #22d3ee, #0ea5e9);
  color: #03202e;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  padding: 12px;
  width: 100%;
  cursor: pointer;
  margin-top: 6px;
}

.ghost {
  background: transparent;
  border: 1px dashed rgba(148, 197, 255, 0.3);
  color: var(--muted);
  border-radius: 12px;
  padding: 10px;
  width: 100%;
  cursor: pointer;
}

.ghost.danger {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.4);
}

.danger {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.4);
}

/* ---------- FAB ---------- */

.fab {
  position: fixed;
  right: 18px;
  bottom: calc(60px + 22px); /* clear the bottom nav, stay above it */
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #fb923c);
  color: #fff;
  font-size: 1.7rem;
  border: none;
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.45);
  z-index: 40; /* above the nav (35) so it's always tappable */
  cursor: pointer;
}

/* ---------- Modals / sheet ---------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 12, 24, 0.66);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 40;
}

.modal.hidden,
.hidden {
  display: none;
}

.sheet {
  background: var(--card-solid);
  width: 100%;
  max-width: 680px;
  border-radius: 22px 22px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  max-height: 82vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: slideUp 0.22s ease-out;
}

.sheet h3 {
  margin: 6px 0 12px;
  font-family: var(--font-display);
}

.sheet .close {
  float: right;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--muted);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
}

/* ---------- Catalog results ---------- */

#catalog-results {
  list-style: none;
  padding: 0;
  margin: 10px 0;
}

#catalog-results li {
  padding: 10px;
  border-radius: 12px;
  cursor: pointer;
}

#catalog-results li:active,
#catalog-results li:hover {
  background: rgba(34, 211, 238, 0.12);
}

#catalog-results li .c-brand {
  color: var(--muted);
  font-size: 0.75rem;
  display: block;
}

#catalog-results li .verified {
  color: var(--good);
  font-size: 0.7rem;
}

/* ---------- Catalog recommendation chips ---------- */

.rec-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.rec-chips .chip {
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: 999px;
  line-height: 1.4;
  cursor: help;
}

.rec-chips .chip.pair {
  background: rgba(34, 197, 94, 0.16);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.rec-chips .chip.conflict {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

#catalog-results li .c-notes {
  color: var(--muted);
  font-size: 0.72rem;
  display: block;
  margin-top: 4px;
  line-height: 1.45;
}

#catalog-results li .added-tag {
  display: inline-block;
  margin-top: 6px;
  color: #22d3ee;
  font-size: 0.7rem;
  font-weight: 600;
}

/* ---------- Manual dose override row ---------- */

.dose-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.07);
  margin-bottom: 8px;
}

.dose-row label {
  font-size: 0.8rem;
  font-weight: 600;
}

.dose-row .muted {
  font-size: 0.75rem;
}

.dose-row input {
  width: 90px;
}

.dose-row small {
  flex-basis: 100%;
  font-size: 0.7rem;
}

/* ---------- Day buttons ---------- */

.days {
  display: flex;
  gap: 5px;
  margin: 6px 0 10px;
}

.day-btn {
  flex: 1;
  padding: 8px 0;
  background: rgba(3, 25, 48, 0.65);
  border: 1px solid rgba(148, 197, 255, 0.22);
  border-radius: 9px;
  color: var(--muted);
  font-size: 0.72rem;
  cursor: pointer;
}

.day-btn.on {
  background: rgba(34, 211, 238, 0.25);
  border-color: var(--accent);
  color: var(--ink);
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-solid);
  color: var(--ink);
  border: 1px solid rgba(34, 211, 238, 0.5);
  padding: 10px 18px;
  border-radius: 999px;
  z-index: 50;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  animation: pop 0.18s ease-out;
}

/* ---------- Mini list ---------- */

.mini-list {
  list-style: none;
  padding: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.mini-list li {
  display: flex;
  justify-content: space-between;
  padding: 6px 2px;
  border-bottom: 1px solid rgba(148, 197, 255, 0.08);
}

/* ---------- Animations ---------- */

@keyframes pulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}

@keyframes pop {
  from {
    transform: translateX(-50%) scale(0.85);
    opacity: 0;
  }
}

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

@media (max-width: 380px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 340px) {
  .param-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 480px) {
  .hero-text h1 {
    font-size: 2.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pill .dot,
  .sheet,
  .toast,
  .card,
  #tank-img {
    animation: none;
    transition: none;
  }
}

/* ---------- v3 ---------- */

/* View router */
.view {
  display: none;
}
.view.on {
  display: block;
  animation: viewIn 0.25s ease-out;
}
@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* Bottom navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  background: rgba(4, 16, 31, 0.82);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-top: 1px solid rgba(148, 197, 255, 0.12);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  z-index: 35;
}
.nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.62rem;
  padding: 6px 2px;
  border-radius: 12px;
  letter-spacing: 2px;
}
.nav-ico {
  font-size: 1.35rem;
  line-height: 1;
  transition: transform 0.18s ease;
}
.nav-btn.on {
  color: var(--accent);
}
.nav-btn.on .nav-ico {
  transform: translateY(-2px) scale(1.15);
}
main {
  padding-bottom: 96px;
}

/* Dose-complete button */
.check.big {
  width: 54px;
  height: 54px;
  font-size: 1.5rem;
}
.check.popping {
  animation: popCheck 0.45s cubic-bezier(0.2, 2.2, 0.4, 1);
}
@keyframes popCheck {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.28) rotate(8deg);
    background: var(--good);
  }
  100% {
    transform: scale(1);
  }
}

/* Confetti */
.confetti {
  position: fixed;
  width: 9px;
  height: 9px;
  pointer-events: none;
  z-index: 90;
  animation: confettiFly 1.2s cubic-bezier(0.15, 0.6, 0.4, 1) forwards;
}
@keyframes confettiFly {
  from {
    transform: translate(0, 0) rotate(0deg);
    opacity: 1;
  }
  to {
    transform: translate(var(--dx), calc(var(--dy) + 240px)) rotate(calc(var(--rot) * 3));
    opacity: 0;
  }
}

/* XP pop */
.xp-pop {
  position: fixed;
  z-index: 91;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--accent);
  text-shadow: 0 1px 8px rgba(34, 211, 238, 0.5);
  pointer-events: none;
  animation: xpFloat 0.9s ease-out forwards;
}
@keyframes xpFloat {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-46px);
  }
}

/* Achievements grid */
.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.ach {
  background: var(--card);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass);
  border-radius: 14px;
  padding: 10px;
  text-align: center;
  opacity: 0.45;
}
.ach.unlocked {
  opacity: 1;
  border-color: rgba(251, 191, 36, 0.35);
}
.ach .ach-ico {
  font-size: 1.6rem;
}
.ach .ach-nm {
  font-size: 0.78rem;
  font-weight: 700;
  margin: 4px 0 2px;
}
.ach .ach-ds {
  font-size: 0.66rem;
  color: var(--muted);
}

/* Achievement toast */
.ach-toast {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #1e3a5f, #0a2c52);
  border: 1px solid rgba(251, 191, 36, 0.5);
  border-radius: 16px;
  padding: 10px 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  z-index: 95;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: achSlide 0.3s ease-out;
}
.ach-toast.hidden {
  display: none;
}
.ach-medal {
  font-size: 1.7rem;
  animation: medalSpin 0.6s ease-out;
}
@keyframes achSlide {
  from {
    transform: translateX(-50%) translateY(-80px);
  }
}
@keyframes medalSpin {
  from {
    transform: rotate(-180deg) scale(0);
  }
}

/* Maintenance cards */
.maint-item.done-recently {
  border-left: 3px solid var(--good);
}
.maint-item .due-badge {
  font-size: 0.64rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.15);
  color: var(--warn);
}
.maint-item .due-badge.ok {
  background: rgba(52, 211, 153, 0.12);
  color: var(--good);
}
.maint-item .due-badge.over {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
}

/* Livestock grid */
.ls-grid {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.ls-card {
  background: var(--card);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass);
  border-radius: 16px;
  overflow: hidden;
}
.ls-card img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
}
.ls-card .ls-body {
  padding: 8px 10px;
}
.ls-card .ls-name {
  font-weight: 700;
  font-size: 0.9rem;
}
.ls-card .ls-meta {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 2px;
}
.ls-card .ls-actions {
  display: flex;
  gap: 6px;
  padding: 0 10px 10px;
}
.ls-card .ls-actions button {
  flex: 1;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid rgba(148, 197, 255, 0.2);
  background: rgba(3, 25, 48, 0.5);
  color: var(--ink);
  font-size: 0.72rem;
}
.ls-card .ls-care {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.35;
}

/* species autocomplete */
.autocomplete {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  list-style: none;
  margin: 0;
  padding: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow);
}
.autocomplete li {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.autocomplete li:hover, .autocomplete li.active {
  background: var(--accent-soft);
}
.autocomplete .sp-kind {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: capitalize;
}

/* Equipment grid */
.eq-grid {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.eq-card {
  background: var(--card);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.eq-card .eq-ico {
  font-size: 1.6rem;
}
.eq-card .eq-body {
  flex: 1;
  min-width: 0;
}
.eq-card .eq-name {
  font-weight: 700;
  font-size: 0.92rem;
}
.eq-card .eq-meta {
  font-size: 0.7rem;
  color: var(--muted);
}
.eq-card button {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 197, 255, 0.25);
  background: rgba(3, 25, 48, 0.5);
  color: var(--ink);
  font-size: 0.74rem;
}

/* Swipeable cards */
.card.swiping {
  transform: translateX(var(--sw, 0px));
  opacity: calc(1 - min(1, var(--sw) / -160));
  transition: none;
}
.card.swipe-gone {
  transform: translateX(-120vw);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s;
}

/* Reduced motion (v3) */
@media (prefers-reduced-motion: reduce) {
  .view.on,
  .nav-ico,
  .nav-btn.on .nav-ico,
  .check.popping,
  .confetti,
  .xp-pop,
  .ach-toast,
  .ach-medal,
  .card.swiping,
  .card.swipe-gone {
    animation: none;
    transition: none;
  }
}

/* ---- v4: auth + community + comments ---- */
.auth-overlay { position: fixed; inset: 0; z-index: 80; background: radial-gradient(900px 500px at 50% -10%, #0b2a4a 0%, #04101f 60%); display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-overlay.hidden { display: none; }
.auth-card { width: 100%; max-width: 380px; text-align: center; background: rgba(10,44,82,0.6); backdrop-filter: blur(16px); border: 1px solid rgba(148,197,255,0.14); border-radius: 24px; padding: 28px 22px; box-shadow: 0 18px 50px rgba(2,10,24,0.55); }
.auth-logo { font-size: 3rem; margin-bottom: 4px; }
.auth-card h1 { margin: 4px 0 2px; font-size: 1.6rem; }
.auth-card form { margin-top: 18px; text-align: left; }
.auth-card input { width: 100%; box-sizing: border-box; background: rgba(3,25,48,0.65); border: 1px solid rgba(148,197,255,0.22); border-radius: 12px; padding: 12px; margin: 6px 0; color: var(--ink); font-size: 1rem; }
.btn-primary { width: 100%; background: linear-gradient(135deg, #22d3ee, #0ea5e9); color: #03202e; font-weight: 700; border: none; border-radius: 12px; padding: 12px; margin-top: 10px; font-size: 1rem; }
.auth-err { color: var(--danger); font-size: 0.8rem; margin: 8px 0 0; }
.auth-switch { margin-top: 16px; font-size: 0.85rem; }
.linklike { background: none; border: none; color: var(--accent); text-decoration: underline; padding: 0; font-size: inherit; }

.account-chip { background: rgba(148,197,255,0.1); border: 1px solid rgba(148,197,255,0.22); color: var(--ink); border-radius: 999px; padding: 5px 13px; font-size: 0.8rem; font-weight: 600; cursor: pointer; }
.account-menu { position: relative; display: inline-block; }
.account-dropdown { position: absolute; top: calc(100% + 6px); right: 0; background: rgba(7,28,51,0.95); border: 1px solid rgba(148,197,255,0.25); border-radius: 12px; padding: 6px; min-width: 160px; backdrop-filter: blur(12px); z-index: 90; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.account-dropdown.hidden { display: none; }
.account-dropdown button { display: block; width: 100%; background: none; border: none; color: var(--ink); text-align: left; padding: 10px 12px; border-radius: 8px; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.account-dropdown button:hover { background: rgba(148,197,255,0.12); }
.account-dropdown button + button { border-top: 1px solid rgba(148,197,255,0.1); }

.logout-corner { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 10px); right: 12px; z-index: 80; background: rgba(7,28,51,0.82); border: 1px solid rgba(148,197,255,0.3); color: var(--ink); border-radius: 999px; padding: 8px 16px; font-size: 0.82rem; font-weight: 700; backdrop-filter: blur(10px); min-height: 44px; }
.logout-corner:active { background: rgba(148,197,255,0.28); }
.logout-corner.hidden { display: none; }

.viewing-banner { background: linear-gradient(90deg, rgba(251,191,36,0.12), rgba(251,191,36,0.04)); border: 1px solid rgba(251,191,36,0.3); color: #fde68a; border-radius: 14px; padding: 10px 14px; font-size: 0.88rem; margin: 10px 0; }
.viewing-banner.hidden { display: none; }

.community-list { list-style: none; padding: 0; display: grid; gap: 12px; }

.comm-photos-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 2px; }
.comm-photos-head h2 { margin: 0; }
.comm-photo-btn { padding: 9px 16px; font-size: 0.85rem; min-height: 44px; }
.comm-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 12px 0 8px; }
.comm-photo-card { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid rgba(148,197,255,0.14); background: rgba(7,28,51,0.55); }
.comm-photo-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; }
.comm-photo-card .cp-cap { padding: 7px 9px; font-size: 0.75rem; color: var(--ink); min-height: 28px; }
.comm-photo-card .cp-cap .cp-by { display: block; color: rgba(148,197,255,0.75); font-size: 0.68rem; margin-top: 2px; }
.comm-photo-card .cp-del { position: absolute; top: 6px; right: 6px; z-index: 2; background: rgba(7,28,51,0.85); border: 1px solid rgba(148,197,255,0.35); color: var(--ink); border-radius: 999px; width: 30px; height: 30px; font-size: 0.85rem; line-height: 1; }
.comm-photo-empty { grid-column: 1 / -1; text-align: center; padding: 26px 10px; border: 1px dashed rgba(148,197,255,0.25); border-radius: 14px; color: var(--muted); font-size: 0.88rem; }
.tank-card { display: flex; gap: 12px; background: linear-gradient(145deg, rgba(10,44,82,0.72), rgba(7,28,51,0.55)); backdrop-filter: blur(14px); border: 1px solid rgba(148,197,255,0.12); border-radius: 18px; padding: 12px; align-items: center; cursor: pointer; transition: transform 0.15s ease; }
.tank-card:active { transform: scale(0.98); }
.tank-card.mine { border-color: rgba(34,211,238,0.45); }
.tank-card img { width: 86px; height: 66px; object-fit: cover; border-radius: 12px; background: #03182e; flex: none; }
.tank-card .tc-ph { width: 86px; height: 66px; border-radius: 12px; background: linear-gradient(145deg, #0b3a63, #07253f); display: flex; align-items: center; justify-content: center; font-size: 1.8rem; flex: none; }
.tc-body { flex: 1; min-width: 0; }
.tc-name { font-weight: 700; font-size: 0.95rem; }
.tc-meta { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.tc-badges { display: flex; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.tc-badge { font-size: 0.62rem; padding: 2px 8px; border-radius: 999px; background: rgba(148,197,255,0.1); color: var(--muted); }
.tc-badge.good { background: rgba(52,211,153,0.12); color: var(--good); }
.tc-badge.warn { background: rgba(251,191,36,0.12); color: var(--warn); }

.comment-form { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.comment-form textarea { width: 100%; background: rgba(3,25,48,0.65); border: 1px solid rgba(148,197,255,0.22); border-radius: 12px; padding: 12px; color: var(--ink); font: inherit; font-size: 1rem; line-height: 1.45; resize: vertical; min-height: 84px; box-sizing: border-box; }
.comment-form button { background: linear-gradient(135deg, #22d3ee, #0ea5e9); color: #03202e; font-weight: 700; border: none; border-radius: 12px; padding: 14px 20px; font-size: 1rem; min-height: 48px; width: 100%; }
.comments-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.comment { background: rgba(10,44,82,0.5); border: 1px solid rgba(148,197,255,0.1); border-radius: 14px; padding: 12px 14px; }
.comment .c-head { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--muted); margin-bottom: 5px; }
.comment .c-body { font-size: 1rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.comment .c-del { background: none; border: none; color: var(--danger); font-size: 0.8rem; padding: 4px; min-height: 32px; }

/* ---- v5 dashboard ---- */

:root {
  --coral: #ff7f50;
  --coral-soft: rgba(255, 127, 80, 0.15);
  --teal-glow: rgba(34, 211, 238, 0.35);
}

/* Greeting card */
.greeting-card {
  background: linear-gradient(135deg, rgba(255, 127, 80, 0.16), rgba(34, 211, 238, 0.08));
  border: 1px solid var(--glass);
  border-left: 4px solid var(--coral);
  border-radius: var(--radius);
  padding: 18px;
  margin: 4px 0 16px;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.greeting-card h2 {
  margin: 0;
  font-size: 1.6rem;
  font-family: var(--font-display);
  letter-spacing: 0;
}
.greeting-card h2::before { display: none; }
.greeting-card .muted { margin: 6px 0 0; font-size: 0.95rem; }

/* Dash grid + cards */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}
.dash-card {
  background: var(--card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.dc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.dc-ico {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex: none;
}
.dc-ico.coral { background: var(--coral-soft); color: var(--coral); }
.dc-ico.teal { background: rgba(34, 211, 238, 0.14); color: var(--accent); }
.dash-card h2 {
  font-size: 1.05rem;
  letter-spacing: 0.2px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-card h2::before { display: none; }

/* 6-stat overview */
#view-dashboard .stat-grid { grid-template-columns: repeat(3, 1fr); }

/* stat pop */
@keyframes pop-in {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.stat-num { animation: pop-in 0.4s ease-out; }

/* Empty states */
.empty-state {
  border: 1px dashed rgba(148, 197, 255, 0.3);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  display: block;
}
.mini-list .empty-state { text-align: left; }

/* Next-dose highlight pill */
#next-dose {
  border-left: 4px solid var(--coral);
  background: var(--coral-soft);
  margin: 0 0 12px;
}

/* Mini list head */
.mini-head {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin: 14px 0 6px;
}

/* Dashboard mini charts */
.dash-charts .chart-card { min-height: 120px; }
.dash-spark { margin-top: 4px; }

/* Dashboard chart range tabs */
.dctab {
  padding: 7px 14px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid rgba(148, 197, 255, 0.2);
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
}
.dctab.on {
  background: rgba(34, 211, 238, 0.15);
  border-color: var(--accent);
  color: var(--ink);
}

/* Touch target + form polish */
.ghost, .btn-primary { min-height: 44px; font-size: 1rem; }
.prow input, #params-form input { font-size: 1rem; padding: 11px 12px; }
.modal input, .modal select { font-size: 1rem; }

/* Test-logger summary as a chip-button */
details#test-logger {
  background: transparent;
  border: none;
  padding: 0;
  margin-top: 14px;
}
details#test-logger summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(34, 211, 238, 0.14);
  border: 1px solid rgba(34, 211, 238, 0.45);
  border-radius: 999px;
  padding: 10px 18px;
  min-height: 44px;
  color: var(--ink);
  font-weight: 600;
  list-style: none;
}
details#test-logger summary::-webkit-details-marker { display: none; }
#params-form button[type="submit"] { min-height: 48px; font-size: 1rem; }

/* Responsive */
@media (max-width: 700px) {
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  #view-dashboard .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .stat-num { animation: none; }
}

/* ---- v18 auth polish (step 9) ---- */
.field-label { display:block; text-align:left; font-size:.78rem; font-weight:600;
  color:#3d5c5b; margin:10px 0 4px; letter-spacing:.02em; }
.pw-wrap { position:relative; }
.pw-wrap input { width:100%; padding-right:44px; box-sizing:border-box; }
.pw-toggle { position:absolute; right:6px; top:50%; transform:translateY(-50%);
  background:none; border:none; cursor:pointer; font-size:1rem; opacity:.55; padding:4px; }
.pw-toggle:hover { opacity:1; }
.btn-primary.loading { opacity:.7; pointer-events:none; }
.btn-primary.loading::after { content:"…"; }

/* ============ product-first dosing (v24) ============ */

.search-wrap { position: relative; margin: 8px 0 4px; }
.search-wrap #catalog-search { padding-right: 40px; }
.search-ico { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 16px; opacity: .7; }

.search-status { color: var(--muted, #8ca); font-size: 13px; padding: 4px 2px; }
.searching-row { color: var(--muted, #8ca); font-size: 14px; text-align: center; padding: 14px 6px; list-style: none; }

/* found card */
.found-card { border: 2px solid #22c55e; border-radius: 16px; padding: 14px; margin: 10px 0; background: rgba(34,197,94,.07); }
.fc-head { font-weight: 700; color: #22c55e; font-size: 13px; letter-spacing: .4px; text-transform: uppercase; margin-bottom: 8px; }
.fc-name, .cp-name, .prof-name { font-size: 19px; font-weight: 800; margin: 2px 0; }
.fc-brand, .cp-brand, .prof-brand { font-size: 13px; opacity: .75; }
.fc-purpose, .prof-purpose { font-size: 13px; margin-top: 6px; }
.fc-prov-chips, .fc-provides { margin-top: 8px; }
.fc-actions, .cp-actions { display: flex; gap: 10px; margin-top: 12px; }
.fc-actions button, .cp-actions button { flex: 1; }

/* confirm panel */
.confirm-panel { border: 2px dashed #f59e0b; border-radius: 16px; padding: 14px; margin: 10px 0; background: rgba(245,158,11,.06); }
.cp-q { font-size: 14px; font-weight: 600; margin-bottom: 8px; }

/* ranked result rows */
.result-row { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.05); margin: 8px 0; cursor: pointer; list-style: none; }
.rr-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.rr-main strong { font-size: 15px; }
.rr-purpose { font-size: 12px; opacity: .7; flex-basis: 100%; }
.best-match { font-size: 11px; font-weight: 700; color: #fbbf24; border: 1px solid #fbbf24; border-radius: 999px; padding: 2px 8px; }
.added-tag { font-size: 11px; color: #22c55e; font-weight: 700; }
.rr-prov { display: flex; flex-wrap: wrap; gap: 4px; }

/* provides chips */
.prov-chip { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(56,189,248,.15); color: #7dd3fc; border: 1px solid rgba(56,189,248,.3); }

/* product cards on dosing tab */
.prod-cards { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.prod-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: rgba(255,255,255,.05); cursor: pointer; }
.prod-card.off { opacity: .45; }
.prod-card.empty { justify-content: center; color: var(--muted, #8ca); cursor: default; }
.pc-emoji { font-size: 24px; }
.pc-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.pc-main strong { font-size: 15px; }
.pc-brand { font-size: 12px; opacity: .7; }
.pc-dose { font-size: 13px; font-weight: 700; color: #7dd3fc; white-space: nowrap; }
.prod-hint { font-size: 12px; margin-top: 6px; }

/* profile sheet */
.profile-sheet { position: absolute; inset: 0; z-index: 60; display: flex; align-items: flex-end; background: rgba(0,0,0,.5); }
.profile-sheet.hidden { display: none; }
.profile-sheet .sheet { position: relative; max-height: 86vh; overflow-y: auto; }
.prof-emoji { font-size: 40px; margin-bottom: 4px; }
.prof-name { margin-top: 2px; }
.prof-brand { margin-bottom: 8px; }
.prof-provides { display: flex; flex-wrap: wrap; gap: 4px; }
.prof-dose { font-size: 14px; padding: 8px 12px; border-radius: 10px; background: rgba(255,255,255,.06); }
.prof-dose.you { color: #7dd3fc; font-weight: 700; }
.prof-inters { display: flex; flex-direction: column; gap: 8px; }
.prof-inter { padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.05); }
.prof-inter.ok { border-left: 4px solid #22c55e; }
.prof-inter.caution { border-left: 4px solid #f59e0b; }
.prof-inter.duplication { border-left: 4px solid #ef4444; }
.pi-head { font-size: 14px; }
.pi-why { font-size: 12px; opacity: .8; margin-top: 4px; }
#profile-body h4 { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; opacity: .7; }
.loading { color: var(--muted, #8ca); font-size: 13px; padding: 8px 0; }

/* interactions + recs on dosing tab */
.inter-row { padding: 10px 12px; border-radius: 12px; background: rgba(239,68,68,.08); border-left: 4px solid #ef4444; margin-bottom: 8px; }
.ir-head { font-size: 14px; }
.ir-why { font-size: 12px; opacity: .8; margin-top: 4px; }
.all-good { font-size: 13px; color: #22c55e; padding: 4px 0; }
.rec-group { margin-bottom: 12px; }
.rg-title { font-size: 12px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; margin-bottom: 6px; opacity: .85; }
.rec-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; padding: 8px 12px; border-radius: 10px; background: rgba(255,255,255,.05); margin-bottom: 6px; }
.rec-row strong { font-size: 14px; }
.rec-row span { font-size: 12px; opacity: .75; flex-basis: 100%; }
.rec-row.dont { background: rgba(239,68,68,.07); }
.rec-row.consider { background: rgba(34,197,94,.07); }

/* ============ tank-aware interactions (v26) ============ */
.prof-role { font-size: 14px; padding: 10px 12px; border-radius: 10px; background: rgba(56,189,248,.1); border-left: 4px solid #38bdf8; margin-top: 10px; }
.prof-watch { font-size: 13px; padding: 8px 12px; border-radius: 10px; background: rgba(245,158,11,.08); }
.pi-does { font-size: 12px; color: #7dd3fc; margin-top: 4px; }
.pi-watch { font-size: 12px; opacity: .8; margin-top: 4px; font-style: italic; }
.tank-note { padding: 10px 12px; border-radius: 12px; background: rgba(34,197,94,.07); border-left: 4px solid #22c55e; margin-bottom: 8px; }
.tn-topic { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.tn-note { font-size: 13px; opacity: .85; line-height: 1.45; }

/* ============ tests tab history (v29) ============ */
.hist-row { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.03); margin-bottom: 6px; }
.hist-date { font-size: 12px; opacity: .7; min-width: 84px; }
.hist-bits { flex: 1; font-size: 13px; }
.hist-actions { display: flex; gap: 4px; }
.mini-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.05); color: #cfe8ff; font-size: 13px; cursor: pointer; }
.mini-btn:active { transform: scale(.94); }
.mini-btn.danger { color: #fca5a5; border-color: rgba(252,165,165,.25); }

/* ============ command-center dashboard (v31) ============ */
.status-card { background: linear-gradient(145deg, rgba(34,211,238,.07), rgba(14,30,48,.35)); }
.rs-top { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.rs-verdict { font-size: 1.15rem; font-weight: 800; letter-spacing: .2px; }
.rs-sub { font-size: 13px; opacity: .75; margin-top: 2px; }
.rs-meta { display: grid; gap: 3px; font-size: 12px; }
.rs-meta-row { display: flex; gap: 8px; justify-content: space-between; min-width: 150px; }
.rs-meta-row span { opacity: .6; }
.rs-params { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 14px; }
.rsp { padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); cursor: pointer; transition: transform .12s, border-color .12s; }
.rsp:active { transform: scale(.97); }
.rsp.good { border-left: 3px solid #34d399; }
.rsp.warn { border-left: 3px solid #fbbf24; }
.rsp.bad { border-left: 3px solid #f87171; }
.rsp.untested { border-left: 3px solid rgba(255,255,255,.15); opacity: .6; }
.rsp-name { font-size: 11px; opacity: .7; }
.rsp-val { font-size: 1.25rem; font-weight: 700; margin: 2px 0; }
.rsp-unit { font-size: 11px; font-weight: 400; opacity: .6; margin-left: 3px; }
.rsp-st { font-size: 11px; }
.range-tabs { display: flex; gap: 4px; margin-left: auto; }
.rtab { padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.12); background: transparent; color: #9fc6e8; font-size: 12px; cursor: pointer; }
.rtab.on { background: rgba(34,211,238,.18); border-color: rgba(34,211,238,.5); color: #7dd3fc; }
.param-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.pchip { padding: 5px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04); color: #cfe8ff; font-size: 12.5px; cursor: pointer; transition: all .12s; }
.pchip.on { background: rgba(34,211,238,.2); border-color: rgba(34,211,238,.6); color: #7dd3fc; font-weight: 600; }
.pchip.dim { opacity: .45; }
.graph-foot { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; opacity: .85; padding: 8px 2px 0; border-top: 1px dashed rgba(255,255,255,.08); margin-top: 8px; }
.noted-list { list-style: none; padding: 0; margin: 0; }
.noted-item { padding: 9px 12px; border-radius: 10px; background: rgba(255,255,255,.035); margin-bottom: 6px; border-left: 3px solid #34d399; }
.noted-item:first-child { border-left-color: #22d3ee; }
.nt-topic { font-size: 13px; font-weight: 700; }
.nt-note { font-size: 12.5px; opacity: .75; margin-top: 1px; }
.nt-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.nt-action { padding: 5px 10px; border-radius: 8px; background: rgba(34, 211, 238, 0.1); border: 1px solid rgba(34, 211, 238, 0.35); color: #8ce8df; font-size: 12px; cursor: pointer; font-family: var(--font-body); }
.nt-action:hover { background: rgba(34, 211, 238, 0.2); }
.cards.compact .card { padding: 8px 10px; }
.view-dosing-link { margin-left: auto; font-size: 12.5px; color: #7dd3fc; }


/* ============ Ocean Depths refinement (v34) ============ */

/* main sections share the glass treatment */
main > section > section, #view-dashboard > section:not(.alerts), .dash-card {
  background: var(--card);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* headings: quiet, spaced, small-caps feel */
main h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #bfe0ef;
  opacity: 0.9;
}
main h2::before { content: none; }

/* muted text */
.muted { color: var(--muted) !important; }

/* status card: the instrument look */
.status-card {
  border: 1px solid rgba(45, 212, 200, 0.16);
  background: linear-gradient(160deg, rgba(13, 42, 66, 0.55), rgba(7, 22, 38, 0.45));
}
.rs-verdict { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; letter-spacing: 0.01em; }
.rs-sub { font-size: 12.5px; color: var(--muted); }
.rs-meta-row strong { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 600; }
.rsp { background: rgba(151, 204, 234, 0.045); border: 1px solid var(--line); }
.rsp.good { border-left: 2px solid var(--good); }
.rsp.warn { border-left: 2px solid var(--warn); }
.rsp.bad { border-left: 2px solid var(--danger); }
.rsp.untested { border-left: 2px solid rgba(151, 204, 234, 0.18); }
.rsp-val { font-size: 1.3rem; font-weight: 600; color: #eef8ff; }
.rsp-unit { color: var(--muted); }

/* graph card */
#graph-card { border: 1px solid rgba(45, 212, 200, 0.12); }
.pchip { background: rgba(151, 204, 234, 0.05); border: 1px solid var(--line); color: #cfe4f2; }
.pchip.on { background: var(--accent-soft); border-color: rgba(45, 212, 200, 0.55); color: #8ce8df; }
.rtab { border: 1px solid var(--line); color: var(--muted); }
.rtab.on { background: var(--accent-soft); border-color: rgba(45, 212, 200, 0.5); color: #8ce8df; }
.graph-foot { color: #a8cde0; border-top: 1px solid var(--line); }

/* buttons: restrained */
button, .btn-primary, input[type="submit"] {
  font-family: var(--font-body);
}
.btn-primary, form button[type="submit"], #pf-submit {
  background: linear-gradient(135deg, rgba(45, 212, 200, 0.9), rgba(34, 170, 170, 0.85));
  color: #03222a;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 18px rgba(45, 212, 200, 0.22);
}
.ghost, .linklike { color: var(--accent); }

/* inputs: dark glass */
input, select, textarea {
  background: rgba(4, 16, 28, 0.55) !important;
  border: 1px solid var(--line) !important;
  color: var(--ink) !important;
  border-radius: 10px !important;
  font-family: var(--font-body);
}
input::placeholder, textarea::placeholder { color: #5f8199; }
input:focus, textarea:focus, select:focus {
  outline: none !important;
  border-color: rgba(45, 212, 200, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(45, 212, 200, 0.12) !important;
}

/* pills / status */
.pill.good, .pill.ok { background: rgba(62, 207, 154, 0.13); color: #7fe3bd; border: 1px solid rgba(62, 207, 154, 0.35); }
.pill.warn { background: rgba(232, 176, 75, 0.12); color: #f0c877; border: 1px solid rgba(232, 176, 75, 0.35); }
.pill.bad { background: rgba(232, 106, 106, 0.12); color: #f0a0a0; border: 1px solid rgba(232, 106, 106, 0.35); }

/* bottom nav: glass bar */
.bottom-nav {
  background: rgba(5, 18, 31, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.bottom-nav button { color: #6f9ab5; }
.bottom-nav button.on { color: var(--accent); }
.bottom-nav button.on::after { background: var(--accent); }

/* FAB: quiet turquoise */
.fab {
  background: linear-gradient(135deg, #2dd4c8, #1da79e);
  box-shadow: 0 8px 26px rgba(45, 212, 200, 0.35);
}

/* charts: darker grid, crisper */
.reef-chart text { font-family: var(--font-num) !important; }

/* hero: instrument header */
.hero {
  background: linear-gradient(180deg, rgba(7, 26, 44, 0.0), rgba(4, 16, 28, 0.65));
}
.hero h1 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; }
.hero .pill { font-size: 12px; }

/* reduced motion: freeze ambient canvas, keep UI transitions */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}


/* quiet section heads (v35) */
.dc-head h2 { margin: 0; }
.status-card .dc-head, #graph-card .dc-head { margin-bottom: 10px; }


/* ── visitor (read-only) mode: hide owner-only affordances ────────────── */
.visitor-hidden { display: none !important; }
body.readonly .img-edit,
body.readonly .ls-actions,
body.readonly .hist-actions,
body.readonly .cp-del,
body.readonly .mini-btn,
body.readonly .eq-done,
body.readonly .check {
  display: none !important;
}
body.readonly .card .body, body.readonly .eq-card .eq-body, body.readonly .ls-card .ls-body {
  pointer-events: auto;
}
