* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #e8f0ec;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  color: #1e1e1e;
}

#app {
  width: 100%;
  /*max-width: 400px;*/
  min-height: 100vh;
  background: #fff;
  position: relative;
  box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

/* ====== SCREENS ====== */
.screen {
  display: none;
  min-height: 100vh;
  padding-bottom: 90px;
}
.screen.active {
  display: block;
}

/* ====== HEADERS ====== */
.app-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid #e9ecef;
}
.app-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: #2e7d32;
}
.app-header h1 i {
  margin-right: 8px;
}

.header-with-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-with-menu h1 {
  font-size: 20px;
}

.form-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 16px;
  border-bottom: 1px solid #e9ecef;
}
.form-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: #1e1e1e;
  flex: 1;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 20px;
  color: #2e7d32;
  cursor: pointer;
  padding: 4px;
}

.btn-menu {
  font-size: 22px;
  flex-shrink: 0;
}

/* ====== EMPTY STATE ====== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: #adb5bd;
}
.empty-state i {
  font-size: 64px;
  margin-bottom: 16px;
  color: #c8e6c9;
}
.empty-state p {
  font-size: 18px;
  font-weight: 500;
  color: #868e96;
  margin-bottom: 4px;
}
.empty-state span {
  font-size: 14px;
  color: #adb5bd;
}

/* ====== SUPPLEMENT LIST ====== */
.supplement-list {
  padding: 12px 16px;
}

.supplement-card {
  background: #f8faf9;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid #e9ecef;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.1s;
}
.supplement-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.supplement-card:active {
  transform: scale(0.99);
}

.card-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-name {
  font-size: 16px;
  font-weight: 600;
  color: #1e1e1e;
}

.card-quantity {
  font-size: 14px;
  color: #868e96;
}
.card-quantity::before {
  content: 'Cantidad: ';
  font-size: 12px;
  color: #adb5bd;
}

.btn-delete {
  background: none;
  border: none;
  color: #e57373;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.btn-delete:hover {
  opacity: 1;
}

.card-times {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-presets {
  display: flex;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge-morning {
  background: #fff3e0;
  color: #e65100;
}
.badge-afternoon {
  background: #e3f2fd;
  color: #1565c0;
}
.badge-evening {
  background: #f3e5f5;
  color: #7b1fa2;
}
.badge.qty-0 {
  background: #f1f3f4;
  color: #ced4da;
}

.card-schedule {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.card-schedule .time-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #e8f5e9;
  color: #2e7d32;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.card-schedule .time-chip i {
  font-size: 10px;
}

/* ====== FAB ====== */
.fab {
  position: fixed;
  bottom: 24px;
  right: calc(50% - 180px);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #4caf50;
  color: #fff;
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(76,175,80,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 10;
}
.fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(76,175,80,0.45);
}
@media (min-width: 401px) {
  .fab {
    right: calc(50% - 180px);
  }
}

/* ====== FORM ====== */
.supplement-form {
  padding: 24px 20px;
}

.field-group {
  margin-bottom: 28px;
}

.field-group label {
  display: block;
  font-size: 16px;
  font-weight: 500;
  color: #1e1e1e;
  margin-bottom: 8px;
}

.input-line {
  border-bottom: 2px solid #e9ecef;
  transition: border-color 0.2s;
}
.input-line:focus-within {
  border-bottom-color: #4caf50;
}

.input-line input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  padding: 8px 0;
  color: #1e1e1e;
}
.input-line input::placeholder {
  color: #ced4da;
}
.input-line input[type="number"] {
  text-align: right;
  font-size: 18px;
  font-weight: 500;
}

/* ====== TIME SLOTS (M / T / N) ====== */
.time-slots-row {
  display: flex;
  gap: 12px;
}

.time-slot {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  padding: 8px 0;
  border-bottom: 2px solid #e9ecef;
}

.slot-label {
  font-size: 20px;
  font-weight: 600;
  color: #2e7d32;
  min-width: 22px;
}

.slot-qty {
  border: none;
  outline: none;
  background: transparent;
  font-size: 18px;
  font-weight: 500;
  color: #1e1e1e;
  width: 100%;
  text-align: right;
}
.slot-qty::placeholder {
  color: #ced4da;
}

/* ====== SCHEDULE ====== */
.schedule-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-add-time {
  background: none;
  border: none;
  color: #4caf50;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  transition: transform 0.2s;
}
.btn-add-time:hover {
  transform: scale(1.15);
}

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.schedule-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 2px solid #e9ecef;
}

.schedule-item .schedule-time {
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  font-weight: 500;
  color: #1e1e1e;
  font-family: inherit;
  flex-shrink: 0;
}

.schedule-item .schedule-qty {
  border: none;
  outline: none;
  background: #f0f4f3;
  width: 36px;
  font-size: 16px;
  font-weight: 500;
  text-align: center;
  color: #1e1e1e;
  border-radius: 6px;
  padding: 4px;
  flex-shrink: 0;
}

.schedule-line {
  flex: 1;
  height: 2px;
  background: #e9ecef;
}

.btn-remove-time {
  background: none;
  border: none;
  color: #e57373;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.btn-remove-time:hover {
  opacity: 1;
}

/* ====== TOTAL DISPLAY ====== */
.total-display {
  text-align: center;
  font-size: 14px;
  color: #868e96;
  padding: 8px 0;
  margin-top: 4px;
}
.total-display span {
  font-weight: 700;
  color: #2e7d32;
  font-size: 18px;
}

/* ====== SAVE BUTTON ====== */
.btn-save {
  width: 100%;
  padding: 14px;
  background: #4caf50;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(76,175,80,0.25);
  margin-top: 12px;
}
.btn-save:hover {
  background: #43a047;
}
.btn-save:active {
  transform: scale(0.98);
}

/* ====== PROGRESS BAR ====== */
.progress-container {
  padding: 16px 20px 8px;
}

.progress-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #1e1e1e;
  margin-bottom: 8px;
}
.progress-header i {
  color: #4caf50;
  font-size: 16px;
}
.progress-header span {
  font-weight: 600;
}

.progress-bar {
  height: 10px;
  background: #e9ecef;
  border-radius: 5px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #66bb6a, #43a047);
  border-radius: 5px;
  transition: width 0.4s ease;
}

/* ====== DAY BUTTONS ====== */
.days-row {
  display: flex;
  gap: 6px;
}

.day-btn {
  flex: 1;
  height: 40px;
  border-radius: 20px;
  border: 2px solid #e9ecef;
  background: #fff;
  font-size: 15px;
  font-weight: 600;
  color: #adb5bd;
  cursor: pointer;
  transition: all 0.2s;
}
.day-btn.active {
  background: #e8f5e9;
  border-color: #4caf50;
  color: #2e7d32;
}

.card-days {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e9ecef;
}

.day-indicator {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  background: #f1f3f4;
  color: #ced4da;
}
.day-indicator.active {
  background: #e8f5e9;
  color: #2e7d32;
}

/* ====== NAV DRAWER ====== */
.drawer-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.35);
  z-index: 100;
}
.drawer-overlay.open {
  display: block;
}

.drawer {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100%;
  background: #fff;
  z-index: 110;
  transition: left 0.3s ease;
  box-shadow: 4px 0 12px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
}
.drawer-overlay.open .drawer {
  left: 0;
}

.drawer-header {
  padding: 32px 20px 20px;
  font-size: 20px;
  font-weight: 700;
  color: #2e7d32;
  border-bottom: 1px solid #e9ecef;
}
.drawer-header i {
  margin-right: 8px;
}

.drawer-menu {
  padding: 12px 0;
  display: flex;
  flex-direction: column;
}

.drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: none;
  border: none;
  font-size: 16px;
  font-weight: 500;
  color: #1e1e1e;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s;
}
.drawer-item i {
  width: 20px;
  color: #868e96;
  font-size: 18px;
}
.drawer-item:hover {
  background: #f0f4f3;
}
.drawer-item.active {
  color: #2e7d32;
  font-weight: 600;
}
.drawer-item.active i {
  color: #4caf50;
}

/* ====== TRACK SCREEN ====== */
.track-title {
  font-size: 18px !important;
  flex: 1;
}

.btn-calendar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #4caf50;
  padding: 2px 0;
  width: fit-content;
}
.btn-calendar i {
  font-size: 16px;
}
.btn-calendar span {
  font-weight: 500;
}

.date-picker-hidden {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.track-card {
  background: #f8faf9;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid #e9ecef;
  transition: background 0.3s, border-color 0.3s;
}
.track-card.completed {
  background: #e8f5e9;
  border-color: #a5d6a7;
}
.track-card.exceeded {
  background: #fff3e0;
  border-color: #ffcc80;
}

.track-card .card-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.track-card .card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.track-card .card-name {
  font-size: 16px;
  font-weight: 600;
  color: #1e1e1e;
}

.track-card .card-quantity {
  font-size: 14px;
  color: #868e96;
}
.track-card .card-quantity::before {
  content: 'Cantidad: ';
  font-size: 12px;
  color: #adb5bd;
}

.track-card .card-times {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.track-card .card-presets {
  display: flex;
  gap: 8px;
}

.track-card .card-schedule {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.track-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid #e9ecef;
}

.track-btn-plus {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #4caf50;
  color: #fff;
  border: none;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
  box-shadow: 0 2px 6px rgba(76,175,80,0.3);
}
.track-btn-plus:hover {
  background: #43a047;
}
.track-btn-plus:active {
  transform: scale(0.93);
}

.track-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border-radius: 22px;
  background: #e8f5e9;
  color: #2e7d32;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  user-select: none;
}
.track-count:hover {
  background: #c8e6c9;
}
.track-count:active {
  transform: scale(0.93);
}

/* ====== RESPONSIVE ====== */
@media (max-width: 400px) {
  #app {
    max-width: 100%;
  }
}
