/* ===== VARIABELEN ===== */
:root {
  --bg: #0D0D0D;
  --surface: #1A1A1A;
  --surface2: #222222;
  --surface3: #2C2C2C;
  --accent: #C9A84C;
  --accent-dark: #A8872E;
  --accent-glow: rgba(201,168,76,0.12);
  --accent-glow2: rgba(201,168,76,0.25);
  --text: #F0EDE8;
  --text-muted: #888;
  --text-dim: #444;
  --danger: #E05454;
  --success: #5DBF5A;
  --warning: #E0A030;
  --border: #2A2A2A;
  --sidebar: 240px;
  --bnav: 65px;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.5);
}
[data-theme="light"] {
  --bg: #F5F4F0;
  --surface: #FFFFFF;
  --surface2: #F0EDE6;
  --surface3: #E5E1D6;
  --accent: #8A6E20;
  --accent-dark: #6E5618;
  --accent-glow: rgba(138,110,32,0.15);
  --accent-glow2: rgba(138,110,32,0.3);
  --text: #1A1A1A;
  --text-muted: #666;
  --text-dim: #999;
  --danger: #C0392B;
  --success: #2E7D32;
  --warning: #B8860B;
  --border: #DDD6C4;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}
input, select, textarea, button { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 2px; }

/* ===== LAYOUT ===== */
#app {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  display: none;
  width: var(--sidebar);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 28px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo-text {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
}
.sidebar-logo .logo-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover { color: var(--text); background: var(--accent-glow); }
.sidebar-nav a.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-glow); }
.sidebar-nav a svg { flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-dim);
}
.theme-toggle-side {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}
.theme-toggle-side:hover { color: var(--accent); border-color: var(--accent); }

.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--bnav) + env(safe-area-inset-bottom));
  overflow-x: hidden;
  max-width: 100%;
}

/* ===== MOBILE HEADER ===== */
.mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top) calc(16px + env(safe-area-inset-right)) 0 calc(16px + env(safe-area-inset-left));
  height: calc(58px + env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.mobile-header .logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
}
.mobile-header .header-action {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--surface2);
  color: var(--text-muted);
  transition: all 0.2s;
}
.mobile-header .header-action:hover { color: var(--accent); }

/* ===== CONTENT ===== */
#content {
  flex: 1;
  padding: 20px calc(16px + env(safe-area-inset-right)) 20px calc(16px + env(safe-area-inset-left));
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  overflow-x: hidden;
  min-width: 0;
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--bnav) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 100;
  box-sizing: border-box;
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-dim);
  font-size: 0.65rem;
  font-weight: 500;
  transition: all 0.2s;
}
.bottom-nav a:hover { color: var(--text-muted); }
.bottom-nav a.active { color: var(--accent); }
.bottom-nav a svg { width: 22px; height: 22px; }

/* ===== DESKTOP ===== */
@media (min-width: 768px) {
  .sidebar { display: flex; }
  .main-wrap { margin-left: var(--sidebar); padding-bottom: 0; }
  .mobile-header { display: none; }
  .bottom-nav { display: none; }
  #content { padding: 32px 40px; }
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
}
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
}
.page-title span {
  color: var(--accent);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #000;
}
.btn-primary:hover { background: #D9B85C; transform: translateY(-1px); }
.btn-ghost {
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--surface3); }
.btn-danger {
  background: rgba(224,84,84,0.15);
  color: var(--danger);
  border: 1px solid rgba(224,84,84,0.3);
}
.btn-danger:hover { background: rgba(224,84,84,0.25); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-icon {
  width: 36px; height: 36px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center; justify-content: center;
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-icon:hover { color: var(--accent); border-color: var(--accent); }

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-sm { padding: 14px 16px; }

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
@media (min-width: 480px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.stat-card .stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 6px;
}

/* ===== SNAKE GRID ===== */
.snake-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
@media (min-width: 480px) {
  .snake-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

.snake-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.snake-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(201,168,76,0.1);
}
.snake-card-photo {
  width: 100%;
  aspect-ratio: 1;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.snake-card-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.snake-card-photo .no-photo {
  color: var(--text-dim);
  opacity: 0.4;
}
.snake-sex-badge {
  position: absolute;
  top: 8px; right: 8px;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI Symbol', sans-serif;
  font-variant-emoji: text;
  line-height: 1;
}
.sex-m { background: rgba(93,136,219,0.9); color: #fff; }
.sex-f { background: rgba(219,93,140,0.9); color: #fff; }
.sex-u { background: var(--surface3); color: var(--text-muted); }
.snake-sale-badge {
  position: absolute;
  bottom: 8px; left: 8px;
  padding: 3px 8px;
  background: var(--accent);
  color: #000;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 10px;
}

.snake-card-body { padding: 12px; }
.snake-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.snake-card-morph {
  font-size: 0.75rem;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.snake-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.snake-card-weight {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.feeding-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-left: auto;
}
.dot-ok { background: var(--success); }
.dot-warn { background: var(--warning); }
.dot-alert { background: var(--danger); }

/* ===== SNAKE DETAIL ===== */
.snake-detail-header {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
}
.snake-detail-photo {
  width: 90px; height: 90px;
  border-radius: var(--radius);
  background: var(--surface2);
  border: 2px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  cursor: pointer;
}
.snake-detail-photo img { width: 100%; height: 100%; object-fit: cover; }
.snake-detail-photo .photo-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.snake-detail-photo:hover .photo-overlay { opacity: 1; }

.snake-detail-info { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.snake-detail-name {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.snake-detail-morph {
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.snake-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.tag-accent { background: var(--accent-glow); color: var(--accent); border-color: rgba(201,168,76,0.3); }

.snake-detail-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.snake-detail-actions::-webkit-scrollbar { display: none; }
.snake-detail-actions .btn { flex-shrink: 0; white-space: nowrap; }

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
@media (min-width: 600px) {
  .tab-btn { padding: 10px 16px; font-size: 0.85rem; flex: 0 1 auto; }
}

/* ===== LOG ENTRIES ===== */
.log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.log-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s;
}
.log-entry:hover { border-color: var(--surface3); }
.log-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}
.log-icon-feed { background: rgba(93,191,90,0.15); }
.log-icon-weight { background: rgba(201,168,76,0.15); }
.log-icon-shed { background: rgba(93,136,219,0.15); }
.log-icon-note { background: rgba(201,168,76,0.15); }
.log-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.log-title {
  font-size: 0.875rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.log-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  overflow-wrap: anywhere;
}
.log-date {
  font-size: 0.72rem;
  color: var(--text-dim);
  white-space: nowrap;
}
.log-entry .btn-icon { width: 28px; height: 28px; flex-shrink: 0; }

/* ===== EATEN BADGE ===== */
.eaten-yes { color: var(--success); }
.eaten-no { color: var(--danger); }

/* ===== WEIGHT CHART ===== */
.chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.chart-wrap canvas { max-height: 200px; }

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state svg { opacity: 0.2; margin-bottom: 16px; }
.empty-state p { font-size: 0.875rem; margin-top: 6px; }

/* ===== MODAL ===== */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
}
.modal-backdrop.open {
  display: flex;
  animation: backdropIn 0.2s ease;
}
@media (min-width: 600px) {
  .modal-backdrop { align-items: center; }
}
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: sheetUp 0.3s cubic-bezier(0.32,0.72,0,1);
  padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 600px) {
  .modal { border-radius: var(--radius); animation: modalIn 0.2s ease; }
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes modalIn { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
  margin-bottom: 20px;
}
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface2);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.modal-close:hover { background: var(--surface3); color: var(--text); }

.modal-body { padding: 0 20px 20px; }

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 16px;
}
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
@media (min-width: 768px) {
  .form-input, .form-select, .form-textarea { font-size: 0.9rem; }
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { cursor: pointer; }
option { background: var(--surface2); }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 4px;
}
.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* ===== TOGGLE ===== */
.toggle-group {
  display: flex;
  gap: 8px;
}
.toggle-btn {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
}
.toggle-btn.active {
  background: var(--accent-glow2);
  border-color: var(--accent);
  color: var(--accent);
}
.toggle-btn.active-danger {
  background: rgba(224,84,84,0.15);
  border-color: rgba(224,84,84,0.4);
  color: var(--danger);
}

/* ===== PHOTO UPLOAD ===== */
.photo-upload-area {
  width: 100%;
  aspect-ratio: 1;
  max-width: 120px;
  background: var(--surface2);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  overflow: hidden;
  position: relative;
}
.photo-upload-area:hover { border-color: var(--accent); }
.photo-upload-area img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.photo-upload-text {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 6px;
  position: relative;
  z-index: 1;
}

/* ===== DASHBOARD RECENT ===== */
.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.feed-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s;
}
.feed-alert:hover { border-color: var(--accent); }
.feed-alert-name { font-size: 0.875rem; font-weight: 600; flex: 1; }
.feed-alert-days { font-size: 0.75rem; }

/* ===== PROGRESS BAR ===== */
.progress-bar {
  height: 4px;
  background: var(--surface3);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transition: width 0.5s ease;
}

/* ===== BACK BUTTON ===== */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding: 4px 0;
}
.back-btn:hover { color: var(--accent); }

/* ===== TOAST ===== */
.toast-wrap {
  position: fixed;
  bottom: calc(var(--bnav) + 16px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  pointer-events: none;
}
@media (min-width: 768px) {
  .toast-wrap { bottom: 24px; }
}
.toast {
  background: var(--surface3);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid var(--border);
  animation: toastIn 0.2s ease, toastOut 0.2s ease 1.8s forwards;
}
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* ===== SEARCH BAR ===== */
.search-wrap {
  position: relative;
  margin-bottom: 20px;
}
.search-wrap svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
}
@media (min-width: 768px) {
  .search-input { font-size: 0.9rem; }
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ===== DIVIDER ===== */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ===== RESPONSIVE TWEAKS ===== */
@media (max-width: 360px) {
  .snake-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== PHOTO GALLERY ===== */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
@media (min-width: 480px) {
  .photo-gallery { grid-template-columns: repeat(4, 1fr); }
}
.photo-thumb {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  background: var(--surface2);
  cursor: pointer;
  border: 1px solid var(--border);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}
.photo-thumb:hover .photo-thumb-overlay { opacity: 1; }
.photo-thumb-overlay button {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.photo-thumb-overlay button:hover { background: rgba(255,255,255,0.3); }
.photo-main-badge {
  position: absolute;
  top: 5px; left: 5px;
  background: var(--accent);
  color: #000;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.photo-add {
  border: 2px dashed var(--border);
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-dim);
  font-size: 0.7rem;
  transition: all 0.2s;
}
.photo-add:hover { border-color: var(--accent); color: var(--accent); }

/* ===== FOTO LIGHTBOX ===== */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 400;
  display: flex; align-items: center; justify-content: center;
  animation: backdropIn 0.2s ease;
}
.lightbox img {
  max-width: 95vw;
  max-height: 85vh;
  max-height: 85dvh;
  border-radius: var(--radius);
  object-fit: contain;
}
.lightbox-close {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  right: calc(16px + env(safe-area-inset-right));
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
}

/* ===== CLUTCH CARDS ===== */
.clutch-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}
.clutch-card.hatched { border-color: rgba(93,191,90,0.3); opacity: 0.8; }
.clutch-card.failed { border-color: rgba(224,84,84,0.2); opacity: 0.7; }
.clutch-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}
.clutch-title { font-size: 1rem; font-weight: 700; }
.clutch-parents { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 10px; }
.clutch-parents span { color: var(--text); font-weight: 600; }
.clutch-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.incubation-progress {
  margin-bottom: 10px;
}
.incubation-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.incubation-bar {
  height: 6px;
  background: var(--surface3);
  border-radius: 3px;
  overflow: hidden;
}
.incubation-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent));
  transition: width 0.5s ease;
}
.clutch-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ===== HATCHLINGS ===== */
.hatchling-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.hatchling-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
}
.hatchling-sex {
  font-size: 0.8rem;
  font-weight: 700;
  width: 18px;
  text-align: center;
}
.hatchling-morph { flex: 1; font-weight: 600; }
.hatchling-status {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.status-available { background: rgba(93,191,90,0.15); color: var(--success); }
.status-sold { background: rgba(201,168,76,0.15); color: var(--accent); }
.status-kept { background: rgba(93,136,219,0.15); color: #8FAAFF; }

/* ===== VOEDINGSSCHEMA DOT ===== */
.schedule-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.7rem;
  color: var(--text-dim);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px 7px;
}

/* ===== EXPORT BUTTONS ===== */
.export-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.export-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.export-btn:hover { border-color: var(--accent); color: var(--accent); }
.export-btn svg { color: var(--accent); }

/* ===== LOGIN SCHERM ===== */
.login-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  z-index: 1000;
  padding: calc(20px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.login-card {
  width: 100%;
  max-width: 360px;
  margin: 20px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 28px 28px;
  box-sizing: border-box;
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo .logo-text {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 3px;
}
.login-logo .logo-sub {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 4px;
}
.login-logo .logo-snake {
  margin: 0 auto 12px;
  opacity: 0.6;
}
.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
}
.login-remember input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.login-error {
  background: rgba(224,84,84,0.12);
  border: 1px solid rgba(224,84,84,0.3);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.825rem;
  margin-bottom: 16px;
}
.logout-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.logout-btn:hover { color: var(--danger); }

/* ===== PAIRING LOG ===== */
.pairing-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.pairing-snakes { font-size: 0.875rem; font-weight: 600; flex: 1; }
.pairing-snakes small { display: block; font-size: 0.72rem; color: var(--text-muted); font-weight: 400; margin-top: 2px; }

/* ===== GENES ===== */
.gene-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.gene-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid;
}
.gene-tag.gene-visual { background: rgba(201,168,76,0.15); color: var(--accent); border-color: rgba(201,168,76,0.4); }
.gene-tag.gene-super  { background: rgba(201,168,76,0.3);  color: #FFE08A;       border-color: rgba(201,168,76,0.6); }
.gene-tag.gene-het    { background: var(--surface2);       color: var(--text-muted); border-color: var(--border); font-style: italic; }

.gene-tag-edit-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.gene-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.gene-edit-name { flex: 1; font-size: 0.85rem; font-weight: 600; }
.gene-edit-select {
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 4px 8px;
  font-size: 0.8rem;
}
.gene-edit-remove {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--surface3);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
}
.gene-edit-remove:hover { background: var(--danger); color: #fff; }

/* ===== CALCULATOR ===== */
.calc-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.calc-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}
.calc-bar {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.calc-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(201,168,76,0.18), rgba(201,168,76,0.05));
  transition: width 0.3s;
}
.calc-pct {
  position: relative;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
}
.calc-name {
  position: relative;
  font-size: 0.875rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* ===== RACKS ===== */
.rack-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
@media (min-width: 600px) {
  .rack-grid { grid-template-columns: repeat(2, 1fr); }
}
.rack-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.rack-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.rack-name { font-size: 1rem; font-weight: 700; }
.rack-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.rack-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.rack-stat {
  font-size: 0.72rem;
  padding: 3px 8px;
  background: var(--surface2);
  border-radius: 10px;
  color: var(--text-muted);
}
.rack-occupants {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rack-occupant {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
}
.rack-occupant:hover { background: var(--surface3); }

/* ===== TAGS ===== */
.snake-card-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
  margin-bottom: 4px;
}
.snake-card-tag {
  font-size: 0.65rem;
  padding: 2px 7px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font-weight: 600;
}
.tag-suggest {
  font-size: 0.7rem;
  padding: 3px 9px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.tag-suggest:hover { background: var(--accent); color: #000; border-color: var(--accent); }

/* ===== QUICK TEMPLATES ===== */
.quick-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.quick-template {
  font-size: 0.75rem;
  padding: 6px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.quick-template:hover { background: var(--accent-glow); color: var(--accent); border-color: var(--accent); }

/* ===== INVENTORY ===== */
.inv-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.inv-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.inv-item.inv-low {
  border-color: rgba(224,84,84,0.4);
  background: rgba(224,84,84,0.04);
}
.inv-name {
  font-weight: 600;
  font-size: 0.95rem;
}
.inv-warn {
  font-size: 0.7rem;
  color: var(--danger);
  font-weight: 700;
  margin-left: 6px;
}
.inv-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.inv-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.inv-btn:hover { background: var(--accent); color: #000; border-color: var(--accent); }
.inv-qty {
  min-width: 32px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}
.inv-meta {
  grid-column: 1 / -1;
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* ===== FILTERS & SORTEREN ===== */
.filter-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.filter-chip:hover { border-color: var(--accent); color: var(--text); }
.filter-chip.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}
.filter-chip.filter-clear {
  background: transparent;
  color: var(--danger);
  border-color: rgba(224,84,84,0.3);
}
.filter-chip.filter-clear:hover {
  background: var(--danger);
  color: #fff;
}
.sort-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.sort-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

/* ===== GLOBALE ZOEK ===== */
.gs-section {
  margin-bottom: 16px;
}
.gs-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 6px;
  padding-left: 4px;
}
.gs-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.gs-item:hover { border-color: var(--accent); background: var(--surface2); }

/* ===== FAMILIE / STAMBOOM ===== */
.family-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.family-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}
.family-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 10px;
}
.family-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.family-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.family-card:hover {
  border-color: var(--accent);
  background: var(--surface2);
}
.family-card.family-missing {
  background: var(--surface2);
  border-style: dashed;
  cursor: default;
  font-size: 0.75rem;
  font-style: italic;
  justify-content: center;
  padding: 12px 8px;
}
.family-card-photo {
  width: 36px; height: 36px;
  border-radius: 6px;
  background: var(--surface2);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.family-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.family-card-body { flex: 1; min-width: 0; }
.family-card-name {
  font-size: 0.82rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.family-card-morph {
  font-size: 0.7rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.family-clutch {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 8px;
}

/* ===== HELP / DOCUMENTATIE ===== */
.help-content {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text);
}
.help-section {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.help-section:last-child { border-bottom: none; }
.help-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}
.help-content p {
  margin-bottom: 8px;
  color: var(--text-muted);
}
.help-content ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: 8px;
}
.help-content li {
  position: relative;
  padding-left: 14px;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 0.825rem;
}
.help-content li::before {
  content: '·';
  position: absolute;
  left: 4px;
  color: var(--accent);
  font-weight: 700;
}
.help-content strong {
  color: var(--text);
  font-weight: 600;
}
.help-content code {
  font-family: ui-monospace, 'SF Mono', monospace;
  font-size: 0.8rem;
  background: var(--surface2);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--accent);
}
