* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --primary: #5B56D6; --primary-light: #7571E8; --primary-dark: #4946B0;
  --bg: #F9FAFB; --card: #FFFFFF;
  --text: #1F2937; --text-light: #6B7280; --text-lighter: #9CA3AF;
  --success: #10B981; --warning: #F59E0B; --danger: #EF4444;
  --border: #E5E7EB;
  --pink: #FCE7F3; --green: #DCFCE7; --blue: #DBEAFE; --purple: #F3E8FF; --yellow: #FEF3C7; --orange: #FFEDD5;
  --radius: 14px; --safe-bottom: env(safe-area-inset-bottom, 0px);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
}

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

/* ===== LOGIN ===== */
.login-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100dvh; padding: 20px; background: linear-gradient(135deg, var(--primary) 0%, #9B8FE8 100%); }
.login-screen h1 { color: white; font-size: 2.5em; margin-bottom: 8px; letter-spacing: -0.5px; }
.login-screen .subtitle { color: rgba(255,255,255,0.85); font-size: 1.05em; margin-bottom: 40px; }
.login-card { background: white; border-radius: 20px; padding: 28px; width: 100%; max-width: 360px; box-shadow: var(--shadow-lg); }
.role-tabs { display: flex; margin-bottom: 24px; border-radius: 12px; overflow: hidden; border: 2px solid var(--primary); }
.role-tab { flex: 1; padding: 14px; text-align: center; font-weight: 600; cursor: pointer; border: none; background: white; color: var(--primary); font-size: 1em; transition: background-color 0.2s, color 0.2s; }
.role-tab.active { background: var(--primary); color: white; }
.pin-input { display: flex; justify-content: center; gap: 12px; margin-bottom: 24px; }
.pin-input input { width: 55px; height: 65px; text-align: center; font-size: 1.8em; font-weight: 700; border: 2px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--text); outline: none; -webkit-appearance: none; }
.pin-input input:focus { border-color: var(--primary); background: white; box-shadow: 0 0 0 3px rgba(91, 86, 214, 0.12); }

/* ===== BUTTONS ===== */
.btn { display: flex; align-items: center; justify-content: center; width: 100%; padding: 16px; border: none; border-radius: 12px; font-size: 1.05em; font-weight: 600; cursor: pointer; transition: background-color 0.15s, transform 0.1s; text-align: center; min-height: 48px; gap: 8px; touch-action: manipulation; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:active { background: var(--primary-dark); transform: scale(0.97); }
.btn-success { background: var(--success); color: white; }
.btn-success:active { transform: scale(0.97); }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-lg { padding: 18px; font-size: 1.15em; margin-top: 12px; min-height: 56px; }
.btn-danger { background: var(--danger); color: white; border: none; padding: 14px; border-radius: 12px; font-size: 1em; font-weight: 600; cursor: pointer; width: 100%; min-height: 48px; }
.btn-sm { padding: 8px 14px; font-size: 0.85em; min-height: 40px; }

/* ===== HEADER ===== */
.app-header { background: linear-gradient(135deg, var(--primary) 0%, #9B8FE8 100%); color: white; padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top)); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(91,86,214,0.15); }
.app-header h2 { font-size: 1.15em; font-weight: 700; }
.header-baby-name { font-size: 0.85em; opacity: 0.9; }
.header-actions { display: flex; gap: 8px; }
.header-btn { background: rgba(255,255,255,0.2); border: none; color: white; width: 44px; height: 44px; border-radius: 50%; font-size: 1.2em; cursor: pointer; display: flex; align-items: center; justify-content: center; touch-action: manipulation; }
.header-btn:active { background: rgba(255,255,255,0.35); }

/* ===== MAIN CONTENT ===== */
.main-content { padding: 16px; padding-bottom: calc(20px + var(--safe-bottom)); }
.section-title { font-size: 1.2em; font-weight: 700; margin-bottom: 14px; color: var(--text); }
.section-hint { font-size: 0.85em; color: var(--text-light); margin-bottom: 10px; }
.date-banner { text-align: center; font-size: 0.9em; color: var(--primary); font-weight: 600; margin-bottom: 14px; padding: 6px; background: rgba(91,86,214,0.06); border-radius: 8px; }

/* ===== BABY SELECTOR ===== */
.baby-selector { padding: 24px 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; min-height: calc(100vh - 70px); justify-content: center; }
.baby-card { background: white; border-radius: 18px; padding: 28px; width: 100%; max-width: 300px; text-align: center; box-shadow: var(--shadow-md); cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; border: 2px solid transparent; }
.baby-card:active { transform: scale(0.96); box-shadow: var(--shadow-lg); }
.baby-card .emoji { font-size: 3em; margin-bottom: 10px; }
.baby-card .name { font-size: 1.4em; font-weight: 700; color: var(--text); }
.baby-card .age { color: var(--text-light); margin-top: 6px; font-size: 0.95em; }

/* ===== CARDS ===== */
.card { background: white; border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.card-colored { border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card-colored h4 { margin-bottom: 10px; font-size: 1em; font-weight: 700; }
.card-pink { background: var(--pink); } .card-green { background: var(--green); } .card-blue { background: var(--blue); }
.card-purple { background: var(--purple); } .card-yellow { background: var(--yellow); } .card-orange { background: var(--orange); }

/* ===== INFO BOX ===== */
.info-box { background: rgba(255,255,255,0.85); border: 2px solid var(--primary); border-radius: 12px; padding: 14px; font-size: 1em; line-height: 1.5; }
.info-box-original { margin-top: 8px; padding: 10px 14px; background: rgba(0,0,0,0.03); border-radius: 10px; font-size: 0.85em; color: var(--text-light); font-style: italic; }

/* ===== CHECK / ACTIVITY GRID ===== */
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.check-item { display: flex; align-items: center; gap: 10px; padding: 14px 12px; background: rgba(255,255,255,0.75); border-radius: 12px; cursor: pointer; border: 2px solid transparent; transition: border-color 0.15s, background-color 0.15s; user-select: none; -webkit-user-select: none; min-height: 48px; touch-action: manipulation; }
.check-item.checked { border-color: var(--primary); background: rgba(91, 86, 214, 0.08); }
.check-item .icon { font-size: 1.3em; }
.check-item .label { font-size: 0.95em; font-weight: 500; }

.activity-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.activity-item { display: flex; align-items: center; gap: 10px; padding: 14px 12px; background: rgba(255,255,255,0.75); border-radius: 12px; cursor: pointer; border: 2px solid transparent; transition: border-color 0.15s, background-color 0.15s; user-select: none; -webkit-user-select: none; min-height: 48px; touch-action: manipulation; }
.activity-item.checked { border-color: var(--primary); background: rgba(91, 86, 214, 0.08); }
.activity-item .icon { font-size: 1.4em; }
.activity-item .label { font-size: 0.9em; font-weight: 500; }
.activity-other-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 12px 14px; background: rgba(255,255,255,0.75); border-radius: 12px; }
.activity-other-row span { font-size: 0.95em; font-weight: 500; white-space: nowrap; }
.input-inline { flex: 1; padding: 10px 14px; border: 2px solid var(--border); border-radius: 10px; font-size: 1em; background: white; outline: none; -webkit-appearance: none; min-height: 44px; }
.input-inline:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91, 86, 214, 0.1); }

/* Small screens: single column grids */
@media (max-width: 380px) {
  .check-grid, .activity-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .mood-selector-wide { grid-template-columns: repeat(2, 1fr); }
}

/* ===== MOOD ===== */
.mood-selector { display: flex; gap: 10px; justify-content: center; margin: 12px 0; flex-wrap: wrap; }
.mood-btn { width: 64px; height: 64px; border-radius: 16px; border: 2px solid var(--border); background: white; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: border-color 0.15s, transform 0.15s, background-color 0.15s; box-shadow: var(--shadow-sm); touch-action: manipulation; }
.mood-btn .emoji { font-size: 1.8em; }
.mood-btn.selected { border-color: var(--primary); background: rgba(91, 86, 214, 0.08); transform: scale(1.08); box-shadow: var(--shadow-md); }
.mood-btn:active { transform: scale(0.94); }

/* ===== DASHBOARD GRID ===== */
.dashboard-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 14px; }
.dash-btn { background: white; border: none; border-radius: var(--radius); padding: 18px 14px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; box-shadow: var(--shadow-sm); transition: transform 0.12s, box-shadow 0.12s; position: relative; min-height: 88px; touch-action: manipulation; }
.dash-btn:active { transform: scale(0.95); box-shadow: var(--shadow-md); }
.dash-icon { font-size: 2em; }
.dash-label { font-size: 0.85em; font-weight: 600; color: var(--text); }
.dash-count { position: absolute; top: 8px; right: 10px; background: var(--primary); color: white; min-width: 24px; height: 24px; border-radius: 12px; font-size: 0.8em; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 6px; }
.dash-green { border-left: 4px solid var(--success); }
.dash-blue { border-left: 4px solid #3B82F6; }
.dash-purple { border-left: 4px solid #8B5CF6; }
.dash-orange { border-left: 4px solid var(--warning); }
.dash-green { border-left: 4px solid var(--success); }

/* ===== INPUTS ===== */
.time-row { display: flex; gap: 12px; margin-bottom: 14px; }
.time-field { flex: 1; }
.time-field label, .input-field label { display: block; font-size: 0.88em; font-weight: 600; color: var(--text-light); margin-bottom: 6px; }
.time-field input, .input-field input, .input-field textarea {
  width: 100%; padding: 14px; border: 2px solid var(--border); border-radius: 12px; font-size: 16px;
  background: white; color: var(--text); outline: none; transition: border-color 0.2s, box-shadow 0.2s; -webkit-appearance: none;
  min-height: 48px;
}
.time-field input:focus, .input-field input:focus, .input-field textarea:focus { border-color: var(--primary); background: white; box-shadow: 0 0 0 3px rgba(91, 86, 214, 0.1); }
.input-field textarea { resize: vertical; min-height: 88px; font-family: inherit; }
.input-field { margin-bottom: 14px; }

/* ===== VOICE INPUT ===== */
.vocal-row { display: flex; gap: 10px; align-items: flex-start; }
.vocal-row textarea { flex: 1; }
.vocal-btn { width: 52px; height: 52px; border-radius: 50%; border: none; background: var(--primary); color: white; font-size: 1.4em; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: background-color 0.15s, transform 0.1s; touch-action: manipulation; }
.vocal-btn.recording { background: var(--danger); animation: pulse 1s infinite; }
.voice-status { font-size: 0.85em; color: var(--danger); margin-top: 6px; min-height: 20px; }
.voice-review { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 10px; padding: 8px 12px; }
.voice-preview { flex: 1; font-size: 0.9em; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-review-btn { width: 44px; height: 44px; border: none; border-radius: 50%; font-size: 1.2em; cursor: pointer; display: flex; align-items: center; justify-content: center; touch-action: manipulation; }
.voice-review-btn.delete { background: var(--danger); color: white; }
.voice-review-btn.send { background: var(--success); color: white; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }

/* ===== ENTRY CARDS ===== */
.entry-list { display: flex; flex-direction: column; gap: 8px; }
.entry-card { background: white; border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow-sm); border-left: 3px solid var(--primary); }
.entry-card.faded { opacity: 0.5; }
.entry-card .entry-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.entry-card .entry-num { font-weight: 700; color: var(--primary); font-size: 0.95em; }
.entry-card .delete-btn { background: none; border: none; color: var(--danger); font-size: 1.2em; cursor: pointer; padding: 8px; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; touch-action: manipulation; }
.entry-card .entry-summary { font-size: 0.9em; color: var(--text-light); }
.entry-row { display: flex; gap: 10px; margin-bottom: 8px; align-items: center; flex-wrap: wrap; }
.entry-row .small-input { padding: 12px; border: 2px solid var(--border); border-radius: 10px; font-size: 16px; text-align: center; background: white; outline: none; -webkit-appearance: none; min-height: 48px; }
.entry-row .small-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91, 86, 214, 0.1); }

/* ===== QTY / QUALITY ===== */
.qty-selector { display: flex; gap: 8px; flex-wrap: wrap; }
.qty-btn { padding: 12px 16px; border: 2px solid var(--border); border-radius: 10px; background: white; font-size: 0.9em; font-weight: 600; cursor: pointer; transition: border-color 0.15s, background-color 0.15s, color 0.15s; min-height: 44px; min-width: 44px; touch-action: manipulation; }
.qty-btn.selected { border-color: var(--primary); background: var(--primary); color: white; }
.qty-btn:active { transform: scale(0.95); }
.quality-selector { display: flex; gap: 8px; }
.quality-btn { width: 48px; height: 48px; border-radius: 12px; border: 2px solid var(--border); background: white; font-size: 1.3em; cursor: pointer; transition: border-color 0.15s, transform 0.15s; display: flex; align-items: center; justify-content: center; touch-action: manipulation; }
.quality-btn.selected { border-color: var(--primary); background: rgba(91, 86, 214, 0.08); transform: scale(1.08); }
.quality-btn:active { transform: scale(0.92); }

/* ===== MEAL TYPE GRID ===== */
.meal-type-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.meal-type-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border: 2px solid var(--border); border-radius: 10px; background: white; cursor: pointer; font-size: 0.8em; font-weight: 500; transition: border-color 0.15s, background-color 0.15s; min-height: 60px; touch-action: manipulation; }
.meal-type-btn span:first-child { font-size: 1.6em; }
.meal-type-btn.selected { border-color: var(--primary); background: rgba(91, 86, 214, 0.08); }
.meal-type-btn:active { transform: scale(0.95); }

/* ===== MEDICATION ===== */
.med-reminder { background: rgba(255,255,255,0.75); border-radius: 10px; padding: 12px; margin-bottom: 8px; }
.days-left { color: var(--primary); font-weight: 600; float: right; }
.med-quick-list { display: flex; flex-direction: column; gap: 8px; }
.med-quick-btn { padding: 14px; border: 2px solid var(--border); border-radius: 10px; background: white; text-align: left; font-size: 0.95em; cursor: pointer; transition: border-color 0.15s, background-color 0.15s; min-height: 48px; touch-action: manipulation; }
.med-quick-btn.selected { border-color: var(--primary); background: rgba(91, 86, 214, 0.08); }

/* Medication autocomplete */
.med-suggestions { position: absolute; top: 100%; left: 0; right: 90px; background: white; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 50; max-height: 240px; overflow-y: auto; margin-top: 4px; }
.med-suggestion-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; cursor: pointer; border-bottom: 1px solid var(--bg); min-height: 44px; touch-action: manipulation; }
.med-suggestion-item:last-child { border-bottom: none; }
.med-suggestion-item:active { background: rgba(91, 86, 214, 0.08); }
.med-sug-name { font-weight: 600; font-size: 0.95em; }
.med-sug-dose { font-size: 0.85em; color: var(--text-light); }

/* ===== AI ASSISTANT ===== */
.ai-fab { position: fixed; bottom: 90px; right: 20px; width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #8B5CF6); color: white; border: none; font-size: 1.5em; cursor: pointer; box-shadow: var(--shadow-lg); z-index: 50; touch-action: manipulation; transition: transform 0.15s; }
.ai-fab:active { transform: scale(0.9); }
.ai-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 200; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.ai-panel { background: white; border-radius: 20px 20px 0 0; padding: 20px; padding-bottom: 30px; width: 100%; max-width: 500px; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.ai-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ai-header h3 { margin: 0; font-size: 1.1em; }
.ai-close { background: none; border: none; font-size: 1.3em; cursor: pointer; padding: 8px; min-width: 44px; min-height: 44px; touch-action: manipulation; }
.ai-hint { font-size: 0.85em; color: var(--text-light); margin-bottom: 10px; }
.ai-quick-phrases { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.ai-quick { padding: 8px 12px; border: 1px solid var(--border); border-radius: 20px; background: white; font-size: 0.82em; cursor: pointer; touch-action: manipulation; transition: background-color 0.15s; }
.ai-quick:active { background: var(--bg); }
.ai-input-row { display: flex; gap: 8px; align-items: center; }
.ai-input-row input { flex: 1; padding: 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 1em; min-height: 48px; }
.ai-results { margin-top: 16px; }
.ai-action-card { background: var(--bg); border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.ai-action-summary { font-weight: 600; font-size: 1em; margin-bottom: 10px; color: var(--primary); }
.ai-field-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ai-field-label { font-size: 0.85em; font-weight: 500; min-width: 100px; flex-shrink: 0; }
.ai-field-input { flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.9em; min-height: 40px; background: white; }
.ai-check { display: flex; align-items: center; gap: 8px; font-size: 0.9em; min-height: 40px; cursor: pointer; }
.ai-check input { width: 20px; height: 20px; accent-color: var(--primary); }
.ai-action-buttons { display: flex; gap: 8px; margin-top: 10px; }
.ai-question { background: rgba(91, 86, 214, 0.08); border-left: 3px solid var(--primary); border-radius: 8px; padding: 12px; margin-bottom: 12px; font-size: 0.95em; color: var(--text); }
.ai-loading { display: flex; justify-content: center; padding: 20px; }
.ai-error { color: var(--danger); font-size: 0.9em; padding: 12px; text-align: center; }

/* ===== SENT BANNER ===== */
.sent-banner { background: var(--success); color: white; border-radius: var(--radius); padding: 20px; text-align: center; font-size: 1.15em; font-weight: 700; margin-top: 14px; }
.shared-banner { background: var(--blue); border-radius: var(--radius); padding: 14px; text-align: center; font-size: 0.9em; font-weight: 600; color: #1e40af; margin-bottom: 12px; }
.ack-banner { background: var(--green); border-radius: var(--radius); padding: 14px; text-align: center; font-size: 0.95em; font-weight: 600; color: #166534; margin-bottom: 12px; }
.ack-badge { font-size: 0.85em; color: var(--success); font-weight: 600; }

/* ===== TOAST ===== */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-100px); background: var(--text); color: white; padding: 14px 24px; border-radius: 12px; font-weight: 600; z-index: 1000; transition: transform 0.3s ease; white-space: nowrap; max-width: 90vw; }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ===== LOADING ===== */
.loading { display: flex; align-items: center; justify-content: center; min-height: 200px; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== CALENDAR ===== */
.calendar-container { background: white; border-radius: var(--radius); padding: 14px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.calendar-header h3 { font-size: 1.05em; color: var(--primary); margin: 0; font-weight: 700; }
.cal-nav-btn { background: none; border: 1px solid var(--border); width: 40px; height: 40px; border-radius: 50%; font-size: 1.3em; cursor: pointer; color: var(--primary); display: flex; align-items: center; justify-content: center; touch-action: manipulation; }
.cal-nav-btn:active { background: var(--primary); color: white; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-day-name { text-align: center; font-size: 0.7em; font-weight: 700; color: var(--text-light); padding: 4px 0; }
.cal-day { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 10px; font-size: 0.85em; cursor: default; gap: 1px; padding: 2px; }
.cal-day.empty { visibility: hidden; }
.cal-day.today { background: rgba(91, 86, 214, 0.12); font-weight: 700; }
.cal-day.has-report { background: var(--green); cursor: pointer; }
.cal-day.has-report:active { transform: scale(0.92); }
.cal-day-num { font-weight: 500; line-height: 1; }
.cal-summary { font-size: 0.55em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cal-mood { font-size: 0.7em; line-height: 1; margin-top: 1px; }

/* ===== HISTORY ===== */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item { background: white; border-radius: 12px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-sm); cursor: pointer; transition: transform 0.12s; touch-action: manipulation; }
.history-item:active { transform: scale(0.98); }
.history-date { font-weight: 600; font-size: 0.95em; min-width: 80px; }
.history-info { display: flex; gap: 10px; font-size: 0.9em; flex: 1; color: var(--text-light); }
.sent-badge { color: var(--success); font-weight: 700; }
.history-arrow { color: var(--text-lighter); font-size: 1.3em; }

/* ===== DETAIL VIEW ===== */
.detail-view { padding: 16px; padding-bottom: calc(20px + var(--safe-bottom)); }
.detail-section { margin-bottom: 12px; border-radius: var(--radius); padding: 16px; }
.detail-section:first-child { background: white; box-shadow: var(--shadow-sm); }
.detail-section h4 { font-size: 1em; margin-bottom: 10px; font-weight: 700; }
.detail-section p { font-size: 0.95em; line-height: 1.6; }
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; font-size: 0.95em; }
.detail-row + .detail-row { border-top: 1px solid rgba(0,0,0,0.05); }
.detail-actions { margin-top: 20px; }

/* ===== UTILITIES ===== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }

/* ===== AUTH ===== */
.auth-form { width: 100%; max-width: 360px; }
.auth-form .input-field { margin-bottom: 12px; }
.auth-form .input-field input { width: 100%; padding: 14px 16px; border: 2px solid var(--border); border-radius: 12px; font-size: 16px; background: white; color: var(--text); outline: none; -webkit-appearance: none; min-height: 48px; }
.auth-form .input-field input:focus { border-color: var(--primary); background: white; box-shadow: 0 0 0 3px rgba(91, 86, 214, 0.1); }
.auth-form .input-field label { display: block; font-size: 0.88em; font-weight: 600; color: var(--text-light); margin-bottom: 6px; }
.auth-link { text-align: center; margin-top: 15px; font-size: 0.9em; color: var(--text-light); }
.auth-link a { color: white; font-weight: 600; cursor: pointer; text-decoration: underline; }
.lang-selector { display: flex; justify-content: center; margin-bottom: 20px; }
.login-lang-select { padding: 12px 16px; border-radius: 12px; border: 2px solid rgba(255,255,255,0.3); background: rgba(255,255,255,0.15); color: white; font-size: 1em; cursor: pointer; min-width: 180px; text-align: center; min-height: 48px; }
.login-lang-select option { color: #333; background: white; }

/* ===== BOTTOM NAV ===== */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: white; border-top: 1px solid var(--border); display: flex; justify-content: space-around; align-items: stretch; padding: 0; padding-bottom: var(--safe-bottom); z-index: 100; min-height: 60px; box-shadow: 0 -1px 6px rgba(0,0,0,0.04); }
.nav-btn { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: none; border: none; padding: 8px 4px; cursor: pointer; color: var(--text-light); font-size: 0.75em; font-weight: 600; position: relative; min-height: 56px; touch-action: manipulation; transition: color 0.15s; }
.nav-btn .nav-icon { font-size: 1.6em; line-height: 1; }
.nav-btn.active { color: var(--primary); }
.nav-btn:active { background: rgba(91, 86, 214, 0.04); }
.nav-badge { position: absolute; top: 2px; right: 6px; background: var(--danger); color: white; min-width: 18px; height: 18px; border-radius: 9px; font-size: 0.7em; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.has-bottom-nav .main-content, .has-bottom-nav .detail-view { padding-bottom: calc(80px + var(--safe-bottom)); }

/* ===== CHAT ===== */
.chat-container { display: flex; flex-direction: column; height: calc(100dvh - 60px - 60px); }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.chat-bubble { max-width: 80%; padding: 12px 16px; border-radius: 18px; font-size: 0.95em; line-height: 1.45; word-wrap: break-word; }
.chat-bubble.mine { align-self: flex-end; background: var(--primary); color: white; border-bottom-right-radius: 6px; }
.chat-bubble.theirs { align-self: flex-start; background: white; color: var(--text); border-bottom-left-radius: 6px; box-shadow: var(--shadow-sm); }
.chat-bubble .bubble-name { font-size: 0.75em; font-weight: 700; margin-bottom: 4px; opacity: 0.7; }
.chat-bubble .bubble-translation { font-size: 0.8em; margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,0.2); font-style: italic; opacity: 0.8; }
.chat-bubble.theirs .bubble-translation { border-top-color: rgba(0,0,0,0.08); }
.chat-bubble .bubble-time { font-size: 0.7em; margin-top: 4px; opacity: 0.6; text-align: right; }
.chat-input-row { display: flex; gap: 8px; padding: 10px 16px; background: white; border-top: 1px solid var(--border); }
.chat-input-row input { flex: 1; padding: 12px 16px; border: 2px solid var(--border); border-radius: 24px; font-size: 16px; outline: none; -webkit-appearance: none; min-height: 48px; }
.chat-input-row input:focus { border-color: var(--primary); }
.chat-input-row .send-btn { width: 48px; height: 48px; border-radius: 50%; border: none; background: var(--primary); color: white; font-size: 1.3em; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; touch-action: manipulation; transition: background-color 0.15s; }
.chat-input-row .send-btn.recording { background: var(--danger); animation: pulse 1s infinite; }
.chat-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-light); font-size: 0.95em; }
.chat-recipient-row { display: flex; gap: 6px; padding: 6px 16px; background: var(--bg); border-top: 1px solid var(--border); }
.recipient-btn { flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: 20px; background: white; font-size: 0.85em; font-weight: 500; cursor: pointer; text-align: center; transition: background-color 0.15s, color 0.15s; touch-action: manipulation; min-height: 40px; }
.recipient-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.chat-bubble.private { border: 1px dashed rgba(0,0,0,0.15); }
.chat-bubble.mine.private { border-color: rgba(255,255,255,0.3); }
.bubble-private { font-size: 0.7em; opacity: 0.6; margin-bottom: 2px; }

/* ===== MEDIA / GALLERY ===== */
.media-container { }
.media-date-header { font-weight: 700; font-size: 0.9em; color: var(--text); padding: 12px 8px 6px; display: flex; align-items: center; gap: 8px; }
.media-date-count { background: var(--primary); color: #fff; font-size: 0.75em; padding: 2px 8px; border-radius: 10px; }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 0 4px 4px; }
.media-thumb { aspect-ratio: 1; object-fit: cover; border-radius: 8px; width: 100%; cursor: pointer; background: var(--border); }
.media-thumb video { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.media-actions { display: flex; gap: 10px; padding: 16px; }
.media-actions .btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; }
.media-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.media-overlay img, .media-overlay video { max-width: 100%; max-height: 80vh; border-radius: 8px; }
.media-overlay .close-btn { position: absolute; top: 15px; right: 15px; background: rgba(255,255,255,0.2); border: none; color: white; width: 48px; height: 48px; border-radius: 50%; font-size: 1.5em; cursor: pointer; touch-action: manipulation; }
.media-overlay .caption-text { color: white; padding: 12px; text-align: center; font-size: 0.95em; }
.media-overlay .share-actions { display: flex; gap: 10px; padding: 10px; }
.media-overlay .share-actions .btn { background: rgba(255,255,255,0.2); color: white; width: auto; padding: 12px 20px; }
.media-empty { text-align: center; padding: 40px 20px; color: var(--text-light); }
.media-empty .emoji { font-size: 3em; margin-bottom: 12px; }
.upload-progress { position: fixed; top: 0; left: 0; height: 3px; background: var(--primary); z-index: 300; transition: width 0.3s; }

/* ===== STATS ===== */
.stats-period-selector { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.period-btn { flex: 1; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: #fff; font-size: 0.82em; cursor: pointer; min-height: 44px; touch-action: manipulation; font-weight: 500; transition: background-color 0.15s, color 0.15s; min-width: 0; }
.period-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.stats-date-range { margin-bottom: 16px; }
.date-range-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.date-range-row label { font-size: 0.85em; font-weight: 600; color: var(--text-light); }
.date-range-row input[type="date"] { flex: 1; min-width: 120px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.9em; min-height: 44px; }
.btn-sm { padding: 8px 16px; font-size: 0.85em; min-height: 44px; }
.stats-view-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.view-btn { flex: 1; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: #fff; font-size: 0.85em; cursor: pointer; font-weight: 500; min-height: 44px; touch-action: manipulation; transition: background-color 0.15s, color 0.15s; }
.view-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Stats Calendar view */
.sc-grid { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 16px; }
.sc-header { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--primary); color: #fff; }
.sc-hdr { text-align: center; padding: 8px 2px; font-weight: 700; font-size: 0.8em; }
.sc-body { display: grid; grid-template-columns: repeat(7, 1fr); }
.sc-cell { min-height: 80px; border: 1px solid var(--border); padding: 4px; display: flex; flex-direction: column; align-items: center; cursor: default; transition: background-color 0.15s; }
.sc-cell.sc-outside { background: #f3f4f6; opacity: 0.4; }
.sc-cell.sc-today { background: #EEF2FF; border-color: var(--primary); border-width: 2px; }
.sc-cell.sc-has-data { background: #fff; cursor: pointer; }
.sc-cell.sc-has-data:hover { background: #f5f3ff; }
.sc-cell.sc-selected { background: #EEF2FF !important; box-shadow: inset 0 0 0 2px var(--primary); }
.sc-daynum { font-size: 0.7em; font-weight: 700; color: var(--text-light); margin-bottom: 3px; }
.sc-today .sc-daynum { color: var(--primary); font-size: 0.8em; }
.sc-icons { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; }
.sc-icon { font-size: 1.1em; line-height: 1.2; }
.sc-icon.sc-warn { }
.sc-legend { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; font-size: 0.8em; color: var(--text-light); margin-bottom: 16px; }
.sc-day-detail { background: var(--bg); border-radius: var(--radius); padding: 12px; margin-bottom: 16px; animation: scSlideDown 0.2s ease; }
.sc-detail-header { font-size: 1.05em; font-weight: 700; margin-bottom: 12px; color: var(--primary); text-align: center; }
.sc-detail-body { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.sc-detail-card { border-radius: 12px; padding: 12px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-sm); }
.sc-detail-card .sc-card-icon { font-size: 1.6em; }
.sc-detail-card .sc-card-info { font-size: 0.85em; font-weight: 600; color: var(--text); line-height: 1.3; }
.sc-detail-card .sc-card-sub { font-size: 0.75em; font-weight: 400; color: var(--text-light); }
.sc-card-bottle { background: var(--blue); }
.sc-card-meal { background: var(--orange); }
.sc-card-nap { background: var(--purple); }
.sc-card-diaper { background: var(--green); }
.sc-card-mood { background: var(--yellow); }
.sc-card-vomit { background: var(--pink); }
@keyframes scSlideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.stats-period-info { text-align: center; color: var(--text-light); font-size: 0.85em; margin-bottom: 16px; }
.stats-section { margin-bottom: 20px; }
.section-subtitle { font-weight: 700; font-size: 1em; margin-bottom: 10px; color: var(--text); }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-card { background: #fff; border-radius: 12px; padding: 14px; text-align: center; box-shadow: var(--shadow-sm); }
.stat-value { font-size: 1.5em; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.8em; color: var(--text-light); margin-top: 4px; }
.suggestions-section { margin-bottom: 20px; }
.suggestion-card { padding: 12px 14px; border-radius: 10px; margin-bottom: 8px; font-size: 0.9em; line-height: 1.4; }
.suggestion-warning { background: #fff3e0; color: #e65100; border-left: 4px solid #ff9800; }
.suggestion-info { background: #e3f2fd; color: #1565c0; border-left: 4px solid #3B82F6; }
.mood-bar { display: flex; border-radius: 10px; overflow: hidden; height: 36px; }
.mood-segment { display: flex; align-items: center; justify-content: center; font-size: 0.75em; font-weight: 600; color: #fff; min-width: 30px; }
.mood-good { background: var(--success); }
.mood-normal { background: var(--warning); }
.mood-difficult { background: var(--danger); }
.activity-stats { display: flex; flex-direction: column; gap: 6px; }
.activity-stat-item { display: flex; justify-content: space-between; background: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-sm); }
.activity-name { font-weight: 500; }
.activity-count { color: var(--primary); font-weight: 600; }

/* ===== PROFILE ===== */
.profile-section { margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.profile-section:last-child { border-bottom: none; }
.profile-info { color: var(--text-light); font-size: 0.9em; margin-top: 4px; }
.profile-lang-selector { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.lang-flag-btn-sm { font-size: 1.4em; background: none; border: 2px solid transparent; border-radius: 50%; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0.5; transition: opacity 0.15s, border-color 0.15s; touch-action: manipulation; }
.lang-flag-btn-sm.active { border-color: var(--primary); opacity: 1; transform: scale(1.08); }
.profile-baby-card { background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.baby-header { font-size: 1.05em; margin-bottom: 8px; font-weight: 600; }
.linked-people { margin-top: 8px; }
.linked-label { font-size: 0.85em; color: var(--text-light); display: block; margin-bottom: 4px; }
.linked-person { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 0.9em; flex-wrap: wrap; }
.btn-unlink { background: var(--danger); color: white; border: none; border-radius: 50%; width: 28px; height: 28px; font-size: 0.75em; cursor: pointer; display: flex; align-items: center; justify-content: center; margin-left: auto; touch-action: manipulation; }
.text-light { color: var(--text-light); font-size: 0.85em; }
.link-actions { display: flex; flex-direction: column; gap: 8px; }
.code-display { text-align: center; padding: 12px; }
.generated-code { font-size: 2em; font-weight: 700; letter-spacing: 6px; color: var(--primary); font-family: monospace; }
.select-field { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 1em; background: #fff; min-height: 48px; }
.profile-msg { text-align: center; margin-top: 8px; font-size: 0.9em; }
.profile-msg.success { color: var(--success); }
.profile-msg.error { color: var(--danger); }
.time-row .input-field { flex: 1; }
.mb-10 { margin-bottom: 10px; }

/* ===== MODAL ===== */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: flex-end; justify-content: center; z-index: 500; padding: 0; }
.modal-card { background: white; border-radius: 20px 20px 0 0; padding: 24px; padding-bottom: calc(24px + var(--safe-bottom)); width: 100%; max-width: 480px; box-shadow: 0 -4px 20px rgba(0,0,0,0.15); max-height: 90vh; overflow-y: auto; }

/* ===== NOTIFICATION BELL ===== */
.notif-bell { position: relative; }
.bell-badge { position: absolute; top: -4px; right: -4px; background: var(--danger); color: white; font-size: 0.6em; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; }

/* ===== MOOD SELECTOR WIDE ===== */
.mood-selector-wide { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mood-selector-wide .mood-btn { flex-direction: column; padding: 10px 6px; width: auto; height: auto; min-height: 64px; }
.mood-label { font-size: 0.72em; margin-top: 2px; color: var(--text-light); }
.mood-btn.selected .mood-label { color: var(--primary); font-weight: 600; }

/* ===== NOTIFICATIONS PREFS ===== */
.notif-options { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.notif-option { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: #fff; border-radius: 8px; cursor: pointer; min-height: 44px; }
.notif-option input { margin: 0; width: 20px; height: 20px; }

/* ===== FORMAT TOGGLE ===== */
.format-toggle, .detail-format-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.format-btn { flex: 1; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; font-size: 0.9em; cursor: pointer; text-align: center; min-height: 44px; touch-action: manipulation; font-weight: 500; transition: background-color 0.15s, color 0.15s; }
.format-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== PROFILE EMAIL ===== */
.profile-email-row { display: flex; gap: 8px; align-items: center; }

/* ===== STATS BABY SELECTOR ===== */
.stats-baby-selector { margin-bottom: 10px; }
.stats-baby-selector .select-field { width: 100%; }

/* ===== MOOD LEGEND ===== */
.mood-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; font-size: 0.85em; }
.mood-legend-item { display: flex; align-items: center; gap: 3px; }

/* ===== MOOD ENTRIES LOG ===== */
.mood-entries-log { margin-bottom: 10px; }
.mood-entry-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: #f8f0ff; border-radius: 10px; margin-bottom: 4px; font-size: 0.9em; }
.mood-entry-item .delete-btn { background: none; border: none; color: var(--text-light); font-size: 1em; cursor: pointer; padding: 6px 8px; min-width: 40px; min-height: 40px; display: flex; align-items: center; justify-content: center; touch-action: manipulation; }

/* ===== NAP TOTAL ===== */
.nap-total-banner { background: linear-gradient(135deg, #e8d5f5, #f0e6f6); padding: 12px 16px; border-radius: 12px; text-align: center; font-size: 1.05em; margin-bottom: 10px; font-weight: 600; }

/* ===== ADMIN ===== */
.admin-user-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); gap: 8px; flex-wrap: wrap; }

/* ===== RESPONSIVE ===== */
@media (min-width: 768px) {
  .main-content, .detail-view, .chat-container { max-width: 600px; margin: 0 auto; }
  .media-grid { grid-template-columns: repeat(4, 1fr); }
  .modal-overlay { align-items: center; padding: 20px; }
  .modal-card { border-radius: 20px; max-width: 420px; }
}
