/* goals.css — "Goals & Resolutions" v1.
   Namespaced under #goals-root / .goals-*. Matches the hall's dark + gold
   look: gold var(--gold) #d4a94e, headings #ffd166, panels
   rgba(12,9,4,.6) with a gold-tinted border — same as .pbook-sec.
   Mobile-first: 40px+ tap targets on the calendar, day sheet stacks,
   tracker table fits the container without sideways scrolling. */

#goals-root .goals-wrap { color: #f0e2c0; }
#goals-root .goals-error { color: #ff9a8a; }
#goals-root .goals-muted { opacity: .65; font-size: .85rem; }
#goals-root .goals-title {
  font-family: Georgia, serif; color: #ffd166; font-size: 1.15rem; margin: 2px 0 12px;
}
#goals-root .goals-member { opacity: .7; font-size: .9rem; }

/* ---------- tabs ---------- */
#goals-root .goals-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
#goals-root .goals-tab {
  background: transparent; color: var(--gold); border: 1px solid var(--gold-dim);
  border-radius: 8px; padding: 8px 14px; font-size: .92rem; font-weight: 600;
  cursor: pointer; min-height: 40px;
}
#goals-root .goals-tab.active {
  background: linear-gradient(#e2b95c, #b98c34); color: #241a08; border-color: transparent;
}
#goals-root .goals-tab-body { min-height: 80px; }

/* ---------- goals tab ---------- */
#goals-root .goals-card {
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(212, 169, 78, .25);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 12px;
}
#goals-root .goals-card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; flex-wrap: wrap;
}
#goals-root .goals-card-title { font-family: Georgia, serif; font-size: 1.1rem; color: #ffd166; }
#goals-root .goals-kind {
  font-size: .8rem; background: rgba(212, 169, 78, .16); border: 1px solid rgba(212, 169, 78, .45);
  color: #ffd97a; border-radius: 20px; padding: 2px 10px; white-space: nowrap;
}
#goals-root .goals-detail { margin: 6px 0 0; line-height: 1.5; }
#goals-root .goals-meta { margin-top: 6px; font-size: .88rem; opacity: .85; }
#goals-root .goals-card-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
#goals-root .goals-comments-toggle { margin-top: 10px; }

/* goal add/edit form */
#goals-root .goals-form {
  background: rgba(12, 9, 4, .6); border: 1px solid rgba(212, 169, 78, .35);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
#goals-root .goals-form h4 { margin: 0; font-family: Georgia, serif; color: #ffd166; }
#goals-root .goals-form label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; }
#goals-root .goals-form input[type="number"] { width: 120px; }
#goals-root .goals-form .hint { opacity: .65; font-size: .82rem; font-weight: normal; }
#goals-root .goals-sched { border: 1px solid rgba(212, 169, 78, .3); border-radius: 8px; padding: 10px 12px; }
#goals-root .goals-sched legend { color: #ffd166; font-size: .9rem; padding: 0 6px; }
/* frequency picker: four big choices + toggle buttons + mini calendars */
#goals-root .goals-freq-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 4px 0 10px; }
#goals-root .goals-freq input { position: absolute; opacity: 0; pointer-events: none; }
#goals-root .goals-freq span {
  display: flex; flex-direction: column; gap: 2px; align-items: center; text-align: center;
  border: 1px solid rgba(212, 169, 78, .4); border-radius: 10px; padding: 10px 6px;
  cursor: pointer; min-height: 52px; font-size: .92rem; font-weight: 600; color: #f0e2c0;
}
#goals-root .goals-freq span small { font-size: .78rem; font-weight: normal; opacity: .7; }
#goals-root .goals-freq input:checked + span {
  background: linear-gradient(#e2b95c, #b98c34); color: #241a08; border-color: transparent;
}
#goals-root .goals-freq input:checked + span small { opacity: .8; }
#goals-root .goals-freq input:focus-visible + span { outline: 2px solid #ffd166; outline-offset: 2px; }
#goals-root .gf-panel { margin-top: 4px; }
#goals-root .goals-pick { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
#goals-root .goals-pick-btn input { position: absolute; opacity: 0; pointer-events: none; }
#goals-root .goals-pick-btn span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; padding: 6px 10px;
  border: 1px solid rgba(212, 169, 78, .4); border-radius: 10px; cursor: pointer;
  font-size: .92rem; color: #f0e2c0;
}
#goals-root .goals-pick-btn input:checked + span {
  background: linear-gradient(#e2b95c, #b98c34); color: #241a08; border-color: transparent; font-weight: 700;
}
#goals-root .goals-pick-btn input:focus-visible + span { outline: 2px solid #ffd166; outline-offset: 2px; }
/* mini calendar inside the goal form (specific dates + extra dates) */
#goals-root .gf-cal-wrap { margin: 8px 0; }
#goals-root .gf-cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
#goals-root .gf-cal-title { font-family: Georgia, serif; color: #ffd166; font-size: 1.05rem; }
#goals-root .gf-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
#goals-root .gf-cal-dow { text-align: center; font-size: .75rem; opacity: .65; padding: 4px 0; font-weight: 600; }
#goals-root .gf-cal-cell.blank { background: transparent; }
#goals-root .gf-cal-day {
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(212, 169, 78, .2);
  border-radius: 8px; min-height: 44px; cursor: pointer; color: #f0e2c0; font-size: .92rem;
}
#goals-root .gf-cal-day.on {
  background: linear-gradient(#e2b95c, #b98c34); color: #241a08; border-color: transparent; font-weight: 700;
}
#goals-root .gf-extra { margin-top: 10px; border-top: 1px solid rgba(212, 169, 78, .2); padding-top: 10px; }
#goals-root .goals-check { flex-direction: row !important; align-items: center; gap: 6px; }
#goals-root .goals-check input { width: 20px; height: 20px; accent-color: #d4a94e; }

/* shared goals: badges + tag selector */
#goals-root .goals-share { margin-top: 6px; font-size: .85rem; color: #ffd97a; }
#goals-root .goals-group-head { font-family: Georgia, serif; color: #ffd166; margin: 18px 0 4px; }
#goals-root .goals-tag-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 14px; margin: 8px 0 2px; }

/* comments */
#goals-root .goals-comments { margin-top: 12px; border-top: 1px solid rgba(212, 169, 78, .2); padding-top: 10px; }
#goals-root .goals-comment { margin-bottom: 10px; }
#goals-root .goals-comment-reply { margin-left: 22px; border-left: 2px solid rgba(212, 169, 78, .4); padding-left: 10px; }
#goals-root .goals-comment-body { line-height: 1.5; white-space: pre-wrap; }
#goals-root .goals-comment-meta { font-size: .8rem; opacity: .7; margin-top: 2px; }
#goals-root .goals-comment-form { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
#goals-root .goals-comment-form .btn { align-self: flex-start; }

/* ---------- calendar tab ---------- */
#goals-root .goals-cal-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px;
}
#goals-root .goals-cal-title { font-family: Georgia, serif; color: #ffd166; font-size: 1.15rem; }
#goals-root .goals-wallet { font-size: .88rem; opacity: .9; margin-bottom: 10px; }
#goals-root .goals-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
#goals-root .goals-chip {
  background: transparent; color: #f0e2c0; border: 1px solid rgba(212, 169, 78, .4);
  border-radius: 20px; padding: 6px 12px; font-size: .85rem; cursor: pointer; min-height: 36px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px;
}
#goals-root .goals-chip.on { background: rgba(212, 169, 78, .2); border-color: #d4a94e; color: #ffd97a; }
#goals-root .goals-cal {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
#goals-root .goals-cal-dow {
  text-align: center; font-size: .75rem; opacity: .65; padding: 4px 0; font-weight: 600;
}
#goals-root .goals-cal-cell {
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(212, 169, 78, .2);
  border-radius: 8px; min-height: 52px; padding: 4px 2px 6px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; color: #f0e2c0;
}
#goals-root .goals-cal-cell.blank { background: transparent; border-color: transparent; cursor: default; }
#goals-root .goals-cal-cell.today { outline: 2px solid #ffd166; outline-offset: 1px; }
#goals-root .goals-cal-cell.selected { background: rgba(212, 169, 78, .25); border-color: #d4a94e; }
#goals-root .goals-cal-num { font-size: .9rem; line-height: 1.2; }
#goals-root .goals-cal-marks { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; line-height: 1; }
#goals-root .goals-mark { font-size: .8rem; font-weight: 700; width: 14px; text-align: center; }
#goals-root .goals-mark.done { color: #7ed67e; }
#goals-root .goals-mark.pass { color: #f0b429; }
#goals-root .goals-mark.missed { color: #ff7a6e; }
#goals-root .goals-mark.planned { color: rgba(240, 226, 192, .45); }
#goals-root .goals-legend { font-size: .85rem; margin: 10px 0 0; }

/* day sheet */
#goals-root .goals-day-sheet {
  margin-top: 14px; background: rgba(12, 9, 4, .6); border: 1px solid rgba(212, 169, 78, .35);
  border-radius: 10px; padding: 14px 16px;
}
#goals-root .goals-day-sheet h4 { margin: 0 0 10px; font-family: Georgia, serif; color: #ffd166; }
#goals-root .goals-day-goal { padding: 10px 0; border-top: 1px solid rgba(212, 169, 78, .2); }
#goals-root .goals-day-goal-head {
  display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap;
}
#goals-root .goals-day-status { font-size: .85rem; opacity: .8; font-style: italic; }
#goals-root .goals-day-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
#goals-root .goals-day-btns .btn { min-height: 40px; }
#goals-root .goals-day-btns .btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- tracker tab ---------- */
/* Fixed layout, no min-width: the table is exactly the container width, so
   all columns (Week + one per goal + %) are visible at a glance on desktop
   and phone — no sideways scrolling. Headers use short labels (see
   shortLabel in goals.js) and wrap if needed; pass counts sit on a second
   line inside the cell. */
#goals-root .goals-table-wrap { overflow-x: auto; }
#goals-root .goals-table { border-collapse: collapse; width: 100%; font-size: .85rem; table-layout: fixed; }
#goals-root .goals-table th, #goals-root .goals-table td {
  border: 1px solid rgba(212, 169, 78, .25); padding: 6px 4px; text-align: center;
  overflow-wrap: break-word;
}
#goals-root .goals-table th:first-child, #goals-root .goals-table td:first-child { text-align: left; }
#goals-root .goals-table th { color: #ffd166; font-family: Georgia, serif; font-weight: normal; font-size: .82rem; }
#goals-root .goals-table .goals-pass { font-size: .72rem; opacity: .7; }
#goals-root .goals-totals td { font-weight: 700; background: rgba(212, 169, 78, .12); }

/* ---------- year tab ---------- */
#goals-root .goals-year-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px;
}
#goals-root .goals-mini {
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(212, 169, 78, .25);
  border-radius: 10px; padding: 10px 12px;
}
#goals-root .goals-mini-head {
  display: flex; justify-content: space-between; font-family: Georgia, serif;
  color: #ffd166; margin-bottom: 8px;
}
#goals-root .goals-mini-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 8px;
}
#goals-root .goals-mini-day {
  aspect-ratio: 1; border-radius: 2px; background: rgba(240, 226, 192, .14);
}
#goals-root .goals-mini-day.blank { background: transparent; }
#goals-root .goals-mini-day.none { background: rgba(240, 226, 192, .08); }
#goals-root .goals-mini-day.open { background: rgba(240, 226, 192, .3); }
#goals-root .goals-mini-day.part { background: #d9a441; }
#goals-root .goals-mini-day.full { background: #5cb85c; }
#goals-root .goals-mini-day.missed { background: #c0564d; }

/* prior-years shelf (shared by the no-board state and the Year tab) */
#goals-root .goals-shelf { margin-top: 18px; }
#goals-root .goals-shelf-label { font-family: Georgia, serif; color: #ffd166; margin-bottom: 8px; }
#goals-root .goals-shelf-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
#goals-root .goals-year-btn.active { background: rgba(212, 169, 78, .25); border-color: #d4a94e; color: #ffd97a; }

/* small screens: roomier calendar cells, full-width day-sheet buttons,
   tighter tracker table */
@media (max-width: 520px) {
  #goals-root .goals-cal-cell { min-height: 48px; }
  #goals-root .goals-cal { gap: 3px; }
  #goals-root .goals-day-btns .btn { flex: 1 1 40%; }
  #goals-root .goals-table { font-size: .78rem; }
  #goals-root .goals-table th, #goals-root .goals-table td { padding: 5px 2px; }
  #goals-root .goals-table th { font-size: .75rem; }
  #goals-root .goals-table .goals-pass { font-size: .68rem; }
  #goals-root .goals-chip { max-width: 160px; }
}
