:root {
  --kido-green: #4CAF50;
  --kido-red: #F44336;
  --kido-blue: #2196F3;
  --kido-bg: #FFF9F0;
  --kido-card: #FFFFFF;
  --kido-text: #1A1A1A;
  --kido-radius: 16px;
  --kido-shadow: 0 2px 12px rgba(0,0,0,.08);
}

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

body {
  background: var(--kido-bg);
  color: var(--kido-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}

.kido-page {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 0 80px;
  min-height: 100vh;
}

/* Header */
.kido-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 12px;
}
.kido-greeting { font-size: 1.2rem; font-weight: 600; }
.kido-icon-btn {
  font-size: 1.4rem;
  text-decoration: none;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: var(--kido-text);
}

/* Balance card */
.kido-balance-card {
  background: var(--kido-card);
  border-radius: var(--kido-radius);
  box-shadow: var(--kido-shadow);
  margin: 0 16px 20px;
  padding: 24px 20px;
  text-align: center;
}
.kido-balance-label {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #666;
  margin-bottom: 8px;
}
.kido-balance-amount {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -.02em;
}
.kido-balance-amount.positive { color: var(--kido-green); }
.kido-balance-amount.negative { color: var(--kido-red); }

/* Transaction list */
.kido-txn-list { padding: 0 16px; }
.kido-section-title { font-size: 1rem; font-weight: 600; margin-bottom: 12px; }
.kido-txn-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--kido-card);
  border-radius: 10px;
  margin-bottom: 8px;
  box-shadow: var(--kido-shadow);
  min-height: 48px;
}
.kido-txn-icon { font-size: 1.2rem; flex-shrink: 0; }
.kido-txn-meta { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kido-txn-desc { font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kido-txn-date { font-size: .72rem; color: #888; }
.kido-txn-added-by { font-size: .68rem; color: #bbb; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kido-txn-amount { font-weight: 700; font-size: 1rem; white-space: nowrap; }
.kido-txn-row.income .kido-txn-amount { color: var(--kido-green); }
.kido-txn-row.expense .kido-txn-amount { color: var(--kido-red); }

/* Transaction action buttons */
.kido-txn-actions { display: flex; gap: 2px; flex-shrink: 0; }
.kido-txn-edit,
.kido-txn-delete {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: .95rem;
  padding: 4px 5px;
  border-radius: 6px;
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.kido-txn-edit:hover { background: rgba(33,150,243,.12); }
.kido-txn-delete:hover { background: rgba(244,67,54,.12); }

/* Kids grid */
.kido-kids-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 16px;
}
.kido-kid-card {
  background: var(--kido-card);
  border-radius: var(--kido-radius);
  box-shadow: var(--kido-shadow);
  padding: 20px 12px;
  text-align: center;
  text-decoration: none;
  color: var(--kido-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform .15s;
  min-height: 120px;
}
.kido-kid-card:hover { transform: translateY(-2px); }
.kido-kid-avatar { font-size: 2rem; }
.kido-kid-name { font-weight: 600; font-size: .95rem; }
.kido-kid-balance { font-weight: 700; font-size: 1.05rem; }
.kido-kid-balance.positive { color: var(--kido-green); }
.kido-kid-balance.negative { color: var(--kido-red); }

/* FAB */
.kido-fab {
  position: fixed;
  bottom: 80px;
  right: calc(50% - 240px + 16px);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--kido-blue);
  color: #fff;
  font-size: 1.8rem;
  font-weight: 300;
  line-height: 1;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(33,150,243,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
}
.kido-fab-hidden { display: none; }
@media (max-width: 480px) {
  .kido-fab { right: 16px; }
}

/* Bottom tab bar */
.kido-tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: var(--kido-card);
  border-top: 1px solid #e8e8e8;
  z-index: 50;
  min-height: 60px;
}
.kido-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 0;
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  transition: color .15s;
}
.kido-tab.active { color: var(--kido-blue); }
.kido-tab-icon { font-size: 1.3rem; }
.kido-tab-label { font-size: .7rem; font-weight: 600; letter-spacing: .02em; }

/* Version label — sits at the bottom of the tab bar */
.kido-version {
  position: fixed;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  color: #bbb;
  letter-spacing: .04em;
  z-index: 51;
  pointer-events: none;
  user-select: none;
}

/* Back button */
.kido-back-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  color: var(--kido-text);
  padding: 0;
}

/* Kid card cursor (now a div, not an anchor) */
.kido-kid-card { cursor: pointer; }

/* Loading screen full-height centering */
.kido-loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--kido-bg);
}

/* Optimistic saving indicator */
.kido-txn-saving { color: #aaa; font-size: 1rem; padding: 0 6px; }

/* Bottom sheet */
.kido-sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 100;
}
.kido-sheet {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: var(--kido-card);
  border-radius: var(--kido-radius) var(--kido-radius) 0 0;
  padding: 28px 20px 36px;
  z-index: 101;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.kido-sheet-title { font-size: 1.2rem; font-weight: 700; text-align: center; }

.kido-type-toggle { display: flex; gap: 10px; }
.kido-type-btn {
  flex: 1;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 10px;
  background: transparent;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  transition: all .15s;
}
.kido-type-btn.active {
  border-color: var(--kido-blue);
  background: var(--kido-blue);
  color: #fff;
}

.kido-label { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; font-weight: 600; }
.kido-input {
  padding: 14px 12px;
  border: 2px solid #ddd;
  border-radius: 10px;
  font-size: 1rem;
  background: var(--kido-bg);
  width: 100%;
  min-height: 48px;
}
.kido-input:focus { outline: none; border-color: var(--kido-blue); }

.kido-btn-primary {
  padding: 16px;
  background: var(--kido-blue);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 52px;
}
.kido-btn-ghost {
  padding: 12px;
  background: transparent;
  border: none;
  font-size: .95rem;
  color: #666;
  cursor: pointer;
  min-height: 44px;
}

.kido-error { color: var(--kido-red); font-size: .85rem; }
.kido-empty { color: #999; font-size: .9rem; padding: 12px 0; }

/* Kid picker chips (parent quick-add) */
.kido-kid-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.kido-kid-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 2px solid #ddd;
  border-radius: 20px;
  background: transparent;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: all .15s;
}
.kido-kid-chip.active {
  border-color: var(--kido-blue);
  background: var(--kido-blue);
  color: #fff;
}

/* Splash */
.kido-splash {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: var(--kido-bg);
}
.kido-splash-inner { text-align: center; }
.kido-logo { font-size: 4rem; margin-bottom: 12px; }
.kido-app-name { font-size: 2rem; font-weight: 800; margin-bottom: 4px; }
.kido-tagline { color: #666; margin-bottom: 24px; }
.kido-loading { color: #888; font-size: .95rem; margin-bottom: 12px; }
.kido-dots { display: flex; gap: 8px; justify-content: center; }
.kido-dots span {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--kido-blue);
  animation: bounce 1.2s infinite;
}
.kido-dots span:nth-child(2) { animation-delay: .2s; }
.kido-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}
