/* ── Reset & tokens ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f5f0;
  --surface: #ffffff;
  --primary: #3d7d4a;
  --primary-dark: #2e5f38;
  --danger: #c0392b;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
}

body { font-family: system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── Views ──────────────────────────────────────────────── */
.view { min-height: 100vh; }
.hidden { display: none !important; }

/* ── Auth ───────────────────────────────────────────────── */
#view-auth { display: flex; align-items: center; justify-content: center; padding: 24px; }

.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 36px;
  width: 100%; max-width: 380px;
}

.auth-card h1 { font-size: 1.8rem; text-align: center; margin-bottom: 24px; }

.tab-bar { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.tab {
  flex: 1; padding: 10px; background: none; border: none;
  font-size: .95rem; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.auth-form input {
  padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 1rem; outline: none;
  transition: border-color .2s;
}
.auth-form input:focus { border-color: var(--primary); }

/* ── Buttons ────────────────────────────────────────────── */
.btn-primary {
  padding: 11px 20px; background: var(--primary); color: #fff;
  border: none; border-radius: 8px; font-size: 1rem;
  font-weight: 600; cursor: pointer; transition: background .2s;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-ghost {
  padding: 8px 14px; background: none; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: .9rem; cursor: pointer; color: var(--text);
  transition: background .15s;
}
.btn-ghost:hover { background: var(--bg); }

.btn-danger {
  padding: 8px 14px; background: none; border: 1.5px solid var(--danger);
  border-radius: 8px; font-size: .9rem; cursor: pointer; color: var(--danger);
}
.btn-danger:hover { background: #fdf2f2; }

.btn-sm {
  padding: 5px 12px; font-size: .8rem; border-radius: 6px;
  border: 1.5px solid var(--border); background: var(--surface);
  cursor: pointer; color: var(--text);
}
.btn-sm:hover { background: var(--bg); }
.btn-sm.danger { border-color: var(--danger); color: var(--danger); }
.btn-sm.danger:hover { background: #fdf2f2; }

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.topbar h2 { font-size: 1.2rem; }

/* ── Dogs grid ──────────────────────────────────────────── */
.dogs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px; padding: 28px 24px;
  max-width: 1000px; margin: 0 auto;
}

.dog-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.dog-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,.12); }

.dog-card img {
  width: 100%; height: 160px; object-fit: cover;
  background: var(--bg);
}
.dog-card-placeholder {
  width: 100%; height: 160px;
  background: linear-gradient(135deg, #d4edda, #a8d5b5);
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
}
.dog-card-body { padding: 14px 16px; }
.dog-card-body h3 { font-size: 1.1rem; margin-bottom: 4px; }
.dog-card-body p { font-size: .85rem; color: var(--muted); }

/* ── FAB ────────────────────────────────────────────────── */
.fab {
  position: fixed; bottom: 28px; right: 28px;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 1.6rem;
  border: none; cursor: pointer; box-shadow: 0 4px 16px rgba(61,125,74,.4);
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.fab:hover { background: var(--primary-dark); }

/* ── Modal ──────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 16px;
}
.modal-box {
  background: var(--surface); border-radius: var(--radius);
  padding: 32px; width: 100%; max-width: 440px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  display: flex; flex-direction: column; gap: 10px;
}
.modal-box h3 { font-size: 1.2rem; margin-bottom: 4px; }
.modal-box label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.modal-box input, .modal-box select, .modal-box textarea {
  padding: 9px 12px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: .95rem; outline: none;
  width: 100%; transition: border-color .2s; font-family: inherit;
}
.modal-box input:focus, .modal-box select:focus, .modal-box textarea:focus {
  border-color: var(--primary);
}
.modal-box textarea { resize: vertical; min-height: 80px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* ── Dog hero ───────────────────────────────────────────── */
.dog-hero {
  display: flex; align-items: center; gap: 20px;
  padding: 24px; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.dog-avatar {
  width: 90px; height: 90px; border-radius: 50%;
  object-fit: cover; border: 3px solid var(--primary);
}
.dog-meta p { color: var(--muted); font-size: .95rem; margin-top: 4px; }
.chip-link { font-size: .85rem; color: var(--primary); margin-top: 6px; display: block; }

/* ── Section tabs ───────────────────────────────────────── */
.section-tabs {
  display: flex; gap: 4px; padding: 12px 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  overflow-x: auto; flex-wrap: nowrap;
}
.stab {
  white-space: nowrap; padding: 8px 16px; background: none; border: none;
  font-size: .9rem; color: var(--muted); cursor: pointer; border-radius: 20px;
  transition: background .15s;
}
.stab.active { background: var(--primary); color: #fff; font-weight: 600; }

/* ── Section panel ──────────────────────────────────────── */
.section-panel { padding: 24px; max-width: 860px; margin: 0 auto; }

.section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px;
}
.section-header h3 { font-size: 1.1rem; }

.record-list { display: flex; flex-direction: column; gap: 12px; }

.record-card {
  background: var(--surface); border-radius: 10px;
  border: 1px solid var(--border); padding: 16px 18px;
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px;
}
.record-card-body { flex: 1; }
.record-card-body h4 { font-size: 1rem; margin-bottom: 6px; }
.record-card-body p { font-size: .85rem; color: var(--muted); line-height: 1.5; }
.record-actions { display: flex; gap: 8px; flex-shrink: 0; }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
}
.badge-green { background: #d4edda; color: #1a6a2e; }
.badge-orange { background: #fde8d0; color: #a04000; }
.badge-blue { background: #d0e8fd; color: #0050a0; }
.badge-red { background: #fde0d0; color: #a02000; }

.empty-state {
  text-align: center; padding: 48px 0; color: var(--muted);
  font-size: 1rem;
}
.empty-state span { font-size: 2.5rem; display: block; margin-bottom: 10px; }

/* ── Toast ──────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1a1a1a; color: #fff; padding: 12px 24px;
  border-radius: 24px; font-size: .9rem; z-index: 200;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  animation: fadeup .25s ease;
}
@keyframes fadeup {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.error { color: var(--danger); font-size: .85rem; }
