/* TailTrackerAI — design language shared with syntaxweave.com */

:root {
  --bg:            #0a0a0c;
  --surface:       #131316;
  --surface-hi:    #1c1c22;
  --text:          #e8e8ec;
  --text-dim:      #b8b8c4;
  --text-faint:    #8a8a98;
  --accent:        #d4a574;
  --accent-dim:    rgba(212,165,116,0.12);
  --accent-glow:   rgba(212,165,116,0.22);
  --border:        rgba(255,255,255,0.07);
  --border-hi:     rgba(255,255,255,0.13);
  --ok:            #4ade80;
  --ok-dim:        rgba(74,222,128,0.09);
  --warn:          #fb923c;
  --warn-dim:      rgba(251,146,60,0.1);
  --danger:        #f87171;
  --danger-dim:    rgba(248,113,113,0.1);
  --ease:          cubic-bezier(0.2,0.6,0.2,1);
  --f-sans:        'Inter', system-ui, sans-serif;
  --f-serif:       'Fraunces', Georgia, serif;
  --f-mono:        'JetBrains Mono', 'Fira Code', monospace;
}

/* ── Light mode ─────────────────────────────────────── */
[data-theme="light"] {
  --bg:            #f5f4f0;
  --surface:       #eeede8;
  --surface-hi:    #e4e2db;
  --text:          #1a1a1e;
  --text-dim:      #3a3a44;
  --text-faint:    #7a7a88;
  --accent:        #9a6a3a;
  --accent-dim:    rgba(154,106,58,0.1);
  --accent-glow:   rgba(154,106,58,0.18);
  --border:        rgba(0,0,0,0.09);
  --border-hi:     rgba(0,0,0,0.16);
  --ok:            #16a34a;
  --ok-dim:        rgba(22,163,74,0.09);
  --warn:          #c2410c;
  --warn-dim:      rgba(194,65,12,0.09);
  --danger:        #dc2626;
  --danger-dim:    rgba(220,38,38,0.08);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--f-sans); font-weight: 300;
  background: var(--bg); color: var(--text);
  line-height: 1.6; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
a:hover { text-decoration: none; }

/* ── HEADER ─────────────────────────────────────────── */
.app-header {
  background: var(--bg); border-bottom: 1px solid var(--border);
  padding: 0.9rem 1.25rem; position: sticky; top: 0; z-index: 100;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; max-width: 960px; margin: 0 auto; }
.brand {
  font-family: var(--f-mono); font-size: 0.82rem; font-weight: 400;
  color: var(--text); text-decoration: none; letter-spacing: -0.01em;
}
.brand::before { content: "§ "; color: var(--accent); }
.header-nav { display: flex; align-items: center; gap: 1.25rem; }
.header-nav a {
  font-family: var(--f-mono); font-size: 0.72rem; color: var(--text-dim);
  text-decoration: none; letter-spacing: 0.01em;
  transition: color 0.2s var(--ease);
}
.header-nav a:hover { color: var(--text); }
.header-controls { display: flex; align-items: center; gap: .75rem; }
.header-role-label {
  font-family: var(--f-mono); font-size: .76rem; color: var(--text-faint);
}
.header-signout-link {
  font-family: var(--f-mono); font-size: .76rem; color: var(--text-faint);
  text-decoration: none; transition: color .2s;
}
.header-signout-link:hover { color: var(--text); }
.header-home-link {
  font-family: var(--f-mono); font-size: .8rem; color: var(--text-faint);
  text-decoration: none; transition: color .2s;
}
.header-home-link:hover { color: var(--text); }
.header-controls button {
  background: none; border: none; cursor: pointer;
  font-size: 1.15rem; padding: 0; line-height: 1;
  color: var(--text-faint); transition: color .2s;
}
.header-controls button:hover { color: var(--text); }

main { max-width: 960px; margin: 0 auto; }

/* ── PAGE HERO ───────────────────────────────────────── */
.page-hero {
  padding: 1.75rem 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.back-link {
  display: inline-block; font-family: var(--f-mono); font-size: 0.7rem;
  color: var(--text-faint); text-decoration: none; margin-bottom: 0.9rem;
  letter-spacing: 0.02em; transition: color 0.2s var(--ease);
}
.back-link::before { content: "← "; }
.back-link:hover { color: var(--text-dim); }
.page-title {
  font-family: var(--f-serif); font-weight: 300;
  font-size: clamp(1.85rem, 7vw, 2.75rem);
  letter-spacing: -0.02em; line-height: 1.08; margin: 0 0 0.65rem;
}
.page-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  font-family: var(--f-mono); font-size: 0.68rem; letter-spacing: 0.03em;
  padding: 0.25rem 0.6rem; border: 1px solid var(--border); color: var(--text-dim);
}
.chip.ok    { border-color: rgba(74,222,128,0.2);   color: var(--ok);     }
.chip.warn  { border-color: rgba(251,146,60,0.25);  color: var(--warn);   }
.chip.danger{ border-color: rgba(248,113,113,0.25); color: var(--danger); }
.chip.accent{ border-color: var(--accent-dim);      color: var(--accent); }
.chip.faint { color: var(--text-faint); border-color: var(--border); font-size: 0.62rem; }

/* ── STATS ROW ───────────────────────────────────────── */
.stats-row {
  display: flex; gap: 0.4rem; flex-wrap: wrap;
  padding: 0.65rem 1.25rem; border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.stat-pill {
  font-family: var(--f-mono); font-size: 0.68rem; letter-spacing: 0.03em;
  padding: 0.22rem 0.6rem; border: 1px solid var(--border); color: var(--text-dim);
  text-decoration: none;
}
a.stat-pill { cursor: pointer; transition: border-color 0.2s var(--ease), color 0.2s var(--ease); }
a.stat-pill:hover { border-color: var(--border-hi); color: var(--text); }
a.stat-pill.active { border-color: var(--accent); color: var(--accent); }
.stat-pill.warn { border-color: rgba(251,146,60,0.3); color: var(--warn); }
a.stat-pill.warn:hover { border-color: var(--warn); }

/* Page body positioning (keeps it above the fixed doodle bg) */
.page-body { position: relative; z-index: 1; }

/* ── CSS vars for tunable dark-mode legibility ──────────────────────── */
:root {
  --stale-strip-1:   2px;
  --stale-strip-2:   4px;
  --stale-tint:      0.04;
  --heatmap-partial: 0.15;
  --heatmap-full:    0.40;
  --batch-bar-bg:    var(--surface-hi);
}

/* ── Zone heatmap ───────────────────────────────────────────────────── */
.zone-heatmap {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
  padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--border);
  background: var(--bg); overflow-x: auto;
}
.zone-tile {
  position: relative; min-width: 76px; padding: 0.45rem 0.6rem;
  border: 1px solid rgba(212,165,116,0.35); cursor: pointer;
  background: rgba(212,165,116,var(--zone-fill,0));
  transition: border-color 0.2s var(--ease);
  flex-shrink: 0;
}
.zone-tile.partial { background: rgba(212,165,116,var(--heatmap-partial)); }
.zone-tile.full    { background: rgba(212,165,116,var(--heatmap-full)); border-width: 2px; border-color: var(--accent); }
.zone-tile:hover   { border-color: var(--accent); }
.zone-tile-name {
  font-family: var(--f-mono); font-size: 0.58rem; font-weight: 500;
  color: #fff; text-transform: uppercase; letter-spacing: 0.05em;
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px;
}
.zone-tile-count {
  font-family: var(--f-mono); font-size: 0.7rem;
  color: rgba(255,255,255,0.75); display: block; margin-top: 0.1rem;
}
.zone-capacity-dot {
  display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); margin-left: 0.3rem; vertical-align: middle;
}

/* ── Urgency accent strips ──────────────────────────────────────────── */
.item-row.stale-1 { box-shadow: inset var(--stale-strip-1) 0 0 var(--accent); }
.item-row.stale-2 {
  box-shadow: inset var(--stale-strip-2) 0 0 var(--accent);
  background: rgba(212,165,116,var(--stale-tint));
}
.item-row.stale-2:active { background: rgba(212,165,116,calc(var(--stale-tint) + 0.04)); }

/* ── Row checkbox (batch select) ────────────────────────────────────── */
.row-check {
  width: 18px; height: 44px; flex-shrink: 0; display: flex;
  align-items: center; justify-content: center; cursor: pointer;
}
.row-check input[type=checkbox] {
  width: 15px; height: 15px; accent-color: var(--accent);
  cursor: pointer; flex-shrink: 0;
}
.item-row.selected { background: rgba(212,165,116,0.07) !important; }

/* ── Batch action bar ───────────────────────────────────────────────── */
.batch-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 300;
  background: var(--batch-bar-bg); border-top: 2px solid var(--accent);
  padding: 0.75rem 1.25rem; display: none;
  align-items: center; gap: 0.65rem; flex-wrap: wrap;
}
.batch-bar.show { display: flex; }
.batch-bar-count {
  font-family: var(--f-mono); font-size: 0.72rem; color: var(--text-dim);
  margin-right: auto;
}
.batch-btn {
  font-family: var(--f-mono); font-size: 0.72rem; padding: 0.5rem 1rem;
  border: 1px solid var(--border-hi); background: transparent; color: var(--text);
  cursor: pointer; min-height: 44px; transition: border-color 0.2s, color 0.2s;
}
.batch-btn:hover { border-color: var(--accent); color: var(--accent); }
.batch-btn.cancel-batch { color: var(--text-faint); }

/* ── Quick transfer (move icon + popover) ───────────────────────────── */
.move-btn {
  width: 28px; height: 44px; min-height: 44px; padding: 0; flex-shrink: 0;
  background: none; border: none; cursor: pointer; color: var(--text-faint);
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s; position: relative;
}
.move-btn:hover { color: var(--accent); }
.move-popover {
  position: absolute; right: 0; bottom: 48px; z-index: 350;
  background: var(--surface-hi); border: 1px solid var(--border-hi);
  padding: 0.5rem; min-width: 200px; max-height: 260px; overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.move-zone-btn {
  display: block; width: 100%; text-align: left; padding: 0.55rem 0.75rem;
  font-family: var(--f-mono); font-size: 0.72rem; color: var(--text-dim);
  background: none; border: none; cursor: pointer; min-height: 44px;
  transition: background 0.15s, color 0.15s;
}
.move-zone-btn:hover { background: var(--surface); color: var(--accent); }

/* ── Vet alert icon ─────────────────────────────────────────────────── */
.vet-btn {
  width: 28px; height: 44px; min-height: 44px; padding: 0; flex-shrink: 0;
  background: none; border: none; cursor: pointer; color: var(--text-faint);
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s;
}
.vet-btn:hover { color: var(--warn); }
.vet-btn.active { color: var(--warn); }
.vet-icon-badge {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--warn); margin-left: 0.25rem; vertical-align: middle;
  flex-shrink: 0;
}

/* ── CONTROLS / SEARCH ───────────────────────────────── */
.controls {
  padding: 0.75rem 1.25rem;
  background: var(--bg); border-bottom: 1px solid var(--border);
  position: sticky; top: 53px; z-index: 90;
}
.search-input {
  width: 100%; padding: 0.65rem 0.85rem;
  font-family: var(--f-mono); font-size: 0.875rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); outline: none;
  transition: border-color 0.2s var(--ease);
  -webkit-appearance: none; appearance: none;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-faint); }
.filter-row {
  display: flex; gap: 0.35rem; margin-top: 0.55rem;
  overflow-x: auto; padding-bottom: 2px; scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0; font-family: var(--f-mono); font-size: 0.65rem;
  letter-spacing: 0.04em; padding: 0.28rem 0.7rem;
  border: 1px solid var(--border); color: var(--text-faint);
  text-decoration: none; white-space: nowrap;
  transition: all 0.2s var(--ease);
}
.filter-chip:hover { color: var(--text-dim); border-color: var(--border-hi); }
.filter-chip.active { border-color: var(--accent); color: var(--accent); }
.filter-chip.dim { opacity: 0.28; cursor: default; pointer-events: none; }

/* ── ZONE GROUP HEADER ───────────────────────────────── */
.zone-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.1rem 1.25rem 0.45rem;
  font-family: var(--f-mono); font-size: 0.62rem;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-dim);
}

/* ── ITEM LIST ───────────────────────────────────────── */
.item-list { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.item-row {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit;
  transition: background 0.18s var(--ease);
}
.item-row:last-child { border-bottom: none; }
.item-row:active { background: var(--surface-hi); }

/* ── AVATAR ─────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px; flex-shrink: 0;
  border: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-serif); font-size: 1rem; font-weight: 300; color: var(--accent);
}
.avatar-photo {
  object-fit: cover; border-radius: 0;
}
.push-bell {
  background: none; border: none; cursor: pointer; font-size: .85rem;
  padding: 0; line-height: 1; opacity: .35; transition: opacity .15s;
  color: inherit;
}
.push-bell:hover     { opacity: .7; }
.push-bell.push-bell-on { opacity: 1; }

/* ── ANIMAL ROW CONTENT ─────────────────────────────── */
.animal-name {
  font-family: var(--f-serif); font-weight: 300; font-size: 1.05rem;
  letter-spacing: -0.01em; line-height: 1.2;
}
.animal-meta-row {
  display: flex; align-items: center; gap: 0.45rem; margin-top: 0.2rem; flex-wrap: wrap;
}
.animal-id {
  font-family: var(--f-mono); font-size: 0.65rem; color: var(--text-dim); letter-spacing: 0.02em;
}
.status-badge {
  font-family: var(--f-mono); font-size: 0.58rem; text-transform: uppercase;
  letter-spacing: 0.08em; padding: 0.1rem 0.4rem;
  border: 1px solid var(--border-hi); color: var(--text-dim);
}
.status-badge.available { border-color: rgba(74,222,128,0.25); color: var(--ok); }
.last-event {
  margin-left: auto; text-align: right; flex-shrink: 0;
  font-family: var(--f-mono); font-size: 0.65rem; color: var(--text-dim);
  line-height: 1.4;
}
.last-event.stale { color: var(--warn); }

/* ── SECTION LABEL ───────────────────────────────────── */
.section-label {
  font-family: var(--f-mono); font-size: 0.62rem;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-faint);
  padding: 1.35rem 1.25rem 0.55rem;
}

/* ── ACTION BUTTONS (scan page) ──────────────────────── */
.action-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem;
  padding: 0 1.25rem;
}
.action-btn {
  width: 100%; min-height: 82px; padding: 1.25rem 0.5rem;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font-family: var(--f-sans); font-size: 0.95rem; font-weight: 400;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.2rem; cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.action-btn:active { transform: scale(0.97); background: var(--surface-hi); }
.action-btn.primary { border-color: rgba(74,222,128,0.18); }
.action-btn.primary:active { border-color: var(--ok); background: var(--ok-dim); }
.action-btn.danger  { border-color: rgba(248,113,113,0.2); }
.action-btn.danger:active  { border-color: var(--danger); background: var(--danger-dim); }

/* ── NOTES AREA ─────────────────────────────────────── */
.notes-area {
  padding: 1rem 1.25rem; border-top: 1px solid var(--border);
}
.notes-area label {
  display: block; font-family: var(--f-mono); font-size: 0.62rem;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-faint); margin-bottom: 0.45rem;
}
.notes-area textarea {
  width: 100%; padding: 0.7rem 0.8rem; min-height: 3.75em; resize: vertical;
  font-family: var(--f-mono); font-size: 0.875rem;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  outline: none; transition: border-color 0.2s var(--ease);
}
.notes-area textarea:focus { border-color: var(--accent); }
.notes-area textarea::placeholder { color: var(--text-faint); }
.hint { font-family: var(--f-mono); font-size: 0.65rem; color: var(--text-faint); margin-top: 0.35rem; }

/* ── HISTORY ─────────────────────────────────────────── */
.history-item {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 0.75rem; padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.history-item:last-child { border-bottom: none; }
.history-action { font-size: 0.9rem; color: var(--text); }
.history-details { display: block; font-family: var(--f-mono); font-size: 0.72rem; color: var(--text-dim); margin-top: 0.1rem; }
.history-time { flex-shrink: 0; font-family: var(--f-mono); font-size: 0.65rem; color: var(--text-dim); text-align: right; }
.history-empty { padding: 1.25rem; font-family: var(--f-mono); font-size: 0.75rem; color: var(--text-dim); }

/* ── FORMS ───────────────────────────────────────────── */
.form-section { padding: 1.25rem; }
.field { margin-bottom: 1.1rem; }
.field label {
  display: block; font-family: var(--f-mono); font-size: 0.62rem;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-faint); margin-bottom: 0.4rem;
}
.field input,
.field select,
.field textarea {
  width: 100%; padding: 0.75rem 0.8rem;
  font-family: var(--f-mono); font-size: 0.875rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); outline: none;
  -webkit-appearance: none; appearance: none;
  transition: border-color 0.2s var(--ease);
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23555560'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.85rem center;
  padding-right: 2.25rem;
}
.field select option { background: var(--surface); color: var(--text); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field input::placeholder, .field textarea::placeholder { color: var(--text-faint); }
.field textarea { resize: vertical; min-height: 3.5em; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }
.field-hint { font-family: var(--f-mono); font-size: 0.62rem; color: var(--text-faint); margin-top: 0.35rem; }

/* ── BUTTONS ─────────────────────────────────────────── */
.btn {
  display: inline-block; font-family: var(--f-mono); font-size: 0.8rem;
  letter-spacing: 0.03em; padding: 0.85rem 1.35rem;
  border: 1px solid; cursor: pointer; text-decoration: none;
  transition: all 0.2s var(--ease); -webkit-tap-highlight-color: transparent;
}
.btn-primary  { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn-primary:active { opacity: 0.85; transform: scale(0.99); }
.btn-ghost { background: transparent; color: var(--text-dim); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border-hi); }
.btn-full { display: block; width: 100%; text-align: center; }
.btn-sm {
  display: inline-block; font-family: var(--f-mono); font-size: 0.68rem;
  letter-spacing: 0.03em; padding: 0.35rem 0.75rem;
  border: 1px solid var(--border); background: transparent; color: var(--text-dim);
  cursor: pointer; text-decoration: none; transition: all 0.2s var(--ease);
}
.btn-sm:hover { color: var(--text); border-color: var(--border-hi); }
.btn-sm.accent { border-color: var(--accent-dim); color: var(--accent); }
.btn-sm.accent:hover { border-color: var(--accent); }

/* ── ZONE LIST ROWS ──────────────────────────────────── */
.zone-row {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.zone-row:last-child { border-bottom: none; }
.zone-label {
  flex: 1; font-family: var(--f-serif); font-weight: 300; font-size: 1rem; letter-spacing: -0.01em;
}
.zone-meta { font-family: var(--f-mono); font-size: 0.65rem; color: var(--text-faint); margin-right: 0.25rem; }
.zone-actions { display: flex; gap: 0.35rem; }

/* ── INLINE ADD FORM ─────────────────────────────────── */
.inline-add {
  padding: 1rem 1.25rem; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.add-row { display: flex; gap: 0.45rem; }
.add-row input {
  flex: 1; padding: 0.65rem 0.75rem;
  font-family: var(--f-mono); font-size: 0.85rem;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); outline: none;
  transition: border-color 0.2s var(--ease);
}
.add-row input:focus { border-color: var(--accent); }
.add-row input::placeholder { color: var(--text-faint); }
.add-row .btn-add {
  padding: 0.65rem 1rem; background: var(--accent); color: var(--bg);
  border: 1px solid var(--accent); font-family: var(--f-mono); font-size: 0.78rem;
  font-weight: 500; cursor: pointer; white-space: nowrap; flex-shrink: 0;
}

/* ── SUPPLY ROWS ─────────────────────────────────────── */
.supply-row {
  padding: 0.95rem 1.25rem; border-bottom: 1px solid var(--border);
}
.supply-row:last-child { border-bottom: none; }
.supply-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.5rem; }
.supply-name { font-size: 0.95rem; }
.supply-qty  { font-family: var(--f-mono); font-size: 0.9rem; color: var(--text); }
.supply-qty.low { color: var(--warn); }
.supply-unit { font-family: var(--f-mono); font-size: 0.68rem; color: var(--text-faint); margin-left: 0.2rem; }
.supply-bottom { display: flex; justify-content: space-between; align-items: center; }
.reorder-badge {
  font-family: var(--f-mono); font-size: 0.58rem; text-transform: uppercase;
  letter-spacing: 0.08em; padding: 0.1rem 0.4rem;
  border: 1px solid rgba(251,146,60,0.3); color: var(--warn);
}
.threshold-note { font-family: var(--f-mono); font-size: 0.65rem; color: var(--text-faint); }
.adjust-row { display: flex; gap: 0.35rem; align-items: center; }
.adjust-input {
  width: 64px; padding: 0.38rem 0.45rem; text-align: center;
  font-family: var(--f-mono); font-size: 0.82rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); outline: none;
  -moz-appearance: textfield;
}
.adjust-input::-webkit-inner-spin-button,
.adjust-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.adjust-input:focus { border-color: var(--accent); }
.btn-use    { font-family: var(--f-mono); font-size: 0.65rem; padding: 0.38rem 0.65rem; background: transparent; border: 1px solid rgba(248,113,113,0.25); color: var(--danger); cursor: pointer; }
.btn-restock{ font-family: var(--f-mono); font-size: 0.65rem; padding: 0.38rem 0.65rem; background: transparent; border: 1px solid rgba(74,222,128,0.2);   color: var(--ok);    cursor: pointer; }

/* ── MOVE PICKER ─────────────────────────────────────── */
.move-select {
  width: 100%; padding: 0.85rem 2.5rem 0.85rem 0.85rem;
  font-family: var(--f-mono); font-size: 0.875rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); outline: none;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23555560'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.9rem center;
  transition: border-color 0.2s var(--ease); margin-bottom: 0.65rem;
}
.move-select:focus { border-color: var(--accent); }
.move-select option { background: var(--surface); color: var(--text); }

/* ── ERROR BANNER ────────────────────────────────────── */
.error-banner {
  padding: 0.85rem 1.25rem; background: var(--danger-dim); color: var(--danger);
  border-bottom: 1px solid rgba(248,113,113,0.2);
  font-family: var(--f-mono); font-size: 0.8rem;
}

/* ── PREVIEW BAR ─────────────────────────────────────── */
.preview-bar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .5rem;
  background: #2a1a0e; border-bottom: 1px solid #5c3d1e;
  padding: .45rem 1.25rem;
  font-family: var(--f-mono); font-size: .68rem; color: #d4a574;
  position: sticky; top: 0; z-index: 200;
}
.preview-bar-label strong { color: #f0c080; }
.preview-bar-controls { display: flex; align-items: center; gap: .5rem; }
.preview-bar-select {
  background: #1a0e04; border: 1px solid #5c3d1e; color: #d4a574;
  font-family: var(--f-mono); font-size: .68rem;
  padding: .2rem .4rem; border-radius: 3px; cursor: pointer;
}
.preview-bar-exit {
  background: transparent; border: 1px solid #5c3d1e; color: #d4a574;
  font-family: var(--f-mono); font-size: .68rem;
  padding: .2rem .6rem; border-radius: 3px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.preview-bar-exit:hover { background: #5c3d1e; border-color: #8a5a2a; color: #f0c080; }
.home-preview-bar {
  display: flex; align-items: center; gap: .65rem;
  padding: .5rem 1.25rem; border-bottom: 1px solid var(--border);
  font-family: var(--f-mono); font-size: .68rem; color: var(--text-faint);
}
.home-preview-select {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font-family: var(--f-mono); font-size: .68rem;
  padding: .2rem .5rem; border-radius: 3px; cursor: pointer;
}

/* ── TOAST ───────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(140%);
  background: var(--text); color: var(--bg);
  padding: 0.7rem 1.25rem; white-space: nowrap;
  font-family: var(--f-mono); font-size: 0.78rem;
  opacity: 0; z-index: 1000; pointer-events: none;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  transition: opacity 0.28s var(--ease), transform 0.32s var(--ease);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); color: #fff; }

/* ── EMPTY STATE ─────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 4rem 1.5rem; color: var(--text-faint);
}
.empty-state h2 {
  font-family: var(--f-serif); font-weight: 300; font-size: 1.5rem;
  color: var(--text-dim); letter-spacing: -0.02em; margin-bottom: 0.75rem;
}
.empty-state p  { font-size: 0.9rem; line-height: 1.6; }
.empty-state code {
  font-family: var(--f-mono); font-size: 0.78rem; color: var(--accent);
  background: var(--surface); padding: 0.2rem 0.45rem;
  border: 1px solid var(--border);
}

/* ── FAB ─────────────────────────────────────────────── */
.fab {
  position: fixed; bottom: 1.5rem; right: 1.25rem;
  background: var(--accent); color: var(--bg);
  padding: 0.72rem 1.2rem; font-family: var(--f-mono); font-size: 0.75rem;
  letter-spacing: 0.04em; text-decoration: none;
  border: 1px solid var(--accent); box-shadow: 0 4px 24px var(--accent-glow);
  transition: opacity 0.2s var(--ease);
}
.fab:active { opacity: 0.82; }

/* ── FOOTER ──────────────────────────────────────────── */
.app-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.25rem 3.5rem; text-align: center;
}
.app-footer a {
  font-family: var(--f-mono); font-size: 0.76rem; color: var(--text-faint);
  text-decoration: none; margin: 0 0.5rem;
  transition: color 0.2s var(--ease);
}
.app-footer a:hover { color: var(--text-dim); }

/* ── PAGE PADDING ────────────────────────────────────── */
.page-body { padding-bottom: 5rem; }

/* ── HOLD PANELS ─────────────────────────────────────── */
.hold-panel {
  margin: 1rem 1.25rem 0;
  padding: 1rem 1.1rem; border: 1px solid; border-left-width: 3px;
}
.hold-panel.medical {
  border-color: rgba(251,146,60,0.25); border-left-color: var(--warn);
  background: var(--warn-dim);
}
.hold-panel.behavioral {
  border-color: rgba(248,113,113,0.25); border-left-color: var(--danger);
  background: var(--danger-dim);
}
.hold-header { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.35rem; }
.hold-type-label {
  font-family: var(--f-mono); font-size: 0.62rem;
  text-transform: uppercase; letter-spacing: 0.12em; font-weight: 500;
}
.medical .hold-type-label { color: var(--warn); }
.behavioral .hold-type-label { color: var(--danger); }
.hold-severity {
  font-family: var(--f-mono); font-size: 0.62rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.hold-reason { font-size: 0.9rem; color: var(--text); margin: 0 0 0.4rem; line-height: 1.5; }
.hold-dates { font-family: var(--f-mono); font-size: 0.68rem; color: var(--text-dim); line-height: 1.7; }
.hold-edit-link {
  display: inline-block; margin-top: 0.55rem;
  font-family: var(--f-mono); font-size: 0.68rem; color: var(--accent);
  text-decoration: none; letter-spacing: 0.02em;
  transition: opacity 0.2s var(--ease);
}
.hold-edit-link:hover { opacity: 0.75; }

/* ── ACTION BUTTON SUBTITLES ─────────────────────────── */
.action-btn .action-label { font-size: 0.95rem; line-height: 1.2; }
.action-btn .action-sub {
  font-family: var(--f-mono); font-size: 0.58rem;
  letter-spacing: 0.03em; color: var(--text-faint); line-height: 1.3;
  text-align: center;
}
.action-btn.danger .action-sub { color: rgba(248,113,113,0.5); }
.action-btn.primary .action-sub { color: rgba(74,222,128,0.45); }

/* ── ANIMAL DETAIL META ──────────────────────────────── */
.animal-detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.detail-cell {
  padding: 0.8rem 1.25rem; border-bottom: 1px solid var(--border);
}
.detail-cell:nth-child(odd) { border-right: 1px solid var(--border); }
.detail-label {
  font-family: var(--f-mono); font-size: 0.58rem;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-faint);
  margin-bottom: 0.2rem;
}
.detail-value {
  font-family: var(--f-mono); font-size: 0.82rem; color: var(--text);
}
.detail-value.em { font-family: var(--f-sans); font-size: 0.88rem; }

/* ── FORM SECTION HEADER ─────────────────────────────── */
.form-section-header {
  font-family: var(--f-mono); font-size: 0.62rem;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-faint);
  padding: 1.35rem 1.25rem 0.6rem;
  border-top: 1px solid var(--border);
}
.form-section-header:first-child { border-top: none; }

/* ── FOOTER LINK VISIBILITY ──────────────────────────── */
.app-footer a { color: var(--text-dim); }
.app-footer a:hover { color: var(--text); }

/* ── Floating doodle animations ────────────────────────────────────────── */
@keyframes float-up {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(2deg); }
}
@keyframes float-down {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(10px) rotate(-2deg); }
}
@keyframes float-sway {
  0%, 100% { transform: translateY(-5px) rotate(-1deg); }
  50% { transform: translateY(5px) rotate(1deg); }
}
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
.doodle-float {
  animation: float-up 6s ease-in-out infinite;
}
.doodle-float-alt {
  animation: float-down 7s ease-in-out infinite;
}
.doodle-sway {
  animation: float-sway 5s ease-in-out infinite;
}
.animate-in {
  animation: fade-in-up 0.6s ease-out both;
}

/* ── Quick-detail bottom sheet modals ──────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,0.72); backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: flex-end; justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal-sheet {
  background: var(--surface); border: 1px solid var(--border-hi);
  border-radius: 1.25rem 1.25rem 0 0; padding: 1.5rem 1.25rem 2rem;
  width: 100%; max-width: 480px;
  animation: modal-slide-up 0.22s var(--ease) both;
}
@keyframes modal-slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-title {
  font-family: var(--f-serif); font-size: 1.1rem; color: var(--text);
  margin: 0 0 1.25rem; text-align: center;
}
.modal-section-label {
  font-family: var(--f-mono); font-size: 0.66rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-faint); margin-bottom: 0.6rem;
}
.chip-row {
  display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.1rem;
}
.chip-sel {
  font-family: var(--f-mono); font-size: 0.78rem;
  padding: 0.45rem 0.85rem; border-radius: 2rem;
  border: 1px solid var(--border-hi); background: var(--surface-hi);
  color: var(--text-dim); cursor: pointer; transition: all 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.chip-sel:hover  { border-color: var(--accent); color: var(--text); }
.chip-sel.active {
  background: var(--accent-dim); border-color: var(--accent);
  color: var(--accent);
}
.modal-actions {
  display: flex; gap: 0.75rem; margin-top: 0.5rem;
}
.modal-btn {
  flex: 1; padding: 0.8rem; border-radius: 0.6rem; border: none;
  font-family: var(--f-mono); font-size: 0.85rem; cursor: pointer;
  transition: opacity 0.15s var(--ease);
}
.modal-btn:active { opacity: 0.75; }
.modal-btn.cancel { background: var(--surface-hi); color: var(--text-dim); }
.modal-btn.confirm { background: var(--accent); color: #0a0a0c; font-weight: 600; }

/* ── RESPONSIVE — tablet / phone ──────────────────────────────────────────── */

/* Tablet (≤768px) — iPad portrait and smaller */
@media (max-width: 768px) {
  /* Header */
  .app-header { padding: 0.75rem 1rem; }
  .header-nav { gap: 0.85rem; }
  .header-nav a { font-size: 0.68rem; }

  /* Page hero */
  .page-hero { padding: 1.25rem 1rem 1rem; }

  /* Controls bar */
  .controls { top: 48px; padding: 0.65rem 1rem; }

  /* Section padding */
  .section-label { padding: 1.1rem 1rem 0.45rem; }
  .zone-header   { padding: 1rem 1rem 0.4rem; }
  .hold-panel    { margin: 0.75rem 1rem 0; }

  /* Item rows */
  .item-row { padding: 0.85rem 1rem; gap: 0.65rem; }

  /* Two-column form rows → single column on tablet */
  .field-row { grid-template-columns: 1fr; }

  /* Action grid (scan page) — larger touch targets on tablet */
  .action-btn { min-height: 96px; }

  /* Stats row */
  .stats-row { padding: 0.55rem 1rem; }

  /* Zone heatmap */
  .zone-heatmap { padding: 0.75rem 1rem; }

  /* Form sections */
  .form-section { padding: 1rem; }
  .inline-add   { padding: 0.85rem 1rem; }

  /* History */
  .history-item { padding: 0.65rem 1rem; }

  /* Supply rows */
  .supply-row { padding: 0.85rem 1rem; }
  .notes-area { padding: 0.9rem 1rem; }

  /* Batch bar */
  .batch-bar { padding: 0.65rem 1rem; }
}

/* Phone (≤480px) — most Android and iPhone sizes */
@media (max-width: 480px) {
  /* Header — tighter */
  .app-header { padding: 0.6rem 0.85rem; }

  /* Hero title smaller on phone */
  .page-title { font-size: clamp(1.5rem, 9vw, 2rem); }

  /* Item rows — compact */
  .item-row { padding: 0.75rem 0.85rem; gap: 0.5rem; }

  /* Animal name */
  .animal-name { font-size: 0.95rem; }

  /* Detail grid — single column on phone */
  .animal-detail-grid { grid-template-columns: 1fr; }
  .detail-cell:nth-child(odd) { border-right: none; }
  .detail-cell:nth-child(odd):not(:last-child) { border-bottom: 1px solid var(--border); }

  /* Action grid — single column on very small screens */
  .action-grid { grid-template-columns: 1fr; }

  /* Form sections */
  .form-section { padding: 0.85rem; }
  /* Prevent iOS auto-zoom on any input — threshold is 16px */
  input, select, textarea,
  .field input, .field select, .field textarea { font-size: 1rem; }

  /* Stats row — wrap nicely */
  .stats-row { padding: 0.45rem 0.85rem; }
  .stat-pill { font-size: 0.63rem; padding: 0.2rem 0.5rem; }

  /* Chips */
  .chip { font-size: 0.62rem; padding: 0.2rem 0.5rem; }

  /* Buttons — bigger touch area */
  .btn { padding: 0.9rem 1.25rem; min-height: 44px; }
  .btn-sm { padding: 0.4rem 0.8rem; min-height: 36px; }

  /* FAB — keep in safe zone */
  .fab { bottom: 1.2rem; right: 0.85rem; }

  /* Toast — full-width on phone */
  .toast { width: calc(100% - 2rem); white-space: normal; text-align: center; }

  /* Zone heatmap tiles */
  .zone-tile { min-width: 64px; }

  /* History */
  .history-item { padding: 0.6rem 0.85rem; flex-wrap: wrap; }
  .history-time { width: 100%; text-align: left; margin-top: 0.2rem; }

  /* Supply adjustments */
  .supply-bottom { flex-wrap: wrap; gap: 0.45rem; }
  .adjust-row { flex-wrap: wrap; }

  /* Filter chips row scrollable */
  .filter-row { gap: 0.3rem; }
  .filter-chip { font-size: 0.62rem; padding: 0.25rem 0.55rem; }

  /* Zones */
  .zone-row { padding: 0.85rem 0.85rem; }
  .zone-actions { flex-wrap: wrap; gap: 0.25rem; }

  /* Header nav — tight */
  .header-nav { gap: 0.6rem; }
  .header-nav a { font-size: 0.65rem; }

  /* Modal sheet full-width on phone */
  .modal-sheet { max-width: 100%; border-radius: 1rem 1rem 0 0; padding: 1.25rem 1rem 1.75rem; }
}

/* Touch: ensure all interactive elements meet 44px minimum hit target */
@media (hover: none) and (pointer: coarse) {
  .action-btn { min-height: 80px; }
  .btn        { min-height: 44px; }
  .btn-sm     { min-height: 36px; }
  .filter-chip, .stat-pill { min-height: 36px; display: inline-flex; align-items: center; }
  .zone-tile  { min-height: 52px; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }
  select      { min-height: 44px; }
}

/* Landscape phone — keep controls sticky region correct */
@media (max-width: 768px) and (orientation: landscape) {
  .controls { top: 45px; }
}


/* ── Responsive table wrapper ─────────────────────────────── */
.tbl-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}
.tbl-wrap table {
  min-width: 500px;
}

/* ── Desktop content centering ───────────────────────────── */
/* Pages that want a centered max-width column use .page-cap  */
.page-cap {
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Flash banner (shared) ───────────────────────────────── */
.flash-banner {
  padding: .65rem 1.25rem;
  background: var(--ok-dim);
  color: var(--ok);
  font-family: var(--f-mono);
  font-size: .78rem;
  border-bottom: 1px solid rgba(74,222,128,.2);
}

/* ── Mobile: prevent sub-12px font sizes ─────────────────── */
@media (max-width: 480px) {
  .detail-label, .brief-row-meta, .history-details,
  .animal-id, .chip, .stat-pill, .filter-chip, .section-label {
    font-size: max(0.63rem, 10px);
  }
}

/* ── App footer ──────────────────────────────────────────── */
.app-footer {
  max-width: 960px; margin: 3rem auto 0;
  padding: 1.5rem 1.25rem 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-family: var(--f-mono); font-size: .65rem; color: var(--text-faint);
}
.app-footer a { color: var(--text-faint); text-decoration: none; }
.app-footer a:hover { color: var(--accent); }
.app-footer-sep { margin: 0 .6rem; }

/* ── Home page briefing embed ────────────────────────────── */
.home-briefing { border-bottom: 1px solid var(--border); }
.home-briefing-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem 1.25rem; border-bottom: 1px solid var(--border);
}
.home-briefing-label {
  font-family: var(--f-mono); font-size: .62rem; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-faint);
}
.home-briefing-toggle {
  font-family: var(--f-mono); font-size: .65rem; color: var(--accent);
  background: none; border: none; cursor: pointer; padding: 0;
}
.home-briefing-body { padding: 1.25rem 1.25rem .75rem; }
.home-briefing-body p { margin: 0 0 .75rem; line-height: 1.6; font-size: .9rem; }
.home-briefing-body a { color: var(--accent); text-decoration: underline; }
.home-briefing-data {
  display: block; font-family: var(--f-mono); font-size: .62rem;
  color: var(--text-faint); text-align: right;
  padding: .6rem 1.25rem .75rem; border-top: 1px solid var(--border);
  text-decoration: none;
}
.home-briefing-data:hover { color: var(--accent); }

/* ── Safe-area inset for iPhones with notch/home bar ─────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .app-footer  { padding-bottom: calc(3.5rem + env(safe-area-inset-bottom)); }
  .batch-bar   { padding-bottom: calc(0.75rem + env(safe-area-inset-bottom)); }
  .toast       { bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
  .fab         { bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
}

/* ── Hub shared components ───────────────────────────────────── */

.bold  { font-weight: 600; }
.faint { color: var(--text-faint); font-size: .78rem; }

/* Canonical hub header */
.hub-header {
  padding: 1.1rem 1.25rem .6rem;
  border-bottom: 1px solid var(--border);
}
.hub-title {
  font-family: var(--f-serif);
  font-size: 1.35rem;
  font-weight: 300;
  letter-spacing: -.02em;
  color: var(--text);
  margin: 0;
}
.hub-subtitle {
  font-family: var(--f-mono);
  font-size: .65rem;
  color: var(--text-faint);
  margin-top: .2rem;
}

/* Canonical hub sub-nav — underline tab style */
.hub-nav, .dev-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.hub-nav::-webkit-scrollbar, .dev-nav::-webkit-scrollbar { display: none; }
.hub-nav a, .dev-nav a {
  font-family: var(--f-mono);
  font-size: .72rem;
  color: var(--text-faint);
  text-decoration: none;
  padding: .65rem 1rem;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.hub-nav a:hover, .dev-nav a:hover { color: var(--text); }
.hub-nav a.active, .dev-nav a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Hub card-section wrapper */
.purch-section {
  border: 1px solid var(--border);
  background: var(--surface);
  margin: 1rem 1.25rem;
}

/* Two-column layout for hub overviews */
.purch-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
  padding: 0 1.25rem;
}
@media (max-width: 700px) { .purch-two-col { grid-template-columns: 1fr; padding: 0; } }
.purch-two-col > * { margin: 1rem 0 0; }
.purch-two-col .purch-section { margin: 1rem 0 0; }

/* Hub data table */
.purch-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--f-mono);
  font-size: .75rem;
}
.purch-table th {
  text-align: left;
  padding: .5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .07em;
  font-size: .6rem;
  font-weight: 400;
  white-space: nowrap;
  background: var(--bg);
}
.purch-table td {
  padding: .65rem 1.25rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.purch-table tbody tr:last-child td { border-bottom: none; }
.purch-table tbody tr:hover td { background: var(--surface-hi); }

/* Hub section inner label */
.purch-section > .section-label {
  padding: .75rem 1.25rem .5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

/* Hub empty state (inline, not full-page) */
.purch-section .empty-state {
  padding: 2rem 1.25rem;
  text-align: center;
  font-family: var(--f-mono);
  font-size: .78rem;
  color: var(--text-faint);
  background: none;
}

@media (max-width: 768px) {
  .purch-section { margin: .75rem; }
  .purch-table th, .purch-table td { padding: .5rem .85rem; }
}
@media (max-width: 480px) {
  .dev-nav a { font-size: .68rem; padding: .55rem .75rem; }
  .purch-section { margin: .5rem 0; }
}

/* ── Animal Lookup Widget ──────────────────────────────────────────────── */

.animal-lookup {
  position: relative;
}

.al-search-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.al-input {
  flex: 1;
}
.al-scan-btn {
  font-family: var(--f-mono);
  font-size: 0.68rem;
  padding: 0.55rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  border-radius: 3px;
}
.al-scan-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Dropdown */
.al-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  z-index: 200;
  max-height: 260px;
  overflow-y: auto;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.al-result {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.65rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  outline: none;
}
.al-result:last-child { border-bottom: none; }
.al-result:hover, .al-result:focus {
  background: var(--surface-hi);
}
.al-result-name {
  font-family: var(--f-serif);
  font-size: 1rem;
  font-weight: 300;
  color: var(--text);
}
.al-result-meta {
  font-family: var(--f-mono);
  font-size: 0.62rem;
  color: var(--text-faint);
}
.al-no-results {
  padding: 0.75rem 1rem;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  color: var(--text-faint);
}

/* Selected animal card */
.al-card {
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}
.al-card-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.al-card-name {
  font-family: var(--f-serif);
  font-size: 1.05rem;
  font-weight: 300;
  color: var(--text);
}
.al-card-meta {
  font-family: var(--f-mono);
  font-size: 0.62rem;
  color: var(--text-faint);
  margin-top: 0.3rem;
}
.al-change {
  margin-left: auto;
  background: none;
  border: none;
  font-family: var(--f-mono);
  font-size: 0.63rem;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  transition: color 0.15s;
}
.al-change:hover { color: var(--accent); }

/* QR scan overlay */
.al-scan-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.al-scan-box {
  background: var(--surface);
  border: 1px solid var(--border);
  width: min(420px, 95vw);
  overflow: hidden;
}
.al-scan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--f-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
}
.al-scan-close {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.1rem 0.4rem;
  transition: color 0.15s;
}
.al-scan-close:hover { color: var(--text); }
.al-scan-video {
  width: 100%;
  display: block;
  background: #000;
  max-height: 60vh;
  object-fit: cover;
}
.al-scan-canvas { display: none; }
.al-scan-status {
  padding: 0.6rem 1rem;
  font-family: var(--f-mono);
  font-size: 0.68rem;
  color: var(--text-faint);
  text-align: center;
}
