:root {
  --bg: #f7f5f2;
  --surface: #ffffff;
  --surface-alt: #f0ede8;
  --border: #dddad4;
  --text: #2c2a27;
  --text-muted: #6b6762;
  --primary: #3b6b4c;
  --primary-hover: #2d5339;
  --primary-light: #e6f0e9;
  --accent: #b87333;
  --danger: #c0392b;
  --danger-hover: #96281b;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --radius: 8px;
  --radius-lg: 12px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --vaccine: #2e7d6a;
  --illness: #c0642b;
  --surgery: #7a3b8f;
  --medication: #3a6ea5;
  --checkup: #5a7a3c;
  --other: #6b6762;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.55; }
.container { max-width: 1280px; margin: 0 auto; padding: 0 20px; }

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  gap: 16px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { color: var(--primary); }
.brand h1 { font-size: 18px; margin: 0; font-weight: 600; color: var(--text); }
.site-nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-nav a { color: var(--text-muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.site-nav a:hover { color: var(--primary); }

.main-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  padding-top: 24px;
  padding-bottom: 40px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - 88px);
  overflow-y: auto;
  padding-right: 4px;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.panel h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }
.panel h3 { font-size: 14px; margin: 0 0 10px; font-weight: 600; }

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  margin-top: 10px;
}
.field-label:first-child { margin-top: 0; }

input[type="text"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
textarea { resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface-alt); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.main-content { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

.timeline-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
}
.filter-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font);
  transition: all 0.15s;
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.search-wrap input {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  font-family: var(--font);
  width: 200px;
  max-width: 100%;
}
.active-pet-info {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.timeline {
  position: relative;
  padding: 16px 0;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-event {
  position: relative;
  padding-left: 52px;
  margin-bottom: 16px;
  cursor: pointer;
}
.timeline-event::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 14px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-sm);
}
.timeline-event.type-vaccine::before { background: var(--vaccine); }
.timeline-event.type-illness::before { background: var(--illness); }
.timeline-event.type-surgery::before { background: var(--surgery); }
.timeline-event.type-medication::before { background: var(--medication); }
.timeline-event.type-checkup::before { background: var(--checkup); }
.timeline-event.type-other::before { background: var(--other); }

.event-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.15s;
}
.event-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.event-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.event-card-title { font-weight: 600; font-size: 15px; }
.event-card-date { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.event-card-type {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 6px;
}
.type-badge-vaccine { background: #e6f5f1; color: var(--vaccine); }
.type-badge-illness { background: #fdf0e5; color: var(--illness); }
.type-badge-surgery { background: #f3e8f8; color: var(--surgery); }
.type-badge-medication { background: #e5eef7; color: var(--medication); }
.type-badge-checkup { background: #eaf2e4; color: var(--checkup); }
.type-badge-other { background: var(--surface-alt); color: var(--other); }
.event-card-notes {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
  display: none;
  white-space: pre-wrap;
}
.event-card.expanded .event-card-notes { display: block; }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}
.empty-state p:first-child { font-weight: 500; font-size: 16px; margin-bottom: 4px; }

.summary-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.summary-panel h2 { margin-top: 0; }
.summary-output {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 13px;
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
  font-family: var(--font);
  color: var(--text);
  margin: 12px 0;
}

.guide-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.guide-content h2 { margin-top: 0; font-size: 20px; }
.guide-content h3 { font-size: 16px; margin-top: 24px; margin-bottom: 8px; color: var(--primary); }
.guide-content p, .guide-content li { font-size: 14px; color: var(--text); }
.guide-content ul { padding-left: 20px; }
.guide-content li { margin-bottom: 6px; }

.reference-table-wrap { overflow-x: auto; margin: 12px 0; }
.reference-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.reference-table th, .reference-table td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: left;
}
.reference-table th { background: var(--surface-alt); font-weight: 600; }

.muted { color: var(--text-muted); }
.small { font-size: 12px; }

.dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-md);
}
.dialog::backdrop { background: rgba(0,0,0,0.4); }
.dialog-inner { padding: 24px; }
.dialog-inner h2 { margin-top: 0; }
.dialog-meta { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.dialog-fields { display: flex; flex-direction: column; }

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 20px 0;
  margin-top: 40px;
  font-size: 13px;
  color: var(--text-muted);
}
.site-footer a { color: var(--primary); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .main-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .filter-bar { flex-direction: column; align-items: flex-start; }
  .search-wrap input { width: 100%; }
}
@media (max-width: 520px) {
  .brand h1 { font-size: 15px; }
  .header-inner { padding: 10px 16px; }
  .container { padding: 0 14px; }
  .filter-buttons { gap: 4px; }
  .filter-btn { padding: 4px 9px; font-size: 12px; }
}

@media print {
  .sidebar, .site-header, .site-footer, .filter-bar, .summary-panel, #guide-section, .btn, .btn-row { display: none !important; }
  .main-layout { grid-template-columns: 1fr; padding: 0; }
  .timeline::before { display: none; }
  .timeline-event { padding-left: 0; break-inside: avoid; }
  .timeline-event::before { display: none; }
  .event-card-notes { display: block !important; }
  body { background: #fff; }
}


/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
