/* ==========================================================================
   Little Nest Commercial V1 — Design System
   Faithfully ported from the personal app's Cloud Blue POS layout (same
   palette, same three-column shell) at your request — the multi-tenant
   auth/authorization underneath is different, but it should look and feel
   like the same product. Nursery/Photos aren't here since they're not
   part of commercial V1, and this is multi-page (real navigation between
   PHP files) rather than the personal app's single-page panel-switching,
   but the visual result is the same.
   ========================================================================== */

:root {
  --primary: #4A90E2;
  --primary-dark: #3478C5;
  --navy: #183B56;
  --baby-blue: #DCEEFF;
  --baby-blue-light: #EDF6FF;
  --background: #F5F9FC;
  --card: #FFFFFF;
  --border: #DDE7F0;
  --text: #183B56;
  --text-secondary: #718096;

  --success: #63B995;
  --warning: #F4B860;
  --danger: #E76F6F;
  --danger-dark: #C94F4F;

  --shadow: 0 8px 24px rgba(24,59,86,0.08);
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
}

* { box-sizing: border-box; }
.hidden { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--background);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* ==========================================================================
   Buttons / forms / alerts — shared across auth and app screens
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: var(--r-md);
  font-weight: 800; font-size: 0.95rem;
  padding: 14px 20px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:active { transform: scale(0.97); }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 18px rgba(74,144,226,0.35); }
.btn-secondary { background: var(--baby-blue-light); color: var(--navy); border: 1.5px solid var(--border); }
.btn-danger { background: #FDECEA; color: var(--danger-dark); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }

.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 0.8rem; font-weight: 800; color: var(--text-secondary);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.03em;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 15px; border: 1.5px solid var(--border); border-radius: var(--r-sm);
  font-size: 1rem; font-family: inherit; color: var(--text); background: var(--card);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.alert { padding: 13px 16px; border-radius: var(--r-sm); font-size: 0.88rem; font-weight: 600; margin-bottom: 14px; }
.alert-error { background: #FDECEA; color: var(--danger-dark); }
.alert-success { background: #EAF8F1; color: #2E7D53; }
.alert-info { background: var(--baby-blue-light); color: var(--navy); }
.alert-warning { background: #FEF3E4; color: #A5680F; }

.card {
  background: var(--card); border-radius: var(--r-lg); padding: 20px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.card + .card { margin-top: 14px; }

/* ==========================================================================
   Auth screens (signup, login, forgot/reset password, accept invite)
   ========================================================================== */
.auth-shell {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 32px 20px; background: var(--background);
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.auth-brand-icon { font-size: 1.5rem; }
.auth-brand-name { font-size: 1.1rem; font-weight: 900; color: var(--primary-dark); }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border-radius: var(--r-lg); padding: 32px 26px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 1.4rem; margin-bottom: 6px; }
.auth-card .sub { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 22px; }
.auth-step-indicator { display: flex; gap: 6px; margin-bottom: 18px; justify-content: center; }
.auth-step-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.auth-step-dot.active { background: var(--primary); width: 20px; border-radius: 999px; }
.auth-footer-link { text-align: center; margin-top: 20px; font-size: 0.86rem; color: var(--text-secondary); }
.link-box { background: var(--baby-blue-light); border-radius: var(--r-sm); padding: 14px; font-size: 0.8rem; word-break: break-all; color: var(--navy); margin-top: 10px; border: 1px dashed var(--primary); }

/* ==========================================================================
   App shell — three-column POS layout, ported from the personal app
   ========================================================================== */
.pos-shell { position: relative; display: flex; height: 100vh; overflow: hidden; }

.pos-nav {
  width: 190px; flex: 0 0 190px; background: var(--card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 12px; gap: 6px; overflow-y: auto; scrollbar-width: thin;
}
.pos-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1rem; color: var(--primary-dark); padding: 0 4px 4px; }
.brand-icon { font-size: 1.3rem; }
.baby-chip { background: var(--baby-blue-light); padding: 8px 12px; border-radius: 14px; font-weight: 700; font-size: 0.85rem; color: var(--text); margin-bottom: 8px; text-align: center; }
.role-chip { font-size: 0.68rem; font-weight: 800; text-transform: uppercase; color: var(--text-secondary); text-align: center; margin-bottom: 10px; }

.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: none; background: transparent; border-radius: 14px; padding: 12px 6px;
  font-weight: 700; font-size: 0.74rem; color: var(--text-secondary);
  cursor: pointer; text-decoration: none; transition: background 0.15s ease, color 0.15s ease;
}
.nav-btn .nav-icon { font-size: 1.3rem; }
.nav-btn:hover { background: var(--baby-blue-light); text-decoration: none; }
.nav-btn.active { background: var(--primary); color: #fff; box-shadow: 0 4px 10px rgba(74,144,226,0.35); }
.nav-spacer { flex: 1; }

.pos-main { flex: 1; min-width: 0; overflow-y: auto; padding: 22px 24px 40px; }
.panel-grid { display: flex; flex-direction: column; gap: 16px; }
.panel-grid.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

.pos-receipt { width: 270px; flex: 0 0 270px; background: var(--card); border-left: 1px solid var(--border); padding: 18px 14px; overflow-y: auto; }
.receipt-title { font-size: 1rem; font-weight: 800; margin: 0 0 14px; color: var(--text); }

.timeline { position: relative; padding-left: 18px; display: flex; flex-direction: column; gap: 14px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline .timeline-item { position: relative; padding: 2px 0 2px 8px; }
.timeline .timeline-item::before { content: ''; position: absolute; left: -17px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid var(--card); box-shadow: 0 0 0 2px var(--border); }
.timeline .timeline-item .t-title { font-weight: 800; font-size: 0.85rem; color: var(--text); display: flex; align-items: center; gap: 6px; }
.timeline .timeline-item .t-detail { font-size: 0.78rem; color: var(--text-secondary); margin-top: 1px; }
.timeline .timeline-item .t-meta { font-size: 0.72rem; color: var(--text-secondary); font-weight: 700; margin-top: 2px; }

/* ==========================================================================
   Home page pieces
   ========================================================================== */
.greeting { font-size: 1.4rem; font-weight: 900; margin-bottom: 2px; }
.greeting-sub { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 18px; }
.age-chip { font-size: 0.78rem; font-weight: 800; color: var(--primary-dark); background: var(--baby-blue-light); padding: 3px 10px; border-radius: 999px; margin-left: 8px; }

.hero-card {
  background: linear-gradient(160deg, #5AA3F5, var(--primary) 60%, var(--primary-dark));
  border-radius: var(--r-lg); padding: 24px 22px; color: #fff; box-shadow: 0 12px 28px rgba(74,144,226,0.35);
  position: relative; overflow: hidden;
}
.hero-card::after {
  content: ''; position: absolute; width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,0.08); top: -70px; right: -50px;
}
.hero-label { font-size: 0.74rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.85; }
.hero-value { font-size: 2rem; font-weight: 900; margin: 4px 0 2px; letter-spacing: -0.02em; }
.hero-detail { font-size: 0.86rem; opacity: 0.92; }
.hero-actions { display: flex; gap: 10px; margin-top: 16px; position: relative; z-index: 1; }
.hero-actions .btn { flex: 1; background: rgba(255,255,255,0.18); color: #fff; box-shadow: none; backdrop-filter: blur(6px); }
.hero-actions .btn:active { background: rgba(255,255,255,0.28); }

.stat-grid, .stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 14px 0 16px; }
.stat-card { background: var(--card); border-radius: var(--r-md); padding: 16px 10px; text-align: center; border: 1px solid var(--border); }
.stat-card .icon { font-size: 1.3rem; }
.stat-card .value { font-size: 1.15rem; font-weight: 900; margin-top: 4px; }
.stat-card .label { font-size: 0.7rem; color: var(--text-secondary); font-weight: 700; text-transform: uppercase; margin-top: 2px; }

.fade-in { animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .fade-in { animation: none; } }

.prediction-card { background: var(--card); border-radius: var(--r-lg); padding: 18px; margin-top: 14px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.prediction-card .eyebrow { font-size: 0.72rem; font-weight: 800; color: var(--text-secondary); text-transform: uppercase; }
.prediction-card .headline { font-size: 1.3rem; font-weight: 900; margin: 4px 0 2px; }
.prediction-card .sub { font-size: 0.85rem; color: var(--text-secondary); }
.prediction-card .basis { font-size: 0.78rem; color: var(--text-secondary); margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }

.section-title { font-size: 0.95rem; font-weight: 800; color: var(--navy); margin: 22px 0 10px; display: flex; align-items: center; justify-content: space-between; }
.section-title a { font-size: 0.8rem; font-weight: 700; }

.empty-state { text-align: center; padding: 36px 20px; color: var(--text-secondary); }
.empty-state .emoji { font-size: 2.2rem; margin-bottom: 8px; }
.empty-state .msg { font-size: 0.9rem; font-weight: 600; margin-bottom: 14px; }

.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
.quick-action-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 14px 6px; text-decoration: none; font-weight: 800; font-size: 0.72rem; color: var(--navy);
  transition: transform 0.1s ease;
}
.quick-action-btn:active { transform: scale(0.94); background: var(--baby-blue-light); }
.quick-action-btn .qa-icon { font-size: 1.5rem; }

/* ==========================================================================
   POS-style quick action grid (Feed / Nappy / Sleep pages)
   ========================================================================== */
.log-hero { text-align: center; padding: 24px 20px; }
.log-hero .big-icon { font-size: 2.6rem; margin-bottom: 8px; }
.log-hero .status { font-size: 1.25rem; font-weight: 900; }
.log-hero .status-sub { color: var(--text-secondary); font-size: 0.88rem; margin-top: 4px; }

.pos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pos-key {
  border: none; border-radius: 16px; padding: 20px 8px; cursor: pointer;
  font-weight: 800; font-size: 0.95rem; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: transform 0.12s ease;
}
.pos-key:active { transform: scale(0.95); }
.pos-key .key-icon { font-size: 2rem; }
.key-poop { background: #F4D9A6; }
.key-pee { background: var(--baby-blue); }
.key-mixed { background: #E4D3EC; }

.stepper { display: flex; align-items: center; justify-content: center; gap: 0; margin: 16px 0; }
.stepper-btn { width: 44px; height: 44px; border: 1.5px solid var(--border); background: var(--card); font-size: 1.2rem; font-weight: 800; color: var(--primary); cursor: pointer; }
.stepper-btn:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); border-right: none; }
.stepper-btn:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; border-left: none; }
.stepper input { width: 84px; height: 44px; text-align: center; border: 1.5px solid var(--border); border-left: none; border-right: none; font-size: 1.1rem; font-weight: 800; color: var(--text); }

/* ==========================================================================
   Lists, badges, timelines used across Baby/Health/History/Invite pages
   ========================================================================== */
.list-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.role-badge { font-size: 0.68rem; font-weight: 800; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; background: var(--baby-blue-light); color: var(--text-secondary); }
.role-badge.owner { background: var(--baby-blue); color: var(--primary-dark); }

.timeline-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--baby-blue-light); display: flex; align-items: center; justify-content: center; font-size: 1.05rem; flex-shrink: 0; }
.timeline-caregiver { font-size: 0.68rem; font-weight: 800; color: var(--primary); background: var(--baby-blue-light); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }

/* In-page activity list (Baby/Health/History content) — a roomier variant
   of the compact receipt-rail timeline, for when the list IS the page
   content rather than a sidebar summary. */
.timeline-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.timeline-item:last-child { border-bottom: none; }
.timeline-body { flex: 1; min-width: 0; }
.timeline-title { font-weight: 800; font-size: 0.92rem; }
.timeline-meta { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }

/* ==========================================================================
   Toast
   ========================================================================== */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 999px;
  font-weight: 700; font-size: 0.86rem; box-shadow: var(--shadow); z-index: 100;
  opacity: 0; pointer-events: none; transition: all 0.25s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==========================================================================
   Responsive: stack into a single column on phones/portrait, same
   breakpoint and approach the personal app uses
   ========================================================================== */
@media (max-width: 900px), (orientation: portrait) {
  .pos-shell { flex-direction: column; height: auto; overflow: visible; }
  .pos-nav { width: auto; flex: none; flex-direction: row; align-items: center; overflow-x: auto; padding: 12px; gap: 6px; position: sticky; top: 0; z-index: 5; }
  .pos-brand { display: none; }
  .baby-chip, .role-chip { display: none; }
  .nav-btn { flex-direction: row; flex: 0 0 auto; padding: 10px 14px; }
  .nav-spacer { display: none; }
  .pos-main { padding: 16px; }
  .panel-grid.two-col { grid-template-columns: 1fr; }
  .pos-receipt { width: auto; flex: none; max-height: 280px; border-left: none; border-top: 1px solid var(--border); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
