/* ── IMPULSE — dark industrial health tracker ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d0d0f;
  --bg2:       #141418;
  --bg3:       #1c1c22;
  --bg4:       #242430;
  --line:      #2a2a36;
  --line2:     #38384a;
  --text:      #e8e8f0;
  --text2:     #9090a8;
  --text3:     #5a5a70;
  --accent:    #7c6af7;
  --accent2:   #a394ff;
  --green:     #3ddc84;
  --red:       #ff5f6d;
  --amber:     #f5a623;
  --cyan:      #38d9f5;
  --font-mono: 'Space Mono', monospace;
  --font-sans: 'DM Sans', sans-serif;
  --r:         8px;
  --r2:        12px;
}

html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-sans); }
body { display: flex; justify-content: center; overflow: hidden; }

/* ── LAYOUT ── */
#app {
  display: flex; flex-direction: column;
  width: 100%; max-width: 680px; height: 100dvh;
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}

/* ── BANNER HEADER ── */
#banner-header {
  background: var(--bg);
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  line-height: 0;
  flex-shrink: 0;
}
#banner-img {
  width: 100%; height: auto; display: block;
}

/* ── BOTTOM NAV ── */
#bottom-nav {
  flex-shrink: 0;
  display: flex; align-items: stretch;
  background: var(--bg2);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bnav-tab {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; padding: 8px 4px;
  background: none; border: none; cursor: pointer;
  transition: background 0.15s;
  position: relative;
}
.bnav-tab:hover { background: var(--bg3); }
.bnav-tab.active::before {
  content: ''; position: absolute; top: 0; left: 20%; right: 20%;
  height: 2px; background: var(--accent); border-radius: 0 0 2px 2px;
}
.bnav-icon { font-size: 18px; line-height: 1; }
.bnav-label {
  font-family: var(--font-mono); font-size: 8px; font-weight: 700;
  letter-spacing: 0.1em; color: var(--text3);
  transition: color 0.15s;
}
.bnav-tab.active .bnav-label { color: var(--accent2); }

#main { flex: 1; overflow: hidden; position: relative; min-height: 0; }
.view { position: absolute; inset: 0; overflow-y: auto; display: none; padding: 16px; padding-bottom: 24px; -webkit-overflow-scrolling: touch; }
.view.active { display: block; }
.view::-webkit-scrollbar { width: 4px; }
.view::-webkit-scrollbar-track { background: transparent; }
.view::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 2px; }

/* ── CARDS ── */
.card {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--r2); padding: 16px; margin-bottom: 12px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-title {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.14em; color: var(--text3); text-transform: uppercase;
}
.card-icon { font-size: 16px; }

/* ── DATE STRIP ── */
#date-strip {
  display: flex; align-items: center;
  margin-bottom: 16px; gap: 4px;
}
#date-label {
  font-family: var(--font-mono); font-size: 11px; color: var(--text2);
  letter-spacing: 0.08em; flex: 1; text-align: center;
}
#date-today-btn {
  font-family: var(--font-mono); font-size: 9px; color: var(--accent);
  background: rgba(124,106,247,0.1); border: 1px solid rgba(124,106,247,0.25);
  border-radius: 4px; padding: 3px 8px; cursor: pointer;
  transition: background 0.15s; white-space: nowrap;
}
#date-today-btn:hover { background: rgba(124,106,247,0.2); }

/* ── CHECKBOX ROW ── */
.check-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.check-row:last-child { border-bottom: none; }
.check-label { font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.check-label .emo { font-size: 16px; }
.check-toggles { display: flex; gap: 8px; }

.pill-toggle {
  padding: 5px 14px; border-radius: 20px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  border: 1px solid var(--line2); background: var(--bg3);
  color: var(--text3); cursor: pointer; transition: all 0.15s;
  letter-spacing: 0.06em;
}
.pill-toggle.on { background: rgba(61,220,132,0.15); border-color: var(--green); color: var(--green); }

/* ── NUMBER INPUT ── */
.num-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.num-row:last-child { border-bottom: none; }
.num-label { font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.num-label .emo { font-size: 16px; }

.num-ctrl { display: flex; align-items: center; gap: 8px; }
.num-btn {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--line2); background: var(--bg3);
  color: var(--text2); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; line-height: 1;
}
.num-btn:hover { border-color: var(--accent); color: var(--accent); }
.num-val {
  font-family: var(--font-mono); font-size: 14px; color: var(--text);
  min-width: 28px; text-align: center;
}
input[type="number"].num-input {
  background: var(--bg3); border: 1px solid var(--line2);
  color: var(--text); font-family: var(--font-mono); font-size: 13px;
  padding: 4px 8px; border-radius: 6px; width: 70px; text-align: center;
  outline: none;
}
input[type="number"].num-input:focus { border-color: var(--accent); }

/* ── ENERGY DRINK ENTRIES ── */
.energy-entries { display: flex; flex-direction: column; gap: 8px; }
.energy-entry {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg3); border: 1px solid var(--line);
  border-radius: var(--r); padding: 8px 10px;
}
.energy-entry-product { flex: 1; font-size: 13px; color: var(--text2); }
.energy-entry-note {
  flex: 2; background: var(--bg4); border: 1px solid var(--line);
  color: var(--text); font-family: var(--font-sans); font-size: 12px;
  padding: 4px 8px; border-radius: 6px; outline: none;
}
.energy-entry-note:focus { border-color: var(--accent); }
.energy-entry-del {
  background: none; border: none; color: var(--text3); cursor: pointer;
  font-size: 14px; padding: 2px 4px; border-radius: 4px;
  transition: color 0.15s;
}
.energy-entry-del:hover { color: var(--red); }
.energy-add-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg3); border: 1px dashed var(--line2);
  color: var(--text3); font-size: 12px; cursor: pointer;
  padding: 8px 12px; border-radius: var(--r);
  width: 100%; transition: all 0.15s; margin-top: 8px;
}
.energy-add-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── FAST FOOD ENTRIES ── */
.ff-entries { display: flex; flex-direction: column; gap: 8px; }
.ff-entry {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg3); border: 1px solid var(--line);
  border-radius: var(--r); padding: 8px 10px;
}
.ff-entry-place { flex: 1; font-size: 13px; color: var(--text2); }
.ff-entry-del {
  background: none; border: none; color: var(--text3); cursor: pointer;
  font-size: 14px; padding: 2px 4px; border-radius: 4px;
  transition: color 0.15s;
}
.ff-entry-del:hover { color: var(--red); }

/* ── MOOD GRID ── */
#mood-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.mood-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 10px 6px;
  background: var(--bg3); border: 1px solid var(--line);
  border-radius: var(--r); cursor: pointer;
  transition: all 0.15s; position: relative;
}
.mood-card:hover { border-color: var(--line2); background: var(--bg4); }
.mood-card.selected {
  border-color: var(--accent);
  background: rgba(124,106,247,0.15);
}
.mood-card .m-emo { font-size: 20px; }
.mood-card .m-name {
  font-size: 9px; font-family: var(--font-mono);
  color: var(--text3); text-align: center; letter-spacing: 0.04em;
  line-height: 1.2;
}
.mood-card.selected .m-name { color: var(--accent2); }

/* ── NOTES ── */
#notes-input {
  width: 100%; background: var(--bg3); border: 1px solid var(--line);
  color: var(--text); font-family: var(--font-sans); font-size: 13px;
  padding: 10px 12px; border-radius: var(--r); outline: none;
  resize: none; min-height: 80px; line-height: 1.6;
}
#notes-input:focus { border-color: var(--accent); }
#notes-input::placeholder { color: var(--text3); }

/* ── SECTION HEADER ── */
.section-label {
  font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.16em; color: var(--text3); text-transform: uppercase;
  margin-bottom: 10px; display: flex; align-items: center; gap: 6px;
}
.section-label::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}

/* ── TRENDS ── */
.trend-card { margin-bottom: 16px; }
.streak-grid {
  display: flex; gap: 3px; flex-wrap: wrap;
}
.streak-cell {
  width: 14px; height: 14px; border-radius: 3px;
  background: var(--bg4);
  transition: background 0.1s;
}
.streak-cell.on { background: var(--green); }
.streak-cell.partial { background: var(--amber); }

.chart-wrap { position: relative; height: 160px; }

/* ── MOOD SCATTER ── */
#mood-scatter-wrap {
  position: relative; width: 100%; aspect-ratio: 1;
  max-width: 340px; margin: 0 auto;
}
#mood-scatter-wrap canvas { border-radius: var(--r); }
.axis-label {
  position: absolute; font-family: var(--font-mono); font-size: 9px;
  color: var(--text3); letter-spacing: 0.1em; pointer-events: none;
}

/* ── SETTINGS ── */
.settings-section { margin-bottom: 24px; }
.settings-section-title {
  font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.16em; color: var(--text3); text-transform: uppercase;
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.settings-list { display: flex; flex-direction: column; gap: 6px; }
.settings-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg3); border: 1px solid var(--line);
  border-radius: var(--r); padding: 10px 12px;
}
.settings-item-name { flex: 1; font-size: 13px; color: var(--text); }
.settings-item-del {
  background: none; border: none; color: var(--text3);
  cursor: pointer; font-size: 13px; padding: 2px 6px;
  border-radius: 4px; transition: color 0.15s;
}
.settings-item-del:hover { color: var(--red); }
.settings-add-row {
  display: flex; gap: 8px; margin-top: 8px;
}
.settings-input {
  flex: 1; background: var(--bg3); border: 1px solid var(--line);
  color: var(--text); font-family: var(--font-sans); font-size: 13px;
  padding: 8px 12px; border-radius: var(--r); outline: none;
}
.settings-input:focus { border-color: var(--accent); }
.settings-input::placeholder { color: var(--text3); }
.settings-input-sm { width: 60px; flex: 0 0 60px; text-align: center; }
.btn-add {
  background: rgba(124,106,247,0.15); border: 1px solid rgba(124,106,247,0.4);
  color: var(--accent2); font-family: var(--font-mono); font-size: 10px;
  font-weight: 700; letter-spacing: 0.1em; padding: 0 14px;
  border-radius: var(--r); cursor: pointer; transition: all 0.15s;
  white-space: nowrap;
}
.btn-add:hover { background: rgba(124,106,247,0.25); }

/* ── SHORTCUT INFO ── */
.shortcut-info {
  background: var(--bg3); border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: var(--r); padding: 12px 14px;
}
.shortcut-info p { font-size: 12px; color: var(--text2); line-height: 1.6; margin-bottom: 6px; }
.shortcut-info code {
  font-family: var(--font-mono); font-size: 11px;
  background: var(--bg4); padding: 2px 6px; border-radius: 4px;
  color: var(--cyan); word-break: break-all;
}
.shortcut-info p:last-child { margin-bottom: 0; }

/* ── TOAST ── */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg4); border: 1px solid var(--line2);
  color: var(--text); font-family: var(--font-mono); font-size: 11px;
  padding: 8px 16px; border-radius: 20px;
  opacity: 0; transition: opacity 0.2s; pointer-events: none;
  letter-spacing: 0.06em; white-space: nowrap; z-index: 999;
}
#toast.show { opacity: 1; }

/* ── MOOD QUADRANT HEATMAP ── */
.quadrant-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 4px; aspect-ratio: 1; max-width: 300px; margin: 0 auto;
}
.quadrant-cell {
  border-radius: var(--r); padding: 10px; display: flex;
  flex-direction: column; justify-content: flex-end;
  min-height: 80px; position: relative; overflow: hidden;
}
.quadrant-cell-label {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.08em;
  color: rgba(255,255,255,0.5); text-transform: uppercase;
}
.quadrant-cell-count {
  font-family: var(--font-mono); font-size: 22px; font-weight: 700;
  line-height: 1; color: rgba(255,255,255,0.85);
}

/* ── SELECT ── */
select.settings-input {
  appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235a5a70'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 28px; cursor: pointer;
}

/* ── DROPDOWN ── */
.dropdown-wrap { position: relative; flex: 1; }
.dropdown-list {
  position: absolute; bottom: 100%; left: 0; right: 0;
  background: var(--bg3); border: 1px solid var(--line2);
  border-radius: var(--r); margin-bottom: 4px;
  max-height: 200px; overflow-y: auto; z-index: 50;
  display: none;
}
.dropdown-list.open { display: block; }
.dropdown-opt {
  padding: 9px 12px; font-size: 13px; cursor: pointer;
  border-bottom: 1px solid var(--line); transition: background 0.1s;
  display: flex; align-items: center; gap: 8px;
}
.dropdown-opt:last-child { border-bottom: none; }
.dropdown-opt:hover { background: var(--bg4); }
.dropdown-trigger {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; background: var(--bg3); border: 1px solid var(--line);
  color: var(--text2); font-size: 13px; padding: 8px 12px;
  border-radius: var(--r); cursor: pointer; transition: border-color 0.15s;
}
.dropdown-trigger:hover { border-color: var(--accent); }
.dropdown-trigger .arrow { color: var(--text3); font-size: 10px; }

/* ── RESPONSIVE ── */
@media (max-width: 400px) {
  .view { padding: 12px; }
  #mood-grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
}

input[type="time"].num-input {
  background: var(--bg3); border: 1px solid var(--line2);
  color: var(--text); font-family: var(--font-mono); font-size: 13px;
  padding: 4px 8px; border-radius: 6px; outline: none;
  color-scheme: dark;
}
input[type="time"].num-input:focus { border-color: var(--accent); }

/* ── SCHOOL / ASSIGNMENTS ── */
.assignment-row {
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.assignment-row:last-child { border-bottom: none; }
.assignment-meta {
  display: flex; align-items: center; gap: 10px; margin-bottom: 4px;
}
.assignment-cal {
  font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.1em; color: var(--accent2);
  background: rgba(124,106,247,0.12); border-radius: 4px; padding: 2px 6px;
}
.assignment-due {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.08em;
}
.assignment-title {
  font-size: 13px; color: var(--text); margin-bottom: 6px; line-height: 1.4;
}
.submit-btn {
  font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.1em; color: var(--green);
  background: rgba(61,220,132,0.1); border: 1px solid rgba(61,220,132,0.3);
  border-radius: 4px; padding: 4px 10px; cursor: pointer;
  transition: all 0.15s;
}
.submit-btn:hover { background: rgba(61,220,132,0.2); }
.unsubmit-btn {
  background: none; border: none; color: var(--text3); cursor: pointer;
  font-size: 12px; padding: 2px 6px; border-radius: 4px;
  transition: color 0.15s;
}
.unsubmit-btn:hover { color: var(--red); }

/* ── FF STREAKS ── */
.ff-streak-list { display: flex; flex-direction: column; gap: 6px; }
.ff-streak-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.ff-streak-row:last-child { border-bottom: none; }
.ff-streak-name { flex: 1; font-size: 13px; color: var(--text2); }
.ff-streak-days {
  font-family: var(--font-mono); font-size: 13px; font-weight: 700;
  min-width: 60px; text-align: right;
}

/* ── ENERGY SIZE SELECT ── */
.energy-size-select {
  background: var(--bg4); border: 1px solid var(--line2);
  color: var(--text2); font-family: var(--font-mono); font-size: 10px;
  padding: 4px 6px; border-radius: 6px; outline: none; cursor: pointer;
  max-width: 90px;
}
.energy-size-select:focus { border-color: var(--accent); }

/* ── SEGMENTED CONTROL ── */
.seg-ctrl {
  display: flex; gap: 3px;
  background: var(--bg3); border: 1px solid var(--line);
  border-radius: var(--r); padding: 3px;
}
.seg-btn {
  flex: 1; background: none; border: none; cursor: pointer;
  font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.1em; color: var(--text3);
  padding: 6px 8px; border-radius: 6px;
  transition: all 0.15s; white-space: nowrap;
}
.seg-btn:hover { color: var(--text2); background: var(--bg4); }
.seg-btn.active { background: var(--accent); color: #fff; }

/* ── PREVENT MOBILE ZOOM ON INPUT FOCUS ── */
@media (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

/* ── TOP NAV (desktop only) ── */
#top-nav {
  flex-shrink: 0;
  display: none;
  align-items: stretch;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
}

@media (min-width: 768px) {
  #top-nav { display: flex; }
  #bottom-nav { display: none; }
}

@media (max-width: 767px) {
  #top-nav { display: none; }
  #bottom-nav { display: flex; }
}

/* ── DATA START INDICATOR ── */
.streak-cell.data-start {
  outline: 2px solid #f5a623;
  outline-offset: 1px;
}

/* ── SELF CARE TAB SCROLL ── */
#today-tab-ctrl {
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: none;
}
#today-tab-ctrl::-webkit-scrollbar { display: none; }

/* ── TRENDS MOBILE SCROLL FIX ── */
#view-trends {
  touch-action: pan-y;
  overflow-y: auto;
}
