/* Operate first: accepted wood/parchment, with details on demand. */
.guild-theme .contextual-editor { grid-column: 1 / -1; width: 100%; min-width: 0; padding: 1rem; box-sizing: border-box; background: #f7e7cc; color: #4a2a18; border: 2px solid #7a644c; border-radius: 12px; }
.guild-theme .contextual-editor-title { display: block; margin-bottom: .75rem; font-size: 1.05rem; color: #4a2a18; }
.guild-theme .contextual-editor .contextual-edit-form { width: 100%; min-width: 0; margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; box-sizing: border-box; }
.guild-theme .contextual-editor [hidden] { display: none !important; }
.guild-theme .contextual-editor label, .guild-theme .contextual-editor summary, .guild-theme .contextual-editor .training-inline-hint { color: #4a2a18; }
.guild-theme .contextual-editor label { font-size: .9rem; }
.guild-theme .contextual-editor input, .guild-theme .contextual-editor select, .guild-theme .contextual-editor textarea { max-width: 100%; min-width: 0; font-size: 16px; box-sizing: border-box; background: #fff9ef; color: #4a2a18; border-color: #7a644c; }
.guild-theme .contextual-editor input::placeholder, .guild-theme .contextual-editor textarea::placeholder { color: #725139; opacity: 1; }
.guild-theme .contextual-editor button { min-height: 44px; color: #4a2a18 !important; background: #f7e7cc !important; border: 1px solid #7a644c !important; }
.guild-theme .contextual-editor button:hover { color: #4a2a18 !important; background: #e5d4b8 !important; }
.guild-theme .contextual-editor button[type="submit"] { color: #fff9ef !important; background: #6a3d20 !important; border-color: #6a3d20 !important; box-shadow: none; }
.guild-theme .contextual-editor button[type="submit"]:hover { color: #fff9ef !important; background: #4a2a18 !important; }
/* Match the legacy panel ID specificity so Save keeps its action emphasis. */
body.guild-theme :is(#today-panel, #calendar-panel, #add-panel, #workout-panel, #food-panel, #mental-panel, #care-panel, #profile-panel, #training-exercise-modal):is(#today-panel, #calendar-panel, #add-panel, #workout-panel, #food-panel, #mental-panel, #care-panel, #profile-panel, #training-exercise-modal) .contextual-editor button[type="submit"] { color: #fff9ef !important; background: #6a3d20 !important; border-color: #6a3d20 !important; box-shadow: none !important; }
body.guild-theme :is(#today-panel, #calendar-panel, #add-panel, #workout-panel, #food-panel, #mental-panel, #care-panel, #profile-panel, #training-exercise-modal):is(#today-panel, #calendar-panel, #add-panel, #workout-panel, #food-panel, #mental-panel, #care-panel, #profile-panel, #training-exercise-modal) .contextual-editor button[type="submit"]:hover { color: #fff9ef !important; background: #4a2a18 !important; }
body.guild-theme .contextual-editor :is(#care-cancel-edit, #grooming-cancel-edit, #habit-cancel-edit, #program-cancel-edit, #capture-cancel-edit, #quest-cancel-edit, #daily-checklist-cancel, .cancel-edit, .training-inline-cancel) { color: #4a2a18 !important; background: #f7e7cc !important; border: 1px solid #7a644c !important; }
body.guild-theme .contextual-editor :is(#care-cancel-edit, #grooming-cancel-edit, #habit-cancel-edit, #program-cancel-edit, #capture-cancel-edit, #quest-cancel-edit, #daily-checklist-cancel, .cancel-edit, .training-inline-cancel):hover { color: #4a2a18 !important; background: #e5d4b8 !important; }
.guild-theme .contextual-editor button:focus-visible, .guild-theme .contextual-editor input:focus-visible, .guild-theme .contextual-editor select:focus-visible, .guild-theme .contextual-editor textarea:focus-visible { outline: 3px solid #4a2a18; outline-offset: 3px; }
@media (max-width: 760px) {
  .guild-theme .contextual-editor { padding: .65rem; }
  .guild-theme .contextual-editor .field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .guild-theme .contextual-editor .field-row:has(input[type="date"]), .guild-theme .contextual-editor .field-row:has(select) { grid-template-columns: minmax(0, 1fr); }
  .guild-theme .contextual-editor .field-row > label { min-width: 0; }
  .guild-theme .contextual-editor .form-actions, .guild-theme .contextual-editor .program-form-actions { display: flex; flex-wrap: wrap; }
  .guild-theme .contextual-editor input, .guild-theme .contextual-editor select { width: 100%; padding-inline: .4rem; font-size: 16px; }
  .guild-theme .contextual-editor .advanced-fields { padding: .4rem; }
}
.guild-theme .health-hero.compact-hero { padding: 1rem 1.5rem; }
.guild-theme .health-hero .hero-copy { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .3rem 1rem; align-items: center; }
.guild-theme .health-hero .health-label { grid-column: 1; margin: 0; }
.guild-theme .health-hero h1 { grid-column: 1; margin: 0; }
.guild-theme .health-hero .health-lead { grid-column: 1; margin: 0; line-height: 1.5; color: #5b4128; }
.guild-theme .health-hero .hero-log-action { grid-column: 2; grid-row: 1 / 4; margin: 0; }
.guild-theme .health-page-info { margin: .35rem 0 0; }
.guild-theme .health-page-info summary { font-size: .85rem; color: #4a2a18; font-weight: 600; }
.guild-theme .health-page-info .health-quicklinks { margin: .3rem 0; }
.guild-theme .health-page-info > span, .guild-theme .health-page-info strong { color: #4a2a18; }
.guild-theme .today-nutrition-context { margin: .65rem 0 0; color: #f7e7cc; font-size: .9rem; line-height: 1.5; }
.guild-theme .today-status-help { margin: 0 0 .8rem; font-size: .85rem; color: #f7e7cc; }
.guild-theme .today-status-help summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.guild-theme .today-status-help summary::after { content: '⌄'; margin-left: .5rem; }
.guild-theme .today-status-help[open] summary::after { content: '⌃'; }
.guild-theme .today-status-help p { max-width: 65ch; line-height: 1.6; margin-top: 0; }
.guild-theme .macro-grid--ranked .macro-card[data-state="pending"] { border-left-color: #7a644c; }
.guild-theme .macro-grid--ranked .macro-card[data-state="pending"] .metric-track { background: #ccba9a; }
.guild-theme .today-growth-details { margin-block: 1rem; border-top: 1px solid #ac8759; color: #f7e7cc; }
.guild-theme .today-growth-details > summary { min-height: 56px; padding: .6rem .25rem; cursor: pointer; }
.guild-theme .today-growth-details > summary span { margin-left: .6rem; font-size: .9rem; }
.guild-theme .today-growth-details .life-today-zone { margin-bottom: 0; }
@media (max-width: 760px) {
  .guild-theme .health-hero.compact-hero { padding: .85rem 1rem; }
  .guild-theme .health-hero .hero-copy { display: block; }
  .guild-theme .health-hero h1 { font-size: 1.7rem; }
  .guild-theme .health-hero .health-lead { margin-top: .25rem; font-size: .95rem; }
  /* The persistent Log tab and Today shortcuts already offer this action. */
  .guild-theme .health-hero .hero-log-action { display: none; }
  .guild-theme .today-growth-details > summary span { display: block; margin: .2rem 0 0 1.15rem; }
}
@media (prefers-reduced-motion: reduce) {
  .guild-theme #today-panel .metric-track i { transition: none; }
}

/* Today actions: solid paper controls on wood; only the selected tab is gold. */
.guild-theme .health-navigation #health-tabs .health-tab,
.guild-theme .health-navigation #health-tabs .health-tab.add-tab {
  color: #fff6e4; background: #352314; border: 1px solid #977650;
  box-shadow: none; min-height: 48px;
}
.guild-theme .health-navigation #health-tabs .health-tab[aria-selected="true"] {
  color: #352314; background: #f3cc76; border-color: #f3cc76;
  box-shadow: inset 0 -3px 0 #84613d;
}
.guild-theme .health-navigation #health-tabs .health-tab:hover:not([aria-selected="true"]) {
  color: #352314; background: #fff6e4; border-color: #fff6e4;
}
.guild-theme .health-navigation .health-more > summary {
  color: #fff6e4; background: #352314; border: 1px solid #977650;
}
.guild-theme .health-navigation .health-more.has-active-panel > summary,
.guild-theme .health-navigation .health-more[open] > summary {
  color: #352314; background: #f3cc76; border-color: #f3cc76;
}
.guild-theme .health-navigation :is(.health-tab, .health-more > summary):focus-visible {
  outline: 3px solid #fffdfa; outline-offset: 3px;
}
.guild-theme #today-panel .source-edit-action,
.guild-theme #today-panel .source-edit-action:hover {
  min-height: 44px; padding: .55rem .85rem;
  background: #fff6e4 !important; color: #352314 !important;
  border: 1px solid #84613d !important; box-shadow: none;
}
.guild-theme #today-panel #today-date { color: #f7e7cc !important; font-size: .95rem !important; }
.guild-theme #today-panel #quick-actions button {
  background: #fff6e4 !important; color: #352314 !important;
  border: 1px solid #84613d !important; box-shadow: none !important;
  min-height: 100px;
}
.guild-theme #today-panel #quick-actions button :is(strong,small,i) { color: #352314 !important; }
.guild-theme #today-panel #quick-actions button small { color: #604b35 !important; line-height: 1.5; }
.guild-theme #today-panel #quick-actions .quick-primary { background: #f3cc76 !important; border-color: #f3cc76 !important; }
.guild-theme #today-panel #quick-actions button:hover { background: #f7e7cc !important; }
.guild-theme #today-panel #quick-actions .quick-primary:hover { background: #ffdf91 !important; }
.guild-theme #today-panel .macro-grid--ranked .macro-card {
  background: #fff6e4 !important; opacity: 1; box-shadow: none !important;
  padding: 1rem 1rem 1.25rem; min-height: 150px;
}
.guild-theme #today-panel .macro-grid--ranked .macro-card :is(strong,span,small,b,.macro-left) { color: #352314; }
.guild-theme #today-panel .macro-grid--ranked .macro-card > span { font-size: 1rem; font-weight: 700; }
.guild-theme #today-panel .macro-grid--ranked .macro-card strong { font-size: 2rem; }
.guild-theme #today-panel .macro-grid--ranked :is(.carbs,.fat) strong { font-size: 1.65rem; }
.guild-theme #today-panel .macro-grid--ranked .macro-card .macro-left { font-size: .9rem; font-style: normal; }
.guild-theme #today-panel .macro-grid--ranked .macro-card[data-state="pending"] .macro-left { color: #604b35; font-weight: 500; }
.guild-theme #today-panel .today-status-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.guild-theme #today-panel .today-grid .decision-card {
  background: #fff6e4; color: #352314; box-shadow: none;
  min-height: 132px; padding: 1rem 1.1rem 1.4rem;
}
.guild-theme #today-panel .today-grid .decision-card p { color: #604b35; font-size: .8rem; }
.guild-theme #today-panel .today-grid .decision-card h3 { color: #352314; font-size: 1.15rem; }
.guild-theme #today-panel .today-grid .decision-card span { color: #604b35; font-size: .95rem; line-height: 1.55; }
.guild-theme #today-panel .today-journal-action {
  background: #fff6e4; color: #352314; border: 1px solid #84613d; box-shadow: none;
  min-height: 86px;
}
.guild-theme #today-panel .today-journal-action :is(strong,small,i) { color: #352314; }
.guild-theme #today-panel .today-journal-action small { color: #604b35; font-size: .95rem; }
.guild-theme #today-panel .today-journal-action.done { background: #e3eddb; border-color: #477157; }
.guild-theme #today-panel .today-journal-action:hover { background: #f7e7cc; }
.guild-theme #today-panel :is(#quick-actions button,.source-edit-action,.today-journal-action,.routine-copy,.routine-edit):focus-visible {
  outline: 3px solid #754017; outline-offset: 3px;
}
.guild-theme #today-panel :is(#quick-actions button,.source-edit-action,.today-journal-action):focus-visible { outline-color: #f3cc76; }

/* Four children have explicit slots. Edit must never fall into the icon column. */
.guild-theme #today-panel .routine-step {
  display: grid; grid-template-columns: 44px minmax(0,1fr) 76px;
  grid-template-areas: "marker copy edit" "marker reward edit";
  align-items: center; column-gap: .7rem; row-gap: .25rem;
  margin-left: 0; width: 100%; min-height: 88px; padding: .75rem;
  background: #fff6e4; box-shadow: none; box-sizing: border-box;
}
.guild-theme #today-panel .routine-step .routine-marker { grid-area: marker; width: 44px; height: 44px; }
.guild-theme #today-panel .routine-step .routine-copy { grid-area: copy; min-width: 0; width: 100%; }
.guild-theme #today-panel .routine-copy strong { display: flex !important; flex-wrap: wrap; gap: .35rem .5rem; font-size: 1rem; line-height: 1.4; overflow-wrap: anywhere; }
.guild-theme #today-panel .routine-copy small { font-size: .85rem; line-height: 1.5; color: #604b35; }
.guild-theme #today-panel .routine-copy small:empty { display: none; }
.guild-theme #today-panel .routine-step > em { grid-area: reward; font-size: .7rem; color: #604b35; }
.guild-theme #today-panel .routine-step .routine-edit {
  grid-area: edit; display: inline-flex; align-items: center; justify-content: center;
  gap: .35rem; width: 76px; min-width: 76px; min-height: 44px; padding: .5rem;
  white-space: nowrap; line-height: 1; font-size: .9rem; font-weight: 600;
  color: #352314; background: #fffdfa; border: 1px solid #84613d; justify-self: end;
}
.guild-theme #today-panel .routine-step .routine-edit:hover { background: #f3cc76; }
.guild-theme #today-panel .routine-step.done { background: #e3eddb; border-color: #477157; }
.guild-theme #today-panel .routine-phase-pill.is-selected { color: #352314; background: #f3cc76; border-color: #f3cc76; box-shadow: none; }
.guild-theme #today-panel .routine-phase-pill.is-selected :is(strong,small,.routine-phase-count) { color: #352314; }
@media (max-width: 760px) {
  .guild-theme #today-panel #quick-actions button { min-height: 88px; padding: .7rem; }
  .guild-theme #today-panel #quick-actions button > span { font-size: 1.25rem; }
  .guild-theme #today-panel #quick-actions button strong { font-size: .95rem; }
  .guild-theme #today-panel #quick-actions button small { font-size: .8rem; }
  .guild-theme #today-panel .macro-grid--ranked .macro-card { padding: .8rem .7rem 1.2rem; }
}
@media (max-width: 480px) {
  .guild-theme #today-panel .routine-step { grid-template-areas: "marker copy copy" ". reward edit"; }
  .guild-theme #today-panel .routine-step .routine-edit { min-height: 44px; }
  .guild-theme #today-panel .routine-phase-pill { grid-template-columns: minmax(0,1fr); justify-items: start; gap: .4rem; }
  .guild-theme #today-panel .routine-phase-copy { width: 100%; }
  .guild-theme #today-panel .routine-phase-copy small { white-space: normal; line-height: 1.3; letter-spacing: 0; }
  .guild-theme #today-panel .routine-phase-count { grid-column: 1; font-size: .9rem; }
}
