/* X FIT — Yekan Bakh FaNum (self-hosted woff2) */
@font-face {
  font-family: "Yekan Bakh FaNum";
  font-style: normal;
  font-weight: 100;
  font-display: swap;
  src: url("../fonts/yekan-bakh/YekanBakhFaNum-Thin.woff2") format("woff2");
}

@font-face {
  font-family: "Yekan Bakh FaNum";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("../fonts/yekan-bakh/YekanBakhFaNum-Light.woff2") format("woff2");
}

@font-face {
  font-family: "Yekan Bakh FaNum";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/yekan-bakh/YekanBakhFaNum-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "Yekan Bakh FaNum";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/yekan-bakh/YekanBakhFaNum-SemiBold.woff2") format("woff2");
}

@font-face {
  font-family: "Yekan Bakh FaNum";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/yekan-bakh/YekanBakhFaNum-Bold.woff2") format("woff2");
}

@font-face {
  font-family: "Yekan Bakh FaNum";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/yekan-bakh/YekanBakhFaNum-ExtraBold.woff2") format("woff2");
}

@font-face {
  font-family: "Yekan Bakh FaNum";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("../fonts/yekan-bakh/YekanBakhFaNum-Black.woff2") format("woff2");
}

@font-face {
  font-family: "Yekan Bakh FaNum";
  font-style: normal;
  font-weight: 950;
  font-display: swap;
  src: url("../fonts/yekan-bakh/YekanBakhFaNum-ExtraBlack.woff2") format("woff2");
}

:root {
  --bg: #0a0a0b;
  --surface: #111113;
  --surface-2: #16161a;
  --border: rgba(192, 198, 210, 0.18);
  --border-strong: rgba(192, 198, 210, 0.32);
  --text: #f4f4f5;
  --muted: #9ca3af;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.14);
  --silver: #c0c6d2;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #ca8a04;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 40px rgba(0, 0, 0, 0.45);
  --sidebar-w-expanded: 260px;
  --sidebar-w-collapsed: 72px;
  --sidebar-w: var(--sidebar-w-expanded);
  --topbar-h: 56px;
  --font: "Yekan Bakh FaNum", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --body-gradient: radial-gradient(1200px 600px at 20% -10%, rgba(37, 99, 235, 0.12), transparent);
  --sidebar-bg: linear-gradient(180deg, #050506 0%, #0c0c0e 100%);
  --overlay-bg: rgba(0, 0, 0, 0.55);
  --topbar-bg: rgba(10, 10, 11, 0.72);
  --nav-hover-bg: rgba(255, 255, 255, 0.04);
  --nav-active-icon: #93c5fd;
  --surface-hover: rgba(255, 255, 255, 0.04);
  --brand-mark-logo-bg: rgba(255, 255, 255, 0.06);
  --modal-backdrop: rgba(0, 0, 0, 0.55);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f1f2f4;
  --surface: #ffffff;
  --surface-2: #e8eaee;
  --border: rgba(15, 23, 42, 0.14);
  --border-strong: rgba(15, 23, 42, 0.24);
  --text: #0f172a;
  --muted: #3f3f46;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --silver: #475569;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.08);
  --body-gradient: radial-gradient(1200px 600px at 20% -10%, rgba(37, 99, 235, 0.07), transparent);
  --sidebar-bg: linear-gradient(180deg, #ffffff 0%, #f4f6f9 100%);
  --overlay-bg: rgba(15, 23, 42, 0.4);
  --topbar-bg: rgba(255, 255, 255, 0.94);
  --nav-hover-bg: rgba(15, 23, 42, 0.06);
  --nav-active-icon: #1d4ed8;
  --surface-hover: rgba(15, 23, 42, 0.06);
  --brand-mark-logo-bg: rgba(15, 23, 42, 0.05);
  --modal-backdrop: rgba(15, 23, 42, 0.45);
}

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

html {
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--body-gradient), var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
}

img {
  max-width: 100%;
  height: auto;
}

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

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 34;
  background: var(--overlay-bg);
}

.nav-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-inline-end: 1px solid var(--border);
  padding: 1rem 0.75rem;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 40;
  transition: width 0.22s ease, padding 0.22s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.brand-mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #1e3a8a);
  box-shadow: 0 0 0 1px var(--border-strong);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

.brand-mark--logo {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-mark-logo-bg);
  padding: 4px;
  overflow: hidden;
}

.brand-logo-img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  object-position: center;
  border-radius: 6px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1.2;
}

.brand-name {
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 1rem;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--muted);
}

.brand-support-hint {
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 0.65rem;
  padding: 0 0.25rem;
}

.auth-support-hint {
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--muted);
  text-align: center;
  margin: 1rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.brand-settings-preview {
  margin: 0;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-hover);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-inline: 0.05rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.28) transparent;
}

.nav::-webkit-scrollbar {
  width: 5px;
}

.nav::-webkit-scrollbar-track {
  background: transparent;
  margin-block: 0.25rem;
}

.nav::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  border: 1px solid transparent;
  background-clip: padding-box;
}

.nav:hover::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.45);
  background-clip: padding-box;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.nav a:hover {
  color: var(--text);
  background: var(--nav-hover-bg);
}

.nav a.is-active {
  color: var(--text);
  background: var(--accent-soft);
  border-color: rgba(37, 99, 235, 0.35);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  flex-shrink: 0;
  color: var(--muted);
}

.nav-icon svg {
  display: block;
}

.nav a:hover .nav-icon {
  color: var(--silver);
}

.nav a.is-active .nav-icon {
  color: var(--nav-active-icon);
  opacity: 1;
}

.sidebar-footer {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.sidebar-footer-hint {
  overflow: hidden;
}

.sidebar-collapse-btn {
  display: none;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  width: 100%;
  min-height: 40px;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar-collapse-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.sidebar-collapse-icon {
  display: inline-flex;
  flex-shrink: 0;
  transition: transform 0.22s ease;
}

.sidebar-logout-btn {
  width: 100%;
  justify-content: flex-start;
  gap: 0.5rem;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 0.18s ease, max-width 0.22s ease;
  max-width: 12rem;
}

@media (min-width: 901px) {
  .sidebar-collapse-btn {
    display: inline-flex;
  }

  html.sidebar-collapsed {
    --sidebar-w: var(--sidebar-w-collapsed);
  }

  html.sidebar-collapsed .sidebar {
    padding: 0.55rem 0.5rem 1rem;
  }

  html.sidebar-collapsed .brand {
    justify-content: center;
    align-items: center;
    padding: 0.2rem 0.35rem 0.45rem;
    margin-bottom: 0.45rem;
  }

  html.sidebar-collapsed .brand-text {
    display: none;
  }

  html.sidebar-collapsed .sidebar-copyright {
    display: none;
  }

  html.sidebar-collapsed .sidebar-footer-hint,
  html.sidebar-collapsed .nav-label,
  html.sidebar-collapsed .sidebar-collapse-label {
    opacity: 0;
    max-width: 0;
    pointer-events: none;
  }

  html.sidebar-collapsed .nav a {
    justify-content: center;
    padding-inline: 0.5rem;
    gap: 0;
  }

  html.sidebar-collapsed .sidebar-collapse-btn,
  html.sidebar-collapsed .sidebar-logout-btn {
    justify-content: center;
    padding-inline: 0.45rem;
    gap: 0;
  }

  html.sidebar-collapsed .sidebar-collapse-icon {
    transform: scaleX(-1);
  }

  /* Icon-only rail: hide scrollbar; scroll still works (wheel / trackpad) */
  html.sidebar-collapsed .nav {
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-inline: 0;
    margin-inline: -0.05rem;
  }

  html.sidebar-collapsed .nav::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-end {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.topbar-theme-modes {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.topbar-theme-mode {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  line-height: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.topbar-theme-mode:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.topbar-theme-mode.is-active {
  color: var(--text);
  background: var(--accent-soft);
  border-color: rgba(37, 99, 235, 0.35);
}

.topbar-theme-mode:focus {
  outline: none;
}

.topbar-theme-mode:focus-visible {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.topbar-theme-mode svg {
  display: block;
  pointer-events: none;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 700;
}

.topbar-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.topbar-user {
  position: relative;
}

.topbar-user__btn {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.5rem 0.35rem 0.35rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: start;
}

.topbar-user__btn::-webkit-details-marker {
  display: none;
}

.topbar-user__btn:hover,
.topbar-user[open] .topbar-user__btn {
  border-color: var(--border);
  background: var(--surface-hover);
}

.topbar-user__img,
.topbar-user__bubble {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
}

.topbar-user__img {
  object-fit: cover;
  border: 1px solid var(--border);
}

.topbar-user__bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
}

.topbar-user__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
  min-width: 0;
}

.topbar-user__name {
  font-size: 0.88rem;
  font-weight: 600;
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-user__role {
  font-size: 0.72rem;
  color: var(--muted);
}

.topbar-user__menu {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 4px);
  min-width: 11rem;
  padding: 0.35rem;
  border-radius: 0.65rem;
  border: 1px solid var(--border);
  background: var(--surface-2);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  z-index: 50;
}

.topbar-user__item {
  display: block;
  padding: 0.5rem 0.65rem;
  border-radius: 0.45rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
}

.topbar-user__item:hover {
  background: var(--accent-soft);
}

.content {
  padding: 1.25rem;
  max-width: 1200px;
  width: 100%;
  margin-inline: auto;
}

/* Global shell motion: same easing as dashboard (scoped to .content--motion from layout) */
@keyframes xfitTopbarIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .main > .topbar {
    animation: xfitTopbarIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  }

  /* Stagger top-level blocks; skip grids that animate their own children */
  .content--motion > *:not(.dash-stat-grid):not(.dash-page):not(.grid:has(> .dash-chart-card)) {
    animation: dashCardIn 0.52s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  }

  .content--motion > *:not(.dash-stat-grid):not(.dash-page):not(.grid:has(> .dash-chart-card)):nth-child(1) {
    animation-delay: 0.03s;
  }
  .content--motion > *:not(.dash-stat-grid):not(.dash-page):not(.grid:has(> .dash-chart-card)):nth-child(2) {
    animation-delay: 0.07s;
  }
  .content--motion > *:not(.dash-stat-grid):not(.dash-page):not(.grid:has(> .dash-chart-card)):nth-child(3) {
    animation-delay: 0.11s;
  }
  .content--motion > *:not(.dash-stat-grid):not(.dash-page):not(.grid:has(> .dash-chart-card)):nth-child(4) {
    animation-delay: 0.15s;
  }
  .content--motion > *:not(.dash-stat-grid):not(.dash-page):not(.grid:has(> .dash-chart-card)):nth-child(5) {
    animation-delay: 0.19s;
  }
  .content--motion > *:not(.dash-stat-grid):not(.dash-page):not(.grid:has(> .dash-chart-card)):nth-child(6) {
    animation-delay: 0.23s;
  }
  .content--motion > *:not(.dash-stat-grid):not(.dash-page):not(.grid:has(> .dash-chart-card)):nth-child(7) {
    animation-delay: 0.27s;
  }
  .content--motion > *:not(.dash-stat-grid):not(.dash-page):not(.grid:has(> .dash-chart-card)):nth-child(8) {
    animation-delay: 0.31s;
  }
  .content--motion > *:not(.dash-stat-grid):not(.dash-page):not(.grid:has(> .dash-chart-card)):nth-child(9) {
    animation-delay: 0.34s;
  }
  .content--motion > *:not(.dash-stat-grid):not(.dash-page):not(.grid:has(> .dash-chart-card)):nth-child(10) {
    animation-delay: 0.36s;
  }
  .content--motion > *:not(.dash-stat-grid):not(.dash-page):not(.grid:has(> .dash-chart-card)):nth-child(n + 11) {
    animation-delay: 0.38s;
  }
}

/* Mobile nav */
.nav-open-label {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  color: var(--text);
  line-height: 0;
}

.nav-open-label svg {
  display: block;
  opacity: 0.92;
}

@media (max-width: 900px) {
  html.sidebar-collapsed {
    --sidebar-w: var(--sidebar-w-expanded);
  }

  .nav-open-label {
    display: inline-flex;
  }

  body:has(#nav-toggle:checked) {
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: min(var(--sidebar-w), 88vw);
    max-width: 88vw;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-lg, 0 12px 40px rgba(0, 0, 0, 0.45));
  }

  [dir="rtl"] .sidebar {
    transform: translateX(100%);
  }

  .nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    z-index: 35;
    cursor: pointer;
  }

  .nav-toggle:checked ~ .app-shell .nav-overlay {
    display: block;
  }

  .nav-toggle:checked ~ .app-shell .sidebar {
    transform: translateX(0);
  }

  .main {
    width: 100%;
  }
}

/* Cards & tables */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-pad {
  padding: 1rem 1.1rem;
}

.card + .card {
  margin-top: 1rem;
}

/* In grids, spacing comes from `gap`; `.card + .card` would push every card after the
   first in DOM down (in RTL: right column looks “higher” than columns to the left). */
.grid > .card + .card,
.dash-stat-grid > .card + .card {
  margin-top: 0;
}

.grid {
  display: grid;
  gap: 1rem;
  align-items: stretch;
}

@media (min-width: 700px) {
  .grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat {
  padding: 1rem;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 0.15rem;
}

.table-wrap {
  overflow-x: auto;
}

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

table.data th,
table.data td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: start;
  vertical-align: middle;
}

table.data th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: none;
  letter-spacing: 0;
  background: var(--surface-2);
}

table.data tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid var(--border);
  color: var(--muted);
}

.badge.ok {
  color: #bbf7d0;
  border-color: rgba(22, 163, 74, 0.45);
  background: rgba(22, 163, 74, 0.12);
}

.badge.warn {
  color: #fde68a;
  border-color: rgba(202, 138, 4, 0.45);
  background: rgba(202, 138, 4, 0.12);
}

.badge.bad {
  color: #fecaca;
  border-color: rgba(220, 38, 38, 0.45);
  background: rgba(220, 38, 38, 0.12);
}

.badge.neutral {
  color: var(--silver);
  background: rgba(192, 198, 210, 0.08);
}

/* Forms */
label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

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

.form-row {
  display: grid;
  gap: 0.65rem;
}

@media (min-width: 640px) {
  .form-row.inline-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.btn:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
}

.btn-primary {
  background: var(--accent);
  border-color: rgba(37, 99, 235, 0.6);
  color: #fff;
}

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

.btn-ghost {
  background: transparent;
}

.btn-sm {
  padding: 0.35rem 0.55rem;
  font-size: 0.82rem;
}

.btn-danger {
  border-color: rgba(220, 38, 38, 0.45);
  color: #fecaca;
  background: rgba(220, 38, 38, 0.12);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.alert {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(37, 99, 235, 0.1);
  color: var(--text);
  font-size: 0.9rem;
}

.alert.success {
  border-color: rgba(22, 163, 74, 0.45);
  background: rgba(22, 163, 74, 0.12);
}

.alert.error {
  border-color: rgba(220, 38, 38, 0.45);
  background: rgba(220, 38, 38, 0.12);
}

/* Auth page */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  gap: 0;
}

.auth-page__inner {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.auth-site-footer {
  width: 100%;
  max-width: 400px;
  margin-top: 1rem;
  text-align: center;
}

.auth-site-footer__line {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.auth-site-footer__legal {
  margin: 0.35rem 0 0;
  font-size: 0.7rem;
  line-height: 1.55;
}

.auth-site-footer__legal-en {
  margin: 0.25rem 0 0;
  font-size: 0.65rem;
  line-height: 1.45;
  opacity: 0.9;
}

.sidebar-copyright {
  margin: 0 0 0.15rem;
  padding: 0 0.2rem;
  font-size: 0.68rem;
  line-height: 1.45;
  text-align: center;
  opacity: 0.85;
}

.app-copyright-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.app-copyright-footer__line {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

.app-copyright-footer__legal {
  margin: 0.3rem 0 0;
  font-size: 0.68rem;
  line-height: 1.5;
}

@media (min-width: 901px) {
  html:not(.sidebar-collapsed) .app-copyright-footer {
    display: none;
  }
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 1.5rem;
}

.auth-logo {
  text-align: center;
  margin-bottom: 1rem;
}

.auth-brand-mark {
  width: 48px;
  height: 48px;
  margin-inline: auto;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #1e3a8a);
  box-shadow: 0 0 0 1px var(--border-strong);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  color: #fff;
}

.auth-brand-mark--logo {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.5);
  padding: 6px;
  overflow: hidden;
}

.auth-brand-img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  object-position: center;
  border-radius: 8px;
}

.auth-brand-fallback {
  line-height: 1;
}

.h1 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 0.35rem;
}

.h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
}

hr.soft {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
}

.icon-svg {
  flex-shrink: 0;
}

/* Admin sessions — toolbar, athlete strip, Jalali row */
.session-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.session-toolbar .field-grow {
  flex: 1 1 240px;
  min-width: 200px;
}

.session-toolbar .field-check {
  display: flex;
  align-items: flex-end;
  padding-bottom: 0.35rem;
}

.session-toolbar .field-actions {
  flex-shrink: 0;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
}

.session-user-strip {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem 1.25rem;
  align-items: start;
  margin-bottom: 1rem;
}

.session-user-name {
  font-weight: 700;
  font-size: 1.08rem;
}

.session-user-pack {
  text-align: center;
}

.session-user-filter {
  align-self: center;
}

@media (max-width: 720px) {
  .session-user-strip {
    grid-template-columns: 1fr;
  }
  .session-user-pack {
    text-align: start;
  }
  .session-user-filter {
    text-align: start !important;
  }
}

.session-table-card {
  padding: 0;
}

.table-sessions td {
  vertical-align: top;
}

.jalali-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.jalali-group select {
  width: auto;
  min-width: 5.5rem;
  max-width: 100%;
}

.session-note-input {
  min-height: 68px;
  font-size: 0.88rem;
  width: 100%;
}

.session-row-form,
.session-toggle-form {
  margin: 0;
}

.session-empty-footer {
  border-top: 1px solid var(--border);
}

.empty-session-hint {
  border: 1px dashed var(--border-strong);
  background: rgba(255, 255, 255, 0.02);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.workout-type-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.workout-type-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.workout-type-chip {
  display: inline-flex;
  align-items: center;
  margin: 0;
  cursor: pointer;
}

.workout-type-chip input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.workout-type-chip span {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  line-height: 1.35;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.workout-type-chip input:checked + span {
  border-color: rgba(37, 99, 235, 0.55);
  background: rgba(37, 99, 235, 0.18);
  color: var(--text);
  font-weight: 600;
}

.workout-type-chip input:focus-visible + span {
  outline: 2px solid rgba(37, 99, 235, 0.65);
  outline-offset: 2px;
}

.workout-type-hint {
  margin: 0.4rem 0 0;
  font-size: 0.72rem;
  line-height: 1.45;
}

.workout-type-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.workout-type-badge {
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
}

/* Dashboard — layout, hero, sections, motion (respects prefers-reduced-motion) */
.dash-page {
  max-width: 1200px;
  margin-inline: auto;
}

.dash-hero,
.dash-preview-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.65rem 1rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem 0.95rem;
  border-radius: var(--radius);
  border: 1px solid rgba(37, 99, 235, 0.28);
  background: linear-gradient(120deg, rgba(37, 99, 235, 0.14) 0%, rgba(15, 23, 42, 0.35) 45%, rgba(37, 99, 235, 0.08) 100%);
  background-size: 200% 100%;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.dash-hero__body {
  flex: 1 1 min(100%, 18rem);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.dash-hero__lead {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.45;
  font-weight: 650;
  color: var(--text, #e8ecf4);
}

.dash-hero__lead a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.dash-hero__lead a:hover {
  text-decoration-thickness: 2px;
}

.dash-hero__lead--action {
  font-weight: 700;
}

.dash-hero__sep {
  margin-inline: 0.15rem;
  opacity: 0.55;
  font-weight: 500;
}

@media (prefers-reduced-motion: no-preference) {
  .dash-hero {
    animation: dashHeroShift 14s ease-in-out infinite alternate;
  }
}

@keyframes dashHeroShift {
  from {
    background-position: 0% 50%;
  }
  to {
    background-position: 100% 50%;
  }
}

.dash-hero__pill,
.dash-preview-pill {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}

.dash-hero__text {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: 42rem;
}

.dash-section {
  margin-bottom: 1.5rem;
}

.dash-section__head {
  margin-bottom: 0.65rem;
}

.dash-section__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dash-section__title--soft {
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--muted);
}

.dash-section__sub {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
}

/* Shortcuts after hero */
.dash-section--shortcuts .dash-section__head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.15rem;
  margin-bottom: 0.55rem;
}

.dash-section--shortcuts .dash-section__head .dash-section__sub {
  margin: 0;
}

.dash-alert {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin: 0 0 1.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(245, 158, 11, 0.38);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(15, 23, 42, 0.35));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.dash-alert__copy {
  flex: 1 1 14rem;
  min-width: 0;
}

.dash-alert__copy strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  margin-bottom: 0.2rem;
}

.dash-alert__meta {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
}

.dash-alert__cta {
  flex-shrink: 0;
}

/* Primary KPIs: keep athletes + coaches on one row whenever the grid shows ≥2 columns. */
.dash-stat-grid--primary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 960px) {
  .dash-stat-grid--primary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.dash-stat-grid--secondary {
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
}

.dash-stat-grid--secondary .dash-stat .stat-value {
  font-size: 1.28rem;
}

.dash-stat--attention {
  border-color: rgba(202, 138, 4, 0.42);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.12);
}

@media (prefers-reduced-motion: no-preference) {
  .dash-stat--attention {
    animation: dashAttentionGlow 2.8s ease-in-out infinite;
  }
}

@keyframes dashAttentionGlow {
  0%,
  100% {
    border-color: rgba(202, 138, 4, 0.35);
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.08);
  }
  50% {
    border-color: rgba(251, 191, 36, 0.55);
    box-shadow: 0 4px 22px rgba(245, 158, 11, 0.12);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .content--motion .dash-stat-grid > .dash-stat {
    animation: dashTileIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  }

  .dash-stat-grid--primary > .dash-stat:nth-child(1) {
    animation-delay: 0.03s;
  }
  .dash-stat-grid--primary > .dash-stat:nth-child(2) {
    animation-delay: 0.08s;
  }
  .dash-stat-grid--primary > .dash-stat:nth-child(3) {
    animation-delay: 0.13s;
  }
  .dash-stat-grid--primary > .dash-stat:nth-child(4) {
    animation-delay: 0.18s;
  }

  .dash-stat-grid--secondary > .dash-stat:nth-child(1) {
    animation-delay: 0.06s;
  }
  .dash-stat-grid--secondary > .dash-stat:nth-child(2) {
    animation-delay: 0.1s;
  }
  .dash-stat-grid--secondary > .dash-stat:nth-child(3) {
    animation-delay: 0.14s;
  }
  .dash-stat-grid--secondary > .dash-stat:nth-child(4) {
    animation-delay: 0.18s;
  }
  .dash-stat-grid--secondary > .dash-stat:nth-child(5) {
    animation-delay: 0.22s;
  }
  .dash-stat-grid--secondary > .dash-stat:nth-child(6) {
    animation-delay: 0.26s;
  }
}

@keyframes dashTileIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.content--motion .dash-stat-grid > .dash-stat {
  transition:
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.22s ease,
    border-color 0.22s ease;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .content--motion .dash-stat-grid > .dash-stat:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow), 0 14px 36px rgba(0, 0, 0, 0.22);
    border-color: rgba(148, 163, 184, 0.35);
  }
}

.dash-charts-grid {
  margin-top: 0.25rem;
}

/* Spider / radar chart (dashboard health overview) */
.dash-spider-card {
  overflow: visible;
}

.dash-spider-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1.25fr) minmax(220px, 1fr);
  gap: 1.25rem 1.75rem;
  align-items: center;
}

.dash-spider-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 340px;
  padding: 0.35rem;
  overflow: visible;
}

.dash-spider-svg {
  width: min(100%, 400px);
  max-height: min(92vw, 400px);
  height: auto;
  display: block;
  overflow: visible;
}

.dash-spider-grid {
  fill: none;
  stroke: var(--border);
  stroke-width: 1;
}

.dash-spider-axis {
  stroke: var(--border-strong);
  stroke-width: 1;
  opacity: 0.65;
}

.dash-spider-polygon {
  fill: rgba(37, 99, 235, 0.2);
  stroke: var(--accent);
  stroke-width: 2;
  filter: drop-shadow(0 0 18px rgba(37, 99, 235, 0.25));
}

.dash-spider-dot {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 1.5;
}

.dash-spider-label {
  fill: var(--text);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font);
  paint-order: stroke fill;
  stroke: var(--bg);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.dash-spider-score {
  fill: var(--text);
  font-size: 28px;
  font-weight: 800;
  font-family: var(--font);
}

.dash-spider-score-sub {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font);
}

.dash-spider-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.dash-spider-legend__row {
  margin: 0;
}

.dash-spider-legend__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.dash-spider-legend__label {
  font-size: 0.88rem;
  font-weight: 700;
}

.dash-spider-legend__pct {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.dash-spider-legend__track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}

.dash-spider-legend__fill {
  display: block;
  height: 100%;
  width: var(--spider-pct, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.55), var(--accent));
  transition: width 0.85s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.dash-spider-legend__hint {
  margin: 0.35rem 0 0;
  font-size: 0.76rem;
  line-height: 1.45;
}

@media (max-width: 820px) {
  .dash-spider-layout {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .content--motion .dash-chart-card.dash-inview .dash-spider-polygon {
    animation: dashSpiderPolyIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) backwards;
    animation-delay: 0.1s;
  }

  .content--motion .dash-chart-card.dash-inview .dash-spider-dot {
    animation: dashSpiderDotIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) backwards;
    animation-delay: 0.35s;
  }

  .content--motion .dash-chart-card.dash-inview .dash-spider-legend__fill {
    width: 0;
    animation: dashSpiderBarIn 0.85s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
    animation-delay: calc(0.08s + var(--dash-i, 0) * 0.05s);
  }

  .dash-spider-legend__row:nth-child(1) .dash-spider-legend__fill { --dash-i: 1; }
  .dash-spider-legend__row:nth-child(2) .dash-spider-legend__fill { --dash-i: 2; }
  .dash-spider-legend__row:nth-child(3) .dash-spider-legend__fill { --dash-i: 3; }
  .dash-spider-legend__row:nth-child(4) .dash-spider-legend__fill { --dash-i: 4; }
  .dash-spider-legend__row:nth-child(5) .dash-spider-legend__fill { --dash-i: 5; }
  .dash-spider-legend__row:nth-child(6) .dash-spider-legend__fill { --dash-i: 6; }
}

@keyframes dashSpiderPolyIn {
  from {
    opacity: 0;
    transform: scale(0.55);
    transform-origin: center;
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes dashSpiderDotIn {
  from {
    opacity: 0;
    transform: scale(0);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes dashSpiderBarIn {
  to {
    width: var(--spider-pct, 0%);
  }
}

html[data-theme="light"] .dash-spider-polygon {
  fill: rgba(37, 99, 235, 0.14);
  filter: drop-shadow(0 0 12px rgba(37, 99, 235, 0.12));
}

@media (prefers-reduced-motion: no-preference) {
  /* Chart + bar motion runs when scrolled into view (.dash-inview from JS) */
  .content--motion .dash-chart-card:not(.dash-inview) {
    opacity: 0;
    transform: translateY(14px);
  }

  .content--motion .dash-chart-card:not(.dash-inview) .dash-bar-col {
    opacity: 0;
    transform: translateY(14px);
  }

  .content--motion .dash-chart-card:not(.dash-inview) .dash-bar-fill {
    transform: scaleY(0.12);
    opacity: 0.5;
    transform-origin: bottom center;
  }

  .content--motion .dash-chart-card.dash-inview {
    animation: dashCardIn 0.65s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  }

  .dash-charts-grid > .dash-chart-card.dash-inview:nth-child(1),
  .content--motion .grid.cols-2 > .dash-chart-card.dash-inview:nth-child(1) {
    animation-delay: 0.08s;
  }
  .dash-charts-grid > .dash-chart-card.dash-inview:nth-child(2),
  .content--motion .grid.cols-2 > .dash-chart-card.dash-inview:nth-child(2) {
    animation-delay: 0.16s;
  }
}

@keyframes dashCardIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dash-chart-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dash-chart-meta {
  font-size: 0.78rem;
}

.dash-bar-fill[style*='--bar-pct'] {
  height: var(--bar-pct);
  transform-origin: bottom center;
  transition: none;
}

@media (prefers-reduced-motion: no-preference) {
  .content--motion .dash-chart-card.dash-inview .dash-bar-col {
    animation: dashBarColIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) backwards;
    animation-delay: calc(0.04s + (var(--dash-i, 1) - 1) * 0.06s);
  }
}

@keyframes dashBarColIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .content--motion .dash-chart-card.dash-inview .dash-bar-fill {
    animation: dashBarFillIn 0.85s cubic-bezier(0.34, 1.2, 0.64, 1) backwards;
    animation-delay: calc(0.12s + (var(--dash-i, 1) - 1) * 0.06s);
    transform-origin: bottom center;
  }
}

@keyframes dashBarFillIn {
  from {
    transform: scaleY(0.15);
    opacity: 0.65;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}

.dash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.dash-actions--grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.5rem;
}

.dash-action {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  min-height: 44px;
  box-sizing: border-box;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.2s ease;
}

.dash-action--primary {
  border-color: rgba(37, 99, 235, 0.45);
  background: linear-gradient(160deg, rgba(37, 99, 235, 0.14), rgba(255, 255, 255, 0.02));
}

.dash-action:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(148, 163, 184, 0.4);
  text-decoration: none;
}

.dash-action--primary:hover {
  border-color: rgba(96, 165, 250, 0.55);
  background: linear-gradient(160deg, rgba(37, 99, 235, 0.22), rgba(255, 255, 255, 0.04));
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .dash-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  }
}

.dash-action__icon {
  display: flex;
  color: var(--silver);
  opacity: 0.9;
}

.dash-action__icon .icon-svg {
  width: 18px;
  height: 18px;
}

.dash-footnote {
  margin: 1rem 0 0;
  font-size: 0.82rem;
}

@media (prefers-reduced-motion: reduce) {
  .main > .topbar {
    animation: none !important;
  }

  .content--motion > * {
    animation: none !important;
  }

  .dash-hero,
  .dash-preview-banner,
  .dash-stat--attention,
  .content--motion .dash-stat-grid > .dash-stat,
  .content--motion .dash-chart-card,
  .content--motion .dash-chart-card:not(.dash-inview),
  .content--motion .dash-bar-col,
  .content--motion .dash-bar-fill {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .content--motion .dash-chart-card.dash-inview {
    opacity: 1 !important;
    transform: none !important;
  }

  .content--motion .dash-stat-grid > .dash-stat:hover,
  .dash-action:hover {
    transform: none !important;
  }
}

.dash-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 0.85rem;
  align-items: stretch;
}

/* KPI tiles: dedicated icon column (no overlap with text), fixed rhythm */
.dash-stat-grid > .dash-stat {
  min-height: 9rem;
  height: 100%;
  box-sizing: border-box;
}

.dash-stat-grid--primary > .dash-stat {
  min-height: 8.75rem;
}

.dash-stat-grid--secondary > .dash-stat {
  min-height: 8.75rem;
}

.dash-stat-grid .dash-stat.card-pad {
  padding: 13px 14px;
}

.dash-stat {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  grid-template-rows: min-content min-content 1fr min-content;
  column-gap: 10px;
  row-gap: 3px;
  align-items: start;
}

.dash-stat .stat-icon {
  position: static;
  grid-column: 2;
  grid-row: 1 / 3;
  justify-self: center;
  align-self: start;
  width: 40px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2px;
  margin: 0;
  opacity: 0.45;
  color: var(--silver);
  line-height: 0;
  flex-shrink: 0;
}

.dash-stat .stat-icon svg,
.dash-stat .stat-icon .icon-svg {
  display: block;
  width: 22px;
  height: 22px;
}

.dash-stat-accent .stat-icon {
  opacity: 0.55;
  color: #93c5fd;
}

.dash-stat .stat-label {
  grid-column: 1;
  grid-row: 1;
  padding: 0;
  margin: 0;
  min-height: 2.6lh;
  line-height: 1.35;
  font-size: 0.8rem;
  color: var(--muted);
}

.dash-stat .stat-label a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dash-stat .stat-value {
  grid-column: 1;
  grid-row: 2;
  padding: 0;
  margin: 0;
  font-size: 1.3125rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  min-height: 1.2em;
}

.dash-stat-accent {
  border-color: rgba(37, 99, 235, 0.45);
  background: linear-gradient(160deg, rgba(37, 99, 235, 0.1), var(--surface));
}

.stat-money {
  font-variant-numeric: tabular-nums;
}

.dash-stat .stat-hint {
  grid-column: 1 / -1;
  grid-row: 4;
  padding: 8px 0 0;
  margin: 0;
  min-height: 0;
  font-size: 0.6875rem;
  line-height: 1.4;
  color: var(--muted);
}

.stat-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.dash-chart-card {
  min-height: 280px;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.dash-chart-card .dash-bar-chart {
  flex: 1 1 auto;
  min-height: 200px;
  height: auto;
}

.dash-chart-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.dash-chart-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  margin: 0 0 0.75rem;
}

.dash-chart-kpi {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.4rem;
  padding: 0.28rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.72rem;
  line-height: 1.35;
}

.dash-chart-kpi strong {
  font-size: 0.8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* Finance reports — status mix donut + legend */
.finance-status-chart {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.5rem 2.25rem;
  margin: 0.75rem 0 0;
}

.finance-status-chart__viz {
  flex: 0 0 auto;
}

.finance-status-donut {
  width: 11.5rem;
  height: 11.5rem;
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    0 6px 28px rgba(0, 0, 0, 0.28);
  position: relative;
}

.finance-status-donut__hole {
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.35rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.finance-status-donut__total {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.finance-status-donut__label {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 0.2rem;
  max-width: 6.5rem;
  line-height: 1.35;
}

.finance-status-chart__legend {
  flex: 1 1 13rem;
  min-width: min(100%, 15rem);
  max-width: 22rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0;
}

.finance-status-legend-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 0.5rem 0.65rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.14);
}

.finance-status-swatch {
  width: 0.5rem;
  height: 1.85rem;
  border-radius: 4px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.finance-status-legend-row__label {
  font-size: 0.88rem;
  font-weight: 600;
  min-width: 0;
}

.finance-status-legend-row__value {
  font-weight: 800;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.finance-status-legend-row__pct {
  font-size: 0.8rem;
  min-width: 3rem;
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.dash-bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.35rem;
  height: 200px;
  padding: 0.25rem 0 0;
}

.dash-bar-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.dash-bar-value {
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.dash-bar-track {
  flex: 1;
  width: 100%;
  max-width: 48px;
  margin-inline: auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px 8px 4px 4px;
  border: 1px solid var(--border);
  min-height: 80px;
}

.dash-bar-fill {
  width: 72%;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
  box-shadow: 0 0 20px rgba(37, 99, 235, 0.25);
  min-height: 4px;
  transition: height 0.25s ease;
}

.dash-bar-fill-silver {
  background: linear-gradient(180deg, #c0c6d2, #6b7280);
  box-shadow: 0 0 12px rgba(192, 198, 210, 0.15);
}

.dash-bar-chart-silver .dash-bar-track {
  background: rgba(192, 198, 210, 0.06);
}

.dash-bar-label {
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 0.35rem;
  text-align: center;
  line-height: 1.25;
  max-width: 100%;
}

/* Admin AI assistant — physical bottom-left of viewport */
.xfit-ai-root {
  position: fixed;
  z-index: 80;
  bottom: 1rem;
  left: 1rem;
  right: auto;
  font-size: 0.92rem;
}

.xfit-ai-toggle {
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  line-height: 1;
  box-shadow: var(--shadow);
}

.xfit-ai-panel {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 0;
  right: auto;
  width: min(320px, calc(100vw - 2rem));
  max-height: min(70vh, 520px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.5rem);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.xfit-ai-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.xfit-ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.xfit-ai-title {
  font-weight: 800;
  font-size: 0.95rem;
}

.xfit-ai-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem 0.75rem;
  min-height: 0;
  flex: 1;
}

.xfit-ai-body--soon {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.25rem 0.75rem 1.35rem;
  gap: 0.35rem;
}

.xfit-ai-coming-soon {
  margin: 0;
  font-weight: 800;
  font-size: 1.05rem;
}

.xfit-ai-coming-soon-en {
  margin: 0;
  font-size: 0.85rem;
}

.page-coming-soon {
  max-width: 28rem;
  margin: 2rem auto;
  text-align: center;
}

.page-coming-soon__badge {
  margin: 0;
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--accent, #a78bfa);
}

.page-coming-soon__title {
  margin: 0.35rem 0 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.page-coming-soon__icon {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
  color: var(--muted);
  opacity: 0.75;
}

.page-coming-soon__svg {
  width: 3rem;
  height: 3rem;
}

.page-coming-soon__hint {
  margin: 1rem 0 0;
  font-size: 0.88rem;
  line-height: 1.6;
}

@media (max-width: 900px) {
  .xfit-ai-root {
    bottom: 0.75rem;
    left: 0.75rem;
  }
}

/* Admin entity list + modal pattern (packages, coaches, …) */
.admin-entity-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.admin-entity-toolbar h2 {
  margin: 0;
}

table.data.data--entity {
  font-size: 0.88rem;
}

table.data.data--entity th,
table.data.data--entity td {
  vertical-align: middle;
}

.data-cell-clip {
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-cell-meta {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-icon:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

dialog.admin-modal {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: min(28rem, 96vw);
  width: 100%;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

dialog.admin-modal::backdrop {
  background: var(--modal-backdrop);
  backdrop-filter: blur(2px);
}

.admin-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 800;
  font-size: 1rem;
}

.admin-modal__body {
  padding: 1rem;
  max-height: min(75vh, 32rem);
  overflow-y: auto;
}

.admin-modal__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--border);
}

.btn-ghost-icon {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius-sm);
}

.btn-ghost-icon:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.athlete-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.athlete-gallery-item {
  margin: 0;
}

.athlete-gallery-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

/* Light theme — contrast fixes only (dark :root unchanged) */
html[data-theme="light"] table.data tr:hover td {
  background: rgba(15, 23, 42, 0.04);
}

html[data-theme="light"] .badge.ok {
  color: #14532d;
  border-color: rgba(22, 163, 74, 0.45);
  background: rgba(22, 163, 74, 0.14);
}

html[data-theme="light"] .badge.warn {
  color: #854d0e;
  border-color: rgba(202, 138, 4, 0.45);
  background: rgba(202, 138, 4, 0.14);
}

html[data-theme="light"] .badge.bad {
  color: #991b1b;
  border-color: rgba(220, 38, 38, 0.4);
  background: rgba(220, 38, 38, 0.1);
}

html[data-theme="light"] .badge.neutral {
  color: #334155;
  background: rgba(15, 23, 42, 0.06);
  border-color: var(--border-strong);
}

html[data-theme="light"] .btn:hover {
  background: rgba(15, 23, 42, 0.06);
}

html[data-theme="light"] .btn-danger {
  color: #991b1b;
  border-color: rgba(220, 38, 38, 0.4);
  background: rgba(220, 38, 38, 0.1);
}

html[data-theme="light"] .alert {
  background: rgba(37, 99, 235, 0.08);
}

html[data-theme="light"] .alert.success {
  color: #14532d;
  border-color: rgba(22, 163, 74, 0.45);
  background: rgba(22, 163, 74, 0.12);
}

html[data-theme="light"] .alert.error {
  color: #991b1b;
  border-color: rgba(220, 38, 38, 0.4);
  background: rgba(220, 38, 38, 0.1);
}

html[data-theme="light"] .empty-session-hint,
html[data-theme="light"] .brand-settings-preview {
  background: rgba(15, 23, 42, 0.03);
}

html[data-theme="light"] .dash-hero,
html[data-theme="light"] .dash-preview-banner {
  border-color: rgba(37, 99, 235, 0.28);
  background: linear-gradient(120deg, rgba(37, 99, 235, 0.1) 0%, rgba(241, 245, 249, 0.95) 45%, rgba(37, 99, 235, 0.06) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

html[data-theme="light"] .dash-hero__lead {
  color: var(--text);
}

html[data-theme="light"] .dash-alert {
  border-color: rgba(202, 138, 4, 0.45);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(255, 251, 235, 0.95));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

html[data-theme="light"] .dash-alert__copy strong {
  color: var(--text);
}

html[data-theme="light"] .dash-action {
  background: rgba(15, 23, 42, 0.03);
  color: var(--text);
}

html[data-theme="light"] .dash-action--primary {
  border-color: rgba(37, 99, 235, 0.35);
  background: linear-gradient(160deg, rgba(37, 99, 235, 0.12), rgba(255, 255, 255, 0.9));
}

html[data-theme="light"] .dash-action:hover {
  background: rgba(15, 23, 42, 0.06);
  border-color: rgba(15, 23, 42, 0.2);
}

html[data-theme="light"] .dash-action--primary:hover {
  border-color: rgba(37, 99, 235, 0.5);
  background: linear-gradient(160deg, rgba(37, 99, 235, 0.18), rgba(255, 255, 255, 0.95));
}

html[data-theme="light"] .dash-stat--attention {
  border-color: rgba(202, 138, 4, 0.5);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.15);
}

html[data-theme="light"] .dash-bar-chart-silver .dash-bar-track {
  background: rgba(15, 23, 42, 0.06);
}

html[data-theme="light"] .btn-ghost-icon:hover {
  background: rgba(15, 23, 42, 0.06);
}

html[data-theme="light"] dialog.admin-modal {
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.2);
}

html[data-theme="light"] .topbar-user__menu {
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .nav {
  scrollbar-color: rgba(71, 85, 105, 0.28) transparent;
}

html[data-theme="light"] .nav::-webkit-scrollbar-thumb {
  background: rgba(71, 85, 105, 0.28);
  background-clip: padding-box;
}

html[data-theme="light"] .nav:hover::-webkit-scrollbar-thumb {
  background: rgba(71, 85, 105, 0.42);
  background-clip: padding-box;
}

html[data-theme="light"] .nav a.is-active {
  border-color: rgba(37, 99, 235, 0.35);
}

@media (hover: hover) {
  html[data-theme="light"] .content--motion .dash-stat-grid > .dash-stat:hover {
    box-shadow: var(--shadow), 0 14px 36px rgba(15, 23, 42, 0.1);
    border-color: rgba(15, 23, 42, 0.18);
  }

  html[data-theme="light"] .dash-action:hover {
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  }
}
