:root {
  --ink: #17201b;
  --muted: #6f6a5f;
  --line: #e2d9cc;
  --paper: #fbf7ef;
  --panel: #ffffff;
  --green: #3f6f4f;
  --teal: #327c75;
  --amber: #b97915;
  --red: #aa3f35;
  --blue: #356b9a;
  --gold: #e2be6f;
  --sidebar-start: #3f7263;
  --sidebar-end: #254d43;
  --sidebar-border: #78a792;
  --sidebar-soft: rgba(239, 255, 247, 0.12);
  --sidebar-muted: #cbe3d6;
  --warm-panel: #fffaf2;
  --shadow: 0 18px 45px rgba(58, 47, 37, 0.13);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    linear-gradient(180deg, #f8f0e3 0%, #fbf7ef 240px, #f6efe5 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.hidden { display: none !important; }

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(140deg, rgba(58, 47, 37, 0.96), rgba(83, 67, 47, 0.93)),
    #4d3d2d;
}
.auth-card {
  width: min(1060px, 100%);
  min-height: 660px;
  display: grid;
  grid-template-columns: 1fr 430px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.auth-visual { min-height: 360px; }
.auth-visual img { width: 100%; height: 100%; object-fit: cover; display: block; }
.auth-form { padding: 34px; display: grid; align-content: center; gap: 14px; }
.auth-form h1 { font-size: 38px; }
.demo-logins { display: flex; gap: 10px; flex-wrap: wrap; }
.form-message { min-height: 22px; color: var(--red); font-weight: 800; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
}
.sidebar {
  background:
    linear-gradient(180deg, var(--sidebar-start) 0%, var(--sidebar-end) 100%);
  color: #f5fff9;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand.large { color: var(--ink); }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--gold);
  color: #14231b;
  font-weight: 900;
}
.brand span, .sidebar-panel p, .user-badge span { display: block; color: var(--sidebar-muted); font-size: 13px; margin: 3px 0 0; }
.auth-form .brand span { color: var(--muted); }
.user-badge {
  padding: 12px;
  border: 1px solid var(--sidebar-border);
  border-radius: 8px;
  background: var(--sidebar-soft);
  display: grid;
  gap: 6px;
}
.nav { display: grid; gap: 6px; }
.nav button {
  color: #f1fff8;
  background: transparent;
  border: 1px solid transparent;
  padding: 10px 12px;
  text-align: left;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav button.active, .nav button:hover { background: rgba(239, 255, 247, 0.14); border-color: var(--sidebar-border); }
.nav .glyph { width: 22px; color: var(--gold); }
.sidebar-panel {
  margin-top: auto;
  padding: 14px;
  background: var(--sidebar-soft);
  border: 1px solid var(--sidebar-border);
  border-radius: 8px;
}
.sidebar-task-link {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #f4fff8;
  font: inherit;
  font-size: 12px;
  padding: 5px 0;
  cursor: pointer;
}
.sidebar-task-link:hover {
  color: var(--gold);
  text-decoration: underline;
}

.main {
  min-width: 0;
  padding: 24px;
  background:
    radial-gradient(circle at top right, rgba(226, 190, 111, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(255, 251, 244, 0.92), rgba(248, 241, 230, 0.88));
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}
.top-actions, .row-actions, .toolbar, .filter-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar { justify-content: space-between; margin-bottom: 10px; }
.activity-heading small { display: block; color: var(--muted); margin-top: 4px; font-weight: 700; }
.activity-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(6, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
  margin: 12px 0 16px;
}
.activity-controls label { margin: 0; }
.activity-controls input, .activity-controls select { min-height: 40px; }
h1, h2, h3 { margin: 0; line-height: 1.1; }
h1 { font-size: clamp(26px, 4vw, 42px); }
h2 { font-size: 21px; }
h3 { font-size: 16px; }
p { line-height: 1.45; }
.label, .eyebrow {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
  margin: 0 0 4px;
}
.sidebar .label { color: var(--gold); }

.button, .icon-button, .text-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 38px;
  background: #fff;
  color: var(--ink);
}
.button { padding: 0 14px; font-weight: 800; }
.button.primary { background: var(--green); border-color: var(--green); color: #fff; }
.button.secondary { background: #eef3ef; }
.button.danger { background: #fff0ed; border-color: #f1c6bf; color: var(--red); }
.button:disabled { opacity: 0.55; cursor: not-allowed; }
.icon-button { width: 38px; display: grid; place-items: center; font-size: 18px; }
.icon-button.has-notifications {
  background: #bb3e3e;
  border-color: #9f2929;
  color: #fff;
  font-weight: 900;
  box-shadow: 0 0 0 3px rgba(187, 62, 62, 0.14);
}
.icon-button.has-urgent-notifications {
  animation: notificationPulse 1.5s ease-in-out infinite;
}
@keyframes notificationPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(187, 62, 62, 0.14); }
  50% { box-shadow: 0 0 0 7px rgba(187, 62, 62, 0.22); }
}
.text-button {
  border: 0;
  background: transparent;
  color: var(--green);
  min-height: auto;
  padding: 0;
  font-weight: 900;
  text-align: left;
}

.hero {
  position: relative;
  height: clamp(170px, 24vw, 270px);
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(10, 22, 16, 0.06), rgba(10, 22, 16, 0.78));
}
.hero-overlay {
  position: absolute;
  right: 24px;
  bottom: 20px;
  z-index: 1;
  color: white;
  max-width: 520px;
  font-weight: 800;
  font-size: clamp(18px, 2.5vw, 28px);
}
.hero-overlay span { color: var(--gold); font-size: 13px; text-transform: uppercase; letter-spacing: 0; }
.hero-overlay p { margin: 5px 0 0; }

.quick-log {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 18px;
}
.quick-log form {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.2fr 1.6fr auto;
  gap: 10px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
}
.global-search { min-width: min(330px, 100%); }
textarea { resize: vertical; }
label { color: var(--muted); font-weight: 800; font-size: 12px; display: grid; gap: 6px; }
.checkbox-line { display: flex; gap: 8px; align-items: flex-start; color: var(--ink); font-size: 13px; }
.checkbox-line input { width: auto; margin-top: 3px; }

.view { display: grid; gap: 16px; }
.grid { display: grid; gap: 14px; }
.grid.metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid.two { grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.75fr); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel, .animal-card, .task, .record, .listing-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.panel { padding: 16px; }
.metric { padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 8px; min-height: 112px; }
.metric strong { display: block; font-size: 28px; margin-top: 8px; overflow-wrap: anywhere; }
.metric span { color: var(--muted); font-size: 13px; font-weight: 700; }
.metric small, .fine-print { color: var(--muted); }

.animal-list, .market-grid, .store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}
.animal-card, .listing-card, .store-card { padding: 14px; display: grid; gap: 12px; }
.store-card { padding: 0; overflow: hidden; }
.store-card-body { padding: 14px; display: grid; gap: 12px; }
.animal-card header, .listing-card header, .store-card header { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.store-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 14px;
  padding: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.store-hero h2 { font-size: clamp(26px, 4vw, 44px); }
.store-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.store-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 180px auto;
  gap: 10px;
  align-items: center;
}
.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  min-height: 40px;
}
.segmented button {
  border: 0;
  background: #fff;
  padding: 0 12px;
  font-weight: 900;
}
.segmented button.active { background: var(--green); color: #fff; }
.listing-media {
  min-height: 190px;
  padding: 18px;
  display: grid;
  align-content: end;
  gap: 8px;
  color: #fff;
  background:
    linear-gradient(145deg, rgba(58, 47, 37, 0.16), rgba(58, 47, 37, 0.76)),
    radial-gradient(circle at 20% 20%, #e2be6f, transparent 28%),
    linear-gradient(135deg, #3f6f4f, #806345 58%, #3a2f25);
}
.listing-media span {
  width: 58px;
  height: 58px;
  border: 2px solid rgba(255,255,255,0.6);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 900;
}
.listing-media strong { font-size: 20px; max-width: 260px; }
.facts.compact { grid-template-columns: 1fr; }
.store-table td:last-child { white-space: nowrap; }
.store-table td:last-child .button { margin: 2px; }
.listing-detail {
  padding: 16px;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
}
.listing-detail .listing-media { min-height: 420px; border-radius: 8px; }
.detail-main { display: grid; gap: 14px; }
.detail-price { color: var(--green); font-size: 30px; }
.price-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.price-row strong { font-size: 28px; }
.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 900;
  background: #e8f0eb;
  color: var(--green);
}
.badge.warn { background: #fff1d8; color: #87520c; }
.badge.danger { background: #ffe7e3; color: var(--red); }
.badge.blue { background: #e4eff8; color: var(--blue); }
.badge.owner { background: #fff1d8; color: #6a410d; }
.role-profile-button {
  border: 1px solid transparent;
  cursor: pointer;
  justify-self: start;
}
.role-profile-button:hover,
.role-profile-button:focus-visible {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(226, 190, 111, 0.22);
  outline: none;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex;
  gap: 5px;
  min-height: 24px;
  align-items: center;
  border-radius: 6px;
  padding: 2px 8px;
  background: #edf4f7;
  color: #28546e;
  font-size: 12px;
  font-weight: 900;
}
.tag.removable button {
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 900;
  padding: 0 2px;
  min-height: auto;
}
.search-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.search-input-row input { min-width: 0; }
.search-suggestion-strip, .search-type-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.suggestion-tag, .search-type {
  border: 1px solid #c8dde4;
  cursor: pointer;
}
.suggestion-tag:hover, .search-type:hover {
  background: #e0eff4;
}
.search-type.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.search-command-center .ops-grid {
  margin-top: 10px;
}
.reptile-select-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--warm-panel);
}
.reptile-match-grid {
  display: grid;
  gap: 8px;
}
.reptile-match {
  border-left: 4px solid var(--line);
}
.reptile-match.selected {
  border-left-color: var(--teal);
  background: #f2faf5;
}
.genetics-picker { grid-column: 1 / -1; }
.tag-picker {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.tag-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.fact { background: #f5f7f5; border-radius: 8px; padding: 9px; min-width: 0; }
.fact span { color: var(--muted); display: block; font-size: 12px; }
.fact strong { display: block; margin-top: 3px; overflow-wrap: anywhere; }

.task, .record {
  padding: 12px;
  display: grid;
  gap: 5px;
  min-width: 0;
}
.task { border-left: 5px solid var(--green); }
.task.overdue { border-left-color: var(--red); }
.task.soon { border-left-color: var(--amber); }
.task small, .record small { color: var(--muted); }
.records { display: grid; gap: 10px; }
.ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}
.ops-item {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--warm-panel);
}
.ops-item.action-ops {
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.ops-item.action-ops:hover {
  border-color: var(--gold);
  box-shadow: 0 6px 18px rgba(58, 47, 37, 0.10);
  transform: translateY(-1px);
}
.ops-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.ops-item strong {
  color: var(--ink);
  font-size: 18px;
  overflow-wrap: anywhere;
}
.ops-item small {
  color: var(--muted);
  line-height: 1.35;
}
.relationship-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}
.relationship-card { border-left: 4px solid var(--gold); }
.mini-lineage {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { border-bottom: 1px solid var(--line); padding: 10px; text-align: left; vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; color: var(--muted); }

.timeline { display: grid; gap: 10px; }
.timeline-item { display: grid; grid-template-columns: 120px 1fr; gap: 12px; }
.timeline-item time { color: var(--muted); font-weight: 800; font-size: 13px; }

dialog { border: 0; border-radius: 8px; box-shadow: var(--shadow); max-width: min(960px, 96vw); }
dialog::backdrop { background: rgba(17, 28, 22, 0.55); }
.modal-form { padding: 0; min-width: min(880px, 94vw); }
.modal-form header, .modal-form footer {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.modal-form footer { border-top: 1px solid var(--line); border-bottom: 0; justify-content: flex-end; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.modal-hint { color: var(--muted); font-size: 13px; padding: 0 16px 16px; }
.species-assistant {
  padding: 0 16px 16px;
}
.species-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  border-radius: 8px;
  padding: 12px;
  background: #f8faf8;
}
.species-card.custom { border-left-color: var(--amber); }
.species-card small { color: var(--muted); }
.care-suggestion {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  background: #eef6f3;
  border: 1px solid #cce1d9;
}
.care-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 14px;
}
.care-sheet {
  scroll-margin-top: 20px;
}
.care-links {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.care-links > strong {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}
.focus-pulse {
  animation: focusPulse 1.1s ease;
}
@keyframes focusPulse {
  0% { box-shadow: 0 0 0 0 rgba(40, 107, 79, 0.35); }
  70% { box-shadow: 0 0 0 12px rgba(40, 107, 79, 0); }
  100% { box-shadow: none; }
}
.suggestion-panel {
  display: grid;
  gap: 8px;
  padding-top: 4px;
}
.suggestion-panel > strong {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}
.suggestion-tag {
  border: 0;
  min-height: 26px;
  cursor: pointer;
}
.stack-form { display: grid; gap: 12px; }
.checkout-total { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-top: 1px solid var(--line); }
.checkout-total.grand { font-size: 20px; color: var(--green); }
.checklist { columns: 2; padding-left: 18px; }
.checklist li { margin-bottom: 8px; break-inside: avoid; }
.empty { color: var(--muted); padding: 24px; text-align: center; border: 1px dashed var(--line); border-radius: 8px; }
.confirmation-bar {
  position: fixed;
  left: 50%;
  top: 14px;
  transform: translate(-50%, -16px);
  min-width: min(520px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  background: #e8f5ee;
  color: #174631;
  border: 1px solid #a9d5bf;
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
  z-index: 40;
  text-align: center;
  font-weight: 900;
}
.confirmation-bar.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #4d3b29;
  color: #fff8ec;
  border: 1px solid #806345;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: 160ms ease;
  max-width: 360px;
  z-index: 41;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── WEIGHT SPARKLINES ───────────────────────────────────────────────────── */
.sparkline-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  padding: 6px 0 2px;
}
.sparkline-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sparkline-wrap svg { display: block; }

/* ── PHOTO GALLERY ───────────────────────────────────────────────────────── */
.card-hero-photo {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 6px;
  cursor: zoom-in;
  display: block;
}
.listing-card-photo {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
  border-radius: 6px 6px 0 0;
}
.listing-media-photo {
  position: relative;
}
.listing-media-photo::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10,22,16,0.82), rgba(10,22,16,0.1));
  border-radius: inherit;
}
.listing-media-photo strong {
  position: relative;
  z-index: 1;
}
.listing-media-placeholder {
  position: relative;
  background-color: #0f3d2c;
  background-size: cover;
  background-position: center;
}
.listing-media-placeholder strong { display: none; }
.photo-strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.photo-strip .photo-thumb, .photo-thumb {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  cursor: zoom-in;
}
.photo-upload-section {
  padding: 0 16px 16px;
  display: grid;
  gap: 10px;
}
.photo-strip-preview {
  min-height: 72px;
  border: 2px dashed var(--line);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  background: #f8faf8;
  transition: border-color 160ms;
}
.photo-strip-preview.drag-over {
  border-color: var(--green);
  background: #eef6f3;
}
.photo-thumb-wrap {
  position: relative;
  width: 66px;
  height: 66px;
}
.photo-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}
.photo-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 0;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  display: grid;
  place-items: center;
  padding: 0;
  min-height: auto;
  cursor: pointer;
}
.drop-zone { cursor: pointer; }

/* ── BATCH SELECT ────────────────────────────────────────────────────────── */
.card-select-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.card-checkbox input { width: auto; margin: 0; }
.selected-card { outline: 2px solid var(--green); }
.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #eef6f3;
  border-color: #a9d5bf;
}
.feeding-due-badge {
  font-size: 12px;
}

/* ── GENETICS CALCULATOR ─────────────────────────────────────────────────── */
.calc-controls {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  margin: 12px 0;
}
.calc-result { margin-top: 12px; }
.calc-outcome {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
}
.punnett-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.punnett-block {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.punnett-block h3 { font-size: 14px; }
.punnett-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.punnett-bar {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--green) calc(var(--pct) * 1%), var(--line) 0);
}

/* ── CALENDAR ────────────────────────────────────────────────────────────── */
.calendar-widget {
  display: grid;
  gap: 8px;
}
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 900;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-head {
  font-size: 11px;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
  padding: 4px 0;
}
.cal-cell {
  min-height: 42px;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
  position: relative;
  background: #f8faf8;
  border: 1px solid var(--line);
  display: grid;
  align-content: start;
  gap: 2px;
}
.cal-cell.empty { background: transparent; border-color: transparent; }
.cal-cell.cal-today { background: #eef6f3; border-color: var(--green); }
.cal-day { font-weight: 900; font-size: 12px; }
.cal-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
}
.cal-dot.feeding { background: var(--green); }
.cal-dot.task { background: var(--amber); }
.cal-dot.overdue { background: var(--red); }
.cal-legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
}
.cal-legend span { display: flex; align-items: center; gap: 5px; }

@media (max-width: 1120px) {
  .grid.metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-log form, .grid.two, .grid.three, .store-hero, .listing-detail { grid-template-columns: 1fr; }
  .store-controls, .activity-controls { grid-template-columns: 1fr 1fr; }
  .listing-detail .listing-media { min-height: 240px; }
}
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { grid-template-columns: repeat(2, 1fr); }
  .auth-card { grid-template-columns: 1fr; }
  .auth-visual { height: 260px; }
}
@media (max-width: 640px) {
  .main, .auth-gate { padding: 14px; }
  .auth-form { padding: 22px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .nav, .grid.metrics, .form-grid { grid-template-columns: 1fr; }
  .workload-grid { grid-template-columns: 1fr; }
  .report-layout { grid-template-columns: 1fr; }
  .search-input-row { grid-template-columns: 1fr; }
  .store-controls, .store-stats, .activity-controls { grid-template-columns: 1fr; }
  .hero-overlay { left: 16px; right: 16px; bottom: 16px; }
  .timeline-item { grid-template-columns: 1fr; }
  .checklist { columns: 1; }
  .facts { grid-template-columns: 1fr; }
}

/* ── ANALYTICS TABS ─────────────────────────────────────────────── */
.analytics-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--line);
  margin-bottom: 16px;
}
.tab-btn {
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background: #f8faf8;
  color: var(--muted);
  padding: 8px 16px;
  font-weight: 800;
  font-size: 13px;
  min-height: 36px;
  margin-bottom: -2px;
  border-bottom-color: var(--line);
  transition: 120ms;
}
.tab-btn.active {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
  border-bottom-color: var(--panel);
}
.tab-btn:hover:not(.active) {
  background: #eef3ef;
  color: var(--ink);
}

/* ── SVG CHARTS ─────────────────────────────────────────────────── */
.chart-figure {
  margin: 0;
  display: grid;
  gap: 8px;
}
.chart-figure figcaption {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
}
.chart-figure svg {
  display: block;
  overflow: visible;
}
.chart-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 700;
}
.chart-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 20px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

/* ── DONUT CHART ────────────────────────────────────────────────── */
.donut-figure .donut-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.donut-legend {
  display: grid;
  gap: 8px;
}
.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.donut-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ── AUTH PAGE REFRESH ───────────────────────────────────────────── */
.auth-card {
  grid-template-columns: 1fr 400px;
}
.auth-visual { position: relative; }
.auth-visual-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 24px;
  background: linear-gradient(to top, rgba(10,22,16,0.88), transparent);
  color: #fff;
}
.auth-visual-overlay strong {
  display: block;
  font-size: 22px;
  font-weight: 900;
  color: var(--gold);
}
.auth-visual-overlay p {
  margin: 6px 0 0;
  font-size: 14px;
  color: rgba(255,255,255,0.82);
}
.auth-form-wrap {
  padding: 34px;
  display: grid;
  align-content: start;
  gap: 18px;
}
.auth-tabs {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f8faf8;
}
.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px;
  font-weight: 800;
  font-size: 13px;
  color: var(--muted);
  transition: 120ms;
}
.auth-tab.active {
  background: var(--green);
  color: #fff;
}
.auth-form { display: grid; gap: 12px; }

/* ── WELCOME BANNER ──────────────────────────────────────────────── */
.welcome-banner {
  border-left: 5px solid var(--gold) !important;
  background: linear-gradient(135deg, #f8faf8, #eef6f3) !important;
}
.welcome-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.welcome-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* ── TOPBAR TIGHTENING ───────────────────────────────────────────── */
.top-actions { gap: 6px; }
.top-actions .global-search { min-width: min(260px, 100%); }

/* ── GENERAL POLISH ──────────────────────────────────────────────── */
.panel h2 + p { margin-top: 6px; color: var(--muted); font-size: 13px; }
.animal-card { transition: box-shadow 120ms; }
.animal-card:hover { box-shadow: 0 4px 16px rgba(27,42,35,0.10); }
.store-card { transition: box-shadow 120ms; }
.store-card:hover { box-shadow: 0 4px 16px rgba(27,42,35,0.10); }
.listing-card { transition: box-shadow 120ms; }
.listing-card:hover { box-shadow: 0 4px 16px rgba(27,42,35,0.10); }
.record { transition: background 100ms; }
.record:hover { background: #f8faf8; }

/* ── UX REVIEW UPGRADES ──────────────────────────────────────────── */
.onboarding-panel {
  border-left: 5px solid var(--green);
}
.onboarding-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}
.setup-step {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  text-align: left;
  display: grid;
  gap: 5px;
  cursor: pointer;
}
.setup-step span {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: #fff4dc;
  color: #7a4c00;
  font-weight: 900;
}
.setup-step.done {
  background: #f3faf6;
  border-color: #b7dfc5;
}
.setup-step.done span {
  background: #d8f3df;
  color: #176b38;
}
.collection-home .records {
  margin-top: 14px;
}
.today-glance {
  border-left: 5px solid var(--gold);
}
.glance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.glance-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-height: 104px;
  padding: 12px;
  display: grid;
  gap: 6px;
  text-align: left;
}
.glance-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.glance-card strong {
  font-size: 28px;
  line-height: 1;
  color: var(--green);
}
.glance-card small {
  color: var(--muted);
  line-height: 1.3;
}
.glance-card:hover {
  border-color: var(--gold);
  box-shadow: 0 6px 18px rgba(58, 47, 37, 0.10);
}
.workload-profile {
  border-left: 5px solid var(--teal);
}
.workload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.workload-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--warm-panel);
  padding: 12px;
  display: grid;
  gap: 8px;
}
.workload-group h3 {
  margin-bottom: 2px;
}
.workload-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 10px;
  padding: 10px;
  text-align: left;
}
.workload-row span {
  font-weight: 900;
  color: var(--ink);
}
.workload-row strong {
  color: var(--green);
  font-size: 22px;
  line-height: 1;
}
.workload-row small {
  grid-column: 1 / -1;
  color: var(--muted);
  line-height: 1.32;
}
.workload-row:hover {
  border-color: var(--teal);
  box-shadow: 0 5px 16px rgba(58, 47, 37, 0.09);
}
.status-card span {
  display: block;
  font-size: 32px;
  line-height: 1;
  font-weight: 900;
  color: var(--green);
  margin: 8px 0;
}
.badge-stack {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.trust-strip span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  background: #f8faf8;
}
.profile-form {
  display: grid;
  gap: 16px;
}
.profile-report-center {
  border-left: 5px solid var(--teal);
}
.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 14px;
  margin: 14px 0;
}
.report-command-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--warm-panel);
  padding: 14px;
  display: grid;
  gap: 12px;
}
.report-quick-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}
.report-card-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.report-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 11px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  text-align: left;
}
.report-card span {
  border-radius: 999px;
  background: #eef6f3;
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
  padding: 4px 7px;
}
.report-card small {
  grid-column: 1 / -1;
  color: var(--muted);
  line-height: 1.3;
}
.report-card:hover {
  border-color: var(--teal);
  box-shadow: 0 5px 16px rgba(58, 47, 37, 0.09);
}
.records.compact-records {
  gap: 6px;
}
.report-preview pre {
  margin: 0;
  white-space: pre-wrap;
  max-height: 60vh;
  overflow: auto;
  background: #fbf7ef;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.45;
}
.profile-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}
.profile-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 11px;
  display: grid;
  gap: 4px;
}
.profile-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.profile-summary strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}
.form-footer {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}
.toggle-line {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}
.toggle-line input {
  width: auto;
}
.animal-profile {
  display: grid;
  gap: 14px;
}
.profile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.profile-head h2 {
  margin: 6px 0 2px;
  font-size: 28px;
}
.score-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-align: center;
  background:
    radial-gradient(circle at center, #fff 0 56%, transparent 57%),
    conic-gradient(var(--green) 0 75%, #e8eee9 75% 100%);
  border: 1px solid var(--line);
  flex: 0 0 auto;
}
.score-ring strong {
  font-size: 28px;
  line-height: 1;
}
.score-ring span {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--muted);
}
.tabs-lite {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tabs-lite span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
  background: #f8faf8;
}
.tabs-lite button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
  background: #f8faf8;
  color: var(--ink);
  cursor: pointer;
}
.tabs-lite button.active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.nested-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}
.nested-panel h2 {
  font-size: 16px;
  margin-bottom: 10px;
}
.readiness-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.readiness-list li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 800;
}
.readiness-list .ready {
  background: #f2faf5;
  color: #176b38;
  border-color: #b7dfc5;
}
.readiness-list .missing {
  background: #fff8eb;
  color: #8a5a00;
  border-color: #f1d49b;
}
.search-result .row-actions {
  margin-top: 8px;
}
.daily-console {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.daily-action {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  display: grid;
  gap: 4px;
  text-align: left;
  min-height: 76px;
  cursor: pointer;
}
.daily-action strong {
  font-size: 15px;
}
.daily-action small {
  color: var(--muted);
  line-height: 1.35;
}
.daily-action:hover {
  border-color: var(--green);
  box-shadow: 0 4px 14px rgba(27,42,35,0.10);
}
.alert-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.alert-card {
  border-left: 4px solid #c8902c;
}
.alert-card.danger-alert {
  border-left-color: #bb3e3e;
  background: #fff7f6;
}
.import-wizard {
  display: grid;
  gap: 14px;
}
.import-wizard table select {
  min-width: 160px;
}
.mobile-console {
  display: grid;
  gap: 14px;
}
.admin-command {
  border-left: 5px solid var(--green);
}
.sparkline-row.large {
  min-height: 84px;
  align-items: center;
}
.sparkline-row.large svg {
  width: 100%;
  max-width: 520px;
}
.role-home {
  border-left: 5px solid var(--gold);
}
.wizard-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 6px;
  margin-bottom: 14px;
}
.wizard-steps span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8faf8;
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}
.wizard-form {
  display: grid;
  gap: 12px;
}
.wizard-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}
.wizard-section h2 {
  font-size: 16px;
  margin-bottom: 10px;
}
.profile-command-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.agenda-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}
.agenda-card {
  border-left: 4px solid var(--green);
}
.backend-readiness {
  border-left: 5px solid #52677a;
}
.quicklog-hero {
  border-left: 5px solid var(--green);
}
.quicklog-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.saved-view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}
.saved-view {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  text-align: left;
  cursor: pointer;
}
.saved-view span {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #eef6f3;
  color: var(--green);
  font-weight: 900;
}
.saved-view small {
  grid-column: 1 / -1;
  color: var(--muted);
}
.seller-public-profile {
  border-left: 5px solid var(--gold);
}
.operational-focus {
  border-left: 5px solid #bb3e3e;
}
.notification-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.launch-score {
  border-left: 5px solid var(--green);
}
.impersonation-banner {
  border-left: 5px solid #bb3e3e;
  background: #fff7f6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.impersonation-banner strong {
  display: block;
  color: #8f2c2c;
}
.impersonation-banner small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}
[hidden] {
  display: none !important;
}
@media (max-width: 720px) {
  .profile-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .score-ring {
    width: 82px;
    height: 82px;
  }
  .form-footer {
    justify-content: stretch;
  }
  .form-footer .button {
    flex: 1;
  }
  .daily-console {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .daily-action {
    min-height: 92px;
    padding: 12px;
  }
}

/* ════════════════════════════════════════════════════════════════════════
   ENHANCEMENT PASS — visual polish, dark mode, mobile drawer, command
   palette, cloud-sync indicator, share button, undo snackbar, print styles.
   ════════════════════════════════════════════════════════════════════════ */

/* Theme tokens shared across modes */
:root {
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-soft: 0 4px 14px rgba(33, 36, 31, 0.06);
  --shadow-pop: 0 14px 36px rgba(33, 36, 31, 0.14);
  --focus-ring: 0 0 0 3px rgba(63, 111, 79, 0.35);
  --transition: 160ms cubic-bezier(.2,.7,.3,1);
}

/* Smoother defaults */
.button, .icon-button, .text-button { transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition); border-radius: var(--radius); }
.button:hover:not(:disabled), .icon-button:hover:not(:disabled) { box-shadow: var(--shadow-soft); transform: translateY(-1px); }
.button:active:not(:disabled), .icon-button:active:not(:disabled) { transform: translateY(0); }
.button:focus-visible, .icon-button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.panel, .animal-card, .store-card, .listing-card { border-radius: var(--radius-lg); }
.panel { transition: box-shadow var(--transition); }
.panel:hover { box-shadow: var(--shadow-soft); }

/* Topbar layout polish */
.topbar { padding: 6px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.topbar-title { min-width: 0; flex: 0 1 auto; }
.topbar-title .eyebrow { margin-bottom: 2px; }
.topbar-title h1 { font-size: clamp(22px, 3.2vw, 32px); }
.top-actions { margin-left: auto; }
.search-wrap { position: relative; display: flex; align-items: center; min-width: 0; flex: 1 1 280px; }
.search-wrap .search-icon { position: absolute; left: 12px; color: var(--muted); font-size: 16px; pointer-events: none; }
.search-wrap .global-search { width: 100%; min-width: 220px; padding: 0 64px 0 34px; height: 38px; border-radius: 999px; border: 1px solid var(--line); background: #fff; }
.search-hint {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; background: #f0ece2; color: var(--muted);
  border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px;
}

/* Sidebar / mobile drawer */
.sidebar-toggle { display: none; }
.sidebar-scrim { position: fixed; inset: 0; background: rgba(15, 23, 19, 0.45); opacity: 0; pointer-events: none; transition: opacity var(--transition); z-index: 40; }
body.sidebar-open .sidebar-scrim { opacity: 1; pointer-events: auto; }

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: min(86vw, 320px);
    z-index: 50; transform: translateX(-110%); transition: transform var(--transition);
    box-shadow: 0 0 30px rgba(0,0,0,0.25);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-toggle { display: grid; }
  .topbar { gap: 10px; }
  .topbar-title h1 { font-size: 20px; }
  .top-actions .button:not(.primary):not(.danger) { display: none; }
  .top-actions .search-wrap { order: -1; flex-basis: 100%; }
  .activity-controls { grid-template-columns: 1fr 1fr; }
}

/* Cloud sync indicator */
.sync-indicator {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff;
  font-size: 12px; font-weight: 800; color: var(--muted);
  user-select: none; min-height: 32px;
}
.sync-indicator .sync-dot { width: 8px; height: 8px; border-radius: 999px; background: #6ab987; box-shadow: 0 0 0 3px rgba(106,185,135,0.20); }
.sync-indicator[data-state="syncing"] .sync-dot { background: #d6a23b; animation: syncPulse 1.1s ease-in-out infinite; }
.sync-indicator[data-state="offline"] .sync-dot { background: #b75151; }
.sync-indicator[data-state="error"] .sync-dot { background: #b75151; animation: syncPulse 1.1s ease-in-out infinite; }
@keyframes syncPulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.4); opacity: 0.7; } }
@media (max-width: 1180px) { .sync-indicator .sync-label { display: none; } .sync-indicator { padding: 6px; } }

/* Command palette */
.command-palette { position: fixed; inset: 0; z-index: 70; background: rgba(15, 23, 19, 0.55); display: grid; place-items: start center; padding: 12vh 16px 16px; }
.command-palette[hidden] { display: none; }
.command-palette-card { width: min(640px, 100%); background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-pop); overflow: hidden; border: 1px solid var(--line); }
.command-palette-card input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 18px 20px; font-size: 17px; background: transparent; color: inherit; outline: none; }
.command-palette-results { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.command-palette-results li { padding: 10px 14px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 12px; }
.command-palette-results li:hover, .command-palette-results li.active { background: rgba(63, 111, 79, 0.10); }
.command-palette-results .cmd-glyph { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; background: var(--gold); color: #14231b; font-weight: 900; flex-shrink: 0; }
.command-palette-results .cmd-meta { color: var(--muted); font-size: 12px; margin-left: auto; }
.command-palette-footer { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.command-palette-footer kbd { font-family: ui-monospace, monospace; font-size: 10px; background: #f0ece2; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; margin-right: 3px; }
.search-hint kbd { background: transparent; border: 0; padding: 0; }

/* Undo snackbar (re-uses toast container behaviour but with action) */
.toast.with-undo { display: flex; align-items: center; gap: 12px; }
.toast .toast-undo {
  background: transparent; border: 1px solid rgba(255,255,255,0.6); color: #fff;
  padding: 4px 12px; border-radius: 999px; font-weight: 800; font-size: 13px;
  cursor: pointer;
}
.toast .toast-undo:hover { background: rgba(255,255,255,0.15); }

/* Share button */
.share-btn { display: inline-flex; align-items: center; gap: 6px; }

/* Refinements that work in both themes */
input, select, textarea {
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
}

/* Print: cage labels and care sheets */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .quick-log, .hero, .confirmation-bar, .toast,
  .command-palette, .sync-indicator, .top-actions, .sidebar-scrim,
  #notificationBtn, #commandPaletteBtn, #themeToggleBtn, #sidebarToggle,
  .impersonation-banner, .nav, .sidebar-panel { display: none !important; }
  .app-shell { display: block; }
  .main { padding: 0; }
  .panel { box-shadow: none !important; border: 1px solid #d4d4d4; page-break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  .hidden-on-print, .button, .icon-button { display: none !important; }
}

/* ─────────────────────  DARK MODE  ───────────────────── */
:root[data-theme="dark"] {
  --ink: #ecefe9;
  --muted: #a3a89e;
  --line: #2b3530;
  --paper: #11181a;
  --panel: #182320;
  --green: #6dbf86;
  --teal: #5cbab1;
  --amber: #e2b15a;
  --red: #e07a72;
  --blue: #7aa6d1;
  --gold: #eddc8f;
  --sidebar-start: #122421;
  --sidebar-end: #0c1715;
  --sidebar-border: #2a4540;
  --sidebar-soft: rgba(120, 200, 170, 0.10);
  --sidebar-muted: #b6cdc4;
  --warm-panel: #1b2723;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
}
:root[data-theme="dark"] body {
  background:
    radial-gradient(1200px 600px at 90% -10%, rgba(63, 111, 79, 0.16), transparent 60%),
    linear-gradient(180deg, #0c1413 0%, #11181a 100%);
  color: var(--ink);
}
:root[data-theme="dark"] .main {
  background:
    radial-gradient(circle at top right, rgba(226, 190, 111, 0.06), transparent 34%),
    linear-gradient(180deg, rgba(20, 28, 26, 0.6), rgba(14, 20, 19, 0.7));
}
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .glance-card,
:root[data-theme="dark"] .setup-step,
:root[data-theme="dark"] .animal-card,
:root[data-theme="dark"] .store-card,
:root[data-theme="dark"] .listing-card,
:root[data-theme="dark"] .auth-card,
:root[data-theme="dark"] .command-palette-card {
  background: var(--panel); color: var(--ink); border-color: var(--line);
}
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea {
  background: #0f1716; color: var(--ink); border: 1px solid var(--line);
}
:root[data-theme="dark"] input::placeholder, :root[data-theme="dark"] textarea::placeholder { color: #6b7672; }
:root[data-theme="dark"] .button { background: #1d2a26; color: var(--ink); border-color: var(--line); }
:root[data-theme="dark"] .button.primary { background: var(--green); color: #0b1410; border-color: var(--green); }
:root[data-theme="dark"] .button.secondary { background: #1f2c28; }
:root[data-theme="dark"] .button.danger { background: #3a1c19; border-color: #5c2722; color: #f0a39a; }
:root[data-theme="dark"] .icon-button { background: #1d2a26; color: var(--ink); border-color: var(--line); }
:root[data-theme="dark"] .icon-button.has-notifications { background: #a8423d; color: #fff; border-color: #842f2b; }
:root[data-theme="dark"] .text-button { color: var(--green); }
:root[data-theme="dark"] .record:hover { background: #1c2622; }
:root[data-theme="dark"] .sync-indicator { background: #1d2a26; color: var(--muted); border-color: var(--line); }
:root[data-theme="dark"] .search-wrap .global-search { background: #0f1716; color: var(--ink); }
:root[data-theme="dark"] .search-hint { background: #0f1716; color: var(--muted); }
:root[data-theme="dark"] body.sidebar-open .sidebar-scrim { background: rgba(0,0,0,0.6); }
:root[data-theme="dark"] .modal-form { background: var(--panel); color: var(--ink); }
:root[data-theme="dark"] dialog#modal { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
:root[data-theme="dark"] .auth-form-wrap { background: #11181a; color: var(--ink); }
:root[data-theme="dark"] .auth-gate { background: linear-gradient(140deg, rgba(8,14,12,0.96), rgba(14,22,19,0.95)), #0b1410; }
:root[data-theme="dark"] .toast { background: #2b3530; color: var(--ink); }

/* Subtle entrance for view content */
.view > * { animation: viewFadeIn 220ms ease both; }
@keyframes viewFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Animal name hyperlinks — every animal name in lists/tables is clickable to edit */
a.animal-link {
  color: var(--green);
  text-decoration: none;
  font-weight: 700;
  border-bottom: 1px dashed transparent;
  transition: color var(--transition), border-color var(--transition);
}
a.animal-link:hover { color: var(--gold); border-bottom-color: var(--gold); }
:root[data-theme="dark"] a.animal-link { color: var(--gold); }
:root[data-theme="dark"] a.animal-link:hover { color: #fff; border-bottom-color: #fff; }

/* Pagination bar (8 / 25 / 50 / 100 / All) shown above logs + audit lists */
.paginate-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 4px 0 10px;
  padding: 8px 12px; border: 1px dashed var(--line); border-radius: var(--radius);
  background: rgba(63, 111, 79, 0.04);
}
.paginate-bar small { color: var(--muted); }
.paginate-options { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.paginate-options::before { content: "View:"; color: var(--muted); font-size: 12px; margin-right: 4px; }
.paginate-options small:first-child { display: none; }
.paginate-btn {
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-size: 12px; font-weight: 700; cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.paginate-btn:hover { background: var(--gold); color: #14231b; border-color: var(--gold); }
.paginate-btn.active { background: var(--green); color: #fff; border-color: var(--green); }
:root[data-theme="dark"] .paginate-btn { background: #1d2a26; color: var(--ink); }
:root[data-theme="dark"] .paginate-btn.active { background: var(--green); color: #0b1410; }


/* Hero / auth image fallbacks if the static asset can't load */
.auth-visual.auth-visual-fallback,
.hero.hero-fallback {
  background:
    radial-gradient(800px 400px at 30% 20%, rgba(226, 190, 111, 0.20), transparent 60%),
    linear-gradient(135deg, #0f3d2c 0%, #1b5a3e 45%, #3f6f4f 100%);
  min-height: 280px;
  position: relative;
}
.auth-visual.auth-visual-fallback::after,
.hero.hero-fallback::after {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at 18px 18px, rgba(237, 220, 143, 0.10) 1.5px, transparent 2px);
  background-size: 28px 28px;
  pointer-events: none;
}

/* Listing/animal "no photo" tile (rare now that we ship SVG placeholders) */
.no-photo {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0f3d2c 0%, #3f6f4f 100%);
  color: var(--gold, #eddc8f);
  font-family: Georgia, serif;
  font-weight: 800;
  font-size: 28px;
  letter-spacing: 1px;
  border-radius: var(--radius, 10px);
}


/* Rack/enclosure hyperlinks inherit the animal-link look */
a.rack-link { font-weight: 800; }
