/* ===== DASHBOARD LAYOUT ===== */
.dash-page { min-height: 100vh; background: var(--bg); }

.dash-header {
  background: rgba(247,244,239,0.95);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.dash-header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dash-header .wordmark {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}
.dash-nav { display: flex; align-items: center; gap: 24px; }
.dash-nav-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}
.dash-nav-link:hover, .dash-nav-link.active {
  color: var(--accent);
  background: rgba(13,92,92,0.06);
}
.btn-logout {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  padding: 7px 18px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg-muted);
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: border-color 0.2s, color 0.2s;
}
.btn-logout:hover { border-color: var(--accent); color: var(--accent); }

.dash-main { padding: 48px 32px; }
.dash-container { max-width: 960px; margin: 0 auto; }

/* Welcome bar */
.dash-welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
}
.dash-welcome h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 4px;
}
.dash-welcome-sub { font-size: 0.9rem; color: var(--fg-muted); margin: 0; }

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 20px;
  display: none;
}
.alert.visible { display: block; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }

/* Sections */
.dash-section { margin-bottom: 48px; }
.dash-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 1.5px solid var(--border);
}

/* Loading spinner */
.pets-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--fg-muted);
  font-size: 0.875rem;
  padding: 20px 0;
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Pets grid */
.pets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.pets-empty {
  text-align: center;
  padding: 48px 24px;
  background: #fff;
  border: 1.5px dashed var(--border);
  border-radius: 16px;
}
.pets-empty-icon {
  width: 64px; height: 64px;
  background: var(--accent-light);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.pets-empty-icon svg { fill: var(--accent); }
.pets-empty p { color: var(--fg-muted); font-size: 0.9rem; margin: 0 0 20px; }

/* Pet card */
.pet-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: box-shadow 0.2s;
}
.pet-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.06); }
.pet-card-icon {
  width: 48px; height: 48px;
  background: var(--accent-light);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pet-card-info { flex: 1; min-width: 0; }
.pet-card-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 4px;
}
.pet-card-detail { font-size: 0.8rem; color: var(--fg-muted); margin: 0 0 2px; }
.pet-card-conditions { font-size: 0.78rem; color: #b45309; margin: 4px 0 0; }
.pet-card-actions { display: flex; flex-direction: column; gap: 8px; }

/* Buttons */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: background 0.2s;
}
.btn-primary:hover { background: #0a4f4f; }

.btn-secondary {
  background: #fff;
  color: var(--fg-muted);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: border-color 0.2s, color 0.2s;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.15s;
  display: flex;
  align-items: center;
}
.btn-icon:hover { background: var(--bg); }

/* AI Assistant */
.assistant-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
.assistant-messages {
  min-height: 280px;
  max-height: 400px;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-msg {
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.5;
  max-width: 80%;
  white-space: pre-wrap;
}
.chat-user { background: var(--accent-light); color: var(--fg); align-self: flex-end; }
.chat-assistant { background: var(--bg); color: var(--fg); border: 1px solid var(--border); align-self: flex-start; }

.assistant-input-row {
  display: flex;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--border);
  background: rgba(247,244,239,0.5);
}
.pet-select {
  flex-shrink: 0;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: #fff;
  color: var(--fg);
  cursor: pointer;
  min-width: 160px;
}
.pet-select:focus { outline: none; border-color: var(--accent); }
.chat-input {
  flex: 1;
  padding: 10px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: #fff;
  color: var(--fg);
  outline: none;
}
.chat-input:focus { border-color: var(--accent); }
.btn-send {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 600;
}
.btn-send:hover { opacity: 0.9; }

.dash-usage-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 16px 12px;
  font-size: 12px;
}
.dash-usage-text { color: var(--fg-muted, #6B8A82); }
.dash-usage-text.usage-warning { color: #D97706; }
.dash-usage-text.usage-exhausted { color: #DC2626; }
.dash-usage-upgrade {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.dash-usage-upgrade:hover { opacity: 0.8; }
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: background 0.2s;
  flex-shrink: 0;
}
.btn-send:hover:not(:disabled) { background: #0a4f4f; }
.btn-send:disabled { opacity: 0.6; cursor: not-allowed; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.modal-card {
  position: relative;
  background: #fff;
  border-radius: 20px;
  padding: 32px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  margin: 20px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.modal-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--fg);
  margin: 0;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--fg-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}
.modal-close:hover { color: var(--fg); }

/* Form */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.875rem; font-weight: 600; color: var(--fg); margin-bottom: 6px; }
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--fg);
  outline: none;
  box-sizing: border-box;
}
.form-input:focus { border-color: var(--accent); background: #fff; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.field-error { font-size: 0.78rem; color: #d9534f; margin-top: 4px; display: none; }
.field-error.visible { display: block; }

/* Mobile */
@media (max-width: 640px) {
  .dash-header-inner { padding: 0 16px; }
  .dash-main { padding: 32px 16px; }
  .dash-welcome { flex-direction: column; align-items: flex-start; gap: 16px; }
  .pets-grid { grid-template-columns: 1fr; }
  .assistant-input-row { flex-direction: column; }
  .pet-select { min-width: unset; }
  .form-row { grid-template-columns: 1fr; }
}