body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    margin: 0;
    background: #0b0b0b;
    color: #fff;
}

.wrap{
    width: 100%;
    max-width: 1400px;   /* bigger than before */
    margin: 0 auto;
    padding: 18px;
    box-sizing: border-box;
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  margin-bottom:14px;
  flex-wrap:wrap;
}

.topbar-left h1{
  margin:0;
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.topbar-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.authBtn{
  width:auto;
  min-width:110px;
  padding:10px 16px;
}

.authStatus{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:2px;
  min-width:220px;
}

.authLabel{
  font-size:12px;
  opacity:.7;
}

.authName{
  font-size:14px;
  font-weight:700;
}

.profilePrompt{
  margin-bottom:14px;
}

.profilePromptTitle{
  font-weight:800;
  margin-bottom:6px;
}

.hidden{
  display:none !important;
}

h1 {
    font-size: 22px;
    margin: 10px 0 14px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.grid{
  display:flex;
  gap:16px;
  align-items:flex-start;
}

/* LEFT column width */
.leftCol{
  flex: 0 0 clamp(340px, 34vw, 480px);
}

/* RIGHT column takes the rest */
.rightCol{
  flex: 1 1 0;
  min-width: 0;               /* IMPORTANT: prevents chart/card overflow */
  display:flex;
  flex-direction:column;
  gap:16px;
}

label {
    display: block;
    font-size: 13px;
    opacity: .85;
    margin-top: 14px;
}

input,
textarea,
button {
    width: 100%;
    box-sizing: border-box;
    border-radius: 12px;
    border: 1px solid #2a2a2a;
    background: #121212;
    color: #fff;
    padding: 12px;
    font-size: 16px;
}

textarea {
    min-height: 84px;
    resize: vertical;
}

.row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.row>* {
    flex: 1;
}

.stack { display:flex; flex-direction:column; gap:8px; }

.badge {
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:2px 8px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.15);
  font-size:12px;
}

.badge.ok { opacity:0.95; }
.badge.plan { opacity:0.75; }

button {
    background: #ffffff;
    color: #000;
    border: none;
    font-weight: 700;
}

button.secondary {
    background: #1c1c1c;
    color: #fff;
    border: 1px solid #2a2a2a;
    font-weight: 600;
}

button:disabled {
    opacity: .6;
}

.pill {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    background: #1c1c1c;
    border: 1px solid #2a2a2a;
}

.small {
    font-size: 12px;
    opacity: .85;
}

.card {
    background: #0f0f0f;
    border: 1px solid #1e1e1e;
    border-radius: 16px;
    padding: 14px;
}

.chartRangeBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.chartMeta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  white-space: nowrap;
}

.avgToggleBtn {
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid #2a2a2a;
  background: #151515;
  color: #e5e7eb;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.avgToggleBtn:hover {
  background: #1d1d1d;
}

.avgToggleBtn.active {
  background: #f3f4f6;
  color: #111827;
  border-color: #f3f4f6;
}

.chartRangeHint {
  font-size: 13px;
  color: #9ca3af;
  white-space: nowrap;
  line-height: 1;
}

.rangePills{
  display:flex;
  gap:8px;
  padding:6px;
  border:1px solid #1e1e1e;
  border-radius:999px;
  background:#0f0f0f;
}

.rangeBtn{
  width:auto;
  padding:8px 12px;
  border-radius:999px;
  border:1px solid transparent;
  background:transparent;
  color:#fff;
  font-weight:700;
  font-size:13px;
}

.rangeBtn:hover{
  border-color:#2a2a2a;
  background:#121212;
}

.rangeBtn.active{
  background:#ffffff;
  color:#000;
}

.charts {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 16px 0;
}

.chart-card {
    flex: 1 1 420px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 12px;
    background: rgba(255,255,255,0.03);
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.chart-wrap {
    flex: 1;
    min-height: 180px;
    position: relative;
}

.chart-card h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.weekHeader{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}

.weekStrip{
  display:flex;
  gap:10px;
  flex-wrap:nowrap;     /* keep in one row */
  overflow:hidden;      /* no scroll bar */
}

.dayBox{
  flex: 1 1 0;          /* each day shares space equally */
  min-width: 0;         /* allows shrinking to fit */

  border: 1px solid #222;
  border-radius: 14px;
  padding: 10px;
  background: #121212;
  cursor: pointer;
  user-select: none;
  transition: border-color .12s ease, background-color .12s ease;
}
.dayBox .date{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; /* prevents long date from stretching boxes */
  font-size:12px; 
  opacity:.75; 
  margin-top:2px;
}

.dayBox:hover{ border-color:#333; }

.dayBox .dow{ font-weight:800; }
.dayBox .tag{ font-size:12px; opacity:.9; margin-top:8px; }

.dayBox.planned{
  background: rgba(255, 215, 0, 0.16);
  border-color: rgba(255, 215, 0, 0.45);
}

.dayBox.done{
  background: rgba(0, 255, 140, 0.14);
  border-color: rgba(0, 255, 140, 0.45);
}


@media (max-width: 880px){
  .grid{ flex-direction: column; }
  .leftCol{ flex: 1 1 auto; }
  .rightCol{ flex: 1 1 auto; }
}


.calList {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 520px;
    overflow: auto;
    padding-right: 4px;
}

.calItem {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid #222;
    background: #121212;
    cursor: pointer;
}

.calItem:hover {
    border-color: #333;
}

.calDate {
    font-weight: 700;
}

.calPreview {
    font-size: 12px;
    opacity: .85;
    max-width: 520px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.muted {
    opacity: .65;
}

/* passcode modal */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .65);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.modal {
    width: min(520px, 100%);
    background: #0f0f0f;
    border: 1px solid #222;
    border-radius: 18px;
    padding: 16px;
}

.modal h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

.modal p {
    margin: 0 0 12px;
    font-size: 13px;
    opacity: .85;
    line-height: 1.4;
}

.modalActions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

/* =========================
   Monthly Wrap
   ========================= */

#wrapCard {
  border: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
}

#wrapCard h3 {
  letter-spacing: 0.2px;
}

/* Slightly "premium" pills inside wrap */
#wrapCard .pill {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.14);
}

/* Compare line spacing */
#wrapCompareLine {
  line-height: 1.35;
}

/* Optional: a brighter pill for availability states */
.pill.good {
  border-color: rgba(0, 255, 140, 0.45);
  background: rgba(0, 255, 140, 0.12);
}

.pill.warn {
  border-color: rgba(255, 215, 0, 0.45);
  background: rgba(255, 215, 0, 0.12);
}

.pill.bad {
  border-color: rgba(255, 90, 90, 0.45);
  background: rgba(255, 90, 90, 0.10);
}


/* =========================
   Overlay behavior (both modals)
   - Toggle by adding/removing .open in JS
   ========================= */

.overlay.open {
  display: flex;
}

/* Make modal feel a bit more "app-like" */
.modal {
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
}

/* Wrap modal tweaks */
#wrapOverlay .modal {
  width: min(720px, 100%);
}

/* Slide container */
#wrapSlides {
  display: grid;
  gap: 10px;
}

/* One "slide card" (you'll render these in JS) */
.wrapSlide {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 14px;
}

.wrapSlideTitle {
  font-weight: 800;
  margin: 0 0 6px;
  font-size: 16px;
}

.wrapSlideValue {
  font-weight: 900;
  font-size: 26px;
  letter-spacing: 0.3px;
}

.wrapSlideSub {
  margin-top: 6px;
  font-size: 13px;
  opacity: 0.8;
  line-height: 1.35;
}

.wrapGrid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:12px;
}

.wrapTile{
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  padding: 12px;
  min-width: 0;
}

.wrapTileLabel{
  font-size: 12px;
  opacity: 0.75;
}

.wrapTileValue{
  font-size: 22px;
  font-weight: 900;
  margin-top: 6px;
  line-height: 1.1;
}

.wrapTileSub{
  font-size: 12px;
  opacity: 0.75;
  margin-top: 6px;
  line-height: 1.3;
}


/* Wrap nav row: keep buttons tight on mobile */
@media (max-width: 520px) {
  #wrapOverlay .modalActions,
  #wrapOverlay .row {
    flex-wrap: wrap;
  }
}



/* =========================
   Monthly Wrapped v2
   ========================= */

.wrapModal {
  width: min(920px, 100%);
  max-height: min(760px, 92vh);
  overflow: auto;
  padding: 18px;
}

.wrapModalHeader {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.wrapModalHeader h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.wrapCloseBtn {
  width: auto;
  min-width: 90px;
  padding: 10px 14px;
}

.wrapTabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
  border-radius: 999px;
  margin-bottom: 16px;
}

.wrapTab {
  width: auto;
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 9px 13px;
  background: transparent;
  color: #e5e7eb;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.wrapTab:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
}

.wrapTab.active {
  background: #f8fafc;
  color: #111827;
}

.wrapContent {
  display: grid;
  gap: 14px;
}

.wrapHero {
  border-radius: 22px;
  padding: 22px;
  border: 1px solid rgba(255,255,255,0.13);
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.12), transparent 35%),
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.025));
}

.wrapHeroKicker {
  font-size: 13px;
  color: #a3a3a3;
  font-weight: 700;
}

.wrapHeroTitle {
  margin-top: 8px;
  font-size: clamp(26px, 5vw, 44px);
  line-height: 1;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.wrapHeroGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.wrapMetricCard {
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(255,255,255,0.11);
  border-radius: 16px;
  padding: 14px;
}

.wrapMetricLabel {
  color: #a3a3a3;
  font-size: 12px;
  font-weight: 700;
}

.wrapMetricValue {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 950;
  line-height: 1;
}

.wrapMetricSub {
  margin-top: 6px;
  color: #a3a3a3;
  font-size: 12px;
}

.wrapSectionCard {
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  padding: 16px;
}

.wrapSectionTitle {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 900;
}

.wrapSectionSub {
  color: #a3a3a3;
  font-size: 13px;
  margin-bottom: 14px;
}

.wrapDeltaGrid,
.wrapInsightGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.wrapDelta {
  border-radius: 14px;
  padding: 12px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.09);
}

.wrapDeltaValue {
  font-size: 20px;
  font-weight: 950;
}

.wrapDeltaValue.good {
  color: #86efac;
}

.wrapDeltaValue.bad {
  color: #fca5a5;
}

.wrapCompareTableWrap {
  overflow-x: auto;
}

.wrapCompareTable {
  min-width: 620px;
  display: grid;
  gap: 8px;
}

.wrapCompareRow {
  display: grid;
  grid-template-columns: 1.4fr repeat(4, 1fr);
  gap: 8px;
}

.wrapCompareCell {
  padding: 11px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 13px;
}

.wrapCompareRow.header .wrapCompareCell {
  font-weight: 900;
  background: rgba(255,255,255,0.075);
}

.wrapTrendChartBox {
  height: 280px;
  position: relative;
}

.wrapLabelList {
  display: grid;
  gap: 8px;
}

.wrapLabelItem {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px;
  border-radius: 12px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.08);
}

.wrapTargetGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 720px) {
  .wrapHeroGrid,
  .wrapDeltaGrid,
  .wrapInsightGrid,
  .wrapTargetGrid {
    grid-template-columns: 1fr;
  }

  .wrapModalHeader {
    flex-direction: column;
  }

  .wrapCloseBtn {
    width: 100%;
  }
}