*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-input: #252833;
  --border: #2e3140;
  --text: #e4e4e7;
  --text-muted: #9ca3af;
  --primary: #c89b6c;
  --primary-hover: #b5875a;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 8px;
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem; }

/* Nav */
nav#nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.brand:hover { text-decoration: none; color: var(--primary); }
.nav-links { display: flex; gap: 1rem; flex: 1; }
.nav-links a { color: var(--text-muted); }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-user { display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; color: var(--text-muted); }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

h1 { font-size: 1.5rem; margin-bottom: 1rem; }
h2 { font-size: 1.15rem; margin-bottom: 0.75rem; }
p { margin-bottom: 0.5rem; }
.muted { color: var(--text-muted); font-size: 0.9rem; }

/* Forms */
label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}
input[type='text'], input[type='password'], input[type='date'],
input[type='number'], input[type='color'], select, textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
textarea { min-height: 140px; resize: vertical; }
input[type='color'] { height: 40px; padding: 2px; cursor: pointer; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

.form-group { margin-bottom: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text);
}
.btn:hover:not(:disabled) { background: var(--border); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #1a1410; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.85rem; }

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.9rem; }
.alert-error { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.alert-success { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.hidden { display: none !important; }

/* Login */
.login-wrapper { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; }
.login-card { max-width: 400px; width: 100%; }

/* Dashboard tiles */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}
.tile:hover { border-color: var(--primary); }
.tile h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.tile p { color: var(--text-muted); font-size: 0.85rem; margin: 0; }

/* Dog list */
.dog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.dog-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
}
.dog-card:hover { border-color: var(--primary); }
.dog-card-img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--bg-input); display: block; }
.dog-card-body { padding: 0.75rem; }
.dog-card-body h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.dog-card-body .muted { font-size: 0.8rem; }

/* Status pill */
.pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: capitalize;
}
.pill-available { background: rgba(34, 197, 94, 0.2); color: #86efac; }
.pill-reserved { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.pill-rehomed { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.pill-sanctuary { background: rgba(167, 139, 250, 0.2); color: #c4b5fd; }
.pill-hidden { background: rgba(156, 163, 175, 0.2); color: #9ca3af; }

/* Toolbar */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }

/* Image thumbs on dog edit */
.image-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; }
.image-thumb {
  position: relative;
  width: 140px;
  height: 140px;
  background: var(--bg-input);
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid transparent;
}
.image-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-thumb.is-primary { border-color: var(--primary); }
.image-thumb-actions { position: absolute; inset: auto 4px 4px 4px; display: flex; gap: 4px; }
.image-thumb-actions .btn { padding: 0.2rem 0.5rem; font-size: 0.7rem; }
.image-thumb-label {
  position: absolute; top: 4px; left: 4px;
  background: var(--primary); color: #1a1410;
  font-size: 0.7rem; padding: 0.1rem 0.4rem; border-radius: 3px;
  font-weight: 600;
}
