/* ===== DESIGN TOKENS ===== */
:root {
  --bg: #f2f2f7;
  --bg-2: #ffffff;
  --text: #1c1c1e;
  --text-secondary: #8e8e93;
  --accent: #ff6b3d;
  --accent-2: #c73498;
  --accent-blue: #007aff;
  --accent-purple: #af52de;
  --surface: rgba(255, 255, 255, 0.82);
  --stroke: rgba(60, 60, 67, 0.08);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
  --radius: 16px;
  --radius-lg: 24px;
  --radius-sm: 12px;
  --font-body: "Manrope", system-ui, -apple-system, sans-serif;
  --font-heading: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== RESET & BASE ===== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  margin: 0;
  letter-spacing: -0.02em;
}

p {
  margin: 0;
}

/* ===== RTL SUPPORT ===== */
html[dir="rtl"] body {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .topbar-actions {
  flex-direction: row-reverse;
}

html[dir="rtl"] .card-head {
  flex-direction: row-reverse;
}

html[dir="rtl"] .dialog-actions {
  flex-direction: row-reverse;
}

html[dir="rtl"] .inline-row {
  flex-direction: row-reverse;
}

html[dir="rtl"] .activity-steps {
  padding-left: 0;
  padding-right: 18px;
}

html[dir="rtl"] .list {
  padding-left: 0;
  padding-right: 18px;
}

html[dir="rtl"] .switch-field {
  flex-direction: row-reverse;
}

html[dir="rtl"] .rb-list-row {
  flex-direction: row-reverse;
}

html[dir="rtl"] .segment-control {
  flex-direction: row-reverse;
}

html[dir="rtl"] .care-quick-actions {
  direction: rtl;
}

/* ===== BACKGROUND ORBS ===== */
.bg-orb {
  position: fixed;
  z-index: -1;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
}

.orb-1 {
  background: #ff9a5c;
  top: -100px;
  left: -100px;
}

.orb-2 {
  background: #5ac8cb;
  right: -120px;
  bottom: 15%;
}

/* ===== APP SHELL ===== */
.app-shell {
  width: min(100%, 860px);
  margin: 0 auto;
  padding: 16px 16px 100px;
}

/* ===== LANGUAGE GATE ===== */
.lang-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  background: var(--surface);
  border-radius: var(--radius-lg);
  text-align: center;
}

.lang-gate-inner {
  width: 100%;
  max-width: 380px;
  padding: 20px;
}

.lang-gate-title {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #f89d37);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}

.lang-gate-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 28px;
  font-weight: 600;
}

.lang-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.lang-picker-grid.compact {
  gap: 10px;
}

.lang-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 12px;
  border: 2px solid var(--stroke);
  border-radius: var(--radius);
  background: var(--bg-2);
  cursor: pointer;
  transition: all var(--transition);
  font: inherit;
}

.lang-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.lang-card:active {
  transform: translateY(0);
}

.lang-flag {
  font-size: 2rem;
  line-height: 1;
}

.lang-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text);
}

/* ===== TOP BAR ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 20px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-purple) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  font-size: 1.1rem;
  font-family: var(--font-heading);
  box-shadow: 0 3px 10px rgba(255, 107, 61, 0.3);
  flex-shrink: 0;
}

.brand-name {
  font-size: 1.45rem;
  font-weight: 900;
  font-family: var(--font-heading);
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.topbar-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--stroke);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  cursor: pointer;
  padding: 0;
  color: var(--text-secondary);
  transition: all var(--transition);
  flex-shrink: 0;
}

.topbar-icon-btn:hover {
  transform: scale(1.08);
  box-shadow: var(--shadow-sm);
  color: var(--text);
}

.eyebrow { display: none; }

/* ===== PANELS & CARDS ===== */
.panel {
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.plan-card,
.quick-card,
.content-card,
.learn-card,
.progress-summary,
.metric {
  margin-top: 14px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

/* ===== LAYOUT UTILITIES ===== */
.stack {
  display: flex;
  flex-direction: column;
}

.gap-sm { gap: 10px; }
.gap-md { gap: 14px; }
.gap-lg { gap: 18px; }

.inline-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.top-gap { margin-top: 14px; }
.top-gap-sm { margin-top: 10px; }
.top-gap-xs { margin-top: 8px; }

.hidden {
  display: none !important;
}

.hidden-section {
  display: none;
}

.lang-dialog-body {
  padding: 8px;
}

/* ===== FORM FIELDS ===== */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
}

.field span {
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input, textarea, select, button {
  font: inherit;
}

input, textarea, select {
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--bg-2);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 61, 0.15);
}

textarea {
  resize: vertical;
  min-height: 90px;
}

/* ===== BUTTONS ===== */
button {
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 600;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(1px);
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), #ff9a5c);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 6px 20px rgba(255, 107, 61, 0.3);
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
}

.primary-btn:hover {
  box-shadow: 0 8px 28px rgba(255, 107, 61, 0.4);
}

.ghost-btn {
  background: var(--bg);
  border: 1px solid var(--stroke);
  color: var(--text);
  font-weight: 700;
}

.soft-btn {
  background: var(--bg-2);
  border: 1px solid var(--stroke);
  font-weight: 700;
}

/* ===== PILLS & CHIPS ===== */
.step-pill, .pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 14px;
  background: rgba(52, 199, 89, 0.12);
  color: #248a3d;
  font-size: 0.75rem;
  font-weight: 700;
}

.chip {
  background: var(--bg);
  color: var(--text-secondary);
  font-weight: 700;
  border-radius: 999px;
  padding: 10px 18px;
}

/* ===== AUTH SWITCH ===== */
.auth-switch {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  background: var(--bg);
  border-radius: 999px;
  padding: 4px;
}

.auth-switch .chip {
  flex: 1;
  text-align: center;
  border: none;
  padding: 10px 14px;
  border-radius: 999px;
  transition: all var(--transition);
}

.auth-switch .chip.active {
  background: var(--bg-2);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* ===== SEGMENT CONTROL (Baby / Mother toggle) ===== */
.segment-control {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
  margin-bottom: 14px;
}

.segment-btn {
  flex: 1;
  text-align: center;
  padding: 10px 14px;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.85rem;
  transition: all var(--transition);
}

.segment-btn.active {
  background: var(--bg-2);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ===== TAB PANELS ===== */
.tabs-viewport {
  overflow: hidden;
  position: relative;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: tabSlideInRight 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.tab-panel.active.slide-from-left {
  animation: tabSlideInLeft 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.tab-panel.active.slide-from-right {
  animation: tabSlideInRight 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Swipe-drag states */
.tab-panel.swipe-peek {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  animation: none !important;
  pointer-events: none;
}

.tab-panel.swipe-dragging,
.tab-panel.swipe-no-anim {
  animation: none !important;
}

@keyframes tabSlideInRight {
  from { opacity: 0; transform: translateX(48px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes tabSlideInLeft {
  from { opacity: 0; transform: translateX(-48px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ===== WELCOME CARD ===== */
.welcome-card {
  background: linear-gradient(145deg, #ffffff, #f5f9f9);
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  padding: 18px;
  margin-bottom: 14px;
}

/* ===== ACTIVITY ITEMS ===== */
.activity-item {
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  background: var(--bg-2);
  transition: all var(--transition);
}

.activity-item:hover {
  box-shadow: var(--shadow-sm);
}

.activity-item h4 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.activity-item p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.activity-media {
  width: 100%;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  border: 1px solid var(--stroke);
  object-fit: cover;
  max-height: 140px;
}

.activity-steps {
  margin: 0 0 8px;
  padding-left: 18px;
  color: var(--text);
}

.activity-actions {
  display: flex;
  gap: 8px;
}

.switch-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}

/* ===== STATUS TAB: simplified question cards ===== */
.status-question-card {
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.status-question-card p {
  font-weight: 600;
  font-size: 0.9rem;
}

.status-question-card .status-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.status-question-card .status-input-row input {
  flex: 1;
}

.status-question-card .status-input-row button {
  padding: 10px 16px;
  white-space: nowrap;
}

/* ===== CARE TAB: icon-based quick actions ===== */
.care-quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.care-action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 10px;
  border-radius: var(--radius);
  background: var(--bg-2);
  border: 1px solid var(--stroke);
  cursor: pointer;
  transition: all var(--transition);
}

.care-action-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.care-action-card:active {
  transform: translateY(0);
}

/* .care-icon font sizing replaced by SVG icon block above */

.care-label {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--text);
  text-align: center;
}

/* ===== CARE TRENDS ===== */
.trend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.trend-date {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--text-secondary);
  min-width: 50px;
}

.trend-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--bg);
}

.trend-badge.feeding { color: #ff9500; background: rgba(255, 149, 0, 0.1); }
.trend-badge.sleep { color: #5856d6; background: rgba(88, 86, 214, 0.1); }
.trend-badge.diaper { color: #34c759; background: rgba(52, 199, 89, 0.1); }

/* ===== PROGRESS BARS ===== */
.bar {
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  min-height: 26px;
}

.bar-fill {
  height: 100%;
  min-height: 26px;
  border-radius: 999px;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1), background 0.4s;
}

.bar-fill.pct-low   { background: linear-gradient(90deg, #ef4444, #f87171); }
.bar-fill.pct-mid   { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.bar-fill.pct-high  { background: linear-gradient(90deg, #3b82f6, #6366f1); }
.bar-fill.pct-full  { background: linear-gradient(90deg, #10b981, #34d399); }

.bar-pct {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.85);
  pointer-events: none;
  white-space: nowrap;
  z-index: 1;
}

.rb-progress-track { margin-top: 10px; min-height: 26px; }
.rb-progress-fill { border-radius: 999px; height: 100%; min-height: 26px; }

.rb-progress--red { background: linear-gradient(90deg, #ff3b30, #ff6961); }
.rb-progress--blue { background: linear-gradient(90deg, #007aff, #5ac8fa); }
.rb-progress--pink { background: linear-gradient(90deg, #ff2d55, #ff6f91); }
.rb-progress--green { background: linear-gradient(90deg, #34c759, #30d158); }

.progress-initial { width: 0%; }

.bar-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===== QUICK GRID (legacy support) ===== */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

/* ===== LISTS ===== */
.list {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
}

.list li {
  margin-bottom: 6px;
}

.learn-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ===== TIMELINE / LOGS ===== */
.timeline {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-entry {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: var(--bg-2);
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-entry-type {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: 0.82rem;
}

.log-entry-time {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.log-entry-notes {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

/* ===== STATUS HELPERS ===== */
.muted {
  color: var(--text-secondary);
}

.status-error {
  color: #ff3b30;
  font-weight: 700;
}

.status-success {
  color: #34c759;
  font-weight: 700;
}

/* ===== PROGRESS SUMMARY ===== */
.progress-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric h3 {
  margin-top: 4px;
  font-size: 1.25rem;
}

/* ===== INLINE FORMS ===== */
.inline-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 12px;
}

/* ===== CAREGIVERS ===== */
.caregivers {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.caregiver-item {
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: var(--bg-2);
  display: flex;
  justify-content: space-between;
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.88);
  border-top: 1px solid var(--stroke);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  z-index: 100;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: transparent;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.7rem;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

/* .nav-icon font sizing replaced by SVG icon block above */

.nav-btn.active {
  background: rgba(255, 107, 61, 0.1);
  color: var(--accent);
}

/* ===== DIALOGS ===== */
.log-dialog {
  border: none;
  border-radius: var(--radius-lg);
  width: min(92vw, 440px);
  box-shadow: var(--shadow-lg);
  padding: 20px;
}

.log-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.subform-dialog {
  width: min(95vw, 680px);
}

/* Red Book form dialog — full-screen-ish on mobile */
.rb-form-dialog {
  width: min(96vw, 640px);
  max-height: min(90vh, 800px);
  padding: 20px;
  overflow-y: auto;
}

.rb-editor-card {
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 16px;
}

.rb-entry-item {
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ===== RED BOOK FORMS ===== */

.rb-field {
  border: 1px solid var(--stroke);
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.rb-field > label,
.rb-field .field > span {
  font-weight: 700;
}

.rb-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rb-list-item {
  border: 1px dashed rgba(60, 60, 67, 0.12);
  border-radius: 10px;
  padding: 10px;
}

.rb-field-modal {
  background: #fefefe;
}

/* ===== DATE PICKER ===== */
.dp-dialog {
  padding: 0;
  overflow: hidden;
}

.dp-container {
  padding: 20px;
}

.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}

.dp-nav {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--stroke);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  padding: 0;
}

.dp-nav:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.dp-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dp-select {
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--bg-2);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
}

.dp-year-input {
  width: 80px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--bg-2);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text);
  text-align: center;
}

.dp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}

.dp-wday {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dp-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.dp-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  border: none;
  color: var(--text);
  transition: all var(--transition);
  padding: 0;
  min-width: 36px;
  min-height: 36px;
}

.dp-day:hover:not(.dp-empty) {
  background: rgba(255, 107, 61, 0.12);
  color: var(--accent);
}

.dp-day.dp-selected {
  background: linear-gradient(135deg, var(--accent), #ff9a5c);
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 107, 61, 0.3);
  font-weight: 800;
}

.dp-day.dp-empty {
  cursor: default;
  pointer-events: none;
}

.dp-time-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  padding: 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.dp-time-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.dp-time-field span {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dp-time-field input {
  width: 60px;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.dp-time-sep {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-secondary);
  margin-top: 16px;
}

.dp-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.dp-input {
  cursor: pointer;
  caret-color: transparent;
}

.dp-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 61, 0.15);
}

/* ===== ANIMATIONS ===== */
.stagger {
  opacity: 0;
  transform: translateY(12px);
  animation: fadeSlideUp 0.5s ease forwards;
}

.stagger:nth-child(2) { animation-delay: 0.06s; }
.stagger:nth-child(3) { animation-delay: 0.12s; }
.stagger:nth-child(4) { animation-delay: 0.18s; }
.stagger:nth-child(5) { animation-delay: 0.24s; }

@keyframes fadeSlideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== SVG NAV ICONS ===== */
.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}

.nav-icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
}

/* ===== SVG CARE ICONS ===== */
.care-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 107, 61, 0.08);
  border-radius: 50%;
  transition: background var(--transition);
}

.care-icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--accent);
}

.care-action-card:hover .care-icon {
  background: rgba(255, 107, 61, 0.15);
}

/* ===== LOG TYPE DOTS ===== */
.log-type-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-inline-end: 6px;
}

.log-type-sleep { background: #5856d6; }
.log-type-feeding { background: #ff9500; }
.log-type-diaper { background: #34c759; }
.log-type-picture { background: #007aff; }

/* ===== RED BOOK FORM LIST ===== */
.rb-form-link {
  display: block;
  width: 100%;
  text-align: start;
  padding: 12px 14px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: none;
}

.rb-form-link:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(255, 107, 61, 0.1);
  transform: translateY(-1px);
}

.rb-form-link-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.rb-form-link-inner h4 {
  font-size: 0.88rem;
  font-weight: 700;
  text-align: start;
  margin: 0;
}

.rb-form-pct {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
  margin-inline-start: 8px;
}

/* ===== ABSTRACT / MODERN UI POLISH ===== */

/* Glassmorphic overlays on panels */
.panel {
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}

/* Subtle gradient borders on cards */
.plan-card,
.content-card {
  border: 1px solid transparent;
  background:
    linear-gradient(var(--bg-2), var(--bg-2)) padding-box,
    linear-gradient(135deg, rgba(255, 107, 61, 0.15), rgba(90, 200, 203, 0.15)) border-box;
}

/* Soft glow on primary buttons */
.primary-btn {
  position: relative;
}

.primary-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent), #ff9a5c);
  opacity: 0;
  transition: opacity var(--transition);
  z-index: -1;
  filter: blur(16px);
}

.primary-btn:hover::after {
  opacity: 0.5;
}

/* Abstract gradient accent on welcome card */
.welcome-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(245, 249, 249, 0.9));
}

.welcome-card::before {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(255, 107, 61, 0.15), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

html[dir="rtl"] .welcome-card::before {
  right: auto;
  left: -40px;
}

/* Floating orb accents on care cards */
.care-action-card {
  position: relative;
  overflow: hidden;
}

.care-action-card::before {
  content: "";
  position: absolute;
  bottom: -16px;
  right: -16px;
  width: 48px;
  height: 48px;
  background: radial-gradient(circle, rgba(255, 107, 61, 0.08), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  transition: all var(--transition);
}

.care-action-card:hover::before {
  transform: scale(2);
  opacity: 0.6;
}

/* Nicer form fields with subtle inner shadow */
input, textarea, select {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

input:focus, textarea:focus, select:focus {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04), 0 0 0 3px rgba(255, 107, 61, 0.15);
}

/* Nav bar glass effect */
.bottom-nav {
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}

/* Activity items — subtle left accent bar */
.activity-item {
  position: relative;
  border-left: 3px solid var(--accent);
  padding-left: 16px;
}

html[dir="rtl"] .activity-item {
  border-left: none;
  border-right: 3px solid var(--accent);
  padding-left: 14px;
  padding-right: 16px;
}

/* Segment control pill-like appearance */
.segment-control {
  border: 1px solid var(--stroke);
  background: rgba(242, 242, 247, 0.6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.segment-btn.active {
  background: var(--bg-2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Auth switch polish */
.auth-switch {
  border: 1px solid var(--stroke);
  background: rgba(242, 242, 247, 0.6);
}

.auth-switch .chip.active {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Lang gate glassmorphism */
.lang-gate {
  background: rgba(255, 255, 255, 0.6);
  -webkit-backdrop-filter: blur(32px);
  backdrop-filter: blur(32px);
}

/* Status tab question card subtle border */
.status-question-card {
  border: 1px solid transparent;
  background:
    linear-gradient(var(--bg-2), var(--bg-2)) padding-box,
    linear-gradient(135deg, rgba(88, 86, 214, 0.1), rgba(52, 199, 89, 0.1)) border-box;
}

/* Log entries timeline accent dot */
.log-entry {
  position: relative;
  padding-left: 20px;
}

.log-entry::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 16px;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
}

html[dir="rtl"] .log-entry {
  padding-left: 14px;
  padding-right: 20px;
}

html[dir="rtl"] .log-entry::before {
  left: auto;
  right: 6px;
}

/* Trend badge subtle animation on hover */
.trend-badge {
  transition: all var(--transition);
}

.trend-badge:hover {
  transform: scale(1.05);
}


/* Dialog smooth entrance */
.log-dialog[open] {
  animation: dialogIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dialogIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Step pill with gradient */
.step-pill {
  background: linear-gradient(135deg, rgba(52, 199, 89, 0.12), rgba(90, 200, 250, 0.12));
}

/* Language card selected state */
.lang-card[aria-pressed="true"],
.lang-card.selected {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(255, 107, 61, 0.2);
  background: linear-gradient(160deg, #fff, rgba(255, 107, 61, 0.04));
}

/* Progress bar shimmer effect */
.bar-fill {
  background-size: 200% 100%;
  animation: barShimmer 2s ease infinite;
}

@keyframes barShimmer {
  0%, 100% { background-position: 0% 0%; }
  50% { background-position: 100% 0%; }
}

/* Pill badge active state */
.pill {
  background: linear-gradient(135deg, rgba(52, 199, 89, 0.12), rgba(90, 200, 250, 0.12));
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(60, 60, 67, 0.15);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(60, 60, 67, 0.3);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .care-quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }

  .lang-picker-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .lang-card {
    padding: 16px 8px;
  }
}

@media (min-width: 760px) {
  .brand-name {
    font-size: 1.7rem;
  }

  .app-shell {
    padding-bottom: 28px;
  }

  .bottom-nav {
    position: static;
    margin-top: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--stroke);
  }

  .inline-form {
    grid-template-columns: 1fr 1fr auto;
  }

  .quick-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ===== SUPPORT SUB-TABS ===== */
#onlineAdviceText {
  resize: vertical;
  width: 100%;
}

.support-subtabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.support-subtab-btn {
  flex: 1;
  padding: 9px 12px;
  border-radius: var(--radius-md, 10px);
  border: 1.5px solid var(--stroke);
  background: var(--surface);
  color: var(--text-muted, #64748b);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.support-subtab-btn.active {
  background: var(--brand, #2563eb);
  border-color: var(--brand, #2563eb);
  color: #fff;
}

/* ===== TOKEN BADGE ===== */
.token-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(135deg, #ffd60a 0%, #ff9f0a 100%);
  border: none; border-radius: 20px; padding: 3px 10px 3px 6px;
  font-size: 0.82rem; font-weight: 700; color: #7c4f00;
  cursor: pointer; box-shadow: 0 2px 8px rgba(255,160,0,0.3);
  transition: transform 0.15s;
}
.token-badge:active { transform: scale(0.95); }
.token-icon { font-size: 1rem; }

/* ===== BUY TOKENS DIALOG ===== */
.token-balance-big {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: linear-gradient(135deg, #fff7e0 0%, #fff 100%);
  border-radius: var(--radius); padding: 20px; margin: 4px 0;
}
.token-big-icon { font-size: 2.5rem; }
#tokenBalanceBig { font-size: 2.8rem; font-weight: 800; color: #7c4f00; font-family: var(--font-heading); }
.token-big-label { font-size: 1rem; color: var(--text-secondary); font-weight: 600; }
.token-earn-list { display: flex; flex-direction: column; gap: 6px; }
.token-earn-item { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--text-secondary); }
.token-earn-icon { font-size: 1.1rem; width: 24px; text-align: center; }

/* ===== CARE TREND CHART ===== */
.trend-chart-wrap { overflow-x: auto; }
.trend-svg { display: block; overflow: visible; }
.tbar { transition: height 0.4s cubic-bezier(0.34,1.56,0.64,1), y 0.4s cubic-bezier(0.34,1.56,0.64,1); }
.tbar-feeding { fill: #007aff; opacity: 0.85; }
.tbar-sleep { fill: #af52de; opacity: 0.85; }
.tbar-diaper { fill: #ff9f0a; opacity: 0.85; }
.tbar-label { font-size: 9px; fill: var(--text-secondary); text-anchor: middle; font-family: var(--font-body); }
.tbar-legend-text { font-size: 9px; fill: var(--text-secondary); dominant-baseline: middle; font-family: var(--font-body); }
.trend-legend rect { opacity: 0.85; }

/* ===== QUESTION LIST ===== */
.question-list { display: flex; flex-direction: column; gap: 8px; }
.question-item {
  background: var(--surface); border: 1px solid var(--stroke);
  border-radius: var(--radius-sm); padding: 12px 14px;
  cursor: pointer; transition: box-shadow 0.15s;
}
.question-item:active { box-shadow: var(--shadow-sm); }
.question-item-preview { font-size: 0.92rem; color: var(--text); line-height: 1.4; margin-bottom: 6px; }
.question-item-meta { display: flex; justify-content: space-between; align-items: center; }
.question-date { font-size: 0.78rem; color: var(--text-secondary); }
.question-status { font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.qstatus-pending { background: #fff3cd; color: #856404; }
.qstatus-progress { background: #cfe2ff; color: #084298; }
.qstatus-answered { background: #d1e7dd; color: #0a3622; }

/* ===== QUESTION THREAD DIALOG ===== */
.question-thread-dialog { max-width: 500px; width: 95vw; }
.thread-messages {
  max-height: 320px; overflow-y: auto; display: flex; flex-direction: column;
  gap: 8px; padding: 4px; background: var(--bg); border-radius: var(--radius-sm);
  min-height: 80px;
}
.thread-msg { display: flex; flex-direction: column; max-width: 80%; }
.thread-msg-user { align-self: flex-end; align-items: flex-end; }
.thread-msg-advisor { align-self: flex-start; align-items: flex-start; }
.thread-msg-bubble {
  padding: 8px 12px; border-radius: 14px; font-size: 0.9rem; line-height: 1.4;
}
.thread-msg-user .thread-msg-bubble { background: var(--accent-blue); color: #fff; border-bottom-right-radius: 4px; }
.thread-msg-advisor .thread-msg-bubble { background: var(--surface); border: 1px solid var(--stroke); color: var(--text); border-bottom-left-radius: 4px; }
.thread-msg-time { font-size: 0.72rem; color: var(--text-secondary); margin-top: 2px; }
.thread-empty { text-align: center; padding: 20px; color: var(--text-secondary); }
.thread-input-row { display: flex; flex-direction: column; gap: 6px; }
.thread-input-row textarea { border-radius: var(--radius-sm); border: 1.5px solid var(--stroke); padding: 10px 12px; font: inherit; font-size: 0.9rem; resize: none; }
.thread-cost-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.token-cost-label { font-size: 0.8rem; flex: 1; }
.cost-ok { color: #0a7c3e; }
.cost-over { color: #c0392b; }
