/* Hizuk dark mode polish — scoped so the nutrition workspace keeps its original appearance. */
html[data-theme="dark"] {
  color-scheme: dark;
  --dm-bg: #101713;
  --dm-surface: #18221c;
  --dm-surface-2: #202d25;
  --dm-surface-3: #26362c;
  --dm-text: #f1f5f0;
  --dm-muted: #b5c2b8;
  --dm-dim: #93a397;
  --dm-border: #35483b;
  --dm-accent: #d7f36a;
  --dm-input: #121b16;
}
html[data-theme="dark"] body[data-page="home"],
html[data-theme="dark"] body[data-page="app"],
html[data-theme="dark"] body[data-page="admin"] {
  background: var(--dm-bg) !important;
  color: var(--dm-text);
}
html[data-theme="dark"] body[data-page="home"] :is(h1,h2,h3,h4,h5,h6,p,li,dt,dd,label,legend,figcaption,blockquote),
html[data-theme="dark"] body[data-page="app"] :is(h1,h2,h3,h4,h5,h6,p,li,dt,dd,label,legend,figcaption,blockquote),
html[data-theme="dark"] body[data-page="admin"] .main>div:not(#tab-nutrition) :is(h1,h2,h3,h4,h5,h6,p,li,dt,dd,label,legend,figcaption,blockquote) {
  color: var(--dm-text);
}
html[data-theme="dark"] body[data-page="home"] :is(.muted,.hint,small,.sub,.desc,.lead,.book-by,.programs p,.steps p),
html[data-theme="dark"] body[data-page="app"] :is(.muted,.hint,small,.sub,.desc,.stats span,.bar-user span),
html[data-theme="dark"] body[data-page="admin"] .main>div:not(#tab-nutrition) :is(.muted,.hint,small,.sub,.desc,.stats span) {
  color: var(--dm-muted) !important;
}
/* Panels, cards and content surfaces */
html[data-theme="dark"] body[data-page="home"] :is(.panel,.card,.programs li,.book-home,#request .panel,.steps li),
html[data-theme="dark"] body[data-page="app"] :is(.panel,.card,.stat,.stats>div,.plan,.wearable-panel,.exercise-card,.workout-card,.list-card,.calendar-day,.day-cell,.chat-panel,#plan-cal),
html[data-theme="dark"] body[data-page="admin"] .main>div:not(#tab-nutrition) :is(.panel,.card,.stat,.stats>div,.exercise-card,.workout-card,.list-card,.calendar-day,.day-cell,.cal-bar,.cal-filters) {
  background-color: var(--dm-surface) !important;
  color: var(--dm-text) !important;
  border-color: var(--dm-border) !important;
  box-shadow: 0 10px 28px rgba(0,0,0,.16);
}
html[data-theme="dark"] body[data-page="home"] .book-home { background: #1b2921 !important; }
html[data-theme="dark"] body[data-page="home"] .coach-home .panel { background: #20392b !important; }
html[data-theme="dark"] body[data-page="home"] .brand-card { background: #18251d !important; }
html[data-theme="dark"] body[data-page="home"] .block,
html[data-theme="dark"] body[data-page="app"] .top,
html[data-theme="dark"] body[data-page="app"] .mtabs,
html[data-theme="dark"] body[data-page="admin"] .main>div:not(#tab-nutrition) .sec-head { border-color: var(--dm-border) !important; }
/* Form controls */
html[data-theme="dark"] body[data-page="home"] :is(input,textarea,select),
html[data-theme="dark"] body[data-page="app"] :is(input,textarea,select),
html[data-theme="dark"] body[data-page="admin"] .main>div:not(#tab-nutrition) :is(input,textarea,select) {
  background: var(--dm-input) !important;
  color: var(--dm-text) !important;
  border-color: #43584a !important;
  caret-color: var(--dm-accent);
}
html[data-theme="dark"] body[data-page="home"] :is(input,textarea,select)::placeholder,
html[data-theme="dark"] body[data-page="app"] :is(input,textarea,select)::placeholder,
html[data-theme="dark"] body[data-page="admin"] .main>div:not(#tab-nutrition) :is(input,textarea,select)::placeholder { color: #9eaea2 !important; opacity: 1; }
html[data-theme="dark"] body[data-page="home"] :is(input,textarea,select):focus,
html[data-theme="dark"] body[data-page="app"] :is(input,textarea,select):focus,
html[data-theme="dark"] body[data-page="admin"] .main>div:not(#tab-nutrition) :is(input,textarea,select):focus { outline: 2px solid #91b84d; outline-offset: 1px; }
/* Buttons and navigation */
html[data-theme="dark"] body[data-page="app"] :is(.mtabs button,.side-nav button,.tab),
html[data-theme="dark"] body[data-page="admin"] .main>div:not(#tab-nutrition) :is(.tabs button,.tab,.side-nav button) { color: var(--dm-muted); }
html[data-theme="dark"] body[data-page="app"] .mtabs button[aria-pressed="true"],
html[data-theme="dark"] body[data-page="admin"] .main>div:not(#tab-nutrition) :is(button[aria-pressed="true"],.tabs .btn[aria-pressed="true"]) { background: var(--dm-accent) !important; color: #172218 !important; border-color: var(--dm-accent) !important; }
html[data-theme="dark"] body[data-page="home"] .btn.ghost,
html[data-theme="dark"] body[data-page="app"] .btn.ghost,
html[data-theme="dark"] body[data-page="admin"] .main>div:not(#tab-nutrition) .btn.ghost { background: var(--dm-surface-2) !important; color: var(--dm-text) !important; border-color: var(--dm-border) !important; }
html[data-theme="dark"] body[data-page="home"] .btn:not(.ghost),
html[data-theme="dark"] body[data-page="app"] .btn:not(.ghost),
html[data-theme="dark"] body[data-page="admin"] .main>div:not(#tab-nutrition) .btn:not(.ghost) { color: #fff; }
html[data-theme="dark"] body[data-page="home"] .hero :is(.btn,.btn.ghost) { color: #fff !important; }
html[data-theme="dark"] body[data-page="home"] .hero .btn:not(.ghost) { background: var(--dm-accent) !important; color: #172218 !important; border-color: var(--dm-accent) !important; }
/* Tables, calendars, menus, dialogs and overlays */
html[data-theme="dark"] body[data-page="app"] :is(table,th,td),
html[data-theme="dark"] body[data-page="admin"] .main>div:not(#tab-nutrition) :is(table,th,td) { color: var(--dm-text); border-color: var(--dm-border) !important; }
html[data-theme="dark"] body[data-page="app"] :is(th,thead),
html[data-theme="dark"] body[data-page="admin"] .main>div:not(#tab-nutrition) :is(th,thead) { background: var(--dm-surface-2) !important; }
html[data-theme="dark"] body[data-page="app"] :is(dialog,.modal,.popover,.dropdown,.menu),
html[data-theme="dark"] body[data-page="admin"] .main>div:not(#tab-nutrition) :is(dialog,.modal,.popover,.dropdown,.menu) { background: var(--dm-surface-2) !important; color: var(--dm-text) !important; border-color: var(--dm-border) !important; }
html[data-theme="dark"] body[data-page="app"] dialog::backdrop,
html[data-theme="dark"] body[data-page="admin"] dialog::backdrop { background: rgba(0,0,0,.72); }
html[data-theme="dark"] body[data-page="app"] :is(.chip,.badge,.tag),
html[data-theme="dark"] body[data-page="admin"] .main>div:not(#tab-nutrition) :is(.chip,.badge,.tag) { color: #172218; }
html[data-theme="dark"] body[data-page="home"] .foot,
html[data-theme="dark"] body[data-page="app"] .foot,
html[data-theme="dark"] body[data-page="admin"] .foot { color: var(--dm-muted); border-color: var(--dm-border); }
html[data-theme="dark"] body[data-page="admin"] .side { background: #151f19 !important; border-color: var(--dm-border) !important; }
html[data-theme="dark"] body[data-page="admin"] .side :is(a,button,small,p,span) { color: var(--dm-muted); }
html[data-theme="dark"] body[data-page="admin"] .side :is(.active,[aria-current="page"],[aria-pressed="true"]) { color: var(--dm-text) !important; }
/* Toggle remains legible and visually integrated on every page. */
html[data-theme="dark"] .theme-toggle { background: #26362c !important; color: #f1f5f0 !important; border-color: #526657 !important; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
html[data-theme="dark"] .theme-toggle:hover { background: #34483a !important; }
@media (max-width: 600px) { html[data-theme="dark"] .theme-toggle { background: #26362c !important; } }

/* Chat: darker conversation surfaces with crisp, true-black message text. */
html[data-theme="dark"] body:is([data-page="app"],[data-page="admin"]) .chat-panel,
html[data-theme="dark"] body:is([data-page="app"],[data-page="admin"]) .conv-pane {
  background: #151d19 !important;
  border: 1px solid #34443a !important;
}
html[data-theme="dark"] body:is([data-page="app"],[data-page="admin"]) :is(.chat-profile,.conv-h) {
  background: #1b2820 !important;
  border-color: #34443a !important;
}
html[data-theme="dark"] body:is([data-page="app"],[data-page="admin"]) .chat-log {
  background: linear-gradient(180deg, #101813 0%, #17221b 100%) !important;
  color: #000 !important;
}
html[data-theme="dark"] body:is([data-page="app"],[data-page="admin"]) .chat-log .bub,
html[data-theme="dark"] body:is([data-page="app"],[data-page="admin"]) .chat-log .bub.theirs {
  background: #cbd3ce !important;
  border: 1px solid #aebbb2 !important;
  color: #000000 !important;
  box-shadow: 0 3px 10px rgba(0,0,0,.24) !important;
}
html[data-theme="dark"] body:is([data-page="app"],[data-page="admin"]) .chat-log .bub.mine {
  background: #b9c9bd !important;
  border-color: #9eafa3 !important;
  color: #000000 !important;
}
html[data-theme="dark"] body:is([data-page="app"],[data-page="admin"]) .chat-log .bub :is(p,span,strong,b,em,a,li,small,time),
html[data-theme="dark"] body:is([data-page="app"],[data-page="admin"]) .chat-log .bub-meta,
html[data-theme="dark"] body:is([data-page="app"],[data-page="admin"]) .chat-log .bub-meta * {
  color: #000000 !important;
  opacity: 1 !important;
}
html[data-theme="dark"] body:is([data-page="app"],[data-page="admin"]) .chat-log .chat-person {
  color: #dce7df !important;
}
html[data-theme="dark"] body:is([data-page="app"],[data-page="admin"]) .chat-log .msg-day span {
  background: #29382f !important;
  color: #f1f5f0 !important;
  border: 1px solid #425348;
}
html[data-theme="dark"] body:is([data-page="app"],[data-page="admin"]) .chat-bar {
  background: #1b2820 !important;
  border-color: #34443a !important;
}
html[data-theme="dark"] body:is([data-page="app"],[data-page="admin"]) .chat-bar textarea {
  background: #101813 !important;
  color: #f1f5f0 !important;
  border: 1px solid #45594b !important;
}
html[data-theme="dark"] body:is([data-page="app"],[data-page="admin"]) .chat-bar textarea::placeholder {
  color: #aebdb2 !important;
}
html[data-theme="dark"] body:is([data-page="app"],[data-page="admin"]) :is(.chat-menu,.share-card) {
  background: #26352c !important;
  color: #f1f5f0 !important;
  border: 1px solid #45594b !important;
}
html[data-theme="dark"] body:is([data-page="app"],[data-page="admin"]) .chat-menu button {
  color: #f1f5f0 !important;
}
html[data-theme="dark"] body:is([data-page="app"],[data-page="admin"]) .share-card :is(h1,h2,h3,h4,p,span,li,small,b,strong) {
  color: #f1f5f0 !important;
}


/* Member-side coach messages: keep the dark chat canvas, but make incoming
   coach bubbles and their labels comfortably readable. */
html[data-theme="dark"] body[data-page="app"] .chat-log .bub.theirs {
  background: #e4ece6 !important;
  border-color: #bdcfc1 !important;
  color: #17251c !important;
}
html[data-theme="dark"] body[data-page="app"] .chat-log .bub.theirs :is(p,span,strong,b,em,a,li,small,time),
html[data-theme="dark"] body[data-page="app"] .chat-log .bub.theirs .chat-person {
  color: #17251c !important;
}


/* Overview drill-down and trainer activity clarity */
.overview-drill-stats .overview-stat{appearance:none;width:100%;min-width:0;text-align:left;display:flex;flex-direction:column;gap:.2rem;padding:1rem 1.1rem;border:1px solid var(--line);border-radius:16px;background:var(--panel);color:var(--ink);font:inherit;cursor:pointer;transition:border-color .15s,transform .15s,box-shadow .15s}
.overview-drill-stats .overview-stat:hover,.overview-drill-stats .overview-stat:focus-visible{border-color:var(--blue);transform:translateY(-2px);outline:none;box-shadow:0 5px 18px #00000012}
.overview-drill-stats .overview-stat b{font-size:1.8rem;line-height:1.15}
.overview-drill-stats .overview-stat span{font-weight:650}
.overview-drill-stats .overview-stat small{font-size:.75rem;color:var(--mute)}
.overview-drill{margin:1rem 0}
.overview-drill-head{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem}
.overview-drill-head h3{margin:.1rem 0}
.overview-drill-head p{margin:.2rem 0 .8rem}
.overview-drill-list{list-style:none;padding:0;margin:0;display:grid;gap:.55rem}
.overview-drill-list li{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.75rem .85rem;border:1px solid var(--line);border-radius:12px;background:var(--panel)}
.overview-drill-list li>div{min-width:0;display:grid;gap:.15rem}
.overview-drill-list small{color:var(--mute);overflow-wrap:anywhere}
.mem-activity-glance{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.45rem;margin:.7rem 0 .8rem}
.mem-glance-item{display:flex;min-width:0;flex-direction:column;gap:.12rem;padding:.6rem .65rem;border:1px solid var(--line);border-radius:10px;background:var(--panel)}
.mem-glance-item b{font-size:.72rem;color:var(--mute);font-weight:650}
.mem-glance-item strong{font-size:.82rem;line-height:1.25}
.mem-glance-item small{font-size:.72rem;color:var(--mute)}
.mem-glance-item.has-workout strong{color:var(--green)}
.mem-glance-item.has-form strong{color:var(--blue)}
.mem-glance-item.has-checkin strong{color:var(--green)}
.mem-glance-item.is-empty strong{color:var(--mute);font-weight:500}
.assigned-form-row{border-radius:12px;padding:.75rem .85rem!important;margin:.35rem 0;border:1px solid var(--line)}
.assigned-form-row.form-due{border-inline-start:4px solid #d99a27;background:color-mix(in srgb,#d99a27 8%,var(--panel))}
.assigned-form-row.form-scheduled{border-inline-start:4px solid var(--blue)}
.assigned-form-row.form-done{border-inline-start:4px solid var(--green)}
.form-state-tag{font-weight:700}
.member-forms-panel{overflow:hidden}
.member-forms-panel .list>li{padding:.85rem .9rem;border:1px solid var(--line);border-radius:12px;margin:.4rem 0;background:var(--panel);gap:.8rem}
.member-forms-panel .list>li>div:first-child{min-width:0}
.member-forms-panel .list>li small{display:block;color:var(--mute);line-height:1.4;margin-top:.2rem}
.member-forms-panel .list .tag{display:inline-flex;align-items:center;border-radius:999px;padding:.2rem .55rem;background:color-mix(in srgb,var(--blue) 14%,var(--panel));color:var(--ink);font-size:.75rem;font-weight:700}
html[data-theme="dark"] .overview-drill-stats .overview-stat{background:var(--dm-surface);border-color:var(--dm-border);color:var(--dm-text)}
html[data-theme="dark"] .overview-drill-stats .overview-stat small,html[data-theme="dark"] .overview-drill-list small{color:var(--dm-muted)}
html[data-theme="dark"] .overview-drill-list li,html[data-theme="dark"] .mem-glance-item,html[data-theme="dark"] .member-forms-panel .list>li{background:var(--dm-surface-2);border-color:var(--dm-border);color:var(--dm-text)}
html[data-theme="dark"] .mem-glance-item b,html[data-theme="dark"] .mem-glance-item small,html[data-theme="dark"] .member-forms-panel .list>li small{color:var(--dm-muted)}
html[data-theme="dark"] .assigned-form-row.form-due{background:#3a2d18;border-color:#795c2a}
html[data-theme="dark"] .assigned-form-row.form-scheduled{background:#1b2c40;border-color:#365a82}
html[data-theme="dark"] .assigned-form-row.form-done{background:#1c3529;border-color:#35684b}
@media(max-width:600px){.mem-activity-glance{grid-template-columns:1fr 1fr}.overview-drill-list li{align-items:flex-start}.overview-drill-stats .overview-stat{padding:.8rem}}

html[data-theme="dark"] .member-forms-panel .btn.ghost{background:#26362c!important;color:#f1f5f0!important;border-color:#465b4b!important}
html[data-theme="dark"] .member-forms-panel .btn:not(.ghost){background:#d7f36a!important;color:#172017!important}
html[data-theme="dark"] .member-forms-panel .tag{background:#2c4635!important;color:#e7f4e9!important}
html[data-theme="dark"] .assigned-form-row .tag{background:#2c3a31;color:#e9f3eb}
html[data-theme="dark"] .mem-activity-status{color:var(--dm-text)}
html[data-theme="dark"] .overview-drill-head .hint{color:var(--dm-muted)}
