/* ---- Settings Bar ---- */
.tracker-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 18px;
  align-items: flex-end;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-group > label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.setting-group input[type="text"] {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--color-text);
  background: var(--color-surface);
  min-height: 44px;
}

.setting-group input[type="text"]:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
  outline: none;
}

/* ---- KPI Grid ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.kpi {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: 16px 18px;
  border-left: 3px solid transparent;
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

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

.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.kpi-content {
  min-width: 0;
}

.kpi .value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}

.kpi .label {
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-top: 2px;
}

/* KPI color variants */
.kpi[data-color="teal"]   { border-left-color: #14b8a6; }
.kpi[data-color="blue"]   { border-left-color: #3b82f6; }
.kpi[data-color="amber"]  { border-left-color: #f59e0b; }
.kpi[data-color="purple"] { border-left-color: #a855f7; }

.kpi[data-color="teal"]   .kpi-icon { background: #f0fdfa; color: #14b8a6; }
.kpi[data-color="blue"]   .kpi-icon { background: #eff6ff; color: #3b82f6; }
.kpi[data-color="amber"]  .kpi-icon { background: #fffbeb; color: #f59e0b; }
.kpi[data-color="purple"] .kpi-icon { background: #faf5ff; color: #a855f7; }

.kpi[data-color="teal"]   .value { color: #14b8a6; }
.kpi[data-color="blue"]   .value { color: #3b82f6; }
.kpi[data-color="amber"]  .value { color: #f59e0b; }
.kpi[data-color="purple"] .value { color: #a855f7; }

/* ---- Day Card ---- */
.day-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  margin-bottom: 10px;
  overflow: hidden;
}

.day-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border-light);
  cursor: pointer;
  user-select: none;
}

.day-card.collapsed .day-card-header {
  border-bottom: none;
}

.day-card.collapsed .day-card-body {
  display: none;
}

.collapse-chevron {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.day-card.collapsed .collapse-chevron {
  transform: rotate(-90deg);
}

.day-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-text);
  flex-shrink: 0;
}

.day-summary {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.day-card-body {
  padding: 10px 14px 14px;
}

/* ---- Quick-Log Buttons ---- */
.quick-log-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.quick-log-row .ql-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  width: 100%;
  margin-bottom: -2px;
}

.btn-quick-log {
  padding: 10px 14px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex: 1;
  min-height: 48px;
  min-width: 90px;
  white-space: nowrap;
}

.btn-quick-log--breast {
  color: #0d9488;
  border-color: #99f6e4;
}
.btn-quick-log--breast:hover,
.btn-quick-log--breast:active {
  background: #f0fdfa;
  border-color: #14b8a6;
  border-style: solid;
}

.btn-quick-log--bottle {
  color: #0d9488;
  border-color: #99f6e4;
}
.btn-quick-log--bottle:hover,
.btn-quick-log--bottle:active {
  background: #f0fdfa;
  border-color: #14b8a6;
  border-style: solid;
}

.btn-quick-log--solid {
  color: #0d9488;
  border-color: #99f6e4;
}
.btn-quick-log--solid:hover,
.btn-quick-log--solid:active {
  background: #f0fdfa;
  border-color: #14b8a6;
  border-style: solid;
}

.btn-quick-log--wet {
  color: #d97706;
  border-color: #fde68a;
}
.btn-quick-log--wet:hover,
.btn-quick-log--wet:active {
  background: #fffbeb;
  border-color: #f59e0b;
  border-style: solid;
}

.btn-quick-log--dirty {
  color: #d97706;
  border-color: #fde68a;
}
.btn-quick-log--dirty:hover,
.btn-quick-log--dirty:active {
  background: #fffbeb;
  border-color: #f59e0b;
  border-style: solid;
}

.btn-quick-log--both {
  color: #d97706;
  border-color: #fde68a;
}
.btn-quick-log--both:hover,
.btn-quick-log--both:active {
  background: #fffbeb;
  border-color: #f59e0b;
  border-style: solid;
}

/* ---- Section Label ---- */
.entry-section-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: 12px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--color-border-light);
}

/* ---- Entry Rows ---- */
.entry-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-light);
  position: relative;
}

.entry-row--feeding {
  background: #f0fdfa;
  border-left: 3px solid #14b8a6;
}

.entry-row--diaper {
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
}

.entry-row.entry-flash {
  animation: entry-flash 0.6s ease;
}

@keyframes entry-flash {
  0% { background: #d1fae5; }
  100% { background: inherit; }
}

/* ---- Entry Fields ---- */
.entry-time {
  width: 110px;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono, var(--font-body));
  font-size: 0.88rem;
  color: var(--color-text);
  background: var(--color-surface);
  min-height: 44px;
  outline: none;
}

.entry-time:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* ---- Pill Buttons ---- */
.pill-group {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.pill {
  padding: 8px 12px;
  border: none;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  min-height: 44px;
}

.pill:not(:last-child) {
  border-right: 1px solid var(--color-border);
}

.pill:hover {
  background: var(--color-surface-hover);
}

.pill.active {
  font-weight: 600;
  color: #fff;
}

/* Feeding pills use teal */
.entry-row--feeding .pill.active {
  background: #14b8a6;
}

/* Diaper pills use amber */
.entry-row--diaper .pill.active {
  background: #d97706;
}

/* Side pills — smaller variant */
.pill-group--side .pill {
  padding: 6px 10px;
  font-size: 0.78rem;
  min-height: 36px;
}

/* ---- Optional Detail Fields ---- */
.entry-field {
  width: 80px;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.84rem;
  color: var(--color-text);
  background: var(--color-surface);
  min-height: 44px;
  text-align: center;
  outline: none;
}

.entry-field:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.entry-field::-webkit-inner-spin-button,
.entry-field::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.entry-field {
  -moz-appearance: textfield;
}

.entry-notes {
  flex: 1;
  min-width: 100px;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.84rem;
  color: var(--color-text);
  background: var(--color-surface);
  min-height: 44px;
  outline: none;
}

.entry-notes:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* ---- Muted Remove Button ---- */
.entry-remove {
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  padding: 0;
  flex-shrink: 0;
  opacity: 0.4;
  transition: all var(--transition-fast);
}

.entry-remove:hover {
  opacity: 1;
  background: var(--color-surface-hover);
}

/* ---- Empty State ---- */
.entry-empty {
  text-align: center;
  padding: 10px;
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-style: italic;
}

/* ---- Action Bar ---- */
.plan-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  margin-bottom: 16px;
}

.saved-status {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  align-self: center;
}

/* ---- Toast ---- */
.toast-msg {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--color-text);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 1000;
  pointer-events: none;
}

.toast-msg.show {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Muted Note ---- */
.muted-note {
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .tracker-settings {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .kpi {
    padding: 12px 14px;
    gap: 12px;
  }

  .kpi-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .kpi .value {
    font-size: 1.1rem;
  }

  .entry-row {
    flex-direction: column;
    align-items: stretch;
  }

  .entry-time {
    width: 100%;
  }

  .pill-group {
    width: 100%;
  }

  .pill {
    flex: 1;
    text-align: center;
  }

  .entry-notes {
    width: 100%;
  }

  .entry-remove {
    align-self: flex-end;
  }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  .plan-row,
  .tracker-settings,
  .quick-log-row,
  .entry-remove,
  .toast-msg,
  .ad-zone {
    display: none !important;
  }

  .day-card.collapsed .day-card-body {
    display: block !important;
  }
}
