:root {
  --bg: #fff8f0;
  --card-bg: #ffffff;
  --text: #3a2e26;
  --text-muted: #9c8d80;
  --border: #f3e6d8;
  --accent: #e0784f;
  --accent-rgb: 224, 120, 79;
  --eat: #ff9f5a;
  --eat-rgb: 255, 159, 90;
  --walk: #45b787;
  --walk-rgb: 69, 183, 135;
  --poop: #ad8558;
  --poop-rgb: 173, 133, 88;
  --pee: #4bb4d9;
  --pee-rgb: 75, 180, 217;
  --medicine: #a97fd6;
  --medicine-rgb: 169, 127, 214;
  --vet: #3aa6a0;
  --vet-rgb: 58, 166, 160;
  --symptom: #e0a33f;
  --symptom-rgb: 224, 163, 63;
  --weight: #8a94a6;
  --weight-rgb: 138, 148, 166;
  --radius: 20px;
  --shadow-soft: 0 4px 14px rgba(224, 120, 79, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1e1712;
    --card-bg: #2a2019;
    --text: #f6ede4;
    --text-muted: #b3a294;
    --border: #3d2f25;
    --accent: #f0a479;
    --accent-rgb: 240, 164, 121;
    --shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.28);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Quicksand", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 {
  font-family: "Baloo 2", "Quicksand", sans-serif;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: env(safe-area-inset-top, 20px) 16px 100px;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-badge {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--eat), var(--accent));
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.35);
}

.brand-badge::before,
.brand-badge::after {
  content: "";
  position: absolute;
  top: -30%;
  width: 42%;
  height: 55%;
  background: linear-gradient(160deg, var(--eat), var(--accent));
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  z-index: -1;
}

.brand-badge::before {
  left: -6%;
  transform: rotate(-18deg);
}

.brand-badge::after {
  right: -6%;
  transform: rotate(18deg);
}

.brand-centered .brand-badge {
  width: 56px;
  height: 56px;
  min-width: 56px;
  font-size: 24px;
}

.topbar h1 {
  font-size: 24px;
  font-weight: 800;
  margin: 0;
  color: var(--accent);
  letter-spacing: 0.01em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dog-name {
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
  background: rgba(var(--accent-rgb), 0.12);
  padding: 5px 12px;
  border-radius: 999px;
}

select.dog-name {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
  max-width: 150px;
  text-overflow: ellipsis;
}

.pet-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(var(--accent-rgb), 0.35);
}

.pet-photo-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pet-photo {
  width: 72px;
  height: 72px;
  min-width: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.pet-photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  background: rgba(var(--accent-rgb), 0.12);
}

.photo-btn {
  flex: 0 0 auto;
  padding: 10px 16px;
  font-size: 13px;
}

.field select {
  font-family: inherit;
  font-size: 15px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}

.field select:focus {
  outline: none;
  border-color: var(--accent);
}

.logout-btn {
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.log-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}

.log-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 4px;
  border: none;
  border-radius: var(--radius);
  font-family: "Baloo 2", sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.log-btn:active { transform: scale(0.92) rotate(-1deg); }

.log-btn .icon { font-size: 26px; }

.log-btn.eat  { background: var(--eat);  box-shadow: 0 6px 14px rgba(var(--eat-rgb), 0.35); }
.log-btn.walk { background: var(--walk); box-shadow: 0 6px 14px rgba(var(--walk-rgb), 0.35); }
.log-btn.potty { background: var(--pee); box-shadow: 0 6px 14px rgba(var(--pee-rgb), 0.35); }
.log-btn.potty .icon { font-size: 22px; letter-spacing: -3px; }
.log-btn.medicine { background: var(--medicine); box-shadow: 0 6px 14px rgba(var(--medicine-rgb), 0.35); }

.history-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.history-header h2 {
  font-size: 19px;
  font-weight: 700;
  margin: 0;
}

#historyTitle {
  font-size: 15px;
  color: var(--text-muted);
}

.filter-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.filter-tab {
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 6px 4px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.filter-tab:active { transform: scale(0.95); }

.filter-tab.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.view-tabs {
  grid-template-columns: repeat(2, 1fr);
}

.timeline-controls {
  display: flex;
  gap: 8px;
}

.health-section { margin-bottom: 20px; }

.health-section h3 {
  font-size: 15px;
  margin: 0 0 8px;
}

.weight-chart-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-soft);
  position: relative;
}

.weight-chart-card .chart-empty {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 12px 0;
  margin: 0;
}

.weight-hero {
  font-family: "Baloo 2", sans-serif;
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 2px;
}

.weight-hero small {
  font-size: 12px;
  color: var(--text-muted);
  font-family: "Quicksand", sans-serif;
  font-weight: 600;
  margin-left: 8px;
}

.med-stats {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.med-stat {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 6px;
  text-align: center;
}

.med-stat-value {
  font-family: "Baloo 2", sans-serif;
  font-size: 13.5px;
  font-weight: 700;
}

.med-stat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.vax-calendar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.cal-month {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 6px;
  min-height: 52px;
}

.cal-month.current {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.cal-month.later { background: var(--bg); }

.cal-month { cursor: pointer; }

.cal-detail {
  margin-top: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.cal-detail-row {
  font-size: 13px;
  font-weight: 600;
  padding: 3px 0;
}

.cal-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.cal-vax {
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(var(--medicine-rgb), 0.16);
  border-radius: 8px;
  padding: 3px 5px;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-vax.soon { background: rgba(var(--symptom-rgb), 0.25); }
.cal-vax.given { background: rgba(var(--walk-rgb), 0.18); }
.cal-vax.overdue { background: rgba(224, 90, 90, 0.25); }

.vax-zoom-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.vax-zoom-title {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.vax-zoom-btn {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: "Baloo 2", sans-serif;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  cursor: pointer;
}

.vax-zoom-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.vax-daygrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.vax-dow {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  text-align: center;
}

.vax-day {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 40px;
  padding: 3px 4px;
  text-align: center;
}

.vax-day.blank {
  background: none;
  border: none;
}

.vax-day.today {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.vax-day-num {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.vax-day-mark {
  font-size: 12px;
  line-height: 1.3;
}

.vax-day.due { background: rgba(var(--medicine-rgb), 0.16); }
.vax-day.soon { background: rgba(var(--symptom-rgb), 0.25); }
.vax-day.given { background: rgba(var(--walk-rgb), 0.18); }
.vax-day.overdue { background: rgba(224, 90, 90, 0.25); }

.weight-summary {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 12px;
}

.chart-tooltip {
  position: absolute;
  display: none;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
}

.type-select {
  -webkit-appearance: none;
  appearance: none;
  align-self: flex-start;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.type-select.filtering {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.filter-tab.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 3px 10px rgba(var(--accent-rgb), 0.35);
}

.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.day-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

/* collapsed card: the head is the only child, no divider needed */
.day-card > .day-head:last-child { border-bottom: none; }

.day-caret {
  display: inline-block;
  font-size: 11px;
  margin-right: 6px;
  transform-origin: 45% 50%;
  transition: transform 0.15s ease;
}

.day-caret.open { transform: rotate(90deg); }

.group-children {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  background: var(--bg);
}

.group-children .day-card {
  box-shadow: none;
  border-radius: 14px;
}

.day-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.day-digest {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: right;
}

.entry-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px;
  align-items: baseline;
  padding: 9px 14px;
  cursor: pointer;
}

.entry-row + .entry-row { border-top: 1px solid var(--border); }

.row-icon {
  font-size: 16px;
  line-height: 1;
  align-self: center;
}

.row-main {
  font-size: 13.5px;
  font-weight: 700;
  min-width: 0;
}

.row-detail {
  font-weight: 600;
  color: var(--text-muted);
}

.row-note {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.row-time {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.entry-row.pending {
  opacity: 0.6;
  pointer-events: none;
}

.row-caret {
  display: inline-block;
  font-size: 13px;
  margin-left: 6px;
  transform-origin: 45% 50%;
  transition: transform 0.15s ease;
}

.row-caret.open { transform: rotate(90deg); }

.entry-row.sub-row {
  padding-left: 36px;
  background: var(--bg);
}

.entry {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-soft);
}

.entry .dot {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

/* Only medicine, symptom, and vet entries render as .entry cards now
   (the Health → Medical list); Logs uses .day-card/.entry-row */
.entry.medicine .dot { background: rgba(var(--medicine-rgb), 0.18); }
.entry.vet .dot { background: rgba(var(--vet-rgb), 0.18); }
.entry.symptom .dot { background: rgba(var(--symptom-rgb), 0.18); }

.eat-item {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 10px;
}

.eat-item .field { flex: 1; }

.eat-item:not(:first-child) .field span { display: none; }

.eat-item .remove-item {
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px 13px;
}

.eat-item:only-child .remove-item { visibility: hidden; }

.add-item-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.kind-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kind-toggle .kind-btn {
  flex: 1 1 30%;
}

.profile-pet-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-pet-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: "Baloo 2", sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.profile-pet-chip.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.profile-pet-chip img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}

.sharing-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.share-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}

.share-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 4px;
}

.share-list button {
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
}

.share-row {
  display: flex;
  gap: 8px;
}

.share-row input {
  flex: 1;
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.share-row .share-btn {
  flex: 0 0 auto;
  padding: 9px 18px;
  font-size: 14px;
}

.invite-success {
  background: rgba(69, 183, 135, 0.12);
  border-radius: 12px;
  padding: 12px;
}

.invite-success p {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: #276749;
}

@media (prefers-color-scheme: dark) {
  .invite-success p { color: #7dd8ab; }
}

.invite-success .btn {
  width: 100%;
  padding: 10px;
  font-size: 14px;
}

.share-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 8px 0 0;
  font-weight: 600;
}

.kind-btn {
  padding: 12px 2px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: "Baloo 2", sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.kind-btn.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.entry .content { flex: 1; min-width: 0; }

.entry .top-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.entry .type-label {
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
}

.entry .time {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.entry .notes {
  font-size: 13px;
  margin-top: 4px;
}

.push-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(var(--accent-rgb), 0.1);
  font-size: 13px;
  font-weight: 700;
  padding: 11px 14px;
  border-radius: 14px;
  margin-bottom: 14px;
}

.push-prompt-actions { display: flex; gap: 2px; white-space: nowrap; }

.push-prompt-actions button {
  border: none;
  background: none;
  font-family: "Baloo 2", sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
}

.push-prompt-actions #pushYes { color: var(--accent); }
.push-prompt-actions #pushNo { color: var(--text-muted); }

.vaccine-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: none;
  background: rgba(224, 163, 63, 0.16);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 11px 14px;
  border-radius: 14px;
  margin-bottom: 14px;
  cursor: pointer;
  text-align: left;
}

.vaccine-banner #vaccineSnooze {
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 6px;
  flex: 0 0 auto;
}

.attachment-link {
  display: inline-block;
  margin-top: 6px;
  border: none;
  background: rgba(var(--vet-rgb), 0.14);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.entry.skeleton { pointer-events: none; }

.entry.skeleton .dot,
.entry.skeleton .skel-bar {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.entry.skeleton .skel-bar {
  height: 11px;
  border-radius: 6px;
  margin: 5px 0;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.empty-state {
  display: none;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  padding: 40px 20px;
}

.empty-state::before {
  content: "🐶";
  display: block;
  font-size: 36px;
  margin-bottom: 10px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(440px, calc(100vw - 32px));
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  z-index: 200;
  animation: toast-in 0.2s ease;
  white-space: nowrap;
}

.toast[hidden] { display: none; }

.toast-actions { display: flex; gap: 4px; }

.toast-actions button {
  border: none;
  background: none;
  color: var(--accent);
  font-family: "Baloo 2", sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 8px;
}

@keyframes toast-in {
  from { transform: translate(-50%, 12px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.log-btn {
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--card-bg);
  width: 100%;
  max-width: 480px;
  border-radius: 26px 26px 0 0;
  padding: 14px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
}

.modal::before {
  content: "";
  display: block;
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  margin: 0 auto 6px;
}

.modal h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
}

.field-row {
  display: flex;
  gap: 10px;
}

.field-row .field {
  flex: 1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.field input, .field textarea {
  font-family: inherit;
  font-size: 15px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  resize: none;
  transition: border-color 0.15s ease;
}

.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.field input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Hide Chrome's datalist dropdown arrow — suggestions still appear while typing */
#modalMedName::-webkit-calendar-picker-indicator {
  display: none !important;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.btn {
  flex: 1;
  padding: 13px;
  border-radius: 16px;
  border: none;
  font-family: "Baloo 2", sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.btn:active { transform: scale(0.96); }

.btn.primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 6px 16px rgba(var(--accent-rgb), 0.35);
}

.btn.secondary {
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--border);
}

.prefill-chip {
  display: block;
  width: 100%;
  text-align: left;
  background: rgba(var(--accent-rgb), 0.08);
  border: 1.5px dashed rgba(var(--accent-rgb), 0.45);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 10px;
  font-family: "Quicksand", sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.prefill-chip:active { transform: scale(0.98); }

.btn.danger {
  background: var(--bg);
  color: #e05a5a;
  border: 2px solid rgba(224, 90, 90, 0.45);
}
