:root {
  --bg: #0f1216;
  --bg-elev: #151922;
  --text: #e6e8eb;
  --muted: #a8b0bb;
  --primary: #4f7cff;
  --primary-ink: #0b1020;
  --border: #262b36;
  --success: #3ecf8e;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { margin: 0; font-size: 20px; letter-spacing: .3px; }
.logo { width: 28px; height: 28px; }
.actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}
.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  position: relative; /* Ensure content is above background logo */
  z-index: 1;
}
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
.card-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.card-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.profile-header {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.profile-header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.profile-summary {
  font-size: 13px;
  color: var(--muted);
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-toggle {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 4px 6px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-toggle-icon {
  font-size: 12px;
}

/* Background Logo */
.bg-logo {
  position: fixed;
  top: 80px;
  left: 20px;
  width: 300px;
  height: auto;
  opacity: 0.15; /* Subtle visibility */
  z-index: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(79, 124, 255, 0.2)); /* Optional glow effect */
}

/* Hide on smaller screens to prevent overlap */
@media (max-width: 1200px) {
  .bg-logo {
    display: none;
  }
}
.card-body.collapsed {
  display: none;
}
.card-body { padding: 16px 18px; }
.date-nav {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
}
.date-nav input[type="date"] {
  max-width: 200px;
  width: 100%;
  justify-self: center;
}
.day-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.timeline .block {
  width: 100%;
}
.block h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
}
.phase-time {
  font-weight: 700;
}
.meal-separator {
  text-align: center;
  margin: 20px 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: #4ade80;
}
.meal-highlight {
  color: #4ade80;
  font-weight: 700;
  text-transform: uppercase;
}
.meal-label {
  color: #000000;
  background-color: #facc15;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 800;
  margin: 0 2px;
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.3);
  text-shadow: none;
  font-size: 1.05em;
}
.neb-highlight {
  font-size: 1.1em;
  color: #60a5fa;
  font-weight: 700;
}
.neb-icon {
  font-size: 1.2em;
  margin-right: 6px;
}

/* Phase Headers System */
.phase-header {
  font-size: 1.1rem !important;
  padding: 8px 10px;
  margin-bottom: 12px !important;
  border-radius: 0 8px 8px 0;
  border-left-width: 3px;
  border-left-style: solid;
}

/* Phase Variants */
.phase-start { /* 1A, 1B - Cyan */
  border-left-color: #06b6d4;
  background: rgba(6, 182, 212, 0.1);
  color: #22d3ee;
}
.phase-drill { /* 1C, 1D - Orange */
  border-left-color: #f97316;
  background: rgba(249, 115, 22, 0.1);
  color: #fb923c;
}
.phase-maint { /* 3A, 3C - Emerald */
  border-left-color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
}
.phase-meal { /* Obiad, Kolacja - Yellow */
  border-left-color: #eab308;
  background: rgba(234, 179, 8, 0.1);
  color: #facc15;
}
.phase-neb { /* 6, 7A, 8 - Indigo */
  border-left-color: #6366f1;
  background: rgba(99, 102, 241, 0.1);
  color: #818cf8;
}
.phase-detox { /* 5 - Purple */
  border-left-color: #a855f7;
  background: rgba(168, 85, 247, 0.1);
  color: #c084fc;
}

.btn-emerald {
  background: #059669;
  color: #ffffff;
  border: none;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
}
.btn-indigo {
  background: #6366f1;
  color: #ffffff;
  border: none;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
}
.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}
.checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}
.field {
  display: grid;
  gap: 8px;
}
input[type="date"],
input[type="number"],
input[type="range"],
input[type="text"],
input[type="time"],
select,
textarea {
  width: 100%;
  background: #0c0f13;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}
input[type="range"] { padding: 0; }
.range-value {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}
.primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
}
.status {
  font-size: 13px;
  color: var(--muted);
}
/* Modal System */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  z-index: 1000;
  backdrop-filter: blur(4px);
  padding: 20px;
  overflow-y: auto;
}
.modal.open {
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-content {
  background: var(--bg-elev);
  width: 100%;
  max-width: 600px;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--bg-elev);
  z-index: 10;
}
.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
}
.modal-body {
  padding: 20px;
  overflow-y: auto;
  line-height: 1.6;
}
.modal-actions {
  display: flex;
  gap: 8px;
}
.modal-body h3 {
  color: var(--text);
  margin-top: 24px;
  margin-bottom: 12px;
  font-size: 1.1rem;
}
.modal-body h4 {
  color: var(--primary);
  margin-top: 16px;
  margin-bottom: 8px;
  font-size: 1rem;
}
.modal-body ul {
  padding-left: 20px;
  color: var(--muted);
}
.modal-body li {
  margin-bottom: 8px;
}
.modal-body p {
  color: var(--muted);
  margin-bottom: 16px;
}

/* Info Badge */
.info-badge {
  background: rgba(79, 70, 229, 0.1);
  border: 1px solid rgba(79, 70, 229, 0.2);
  color: #818cf8;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 12px;
  line-height: 1.5;
}
.info-badge.warning {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
  color: #f87171;
}
.info-badge.warning-badge {
  background: rgba(249, 115, 22, 0.14);
  border-color: rgba(249, 115, 22, 0.28);
  color: #fdba74;
}
.sub-info {
  font-size: 0.8rem;
  color: var(--muted);
  margin-left: 28px;
  margin-top: -4px;
}

/* Rescue List Styles */
.rescue-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.rescue-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  background: rgba(0,0,0,0.2);
  padding: 8px;
  border-radius: 8px;
}
.mucus-row {
  display: grid;
  grid-template-columns: auto 80px 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  background: rgba(0,0,0,0.2);
  padding: 8px;
  border-radius: 8px;
  margin-bottom: 8px;
}
.icon-btn.danger {
  color: #ef4444;
  border-color: #ef4444;
}
.icon-btn.danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Progress Bar */
.progress-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Water Tracker */
.cooling-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.cooling-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
