/* ================================
   Harry Pet — Design Tokens
   ================================ */
:root {
  --orange: #E94E1B;
  --orange-dark: #C8401A;
  --orange-light: #FFE5DA;
  --orange-50: #FFF8F3;
  --brown: #5C2C1E;
  --brown-light: #7A5B4F;
  --cream: #FFF8F3;
  --white: #FFFFFF;
  --text: #2D1810;
  --text-soft: #7A5B4F;
  --border: #F0DFD3;
  --border-strong: #E5C9B7;
  --success: #2E7D32;
  --success-bg: #E8F5E9;
  --danger: #C62828;
  --danger-bg: #FFEBEE;
  --warning: #EF6C00;
  --warning-bg: #FFF3E0;
  --info: #1565C0;
  --info-bg: #E3F2FD;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(92, 44, 30, 0.06);
  --shadow: 0 2px 8px rgba(92, 44, 30, 0.08);
  --shadow-lg: 0 8px 24px rgba(92, 44, 30, 0.12);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-8: 48px;

  --sidebar-w: 240px;
  --bottom-nav-h: 64px;
  --topbar-h: 56px;

  --font: -apple-system, BlinkMacSystemFont, 'Nunito', 'Segoe UI', Roboto, sans-serif;
}

/* ================================
   Reset
   ================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; font-weight: 800; color: var(--brown); }

/* ================================
   App Layout
   ================================ */
#app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: var(--space-5) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-bottom: 1px solid var(--border);
}
.brand-logo img { width: 44px; height: 44px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
  font-weight: 900;
  color: var(--orange);
  letter-spacing: 0.5px;
  font-size: 16px;
}
.brand-sub {
  font-size: 11px;
  color: var(--brown);
  font-weight: 600;
}

.nav {
  display: flex;
  flex-direction: column;
  padding: var(--space-3);
  gap: var(--space-1);
  flex: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  color: var(--brown-light);
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item:hover { background: var(--orange-50); color: var(--brown); }
.nav-item.active {
  background: var(--orange);
  color: var(--white);
}

.sidebar-footer {
  padding: var(--space-3);
  border-top: 1px solid var(--border);
}

.topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--space-4);
  height: var(--topbar-h);
  align-items: center;
}
.brand-compact {
  padding: 0;
  border: 0;
  gap: var(--space-2);
}
.brand-compact img { width: 32px; height: 32px; }
.brand-compact span {
  font-weight: 900;
  color: var(--orange);
  letter-spacing: 0.5px;
}

.content {
  padding: var(--space-5) var(--space-6);
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0));
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: var(--white);
  border-top: 1px solid var(--border);
  z-index: 50;
}
.bottom-nav .nav-item {
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: var(--space-2);
  border-radius: 0;
  font-size: 11px;
}
.bottom-nav .nav-item svg { width: 22px; height: 22px; }
.bottom-nav .nav-item.active {
  background: transparent;
  color: var(--orange);
}

/* ================================
   Mobile responsive
   ================================ */
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { display: flex; }
  .bottom-nav { display: flex; }
  .content {
    padding: var(--space-4);
    padding-bottom: calc(var(--bottom-nav-h) + var(--space-5));
  }
}

/* ================================
   Page header
   ================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}
.page-title { font-size: 24px; }
.page-subtitle { color: var(--text-soft); font-size: 13px; margin-top: 2px; }

/* ================================
   Buttons
   ================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 14px;
  transition: transform 0.05s, background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn svg { width: 18px; height: 18px; }
.btn-primary {
  background: var(--orange);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--orange-dark); }
.btn-secondary {
  background: var(--white);
  color: var(--brown);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--orange-50); }
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--brown-light);
  font-weight: 600;
  font-size: 13px;
}
.btn-ghost:hover { background: var(--orange-50); color: var(--brown); }
.btn-ghost svg { width: 18px; height: 18px; }
.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
}
.btn-danger:hover { background: #FFCDD2; }
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  color: var(--brown-light);
  transition: background 0.15s;
}
.btn-icon:hover { background: var(--orange-50); color: var(--orange); }
.btn-icon svg { width: 18px; height: 18px; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ================================
   Cards
   ================================ */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.card-title { font-size: 17px; }

/* ================================
   Stat tiles
   ================================ */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.stat {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.orange { background: var(--orange-light); color: var(--orange); }
.stat-icon.brown { background: #EFE0D5; color: var(--brown); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.blue { background: var(--info-bg); color: var(--info); }
.stat-label { font-size: 12px; color: var(--text-soft); font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 800; color: var(--brown); }

/* ================================
   Forms
   ================================ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}
.form-grid.cols-1 { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-full { grid-column: 1 / -1; }
.label {
  font-size: 12px;
  font-weight: 700;
  color: var(--brown);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.label .req { color: var(--orange); }
.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--white);
  color: var(--text);
  font-size: 14px;
  transition: border 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-light);
}
.textarea { resize: vertical; min-height: 70px; }
.help {
  font-size: 12px;
  color: var(--text-soft);
}
.error-text {
  font-size: 12px;
  color: var(--danger);
}

.radio-row, .check-row {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--white);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.15s;
}
.radio-pill input { display: none; }
.radio-pill:has(input:checked) {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--white);
}

.file-drop {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: var(--space-4);
  text-align: center;
  cursor: pointer;
  transition: border 0.15s, background 0.15s;
  font-size: 13px;
  color: var(--text-soft);
  background: var(--orange-50);
}
.file-drop:hover { border-color: var(--orange); background: var(--orange-light); }
.file-drop input { display: none; }
.file-preview { margin-top: var(--space-3); display: flex; gap: var(--space-2); align-items: center; }
.file-preview img { width: 60px; height: 60px; object-fit: cover; border-radius: var(--radius); }

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

/* ================================
   Tabs
   ================================ */
.tabs {
  display: flex;
  gap: var(--space-1);
  background: var(--white);
  padding: var(--space-1);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: var(--space-5);
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}
.tab {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-soft);
  white-space: nowrap;
}
.tab.active {
  background: var(--orange);
  color: var(--white);
}

/* ================================
   List items
   ================================ */
.list { display: flex; flex-direction: column; gap: var(--space-3); }
.list-item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  transition: box-shadow 0.15s, transform 0.05s;
}
.list-item:hover { box-shadow: var(--shadow); }
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--orange-light);
  color: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 700; color: var(--brown); }
.list-sub { font-size: 13px; color: var(--text-soft); }
.list-actions { display: flex; gap: var(--space-1); }

/* ================================
   Badges
   ================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-blue { background: var(--info-bg); color: var(--info); }
.badge-warn { background: var(--warning-bg); color: var(--warning); }
.badge-gray { background: #EFE0D5; color: var(--brown); }

/* ================================
   Empty state
   ================================ */
.empty {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--text-soft);
}
.empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--orange-50);
  color: var(--orange);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-3);
}
.empty-icon svg { width: 30px; height: 30px; }
.empty h3 { font-size: 16px; margin-bottom: var(--space-1); color: var(--brown); }
.empty p { font-size: 13px; margin: 0 0 var(--space-4); }

/* ================================
   Modal
   ================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(45, 24, 16, 0.5);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fadeIn 0.15s;
}
.modal-overlay[hidden] { display: none !important; }
[hidden] { display: none !important; }
.modal {
  background: var(--white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease-out;
}
@media (min-width: 700px) {
  .modal-overlay { align-items: center; padding: var(--space-4); }
  .modal { border-radius: var(--radius-xl); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 { font-size: 18px; }
.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  transition: background 0.15s;
}
.modal-close:hover { background: var(--orange-50); color: var(--orange); }
.modal-close svg { width: 20px; height: 20px; }
.modal-body {
  padding: var(--space-5);
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  margin-top: var(--space-4);
}
.modal-footer .btn { flex-shrink: 0; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ================================
   Toast
   ================================ */
.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}
@media (max-width: 700px) {
  .toast-container { top: calc(var(--topbar-h) + var(--space-2)); right: var(--space-2); left: var(--space-2); }
}
.toast {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--orange);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 600;
  color: var(--brown);
  pointer-events: auto;
  animation: slideIn 0.2s;
  max-width: 360px;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warning); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ================================
   Calendar / Schedule
   ================================ */
.schedule-day {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.appointment-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--orange);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.appointment-time {
  font-weight: 800;
  font-size: 16px;
  color: var(--orange);
  min-width: 64px;
}
.appointment-card.done { border-left-color: var(--success); opacity: 0.85; }
.appointment-card.done .appointment-time { color: var(--success); }
.appointment-card.cancel { border-left-color: var(--danger); opacity: 0.7; }

/* ================================
   Misc
   ================================ */
.row {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
}
.row-between { justify-content: space-between; }
.spacer { flex: 1; }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.text-soft { color: var(--text-soft); }
.text-orange { color: var(--orange); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-right { text-align: right; }
.text-bold { font-weight: 700; }
.text-lg { font-size: 17px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.hidden { display: none !important; }

.divider { height: 1px; background: var(--border); margin: var(--space-4) 0; }

.section + .section { margin-top: var(--space-6); }
.section-title { font-size: 14px; color: var(--brown-light); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; margin-bottom: var(--space-3); }

/* Pet detail header */
.pet-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--orange-50);
  border-radius: var(--radius);
  padding: var(--space-3);
}
.pet-header-photo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--white);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pet-header-photo img { width: 100%; height: 100%; object-fit: cover; }
.pet-header-photo .placeholder { font-size: 36px; }

/* Pet card with photo */
.pet-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pet-photo {
  aspect-ratio: 1;
  background: var(--orange-50);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.pet-photo img { width: 100%; height: 100%; object-fit: cover; }
.pet-photo .placeholder { font-size: 40px; color: var(--orange); }
.pet-card-body { padding: var(--space-3); }

.grid-pets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-3);
}

/* Inline action chips */
.chip-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--orange-50);
  color: var(--brown);
  font-size: 12px;
  font-weight: 600;
}

/* Filter bar */
.filter-bar {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
  align-items: center;
}
.filter-bar .input { max-width: 280px; }

/* Table-ish row for finance */
.tx-list { display: flex; flex-direction: column; }
.tx-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.tx-row:last-child { border-bottom: 0; }
.tx-amount { font-weight: 800; }
.tx-amount.income { color: var(--success); }
.tx-amount.expense { color: var(--danger); }

/* Pacote progress */
.progress {
  height: 6px;
  background: var(--orange-50);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}
.progress-bar {
  height: 100%;
  background: var(--orange);
  border-radius: 999px;
}
