/* Esmeralda Go Fit — Admin Portal.
   Light theme with rose/wine accents, matching the iOS app's brand palette.
   Sidebar layout, dashboard overview, and a day-based training-program builder. */

:root {
  --bg: #fbf7f2;
  --surface: #ffffff;
  --elevated: #fbf7f2;
  --border: #ede6dc;
  --text: #1c1b1a;
  --muted: #8a8178;
  --accent: #8e2f41;
  --accent-2: #561c28;
  --accent-soft: rgba(142, 47, 65, 0.10);
  --on-accent: #ffffff;
  --success: #3e8e5a;
  --success-soft: rgba(62, 142, 90, 0.14);
  --danger: #c7453b;
  --danger-soft: rgba(199, 69, 59, 0.12);
  --shadow-card: 0 12px 32px -16px rgba(74, 20, 32, 0.18);
  --shadow-soft: 0 4px 18px -10px rgba(74, 20, 32, 0.15);
}

html.dark {
  --bg: #141210;
  --surface: #1e1b18;
  --elevated: #262220;
  --border: #2c2824;
  --text: #f5f2ef;
  --muted: #a9a099;
  --accent: #b05468;
  --accent-2: #6e2734;
  --accent-soft: rgba(176, 84, 104, 0.16);
  --on-accent: #ffffff;
  --success: #62c186;
  --success-soft: rgba(98, 193, 134, 0.16);
  --danger: #e86a60;
  --danger-soft: rgba(232, 106, 96, 0.16);
  --shadow-card: 0 14px 40px -18px rgba(0, 0, 0, 0.7);
  --shadow-soft: 0 6px 20px -10px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  height: 2.85rem; padding: 0 1.15rem; border: none; border-radius: 0.75rem;
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  transition: transform 0.12s ease, filter 0.2s ease, background-color 0.2s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); box-shadow: var(--shadow-soft); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { height: 2.35rem; padding: 0 0.85rem; font-size: 0.82rem; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.4rem; height: 2.4rem; border: none; border-radius: 0.7rem;
  background: transparent; color: var(--text); cursor: pointer; transition: background-color 0.2s ease;
}
.icon-btn:hover { background: var(--accent-soft); }

/* ---------- Inputs ---------- */
.input, .select {
  width: 100%; height: 2.85rem; padding: 0 0.9rem; border-radius: 0.7rem;
  border: 1px solid var(--border); background: var(--elevated); color: var(--text);
  font-size: 0.92rem; font-family: inherit;
}
textarea.input { height: auto; padding: 0.7rem 0.9rem; resize: vertical; }
.input:focus, .select:focus { outline: none; border-color: var(--accent); }
.input::placeholder { color: var(--muted); }
.label { display: block; margin-bottom: 0.4rem; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.field {
  display: flex; align-items: center; gap: 0.7rem; height: 2.85rem; padding: 0 0.9rem;
  background: var(--elevated); border: 1px solid var(--border); border-radius: 0.7rem;
}
.field:focus-within { border-color: var(--accent); }
.field input { flex: 1; min-width: 0; height: 100%; border: none; outline: none; background: transparent; color: var(--text); font-size: 0.92rem; }
.field .ic { color: var(--muted); display: inline-flex; }
.error-text { color: var(--danger); font-size: 0.85rem; }

/* ---------- Icons ---------- */
.svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.svg-sm { width: 18px; height: 18px; }
.svg-lg { width: 30px; height: 30px; }

/* ---------- Animations ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.rise { animation: rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.8s linear infinite; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); }
.spinner-lg { width: 42px; height: 42px; border-width: 3px; }
.skeleton { height: 1.7rem; width: 3.5rem; border-radius: 0.5rem; background: var(--border); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-card { width: 100%; max-width: 25rem; border-radius: 1.5rem; padding: 2rem; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-card); }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 4rem; height: 4rem; border-radius: 1.15rem; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); box-shadow: var(--shadow-soft); }
.center { text-align: center; }
.stack > * + * { margin-top: 1rem; }

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 16rem; z-index: 40;
  display: flex; flex-direction: column; padding: 1.15rem 0.85rem;
  background: var(--surface); border-right: 1px solid var(--border);
  transition: transform 0.3s ease;
}
.sidebar.closed { transform: translateX(-100%); }
.brand-row { display: flex; align-items: center; gap: 0.7rem; padding: 0.35rem 0.6rem 1.4rem; }
.brand-row .mark { display: inline-flex; align-items: center; justify-content: center; width: 2.6rem; height: 2.6rem; border-radius: 0.85rem; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); font-weight: 800; }
.brand-row .title { font-weight: 700; font-size: 0.95rem; letter-spacing: 0.02em; }
.brand-row .sub { font-size: 0.68rem; color: var(--muted); letter-spacing: 0.14em; text-transform: uppercase; }

.nav { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 0.75rem; width: 100%;
  padding: 0.7rem 0.75rem; border: none; border-radius: 0.7rem; background: none;
  color: var(--muted); font-size: 0.9rem; cursor: pointer; text-align: left;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.nav-item:hover { background: var(--accent-soft); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item.active .svg { color: var(--accent); }
.nav-sep { margin: 0.6rem 0.75rem 0.3rem; font-size: 0.64rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); opacity: 0.7; }

.backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,0.5); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem;
  min-height: 4.25rem; padding: 0.75rem 1.25rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
.topbar .spacer { margin-left: auto; }
.topbar h1 { font-size: 1.3rem; font-weight: 700; }
.topbar .date { font-size: 0.78rem; color: var(--muted); }
.user-chip { display: flex; align-items: center; gap: 0.7rem; padding: 0.35rem 0.7rem; border-radius: 0.75rem; border: 1px solid var(--border); }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); font-weight: 700; }

.view-wrap { padding: 1.5rem 1.25rem 3rem; max-width: 78rem; width: 100%; margin: 0 auto; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 1.1rem; box-shadow: var(--shadow-card); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.section-title h2 { font-size: 1.15rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.count-pill { font-size: 0.72rem; font-weight: 700; padding: 0.1rem 0.55rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

/* Stat cards */
.stats { display: grid; grid-template-columns: repeat(1, 1fr); gap: 1rem; margin-bottom: 1.75rem; }
.stat { padding: 1.35rem; border-radius: 1.15rem; background: linear-gradient(160deg, var(--surface), var(--elevated)); border: 1px solid var(--border); box-shadow: var(--shadow-soft); transition: transform 0.18s ease, border-color 0.18s ease; }
.stat:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.stat .row { display: flex; align-items: center; gap: 1rem; }
.stat .badge { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 3rem; height: 3rem; border-radius: 0.85rem; background: linear-gradient(135deg, var(--accent-soft), transparent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); color: var(--accent); }
.stat .value { font-size: 1.85rem; font-weight: 800; line-height: 1; margin-top: 0.2rem; letter-spacing: -0.02em; }
.stat .k { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* Overview grid */
.overview { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
.panel { padding: 1.5rem; border-radius: 1.25rem; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-card); }
.section-title h2::before { content: ""; display: inline-block; width: 4px; height: 1.05em; border-radius: 2px; background: linear-gradient(var(--accent), var(--accent-2)); margin-right: 0.1rem; vertical-align: -2px; }
.empty-inline { padding: 2rem 1rem; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: 0.9rem; }

/* Dashboard card head + footer + link */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.panel-head h3 { font-size: 1.02rem; font-weight: 700; display: flex; align-items: center; gap: 0.45rem; }
.panel-head h3::before { content: ""; display: inline-block; width: 4px; height: 1.05em; border-radius: 2px; background: linear-gradient(var(--accent), var(--accent-2)); }
.link-gold { background: none; border: none; color: var(--accent); font-size: 0.8rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.link-gold:hover { text-decoration: underline; }
.card-footer { width: 100%; margin-top: 0.85rem; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; height: 2.7rem; border: 1px dashed var(--border); border-radius: 0.8rem; background: transparent; color: var(--accent); font-size: 0.88rem; font-weight: 600; cursor: pointer; transition: background-color 0.2s ease, border-color 0.2s ease; }
.card-footer:hover { background: var(--accent-soft); border-color: var(--accent); }

/* Client row with progress bar (dashboard) */
.dash-client-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; flex-shrink: 0; width: 5.5rem; }
.dash-client-side .lbl { font-size: 0.7rem; color: var(--muted); }
.mini-bar { width: 100%; height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; }
.mini-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }

/* Workout / list thumbnail */
.thumb { width: 2.8rem; height: 2.8rem; border-radius: 0.7rem; object-fit: cover; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }

/* Progress card */
.progress-row { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.metrics { flex: 1; min-width: 10rem; display: flex; flex-direction: column; gap: 0.5rem; }
.metric-row { display: flex; align-items: center; justify-content: space-between; font-size: 0.9rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.metric-row:last-child { border-bottom: none; padding-bottom: 0; }
.metric-up { color: var(--success); font-weight: 600; }
.module-empty { padding: 1.5rem; text-align: center; font-size: 0.9rem; color: var(--muted); border: 1px dashed var(--border); border-radius: 0.9rem; }

/* Row list (clients / workouts / generic) */
.row-list { display: flex; flex-direction: column; gap: 0.4rem; }
.list-row { display: flex; align-items: center; gap: 0.85rem; padding: 0.7rem 0.85rem; border-radius: 0.85rem; border: 1px solid var(--border); background: var(--elevated); transition: border-color 0.2s ease, transform 0.15s ease; }
.list-row:hover { border-color: var(--accent); transform: translateY(-1px); }
.list-row .main { flex: 1; min-width: 0; }
.list-row .name { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .sub { font-size: 0.82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda-group { margin: 1.1rem 0 0.5rem; font-size: 0.75rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.agenda-group:first-child { margin-top: 0; }
.agenda-date { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 0.75rem; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); line-height: 1; }
.agenda-date b { font-size: 1.05rem; }
.agenda-date small { font-size: 0.65rem; text-transform: uppercase; }
.list-row .side { font-size: 0.82rem; color: var(--muted); white-space: nowrap; flex-shrink: 0; }

.client-avatar { width: 2.6rem; height: 2.6rem; border-radius: 50%; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 0.85rem; }
.badge-status { font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.6rem; border-radius: 999px; }
.badge-status.ok { background: var(--success-soft); color: var(--success); }
.badge-status.off { background: var(--border); color: var(--muted); }
.chip { font-size: 0.72rem; padding: 0.12rem 0.55rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.3rem; }

/* Progress gauge */
.gauge { --p: 0; width: 8rem; height: 8rem; border-radius: 50%; display: grid; place-items: center; margin: 0 auto;
  background: radial-gradient(closest-side, var(--surface) 72%, transparent 73%),
    conic-gradient(var(--accent) calc(var(--p) * 1%), var(--border) 0); }
.gauge span { font-size: 1.5rem; font-weight: 700; }

/* Checklist (client select) */
.checklist { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.check { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.45rem 0.75rem; border-radius: 0.7rem; border: 1px solid var(--border); background: var(--elevated); font-size: 0.88rem; cursor: pointer; }
.check input { accent-color: var(--accent); }

/* ---------- Schema builder ---------- */
.builder-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.builder-head h2 { font-size: 1.6rem; font-weight: 700; }
.builder-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.day-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 1.25rem 0 1rem; }
.day-tab { padding: 0.55rem 1rem; border-radius: 0.7rem; border: 1px solid var(--border); background: var(--elevated); color: var(--muted); font-size: 0.88rem; font-weight: 600; cursor: pointer; }
.day-tab.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.day-toolbar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.day-toolbar .input { max-width: 22rem; }

.ex-table { display: flex; flex-direction: column; gap: 0.5rem; }
.ex-head { display: none; }
.ex-row { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: 0.8rem; background: var(--elevated); }
.ex-reorder { display: flex; flex-direction: column; gap: 0.15rem; }
.ex-reorder button { width: 1.9rem; height: 1.5rem; border: 1px solid var(--border); border-radius: 0.4rem; background: var(--surface); color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.ex-reorder button:hover { color: var(--accent); border-color: var(--accent); }
.ex-fields { display: grid; grid-template-columns: 1fr; gap: 0.5rem; }
.ex-grid { display: grid; grid-template-columns: repeat(2, 1fr) auto; gap: 0.5rem; align-items: center; }
.ex-grid .input { height: 2.5rem; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); animation: rise 0.2s ease both; }
.modal { width: 100%; max-width: 40rem; max-height: 90vh; overflow-y: auto; border-radius: 1.25rem; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-card); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1.15rem 1.4rem; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 1.15rem; font-weight: 700; }
.modal-body { padding: 1.4rem; display: flex; flex-direction: column; gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 0.5rem; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 1.5rem; z-index: 60; transform: translate(-50%, 1rem); max-width: 90vw; padding: 0.85rem 1.25rem; border-radius: 0.8rem; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); font-size: 0.9rem; font-weight: 600; box-shadow: var(--shadow-card); opacity: 0; transition: opacity 0.3s ease, transform 0.3s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
.menu-btn { display: inline-flex; }
@media (min-width: 640px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .ex-fields { grid-template-columns: 1.4fr 1fr; }
}
.brand-logo { display: inline-flex; align-items: center; justify-content: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 2px solid var(--accent); color: var(--accent); font-weight: 800; }
.toolbar { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.toolbar .search { flex: 1 1 220px; }
.toolbar .select { max-width: 13rem; }
.list-row [data-del]:hover { color: var(--danger); background: var(--danger-soft); }

@media (min-width: 900px) {
  .overview { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1280px) {
  .overview { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
  .sidebar, .sidebar.closed { position: sticky; top: 0; height: 100vh; transform: none; }
  .main { margin-left: 0; min-width: 0; }
  .menu-btn { display: none; }
  .backdrop { display: none; }
  .stats { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1320px) {
  .stats { grid-template-columns: repeat(6, 1fr); }
}

/* ---- Food item action buttons ---- */
.item-actions { display: flex; gap: 0.6rem; margin-top: 0.85rem; flex-wrap: wrap; }
.item-actions .btn { flex: 1; min-width: 12rem; }

/* ---- Food search (Open Food Facts) modal ---- */
.food-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 1rem 1rem; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(4px);
}
.food-overlay.hidden { display: none; }
.food-modal {
  width: 100%; max-width: 34rem; max-height: 84vh; display: flex; flex-direction: column;
  padding: 1.35rem; border-radius: 1.25rem; background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-card);
}
.food-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.85rem; }
.food-head h3 { margin: 0; font-size: 1.05rem; }
.food-hint { font-size: 0.78rem; margin: 0.5rem 0 0.75rem; }
.food-results { overflow-y: auto; display: flex; flex-direction: column; gap: 0.55rem; }
.food-status { text-align: center; padding: 1.5rem 0; font-size: 0.9rem; }
.food-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.75rem 0.85rem; border: 1px solid var(--border); border-radius: 0.85rem; background: var(--elevated);
}
.food-info { min-width: 0; }
.food-name { font-weight: 600; font-size: 0.92rem; }
.food-brand { font-weight: 500; color: var(--muted); font-size: 0.82rem; }
.food-macros { font-size: 0.8rem; color: var(--muted); margin-top: 0.15rem; }
.food-add { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }
.food-grams { width: 4.5rem; text-align: right; }
.food-unit { color: var(--muted); font-size: 0.85rem; margin-right: 0.25rem; }

/* ---- Segmented control (progress metrics) ---- */
.seg { display: inline-flex; gap: 0.25rem; padding: 0.25rem; border-radius: 0.75rem; background: var(--elevated); border: 1px solid var(--border); margin-bottom: 1rem; }
.seg-btn { border: none; background: transparent; color: var(--muted); font: inherit; font-size: 0.85rem; padding: 0.4rem 0.9rem; border-radius: 0.55rem; cursor: pointer; }
.seg-btn.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* ---- Progress ---- */
.prog-latest { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 0.5rem; }
.prog-latest .lbl { color: var(--muted); font-size: 0.85rem; }
.prog-latest .val { font-size: 1.6rem; font-weight: 700; }
.prog-latest .val small { font-size: 0.9rem; color: var(--muted); font-weight: 500; }
.prog-chart { width: 100%; height: 200px; display: block; }
.prog-tags { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.tag { font-size: 0.72rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 0.15rem 0.5rem; border-radius: 999px; }

/* ---- Messages ---- */
.msg-layout { display: grid; grid-template-columns: 280px 1fr; gap: 1rem; min-height: 60vh; }
.msg-list { display: flex; flex-direction: column; gap: 0.3rem; border-right: 1px solid var(--border); padding-right: 0.5rem; max-height: 70vh; overflow-y: auto; }
.msg-conv { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem; border-radius: 0.7rem; border: none; background: transparent; cursor: pointer; text-align: left; width: 100%; }
.msg-conv:hover { background: var(--elevated); }
.msg-conv.active { background: var(--accent-soft); }
.msg-avatar { width: 2.2rem; height: 2.2rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.msg-conv-main { min-width: 0; display: flex; flex-direction: column; }
.msg-conv-name { font-weight: 600; font-size: 0.9rem; display: flex; align-items: center; gap: 0.35rem; }
.msg-conv-sub { font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--accent); display: inline-block; }
.msg-thread-wrap { display: flex; flex-direction: column; min-width: 0; }
.msg-thread-head { font-weight: 700; padding-bottom: 0.6rem; border-bottom: 1px solid var(--border); margin-bottom: 0.6rem; }
.msg-thread { flex: 1; overflow-y: auto; max-height: 60vh; display: flex; flex-direction: column; gap: 0.4rem; padding: 0.3rem; }
.bubble-row { display: flex; }
.bubble-row.mine { justify-content: flex-end; }
.bubble { max-width: 72%; padding: 0.5rem 0.75rem; border-radius: 1rem; background: var(--elevated); font-size: 0.9rem; position: relative; }
.bubble-row.mine .bubble { background: var(--accent); color: #fff; }
.bubble-time { display: block; font-size: 0.65rem; opacity: 0.7; margin-top: 0.2rem; text-align: right; }
.msg-composer { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
.msg-composer .input { flex: 1; }
.notif-row { cursor: pointer; width: 100%; text-align: left; }
@media (max-width: 720px) { .msg-layout { grid-template-columns: 1fr; } .msg-list { border-right: none; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; } }

/* Progress — completed workouts with logged sets */
.prog-sessions-title { font-size: 1rem; font-weight: 600; color: var(--text); }
.prog-ex { padding: 0.5rem 0; border-top: 1px solid var(--border); }
.prog-ex:first-of-type { border-top: none; }
.prog-ex-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.3rem; }
.prog-set { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--muted); padding: 0.12rem 0; }
.prog-set-val { color: var(--accent); font-weight: 600; }

/* Progress — collapsible session cards */
.prog-sess { padding: 0.75rem 1rem; }
.prog-sess > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.prog-sess > summary::-webkit-details-marker { display: none; }
.prog-sess > summary::before { content: "▸"; color: var(--muted); margin-right: 0.5rem; transition: transform 0.15s ease; display: inline-block; }
.prog-sess[open] > summary::before { transform: rotate(90deg); }
.prog-sess-title { font-weight: 600; color: var(--text); }
.prog-sess-meta { color: var(--muted); font-size: 0.85rem; }
.prog-sess-body { margin-top: 0.75rem; }

/* Progress — PR / progress badges */
.pr-badge { display: inline-block; font-size: 0.72rem; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--gold, #d9a441), #b9822d); padding: 0.08rem 0.45rem; border-radius: 999px; margin-left: 0.5rem; vertical-align: middle; }
.up-badge { display: inline-block; font-size: 0.72rem; font-weight: 700; color: #2e7d32; background: rgba(46,125,50,0.12); padding: 0.08rem 0.45rem; border-radius: 999px; margin-left: 0.5rem; vertical-align: middle; }
