/* Kiloops — Portainer-inspired light admin UI */

:root {
  --bg: #f4f5f7;
  --surface: #fff;
  --sidebar-bg: #2f3033;
  --border: #e4e5e7;
  --text: #212529;
  --muted: #6c757d;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --danger: #dc3545;
  --success: #22c55e;
  --warning: #f59e0b;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-w: 40px;
  --sidebar-w-expanded: 154px;
  --topbar-h: 52px;
  --content-max: 1400px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --table-row-alt: #fafbfc;
  --heat-empty: #ebedf0;
  --heat-1: #c6e48b;
  --heat-2: #7bc96f;
  --heat-3: #239a3b;
  --heat-4: #196127;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1115;
  --surface: #1a1d24;
  --sidebar-bg: #12141a;
  --border: #2d3340;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --accent: #3b82f6;
  --accent-soft: #1e3a5f;
  --danger: #f87171;
  --success: #4ade80;
  --warning: #fbbf24;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
  --table-row-alt: #1c212b;
  --heat-empty: #2a303c;
  --heat-1: #3d5c2e;
  --heat-2: #4a7c3f;
  --heat-3: #2d8a47;
  --heat-4: #1f6b34;
}

[data-theme="dark"] .auth-card,
[data-theme="dark"] .card-danger {
  background: var(--surface);
  border-color: var(--border);
}

[data-theme="dark"] .topbar,
[data-theme="dark"] .modal {
  background: var(--surface);
}

[data-theme="dark"] .topbar-search {
  background: var(--bg);
  color: var(--text);
}

[data-theme="dark"] .data-table th {
  background: var(--bg);
}

[data-theme="dark"] .data-table tbody tr:nth-child(even),
[data-theme="dark"] .admin-table tbody tr:nth-child(even) {
  background: var(--table-row-alt);
}

[data-theme="dark"] .data-table tbody tr:hover,
[data-theme="dark"] .admin-table tbody tr:hover {
  background: var(--accent-soft);
}

[data-theme="dark"] .heatmap-day-label {
  color: var(--muted);
}

[data-theme="dark"] .heat-cell {
  border-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .home-mini-calendar-day.l1,
[data-theme="dark"] .home-mini-calendar-day.l2 {
  color: #d9f99d;
}

[data-theme="dark"] .stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
}

[data-theme="dark"] .search-results {
  background: var(--surface);
  border-color: var(--border);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* Typography */
.kicker {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
}

.page-title {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.3;
}

.page-subtitle {
  margin: -8px 0 20px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.highlight {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
}

/* Auth screen */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-md);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.auth-brand h1 {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
}

.auth-brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.logo-mark {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.tabs {
  display: flex;
  gap: 4px;
  margin: 24px 0;
  padding: 3px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.875rem;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* Forms */
.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.field input::placeholder,
.field textarea::placeholder {
  color: #adb5bd;
}

textarea {
  width: 100%;
  min-height: 120px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  resize: vertical;
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  font-size: 0.875rem;
}

.check-row input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.inline-form {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.inline-form input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: inherit;
  font-size: 0.875rem;
}

.inline-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Alerts */
.alert-error {
  padding: 10px 14px;
  border-radius: var(--radius);
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 0.8125rem;
  margin-bottom: 14px;
}

.alert-success {
  padding: 10px 14px;
  border-radius: var(--radius);
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
  font-size: 0.8125rem;
  margin-bottom: 14px;
}

.auth-links {
  margin: 0 0 14px;
  text-align: right;
}

.auth-hint {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.link-btn {
  border: none;
  background: none;
  padding: 0;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-family: inherit;
}

.link-btn:hover {
  color: #1d4ed8;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary,
.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled),
.btn-accent:hover:not(:disabled) {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg);
  border-color: #ced4da;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg);
  color: var(--text);
}

.btn-auto {
  width: auto;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8125rem;
}

.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.btn-stack .btn {
  width: 100%;
}

.btn-stack.horizontal {
  flex-direction: row;
  flex-wrap: wrap;
  max-width: none;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-icon:hover {
  background: var(--bg);
  color: var(--text);
  border-color: #ced4da;
}

.btn-icon.danger {
  color: var(--danger);
}

.btn-icon.danger:hover {
  background: #fef2f2;
  border-color: #fecaca;
}

.btn-start-workout {
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.8125rem;
  cursor: pointer;
  margin-top: auto;
  font-family: inherit;
  transition: background 0.15s;
}

.btn-start-workout:hover {
  background: #1d4ed8;
}

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

/* Icon sidebar */
.icon-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
  transition: width 0.2s ease;
  overflow: hidden;
}

.icon-sidebar.expanded {
  width: var(--sidebar-w-expanded);
}

.icon-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--sidebar-w);
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 6px 0;
}

.icon-sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  cursor: default;
  user-select: none;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  margin: 0;
}

.icon-sidebar.expanded .icon-sidebar-brand {
  flex: 1;
  justify-content: flex-start;
  padding: 0 10px;
  margin: 6px 6px 6px 10px;
  height: 36px;
  font-size: 1.0625rem;
}

.icon-sidebar:not(.expanded) .icon-sidebar-brand {
  width: 32px;
}

.icon-sidebar-foot {
  margin-top: auto;
  flex-shrink: 0;
  width: 100%;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 8px 0;
  display: flex;
  justify-content: center;
}

.icon-sidebar.expanded .icon-sidebar-foot {
  padding: 8px 10px;
}

.sidebar-toggle {
  border: none;
  background: transparent;
  color: #9ca3af;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  border-radius: 8px;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  transition: color 0.15s, background 0.15s;
}

.icon-sidebar.expanded .sidebar-toggle {
  width: 100%;
  height: 36px;
  justify-content: flex-end;
  padding: 0 6px;
}

.sidebar-toggle svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-sidebar.expanded .sidebar-toggle svg {
  transform: rotate(180deg);
}

.sidebar-toggle-label {
  display: none;
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
}

.icon-sidebar.expanded .sidebar-toggle-label {
  display: inline;
}

.sidebar-toggle:hover {
  color: #e5e7eb;
  background: rgba(255, 255, 255, 0.06);
}

.icon-sidebar-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  flex: 1;
  padding: 8px 0;
  gap: 2px;
  overflow-y: auto;
}

.nav-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.icon-sidebar:not(.expanded) .nav-icon {
  justify-content: center;
  padding: 0;
  gap: 0;
}

.nav-label {
  display: none;
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-sidebar.expanded .nav-label {
  display: inline;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-icon:hover {
  color: #e5e7eb;
  background: rgba(255, 255, 255, 0.06);
}

.nav-icon.active {
  color: #fff;
  background: rgba(37, 99, 235, 0.15);
}

.nav-icon.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}

.nav-icon.active svg {
  stroke: #fff;
}

/* Main area & topbar */
.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 0;
}

.topbar-brand {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--text);
}

.topbar-sep {
  color: var(--border);
  font-weight: 300;
}

.topbar-page {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-center {
  flex: 1;
  max-width: 420px;
  margin: 0 auto;
}

.topbar-search-wrap {
  position: relative;
  width: 100%;
}

.topbar-search {
  width: 100%;
  padding: 7px 12px 7px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.656a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") no-repeat 10px center;
  font-family: inherit;
  font-size: 0.8125rem;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.topbar-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  background-color: var(--surface);
}

.topbar-search::placeholder {
  color: #adb5bd;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(420px, 60vh);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  z-index: 200;
  padding: 8px 0;
}

.search-results-section {
  padding: 4px 0;
}

.search-results-section + .search-results-section {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 8px;
}

.search-results-label {
  padding: 4px 14px 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.search-result-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 8px 14px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
}

.search-result-item:hover,
.search-result-item.active {
  background: var(--accent-soft);
}

.search-result-item strong {
  display: block;
  font-size: 0.8125rem;
}

.search-result-item span {
  display: block;
  font-size: 0.6875rem;
  color: var(--muted);
  margin-top: 2px;
}

.search-results-empty {
  padding: 12px 14px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
}

.topbar-user-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.3;
  padding-right: 2px;
}

.topbar-user-text > span:first-child {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.topbar-user-text .sync-meta {
  font-size: 0.6875rem;
}

.header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* Main content */
.main-content {
  flex: 1;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 24px 28px 40px;
  width: 100%;
}

.page {
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Page header bar */
.page-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.page-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.page-toolbar {
  margin-bottom: 16px;
}

/* Panels & cards */
.panel,
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.panel-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.panel > #home-heatmap,
.panel > #home-mini-calendar,
.panel > #home-upcoming,
.panel > .inline-form,
.panel > .alert-error,
.panel > .sync-meta,
.panel > .feedback-list,
.panel > .admin-exercises-toolbar,
.panel > .user-profile-tab-panel {
  padding: 16px 18px;
}

.panel > .table-wrap {
  /* full-bleed table inside panel */
}

.panel > .inline-form + .alert-error {
  padding-top: 0;
  margin-top: -8px;
}

.card {
  padding: 20px;
}

.card-danger {
  border-color: #fecaca;
  background: #fffbfb;
}

.card-danger .kicker {
  color: var(--danger);
}

/* Data tables */
.table-wrap {
  overflow-x: auto;
}

.data-table,
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead,
.admin-table thead {
  background: var(--bg);
}

.data-table th,
.data-table td,
.admin-table th,
.admin-table td {
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table th,
.admin-table th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}

.data-table tbody tr:nth-child(even),
.admin-table tbody tr:nth-child(even) {
  background: var(--table-row-alt);
}

.data-table tbody tr:hover,
.admin-table tbody tr:hover {
  background: var(--accent-soft);
}

.data-table tbody tr:last-child td,
.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.table-row {
  cursor: pointer;
  transition: background 0.1s;
}

.table-empty td {
  text-align: center;
  color: var(--muted);
  padding: 32px 16px !important;
  font-style: italic;
}

.col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right !important;
  vertical-align: middle;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.table-actions .btn-icon {
  width: 28px;
  height: 28px;
  font-size: 0.8125rem;
}

/* Status pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.status-pill.success {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.status-pill.warning {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.status-pill.danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.status-pill.official {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.status-pill.public {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.status-pill.neutral {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
}

/* Chips */
.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
}

.chip-admin {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}

.chip-public {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
  font-size: 0.625rem;
  vertical-align: middle;
}

.chip-official {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #bfdbfe;
  font-size: 0.625rem;
  vertical-align: middle;
}

.chip-personal {
  background: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
  font-size: 0.625rem;
  margin-left: 6px;
}

.chip-bug {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.chip-feature {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #bfdbfe;
}

.chip-filter {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: inherit;
  padding: 5px 12px;
  font-size: 0.75rem;
}

.chip-filter:hover {
  border-color: #ced4da;
  background: var(--bg);
}

.chip-filter.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.chip-tag {
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.6875rem;
  margin-top: 4px;
}

.template-tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.template-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

/* Home layout */
.layout-home {
  display: grid;
  grid-template-columns: 1fr minmax(320px, 400px);
  gap: 20px;
  align-items: start;
}

.home-in-progress {
  margin-bottom: 12px;
}

.home-in-progress.hidden {
  display: none;
}

.layout-home-main,
.layout-home-side {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.home-friends-feed {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 18px 18px;
}

.home-friends-empty {
  margin: 0;
  padding: 8px 0 4px;
}

.home-friend-card {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.home-friend-card:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.home-friend-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.home-friend-head .user-profile-link-block {
  align-items: center;
}

.home-friend-head .user-profile-link-block .header-avatar {
  width: 40px;
  height: 40px;
  font-size: 0.85rem;
}

.home-friend-workouts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.home-friend-workouts li {
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.home-friend-workouts li strong {
  display: block;
  font-size: 0.8125rem;
  margin-bottom: 2px;
}

#home-friends-panel > .panel-head,
#home-calendar-panel > .panel-head,
#home-upcoming-panel > .panel-head {
  padding: 16px 18px 12px;
}

.home-mini-calendar-day-planned {
  box-shadow: inset 0 0 0 2px rgba(0, 102, 204, 0.45);
}

.home-upcoming {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.home-upcoming-empty {
  margin: 0;
  padding: 4px 0;
}

.home-upcoming-day {
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.home-upcoming-day:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.home-upcoming-date {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.home-upcoming-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.home-upcoming-item {
  width: 100%;
  text-align: left;
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
  padding: 8px 10px;
  cursor: pointer;
}

.home-upcoming-item strong {
  display: block;
  font-size: 0.8125rem;
  margin-bottom: 2px;
}

.home-mini-calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 8px;
}

.home-mini-calendar-label {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.home-mini-calendar-label:hover {
  color: var(--accent);
}

.home-mini-calendar-weekdays {
  display: grid;
  grid-template-columns: 24px repeat(7, 1fr);
  gap: 3px;
  margin-bottom: 4px;
}

.home-mini-calendar-weekdays span {
  text-align: center;
  font-size: 0.5625rem;
  font-weight: 600;
  color: var(--muted);
}

.home-mini-calendar-grid {
  display: grid;
  grid-template-columns: 24px repeat(7, 1fr);
  gap: 3px;
}

.home-mini-calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: 4px;
  min-width: 0;
  cursor: default;
}

.home-mini-calendar-day-empty {
  visibility: hidden;
}

.home-mini-calendar-day-today {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.home-mini-calendar-day.l0 {
  color: var(--muted);
}

.home-mini-calendar-day.l1,
.home-mini-calendar-day.l2 {
  color: #1a3d0a;
}

.home-mini-calendar-day.l3,
.home-mini-calendar-day.l4 {
  color: #fff;
}

/* Heatmap — light green scale */
.heatmap-body {
  display: grid;
  grid-template-columns: 2.25rem repeat(var(--heatmap-weeks, 12), minmax(0, 1fr));
  grid-template-rows: repeat(7, minmax(0, 1fr));
  gap: 3px;
  width: 100%;
}

.heatmap-day-label {
  font-size: 0.625rem;
  font-weight: 400;
  color: #d1d5db;
  text-align: right;
  padding-right: 4px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  line-height: 1;
  user-select: none;
}

.heat-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--heat-empty);
  min-width: 0;
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.heat-cell.l1 { background: var(--heat-1); border-color: rgba(0, 0, 0, 0.06); }
.heat-cell.l2 { background: var(--heat-2); border-color: rgba(0, 0, 0, 0.06); }
.heat-cell.l3 { background: var(--heat-3); border-color: rgba(0, 0, 0, 0.08); }
.heat-cell.l4 { background: var(--heat-4); border-color: rgba(0, 0, 0, 0.1); }

/* Calendar month grid */
.calendar-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.calendar-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.calendar-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-month-label {
  min-width: 140px;
  text-align: center;
  font-weight: 600;
  font-size: 0.9375rem;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 18px 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.calendar-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.calendar-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.calendar-legend-swatch.own {
  background: var(--accent);
}

.calendar-legend-swatch.friend {
  background: #7c3aed;
}

.calendar-mount {
  padding: 12px 18px 18px;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}

.calendar-weekdays.calendar-weekdays-with-weeks {
  grid-template-columns: 44px repeat(7, 1fr);
}

.calendar-week-col,
.calendar-week-num {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--muted);
}

.calendar-week-num {
  align-self: stretch;
  font-size: 0.625rem;
  font-weight: 700;
}

.calendar-week-num-mini {
  font-size: 0.5rem;
  align-self: center;
  border: none;
  background: transparent;
  padding: 0;
}

.calendar-weekdays span {
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 4px 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-grid.calendar-grid-with-weeks {
  grid-template-columns: 44px repeat(7, 1fr);
}

.calendar-cell {
  min-height: 96px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calendar-cell-empty {
  background: var(--surface);
  border-style: dashed;
  opacity: 0.45;
}

.calendar-cell-today {
  border-color: var(--accent);
}

.calendar-plan-btn-spacer {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.calendar-legend-swatch.planned {
  background: transparent;
  border: 1px dashed var(--accent);
}

.calendar-day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.calendar-plan-btn {
  border: none;
  background: var(--accent-soft);
  color: var(--accent);
  width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: 0.875rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.calendar-plan-btn:hover {
  background: var(--accent);
  color: #fff;
}

.calendar-workout-planned {
  background: transparent;
  border: 1px dashed var(--accent);
  color: var(--accent);
}

.calendar-workout-planned:hover {
  background: var(--accent-soft);
}

.danger-text {
  color: var(--danger);
}

.calendar-day-num {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.calendar-day-workouts {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
}

.calendar-workout {
  border: none;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 0.6875rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(0, 102, 204, 0.12);
  color: var(--accent);
}

.calendar-workout:hover {
  background: rgba(0, 102, 204, 0.2);
}

.calendar-workout-friend {
  background: rgba(124, 58, 237, 0.12);
  color: #6d28d9;
}

.calendar-workout-friend:hover {
  background: rgba(124, 58, 237, 0.2);
}

.calendar-more {
  font-size: 0.625rem;
  color: var(--muted);
  padding-left: 4px;
}

@media (max-width: 900px) {
  .calendar-cell {
    min-height: 72px;
  }

  .calendar-workout {
    font-size: 0.625rem;
    padding: 2px 4px;
  }
}

.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 12px;
  font-size: 0.6875rem;
  color: var(--muted);
}

.heatmap-legend .heat-cell {
  width: 12px;
  height: 12px;
}

/* Workout pills (legacy list items) */
.workout-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  margin-bottom: 8px;
}

.workout-pill:last-child {
  margin-bottom: 0;
}

.workout-pill:hover {
  background: var(--accent-soft);
  border-color: #bfdbfe;
}

.workout-pill-body {
  flex: 1;
  min-width: 0;
}

.workout-pill .wp-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.workout-pill strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
}

.workout-pill .meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.workout-pill-del {
  flex-shrink: 0;
  opacity: 0.5;
}

.workout-pill:hover .workout-pill-del {
  opacity: 1;
}

/* Empty state */
.empty-box {
  text-align: center;
  padding: 40px 24px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.empty-box .empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  color: var(--muted);
}

.empty-box h3 {
  margin: 0 0 6px;
  font-size: 0.9375rem;
  font-weight: 600;
}

.empty-box p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

/* Templates */
.templates-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#templates-list .folder-block {
  margin-bottom: 0;
}

.folder-block {
  margin-bottom: 28px;
}

.folder-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 0 16px 8px;
  border-bottom: 1px solid var(--border);
}

.folder-head .folder-icon {
  font-size: 1rem;
}

.folder-head h3 {
  margin: 0;
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 600;
}

.folder-count {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
}

.folder-templates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.template-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.template-card:hover {
  border-color: #ced4da;
  box-shadow: var(--shadow-sm);
}

.template-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 8px;
}

.template-card-head h4 {
  margin: 0 0 4px;
  font-size: 0.9375rem;
  font-weight: 600;
}

.template-meta {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}

.template-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.exercise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 6px;
  margin-bottom: 12px;
  flex: 1;
}

.exercise-chip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  font-size: 0.6875rem;
}

.exercise-chip strong {
  display: block;
  margin-bottom: 2px;
  line-height: 1.2;
  font-weight: 600;
}

.exercise-chip span {
  color: var(--muted);
}

/* Stats */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat-row-4 {
  grid-template-columns: repeat(4, 1fr);
}

.stat-row-2 {
  grid-template-columns: repeat(2, 1fr);
}

.stat-row-3 {
  grid-template-columns: repeat(3, 1fr);
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}

.stat-box .label {
  font-size: 0.6875rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.stat-box .value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 4px;
  line-height: 1.1;
}

.layout-stats-charts {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.muscles-period-toggle {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.muscles-chart-type-toggle {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.muscles-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.muscles-metric-toggle {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.muscles-section {
  margin-bottom: 28px;
}

.muscles-section-title {
  margin: 0 0 14px;
  font-size: 0.9375rem;
  font-weight: 600;
}

.muscles-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.muscle-chart-card {
  padding: 16px 18px;
}

.muscle-chart-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.muscle-chart-head-text {
  flex: 1;
  min-width: 0;
}

.muscle-chart-head-text strong {
  display: block;
  font-size: 0.9375rem;
}

.muscle-chart-name-btn {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.muscle-chart-name-btn:hover strong {
  color: var(--accent);
}

.muscle-exercises-subtitle {
  margin: 0 0 12px;
}

.muscle-exercise-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(60vh, 420px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.muscle-exercise-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.muscle-exercise-item .muscle-icon,
.muscle-exercise-item .muscle-icon-placeholder {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.muscle-exercise-item-text {
  min-width: 0;
  flex: 1;
}

.muscle-exercise-item-text strong {
  display: block;
  font-size: 0.875rem;
}

.muscle-exercise-badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.muscle-chart-total {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.muscle-icon-lg {
  width: 44px;
  height: 44px;
}

.muscle-icon-placeholder.muscle-icon-lg {
  width: 44px;
  height: 44px;
}

.muscle-bar-chart {
  height: auto;
  align-items: stretch;
  gap: 4px;
}

.muscle-bar-chart .bar-col {
  height: auto;
  gap: 4px;
}

.muscle-bar-chart .bar-plot {
  height: 100px;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.muscle-bar-chart .bar {
  flex-shrink: 0;
}

.muscle-bar-chart-dense {
  gap: 2px;
}

.muscle-bar-chart-dense .bar {
  max-width: 20px;
}

.muscle-bar-chart-dense .bar-label {
  font-size: 0.5rem;
  letter-spacing: -0.02em;
}

.muscle-bar {
  background: #7c3aed;
  opacity: 0.85;
}

.muscle-bar-current {
  background: var(--accent);
  opacity: 1;
}

.muscle-bar-current-empty {
  height: 4px !important;
}

.bar-label-current {
  color: var(--accent);
  font-weight: 700;
}

.muscle-line-dot-current {
  fill: var(--accent);
  stroke: #fff;
}

.muscle-chart-axis-label-current {
  fill: var(--accent);
  font-weight: 700;
}

.muscle-chart-body {
  min-height: 120px;
}

.muscle-line-chart {
  width: 100%;
  height: auto;
  display: block;
}

.muscle-chart-grid-line {
  stroke: var(--border);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.muscle-line-path {
  fill: none;
  stroke: #7c3aed;
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.muscle-line-dot {
  fill: #7c3aed;
  stroke: #fff;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.muscle-chart-axis-label {
  fill: var(--muted);
  font-size: 9px;
}

.muscle-chart-dense .muscle-chart-axis-label {
  font-size: 7px;
}

.muscles-empty {
  padding: 24px 18px;
  color: var(--muted);
  font-size: 0.875rem;
  grid-column: 1 / -1;
}

.changelog-entry-body ul {
  margin: 0 0 12px;
  padding-left: 1.25rem;
}

.changelog-entry-body li {
  margin-bottom: 6px;
}

.exercise-detail-chart-panel {
  padding: 16px 18px;
}

.exercise-detail-chart-title {
  margin: 0 0 12px;
}

.exercise-weight-chart {
  overflow-x: auto;
  height: auto;
  align-items: stretch;
  gap: 4px;
  padding-bottom: 4px;
}

.exercise-weight-chart .bar-col {
  height: auto;
  gap: 4px;
}

.exercise-weight-chart .bar-plot {
  height: 160px;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.exercise-weight-chart .bar {
  flex-shrink: 0;
}

.exercise-weight-chart-dense {
  gap: 2px;
}

.exercise-weight-chart-dense .bar-col {
  flex: 0 0 28px;
  min-width: 28px;
}

.exercise-weight-chart-dense .bar {
  max-width: 20px;
}

.exercise-weight-chart-dense .bar-label {
  font-size: 0.65rem;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
}

.bar-chart-tall {
  height: 180px;
}

.stats-bar-plot {
  height: 140px;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.stats-bar-plot .bar {
  flex-shrink: 0;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.bar {
  width: 100%;
  max-width: 36px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  opacity: 0.85;
  transition: opacity 0.15s;
}

.bar-col:hover .bar {
  opacity: 1;
}

.bar-label {
  font-size: 0.625rem;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Settings */
.layout-settings {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 24px;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.profile-row {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 4px;
}

.profile-avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.25rem;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid var(--border);
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius);
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin: 12px 0 6px;
}

.sync-meta {
  font-size: 0.8125rem;
  color: var(--muted);
}

.settings-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
  margin: 24px 0 12px;
}

/* Admin */
.admin-panel {
  margin-top: 8px;
}

.admin-exercises-panel {
  margin-top: 8px;
}

.admin-exercises-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.admin-exercises-toolbar input[type="search"] {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8125rem;
}

.admin-exercises-toolbar input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.admin-exercises-toolbar select {
  min-width: 150px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8125rem;
}

.admin-exercises-toolbar select:focus {
  outline: none;
  border-color: var(--accent);
}

.admin-pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 14px;
  flex-wrap: wrap;
}

.admin-pagination .btn {
  min-width: 36px;
  padding: 6px 10px;
}

.admin-pagination span {
  color: var(--muted);
  font-size: 0.8125rem;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.modal h3 {
  margin: 0 0 18px;
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Exercise editor */
.exercise-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}

.exercise-block > strong,
.exercise-block > label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.set-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 10px;
}

.set-row-fields {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.set-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
  margin: 0;
}

.set-field-compact {
  flex: 0 1 72px;
}

.set-field-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

.set-row .btn-delete-set {
  flex-shrink: 0;
  align-self: flex-end;
  white-space: nowrap;
}

/* Set type: warm-up, drop set, failure */
.set-type-picker {
  flex-shrink: 0;
  padding-bottom: 1px;
}

.set-tag-toggle {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.set-tag-toggle:hover {
  border-color: #ced4da;
}

.set-tag-toggle.set-tag-normal {
  background: var(--surface);
  border-color: var(--border);
  color: var(--muted);
}

.set-tag-toggle.set-tag-w,
.set-tag-badge.set-tag-w {
  background: #f5a623;
  border-color: #f5a623;
  color: #fff;
}

.set-tag-toggle.set-tag-d,
.set-tag-badge.set-tag-d {
  background: #4a90e2;
  border-color: #4a90e2;
  color: #fff;
}

.set-tag-toggle.set-tag-f,
.set-tag-badge.set-tag-f {
  background: #e74c3c;
  border-color: #e74c3c;
  color: #fff;
}

.set-tag-badge {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1;
}

.set-tag-name {
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
}

.set-tag-name-empty {
  visibility: hidden;
}

.set-summary-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.875rem;
  padding: 4px 0;
}

.set-summary-text {
  color: var(--text);
}

.set-summary-sep {
  color: var(--muted);
}

.set-done {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #b8e986;
}

.set-done.is-done {
  color: #b8e986;
}

.exercise-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.exercise-block-head h4 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.btn-delete-exercise,
.btn-delete-set {
  color: var(--danger);
  white-space: nowrap;
}

.btn-delete-exercise:hover,
.btn-delete-set:hover {
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
}

.workout-session-exercise-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.workout-session-exercise-top .exercise-autocomplete {
  flex: 1;
  min-width: 0;
}

.set-row input,
.set-field input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8125rem;
  width: 100%;
  min-width: 0;
}

.set-row input:focus,
.set-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.exercise-search-filters {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 12px;
  margin-bottom: 16px;
  align-items: end;
}

.exercise-filter-action .btn {
  width: 100%;
  white-space: nowrap;
}

/* Exercise autocomplete */
.exercise-autocomplete {
  position: relative;
}

.exercise-name-input {
  width: 100%;
}

.exercise-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 240px;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

.exercise-suggestion {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-family: inherit;
  font-size: 0.8125rem;
}

.exercise-suggestion-layout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.muscle-icon-suggestion {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.exercise-thumb-suggestion {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.exercise-detail-hero {
  margin: 0 0 16px;
  max-width: 320px;
}

.exercise-detail-image {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.muscle-icon-placeholder {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 4px;
  background: var(--bg);
  border: 1px dashed var(--border);
}

.exercise-suggestion-body {
  flex: 1;
  min-width: 0;
}

.exercise-suggestion-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.exercise-suggestion-title strong {
  font-size: 0.8125rem;
  font-weight: 600;
}

.exercise-suggestion-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 2px;
}

.chip-catalog {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.workout-session-exercise-filters {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.workout-session-exercise .exercise-autocomplete {
  margin-bottom: 6px;
}

.workout-session-exercise .exercise-suggestions {
  z-index: 40;
}

.exercise-suggestion:last-child {
  border-bottom: none;
}

.exercise-suggestion:hover,
.exercise-suggestion.active {
  background: var(--accent-soft);
}

.exercise-suggestion .exercise-muscles {
  margin-top: 4px;
}

.exercise-suggestion strong {
  display: inline;
  font-size: 0.8125rem;
  font-weight: 600;
}

.exercise-suggestion span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 1px;
}

/* Social layout */
.layout-social {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.social-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.social-catalogue-card {
  margin-bottom: 16px;
}

.social-detail-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 0;
}

.social-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 0;
  padding: 3px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.social-tabs .tab {
  flex: unset;
  padding: 6px 14px;
  font-size: 0.8125rem;
}

.social-user-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.social-user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.social-user-row:last-child {
  border-bottom: none;
}

.folder-panel-head {
  flex-wrap: wrap;
  gap: 10px;
}

.folder-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.folder-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

.folder-public-toggle {
  margin: 0;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.topbar-changelog-btn {
  flex-shrink: 0;
}

.theme-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
}

.theme-switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.theme-switch-track {
  position: relative;
  display: block;
  width: 56px;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  border: 1px solid var(--border);
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.theme-switch-input:checked + .theme-switch-track {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color: #334155;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}

.theme-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.04);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.35s ease;
}

.theme-switch-input:checked + .theme-switch-track .theme-switch-thumb {
  transform: translateX(26px);
  background: #f8fafc;
}

.theme-switch-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f59e0b;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-switch-icon svg {
  width: 14px;
  height: 14px;
}

.theme-switch-sun {
  left: 7px;
  opacity: 1;
  transform: translateY(-50%) rotate(0deg) scale(1);
}

.theme-switch-moon {
  right: 7px;
  opacity: 0.35;
  color: #94a3b8;
  transform: translateY(-50%) rotate(-30deg) scale(0.85);
}

.theme-switch-input:checked + .theme-switch-track .theme-switch-sun {
  opacity: 0.35;
  transform: translateY(-50%) rotate(90deg) scale(0.85);
}

.theme-switch-input:checked + .theme-switch-track .theme-switch-moon {
  opacity: 1;
  color: #e2e8f0;
  transform: translateY(-50%) rotate(0deg) scale(1);
}

.theme-switch:hover .theme-switch-track {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06), 0 0 0 2px var(--accent-soft);
}

.theme-switch-input:checked + .theme-switch-track:hover {
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4), 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.theme-switch-input:focus-visible + .theme-switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.changelog-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.changelog-entry {
  padding: 0;
  overflow: hidden;
}

.changelog-entry-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.changelog-entry-title {
  margin: 0 0 4px;
  font-size: 1.0625rem;
}

.changelog-entry-date {
  margin: 0;
}

.changelog-entry-body {
  padding: 16px 18px 20px;
  font-size: 0.9375rem;
  line-height: 1.55;
}

.changelog-entry-body p {
  margin: 0 0 12px;
}

.changelog-entry-body p:last-child {
  margin-bottom: 0;
}

.changelog-entry-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.changelog-empty {
  margin: 0;
  padding: 8px 0;
}

.social-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* User profile links & page */
.user-profile-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
  max-width: 100%;
}

.user-profile-link:hover strong,
.user-profile-link:focus-visible strong {
  color: var(--accent);
}

.user-profile-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius);
}

.user-profile-link-block {
  width: 100%;
}

.user-profile-link-inline {
  display: inline-flex;
  padding: 0;
  margin: 0 0 8px;
  color: var(--muted);
}

.user-profile-link-inline strong {
  font-weight: 600;
}

.topbar-user[data-user-profile] {
  cursor: pointer;
  border-radius: var(--radius);
  padding: 4px 6px;
  margin: -4px -6px;
}

.topbar-user[data-user-profile]:hover {
  background: var(--bg);
}

.user-profile-back {
  margin-right: 8px;
}

.user-profile-card .user-profile-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 22px;
}

.user-profile-head-text {
  min-width: 0;
  flex: 1;
}

.user-profile-name {
  margin: 0 0 4px;
  font-size: 1.25rem;
  font-weight: 700;
}

.user-profile-bio {
  margin: 0 0 8px;
  white-space: pre-wrap;
  line-height: 1.45;
}

.exercise-history-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.exercise-history-link:hover strong,
.exercise-history-link:focus-visible strong {
  color: var(--accent);
}

.exercise-history-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.user-profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.user-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.user-profile-content .user-profile-tabs {
  margin: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
}

.user-profile-tab-panel {
  padding: 16px 18px 20px;
}

.user-profile-tab-empty {
  margin: 0;
}

.user-profile-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px 24px;
  margin: 0;
}

.user-profile-fact {
  margin: 0;
}

.user-profile-fact dt {
  margin: 0 0 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.user-profile-fact dd {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
}

.user-profile-workout-row:hover td {
  background: var(--accent-soft);
}

.social-user-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.social-template-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.social-template-row:last-child {
  border-bottom: none;
}

.official-template-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.friends-avatar-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.friend-avatar-box {
  position: relative;
  width: 48px;
  height: 48px;
}

.friend-avatar-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-family: inherit;
  font-size: 0.875rem;
  transition: border-color 0.15s;
}

.friend-avatar-btn:hover {
  border-color: var(--accent);
}

.friend-avatar-remove {
  display: none;
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.friend-avatar-box:hover .friend-avatar-remove {
  display: block;
}

/* Feedback */
.feedback-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.feedback-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.feedback-item:last-child {
  border-bottom: none;
}

.feedback-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.feedback-item-body {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.55;
  color: var(--text);
  font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .layout-home {
    grid-template-columns: 1fr;
  }

  .layout-stats-charts {
    grid-template-columns: 1fr;
  }

  .layout-settings {
    grid-template-columns: 1fr;
  }

  .stat-row,
  .stat-row-3,
  .stat-row-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .layout-social {
    grid-template-columns: 1fr;
  }

  .exercise-search-filters {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .topbar {
    padding: 0 12px;
    gap: 10px;
  }

  .topbar-center {
    display: none;
  }

  .topbar-user-text {
    display: none;
  }

  .main-content {
    padding: 16px;
  }

  .page-header-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .stat-row,
  .stat-row-3,
  .stat-row-4 {
    grid-template-columns: 1fr 1fr;
  }

  .folder-templates {
    grid-template-columns: 1fr;
  }

  .set-row {
    flex-wrap: wrap;
  }

  .set-row-fields {
    width: 100%;
  }

  .set-row .btn-delete-set {
    margin-left: auto;
  }

  .workout-set-row {
    flex-wrap: wrap;
  }

  .workout-set-main {
    width: calc(100% - 28px);
  }

  .workout-set-row .btn-delete-set {
    margin-left: auto;
  }
}

@media (max-width: 480px) {
  .stat-row,
  .stat-row-3,
  .stat-row-4 {
    grid-template-columns: 1fr;
  }

  .page-header-actions {
    width: 100%;
  }

  .page-header-actions .btn {
    flex: 1;
  }

  .exercise-search-filters {
    grid-template-columns: 1fr;
  }
}

.calendar-friend-legend {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 12px;
}

.calendar-friend-legend.hidden {
  display: none;
}

.exercise-muscles {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.muscle-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: block;
  flex-shrink: 0;
}

.exercise-muscle-text {
  font-size: 0.75rem;
  color: var(--muted);
}

.workout-session {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--surface);
  display: flex;
  flex-direction: column;
}

.workout-session.hidden {
  display: none;
}

body.workout-session-open {
  overflow: hidden;
}

.workout-session-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.workout-session-name {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
}

.workout-session-timer {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  min-width: 72px;
  text-align: right;
}

.workout-session-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
}

.workout-session-exercise {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 14px;
}

.workout-session-exercise-head {
  margin-bottom: 12px;
}

.workout-session-sets {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.workout-set-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.workout-set-main {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.workout-set-row > input[type="checkbox"] {
  align-self: center;
  margin-bottom: 8px;
}

.workout-set-row .btn-delete-set {
  flex-shrink: 0;
  align-self: flex-end;
  white-space: nowrap;
}

.workout-set-unit {
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
  padding-bottom: 8px;
}

.workout-set-done {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: transparent;
  min-width: 36px;
  text-align: right;
}

.workout-set-done.is-done {
  color: #b8e986;
}

.workout-set-row input[type="number"] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
}

.workout-session-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
