/* ==========================================================================
   GaTi Design System Specification
   Application: Theo Dõi Hậu Sản 6 Giờ Đầu (Mẹ & Bé)
   Mobile-Optimized & Concise Editorial Healthcare UI
   Zero Emojis | Strict Typography | High Signal-To-Noise Ratio
   ========================================================================== */

:root {
  /* Color Tokens - Light Warm Editorial Palette */
  --bg-base: #FDFBF7;
  --surface-panel: #F4F2EE;
  --surface-elevated: #FFFFFF;
  --border-color: #E5E2DC;
  --border-strong: #CDC9C0;
  
  --text-primary: #2D2B2A;
  --text-muted: #6F6B68;
  --text-subtle: #8F8B87;

  /* Semantic Accents (Pastels) */
  --accent-sage: #57877A;
  --accent-sage-soft: #EBF2F0;
  --accent-ochre: #D29E55;
  --accent-ochre-soft: #F9F3EA;
  --accent-terracotta: #C47463;
  --accent-terracotta-soft: #F9EFEB;
  --accent-slate: #8E9CA3;
  --accent-slate-soft: #F0F4F6;

  /* Spatial Scale */
  --gap-xs: 4px;
  --gap-sm: 8px;
  --gap-md: 14px;
  --gap-lg: 20px;

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 24px;

  /* Typography */
  --font-serif: 'Merriweather', 'Georgia', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(45, 43, 42, 0.05);
  --shadow-card: 0 2px 6px rgba(45, 43, 42, 0.05);
  --shadow-active: 0 4px 16px rgba(87, 135, 122, 0.16);
  --shadow-modal: 0 10px 28px rgba(45, 43, 42, 0.14);
}

/* Base Reset & Zero Horizontal Wobble */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
  overscroll-behavior-x: none;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Header - Editorial Glassmorphic Bar */
.app-header {
  background: rgba(253, 251, 247, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(229, 226, 220, 0.9);
  padding: 10px 14px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(45, 43, 42, 0.04);
  width: 100%;
  max-width: 100vw;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.brand-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-sage);
  background-color: var(--accent-sage-soft);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

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

/* Header Action Buttons */
.btn-header-action {
  height: 30px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
}

/* Mobile Header Layout: 2 Rows (Title Top, Buttons Bottom) */
@media (max-width: 680px) {
  .app-header {
    padding: 8px 12px 10px 12px;
  }
  .header-container {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .brand-block {
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding-bottom: 2px;
  }
  .brand-title {
    font-size: 16px;
    text-align: center;
  }
  .brand-badge {
    font-size: 9px;
    padding: 2px 6px;
  }
  .header-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    width: 100%;
  }
  .header-actions .btn,
  .header-actions .btn-toggle,
  .header-actions .btn-header-action {
    width: 100%;
    height: 32px;
    padding: 0 4px;
    font-size: 11.5px;
    justify-content: center;
    box-sizing: border-box;
  }
  .btn-toggle {
    gap: 4px;
  }
}

/* Hold-To-Reset Button Styling */
.btn-hold-reset {
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  cursor: pointer;
}

.btn-hold-reset .btn-hold-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  background-color: rgba(196, 116, 99, 0.35);
  pointer-events: none;
  transition: width 0.05s linear;
  z-index: 1;
}

.btn-hold-reset .btn-hold-text {
  position: relative;
  z-index: 2;
  font-weight: 600;
}

.btn-hold-reset.is-holding {
  border-color: var(--accent-terracotta);
  background-color: var(--accent-terracotta-soft);
}

/* Touch-Friendly Tactile Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 36px;
  padding: 0 12px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.1s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:active {
  transform: scale(0.96);
}

.btn.touch-btn {
  min-height: 42px;
}

.btn-sm {
  height: 29px;
  padding: 0 8px;
  font-size: 11.5px;
}

.btn-large {
  height: 42px;
  padding: 0 16px;
  font-size: 13.5px;
  font-weight: 600;
}

.btn-primary {
  background-color: var(--accent-sage);
  color: #FFFFFF;
  border-color: var(--accent-sage);
}
.btn-primary:active {
  background-color: #497267;
}

.btn-secondary {
  background-color: var(--surface-panel);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background-color: #EAE6DF;
}

.btn-outline {
  background-color: transparent;
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-outline:hover {
  background-color: var(--surface-panel);
}

.btn-outline-sage {
  background-color: var(--accent-sage-soft);
  color: var(--accent-sage);
  border-color: #C7DBD6;
}
.btn-outline-sage:active {
  background-color: #DDEBE6;
}

.btn-outline-ochre {
  background-color: var(--accent-ochre-soft);
  color: #B57F32;
  border-color: #EBD6BC;
}

.btn-outline-danger {
  background-color: var(--accent-terracotta-soft);
  color: var(--accent-terracotta);
  border-color: #E8CAC4;
}

.btn-outline-slate {
  background-color: var(--accent-slate-soft);
  color: var(--accent-slate);
  border-color: #CAD5DB;
}

.btn-danger-soft {
  background-color: var(--accent-terracotta-soft);
  color: var(--accent-terracotta);
  border-color: #E8CAC4;
  font-weight: 600;
}
.btn-danger-soft:active {
  background-color: #F4DFD8;
}

.btn-symbol {
  font-family: var(--font-mono);
  font-weight: 700;
}

/* Sound Toggle Button */
.btn-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 29px;
  padding: 0 8px;
  background-color: var(--surface-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  transition: transform 0.1s ease, background-color 0.15s ease, border-color 0.15s ease;
  user-select: none;
}
.btn-toggle:active {
  transform: scale(0.96);
}
.btn-toggle .toggle-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #A3A09B;
  transition: background-color 0.2s ease;
}
.btn-toggle.active {
  color: var(--accent-sage);
  border-color: #B9D3CD;
  background-color: var(--accent-sage-soft);
}
.btn-toggle.active .toggle-indicator {
  background-color: var(--accent-sage);
}

/* Main Container - Zero Overflow-X Protection */
.main-container {
  max-width: 1200px;
  margin: var(--gap-md) auto;
  padding: 0 12px 76px 12px; /* Bottom padding for floating dock */
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Cards */
.card {
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-card);
}

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

.section-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-transform: uppercase;
  display: block;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

/* Badges */
.status-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
}
.badge-idle { background-color: var(--surface-panel); color: var(--text-muted); border: 1px solid var(--border-color); }
.badge-active { background-color: var(--accent-sage-soft); color: var(--accent-sage); border: 1px solid #B9D3CD; }
.badge-warning { background-color: var(--accent-ochre-soft); color: #A6732B; border: 1px solid #E4CDAE; }
.badge-done { background-color: #E2ECE9; color: #386458; border: 1px solid #B2CEC6; }
.badge-sage { background-color: var(--accent-sage-soft); color: var(--accent-sage); }
.badge-terracotta { background-color: var(--accent-terracotta-soft); color: var(--accent-terracotta); }

/* Dashboard Hero */
.dashboard-hero {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: var(--gap-md);
  margin-bottom: var(--gap-md);
}

@media (max-width: 860px) {
  .dashboard-hero {
    grid-template-columns: 1fr;
  }
}

/* Timer Display Card */
.hero-timer-card {
  display: flex;
  flex-direction: column;
}

.timer-display-wrap {
  background-color: var(--surface-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  text-align: center;
  margin-bottom: 10px;
}

.timer-digits {
  font-family: var(--font-mono);
  font-size: 38px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  line-height: 1.05;
}

.timer-target {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Progress Track */
.timeline-progress-wrap {
  margin-bottom: 12px;
}

.progress-bar-bg {
  position: relative;
  height: 10px;
  background-color: var(--surface-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--accent-sage);
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
}

.progress-marker {
  position: absolute;
  top: -5px;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: var(--surface-elevated);
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
}
.marker-0 { left: 0%; transform: translateX(0); }
.marker-2 { left: 33.33%; }
.marker-4 { left: 66.66%; }
.marker-6 { left: 100%; transform: translateX(-100%); }

.progress-marker.reached {
  border-color: var(--accent-sage);
  color: var(--accent-sage);
  background-color: var(--accent-sage-soft);
}

.stage-names-row {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 10.5px;
  color: var(--text-muted);
  gap: 2px;
}

.stage-name-col {
  flex: 1;
  text-align: center;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
}

.stage-name-col.active-stage {
  color: var(--accent-sage);
  font-weight: 600;
  background-color: var(--accent-sage-soft);
}

/* Timer Controls */
.timer-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.primary-controls, .secondary-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

/* Simulation Quick Bar */
.simulation-quick-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background-color: var(--surface-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.sim-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.sim-buttons-scroll {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.sim-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  height: 24px;
  padding: 0 6px;
  background-color: var(--surface-elevated);
}

/* Active Reminder Banner */
.reminder-banner {
  background-color: var(--accent-ochre-soft);
  border: 1px solid #E8D3B7;
  border-left: 3px solid var(--accent-ochre);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  transition: all 0.25s ease;
}

.reminder-banner-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #9C671C;
  text-transform: uppercase;
}

.reminder-banner-content {
  font-size: 12.5px;
  color: var(--text-primary);
  font-weight: 500;
  margin-top: 2px;
}

.reminder-banner-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #8C642B;
  margin-top: 2px;
}

/* Collapsible Patient Profile for Mobile */
.hero-info-card {
  padding: 12px 14px;
}

.accordion-header {
  cursor: pointer;
  user-select: none;
  margin-bottom: 0;
}

.patient-collapse-content {
  margin-top: 10px;
  transition: max-height 0.3s ease, opacity 0.25s ease;
}
.patient-collapse-content.collapsed {
  display: none;
}

.patient-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

@media (max-width: 580px) {
  .patient-form-grid {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-control {
  height: 34px;
  padding: 0 8px;
  background-color: var(--surface-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-primary);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-sage);
  background-color: var(--surface-elevated);
}

.info-card-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.notice-callout {
  background-color: var(--surface-panel);
  border-left: 3px solid var(--accent-terracotta);
  padding: 6px 10px;
  font-size: 11.5px;
  color: var(--text-primary);
  line-height: 1.4;
}

/* Tabs Navigation - Smooth Mobile Horizontal Scroll & Zero Wobble */
.app-tab-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: var(--gap-md);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
  max-width: 100%;
}
.app-tab-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s ease, border-bottom-color 0.2s ease;
}

.tab-btn:active {
  transform: scale(0.97);
}

.tab-btn.active {
  color: var(--accent-sage);
  border-bottom-color: var(--accent-sage);
  font-weight: 600;
}

.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
  animation: tabFadeIn 0.25s ease-out;
}

@keyframes tabFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   TAB 1: TIMELINE (Compact, Mobile-First, Short Punchy Text)
   ========================================================================== */

.timeline-toolbar-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin-bottom: 14px;
  position: sticky;
  top: 55px;
  z-index: 90;
}

.stage-nav-cluster {
  display: flex;
  gap: 3px;
}

.filter-stage-btn.active {
  background-color: var(--accent-sage-soft);
  color: var(--accent-sage);
  border-color: var(--accent-sage);
  font-weight: 600;
}

/* Timeline Container - Zero Negative Margins & Perfect Alignment */
.timeline-stream-container {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  padding-left: 0;
  box-sizing: border-box;
}

/* Vertical Spine Behind Node Rail */
.timeline-vertical-spine {
  position: absolute;
  top: 6px;
  bottom: 14px;
  left: 21px;
  width: 2px;
  background-color: var(--border-strong);
  z-index: 1;
}

/* Node - Rock-Solid CSS Grid (44px rail | 1fr card) */
.timeline-node {
  position: relative;
  display: grid;
  grid-template-columns: 44px 1fr;
  column-gap: 10px;
  align-items: flex-start;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Rail Dot (Cell 1 of Grid) */
.timeline-node-rail {
  position: relative;
  left: 0;
  width: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
  flex-shrink: 0;
}

.timeline-node-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--surface-panel);
  border: 1.5px solid var(--border-strong);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.timeline-node-status {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  color: var(--text-subtle);
  margin-top: 2px;
  text-align: center;
  text-transform: uppercase;
  line-height: 1.15;
}

/* Timeline Card (Cell 2 of Grid) - Zero Flex Blowout */
.timeline-card {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
}

.timeline-card-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 4px;
}

.timeline-time-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  background-color: var(--surface-panel);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.timeline-stage-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
}
.stage-g1 { background-color: var(--accent-sage-soft); color: var(--accent-sage); }
.stage-g2 { background-color: var(--accent-ochre-soft); color: #9C671C; }
.stage-g3 { background-color: var(--accent-slate-soft); color: var(--accent-slate); }

.timeline-live-tag {
  display: none;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  background-color: var(--accent-sage);
  color: #FFFFFF;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.04em;
}

.timeline-card-title {
  font-family: var(--font-serif);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 6px;
}

/* Compact Check List */
.compact-check-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.compact-check-list li {
  padding: 4px 0;
  border-bottom: 1px dashed #EDEAE4;
}
.compact-check-list li:last-child {
  border-bottom: none;
}

.check-item-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-primary);
  line-height: 1.35;
  cursor: pointer;
  min-height: 32px;
}

.check-item-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: 3px;
  margin-top: 1px;
  flex-shrink: 0;
  cursor: pointer;
  background-color: var(--surface-panel);
  position: relative;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.check-item-row input[type="checkbox"]:checked {
  background-color: var(--accent-sage);
  border-color: var(--accent-sage);
}

.check-item-row input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.check-item-row.completed span {
  color: var(--text-muted);
  text-decoration: line-through;
}

/* Locked Check Item State (For Upcoming Milestones) */
.check-item-row.item-locked {
  opacity: 0.55;
  cursor: not-allowed;
  user-select: none;
}

.check-item-row.item-locked input[type="checkbox"] {
  cursor: not-allowed;
  background-color: #EAE7E1;
  border-color: #D6D2CA;
}

.check-item-row.item-locked span {
  color: var(--text-muted);
}

.btn-disabled,
.confirm-milestone-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  background-color: var(--surface-panel);
  border-color: var(--border-color);
  color: var(--text-subtle);
}

/* Compact Alert Box */
.compact-alert-box {
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 11.5px;
  line-height: 1.35;
  margin-top: 6px;
}

.alert-terracotta {
  background-color: var(--accent-terracotta-soft);
  border-left: 3px solid var(--accent-terracotta);
  color: #7B2A18;
}

.alert-ochre {
  background-color: var(--accent-ochre-soft);
  border-left: 3px solid var(--accent-ochre);
  color: #7D5114;
}

.timeline-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

/* ==========================================================================
   DYNAMIC HIGHLIGHT STATES & FLUID ANIMATIONS
   ========================================================================== */

/* Active Highlighted Node */
.timeline-node.is-active-milestone .timeline-node-dot {
  background-color: var(--accent-sage);
  border-color: var(--accent-sage);
  color: #FFFFFF;
  box-shadow: 0 0 0 4px rgba(87, 135, 122, 0.22);
  animation: dotRadarPulse 2.2s infinite ease-out;
}

@keyframes dotRadarPulse {
  0% {
    box-shadow: 0 0 0 2px rgba(87, 135, 122, 0.35);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(87, 135, 122, 0.08);
  }
  100% {
    box-shadow: 0 0 0 2px rgba(87, 135, 122, 0.35);
  }
}

.timeline-node.is-active-milestone .timeline-node-status {
  color: var(--accent-sage);
  font-weight: 700;
}

.timeline-node.is-active-milestone .timeline-card {
  border: 1.5px solid var(--accent-sage);
  background-color: #F7FAF9;
  box-shadow: var(--shadow-active);
  animation: activePulseGlow 3s infinite ease-in-out;
}

@keyframes activePulseGlow {
  0% {
    box-shadow: 0 2px 10px rgba(87, 135, 122, 0.12);
    border-color: var(--accent-sage);
  }
  50% {
    box-shadow: 0 6px 20px rgba(87, 135, 122, 0.24);
    border-color: #497267;
  }
  100% {
    box-shadow: 0 2px 10px rgba(87, 135, 122, 0.12);
    border-color: var(--accent-sage);
  }
}

.timeline-node.is-active-milestone .timeline-live-tag {
  display: inline-block;
}

/* Completed Node */
.timeline-node.is-completed-milestone .timeline-node-dot {
  background-color: var(--accent-sage-soft);
  border-color: #A6C7BF;
  color: var(--accent-sage);
}

.timeline-node.is-completed-milestone .timeline-node-status {
  color: var(--accent-sage);
}

.timeline-node.is-completed-milestone .timeline-card {
  opacity: 0.94;
}

/* Upcoming Node */
.timeline-node.is-upcoming-milestone .timeline-node-dot {
  background-color: var(--surface-panel);
  border-color: var(--border-color);
  color: var(--text-subtle);
}

.timeline-node.is-upcoming-milestone .timeline-card {
  opacity: 0.86;
}

/* Compact Infant Care Card */
.card-accent-infant {
  border-top: 3px solid var(--accent-sage);
  padding: 12px;
}

.infant-care-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

@media (max-width: 600px) {
  .infant-care-grid {
    grid-template-columns: 1fr;
  }
}

.infant-rule-box {
  background-color: var(--surface-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.infant-rule-box h4 {
  font-family: var(--font-serif);
  font-size: 13px;
  margin-bottom: 2px;
}

.infant-rule-box p {
  font-size: 11.5px;
  color: var(--text-primary);
  line-height: 1.35;
}

/* Mobile Sticky Dock for Fast Jump */
.mobile-sticky-dock {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 95;
  display: none;
  animation: dockSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dockSlideUp {
  from {
    transform: translate(-50%, 20px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

.btn-mobile-dock {
  box-shadow: 0 6px 18px rgba(45, 43, 42, 0.22);
  font-weight: 600;
  height: 40px;
  border-radius: var(--radius-pill);
  padding: 0 18px;
  letter-spacing: 0.02em;
}

@media (max-width: 860px) {
  .mobile-sticky-dock {
    display: block;
  }
}

/* TAB 2: Quick Log Layout */
.quick-log-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap-md);
}

.quick-group-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 10px 0 4px 0;
}

.button-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.custom-note-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.input-with-button {
  display: flex;
  gap: 6px;
}

.input-with-button .form-control {
  flex: 1;
}

/* Data Table - Horizontal Scroll Containment */
.table-responsive {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--surface-elevated);
  box-sizing: border-box;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  background-color: var(--surface-panel);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: top;
}

.tag-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
}
.tag-normal { background-color: var(--surface-panel); color: var(--text-primary); }
.tag-success { background-color: var(--accent-sage-soft); color: var(--accent-sage); }
.tag-warning { background-color: var(--accent-ochre-soft); color: #9C671C; }
.tag-alert, .tag-danger { background-color: var(--accent-terracotta-soft); color: var(--accent-terracotta); }
.tag-info { background-color: var(--accent-slate-soft); color: var(--accent-slate); }

.btn-del-row {
  background: none;
  border: none;
  color: var(--text-subtle);
  font-weight: bold;
  cursor: pointer;
}

/* TAB 3: Visual Protocols */
.protocol-cards-grid {
  display: flex;
  flex-direction: column;
  gap: var(--gap-md);
}

.four-step-flow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 8px;
}

@media (max-width: 768px) {
  .four-step-flow {
    grid-template-columns: 1fr 1fr;
  }
}

.step-flow-item {
  background-color: var(--surface-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.step-flow-number {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-sage);
}

.step-flow-body h4 {
  font-size: 12.5px;
  margin: 2px 0;
}

.step-flow-body p {
  font-size: 11px;
  color: var(--text-muted);
}

.hygiene-guideline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

@media (max-width: 680px) {
  .hygiene-guideline-grid {
    grid-template-columns: 1fr;
  }
}

.hygiene-rule {
  border-radius: var(--radius-sm);
  padding: 10px;
  border: 1px solid var(--border-color);
  font-size: 12px;
}

.do-rule { background-color: var(--accent-sage-soft); }
.dont-rule { background-color: var(--accent-terracotta-soft); }

.rule-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.do-rule .rule-badge { background-color: var(--accent-sage); color: #fff; }
.dont-rule .rule-badge { background-color: var(--accent-terracotta); color: #fff; }

.hygiene-rule ul {
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Modals - Mobile-First Full Viewport Protection & Internal Scrolling */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(45, 43, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 12px;
  box-sizing: border-box;
  overflow: hidden;
  overscroll-behavior: contain;
}

.modal-card {
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 480px;
  max-height: calc(100dvh - 24px);
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  animation: modalCardPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--surface-panel);
  flex-shrink: 0;
}

.modal-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--text-primary);
}

.modal-body {
  padding: 14px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
  box-sizing: border-box;
}

.modal-description {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.developer-info-box {
  background-color: var(--surface-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 10px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border-color);
  font-size: 12px;
}
.info-row:last-child {
  border-bottom: none;
}

.info-link {
  color: var(--accent-sage);
  text-decoration: none;
  font-weight: 500;
}

.interactive-links-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.link-btn {
  display: block;
  text-align: center;
  background-color: var(--surface-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
}

.modal-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background-color: var(--surface-panel);
  flex-shrink: 0;
}

/* ==========================================================================
   TAB 5: SCIENTIFIC EVIDENCE & CITATIONS
   ========================================================================== */
.evidence-master-card {
  padding: 14px;
}

.evidence-list-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}

.evidence-item-card {
  background-color: var(--surface-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.evidence-item-card.item-highlight-byt {
  border-left: 3px solid var(--accent-sage);
  background-color: var(--accent-sage-soft);
}

.evidence-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.evidence-cat {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.evidence-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--accent-slate);
}

.evidence-tag.tag-vn {
  background-color: var(--accent-sage);
  color: #FFFFFF;
  border-color: var(--accent-sage);
}

.evidence-title {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.3;
}

.evidence-summary {
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 6px;
}

.evidence-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-primary);
  border-top: 1px dashed var(--border-color);
  padding-top: 5px;
}

.evidence-link {
  color: var(--accent-sage);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
  transition: color 0.15s ease;
}
.evidence-link:hover {
  color: #3b5f55;
  text-decoration: underline;
}

/* Modal Wide for Legal Disclaimer */
.modal-card-wide {
  max-width: 620px;
}

.disclaimer-section-box {
  background-color: var(--surface-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
}

.disclaimer-subtitle {
  font-family: var(--font-serif);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.disclaimer-points {
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-primary);
}

.privacy-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  background-color: var(--accent-terracotta-soft);
  border: 1px solid #E8CAC4;
  border-radius: var(--radius-sm);
}

.privacy-action-bar .btn {
  white-space: normal;
  text-align: center;
  height: auto;
  min-height: 32px;
  padding: 6px 10px;
  line-height: 1.3;
}

@media (max-width: 580px) {
  .modal-backdrop {
    padding: 8px;
  }
  .modal-card {
    max-height: calc(100dvh - 16px);
    max-height: calc(100vh - 16px);
  }
  .modal-body {
    padding: 10px 12px;
  }
  .privacy-action-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .privacy-action-bar .btn {
    width: 100%;
  }
}

.privacy-status-text {
  font-size: 11.5px;
  color: var(--text-primary);
}

/* Print */
@media print {
  .app-header .header-actions,
  .timer-controls-row,
  .simulation-quick-bar,
  .timeline-toolbar-card,
  .app-tab-nav,
  .mobile-sticky-dock,
  .modal-backdrop,
  .timeline-card-actions {
    display: none !important;
  }
}
