/* ==========================================================================
   Xenotech Chess Academy — application layer
   Extends styles.css. Reuses its tokens (--primary, --bg-dark, --bg-card,
   --text-muted, --white) and its component vocabulary (.modern-panel, .btn,
   .modal-overlay, .form-control). Adds only what the platform surfaces need.
   ========================================================================== */

:root {
  --xt-surface:        #161622;
  --xt-surface-raised: #1d1d2b;
  --xt-line:           rgba(255, 255, 255, 0.09);
  --xt-line-strong:    rgba(255, 255, 255, 0.16);
  --xt-ink:            #ffffff;
  --xt-ink-muted:      #a0a0b0;
  --xt-ink-faint:      #6f6f82;

  --xt-success: #4caf50;
  --xt-warning: #ff9800;
  --xt-danger:  #f44336;
  --xt-info:    #0288d1;

  /* Comfort scale — repertoire tree colouring, used as a shared semantic. */
  --xt-comfort-0: #5a5a68; /* Never Seen  */
  --xt-comfort-1: #f44336; /* Weak        */
  --xt-comfort-2: #ff9800; /* Neutral     */
  --xt-comfort-3: #ffd54f; /* Comfortable */
  --xt-comfort-4: #4caf50; /* Very Comfortable */

  --xt-radius:    12px;
  --xt-radius-sm: 8px;
  --xt-gap:       1.25rem;
  --xt-nav-h:     72px;
}

/* --------------------------------------------------------------------------
   Layout primitives — .row/.col-md-* were referenced but never defined and
   Bootstrap is not loaded, so pages fell back to inline styles. This gives us
   a real grid.
   -------------------------------------------------------------------------- */

/* .row / .col-* are used throughout the legacy pages (dashboard, admin, coach)
   but Bootstrap is not loaded and nothing ever defined them, so every column
   collapsed to a full-width block — which is why the dashboard read as a stack
   of wide horizontal cards. This is a real 12-column grid for those classes. */
.row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--xt-gap);
  align-items: stretch;
}
.col-12, .col-md-12 { grid-column: span 12; }
.col-md-8 { grid-column: span 8; }
.col-6, .col-md-6, .col-lg-6 { grid-column: span 6; }
.col-md-4 { grid-column: span 4; }
.col-md-3 { grid-column: span 3; }

/* The grid gap owns the rhythm now; legacy margin utilities would double it. */
.row > [class*="col-"].mb-2,
.row > [class*="col-"].mb-3,
.row > [class*="col-"].mb-4 { margin-bottom: 0; }

.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: var(--xt-gap); }
.text-center { text-align: center; }
.h-100 { height: 100%; }

@media (max-width: 1100px) {
  .col-md-3 { grid-column: span 6; }
  .col-md-4, .col-md-8 { grid-column: span 12; }
}
@media (max-width: 700px) {
  .col-md-3, .col-md-6, .col-6 { grid-column: span 12; }
}

.xt-grid { display: grid; gap: var(--xt-gap); }
.xt-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.xt-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.xt-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.xt-grid--sidebar { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.xt-grid--sidebar-left { grid-template-columns: 300px minmax(0, 1fr); align-items: start; }

.xt-stack { display: flex; flex-direction: column; gap: var(--xt-gap); }
.xt-row { display: flex; align-items: center; gap: 0.75rem; }
.xt-row--between { justify-content: space-between; }
.xt-row--wrap { flex-wrap: wrap; }
.xt-spacer { flex: 1 1 auto; }
.xt-muted { color: var(--xt-ink-muted); }
.xt-small { font-size: 0.85rem; }
.xt-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xt-scroll-x { overflow-x: auto; }

.xt-page { background: var(--bg-dark); min-height: 100vh; padding-bottom: 5rem; }
.xt-section { padding-top: 1.5rem; }

/* --------------------------------------------------------------------------
   Page header
   -------------------------------------------------------------------------- */

.xt-page-header { padding-top: calc(var(--xt-nav-h) + 2.5rem); padding-bottom: 1.5rem; background: var(--bg-dark); }
.xt-page-header.xt-page-header--compact { padding-top: calc(var(--xt-nav-h) + 2rem); padding-bottom: 0.85rem; }
.xt-page-header--compact .xt-page-header__title { font-size: 1.8rem; }
.xt-page-header--compact .xt-page-header__subtitle { font-size: 0.92rem; margin: 0.2rem 0 0; }
.xt-page-header__inner { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.xt-page-header__title { color: var(--xt-ink); font-size: 2.2rem; margin: 0; display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.xt-page-header__subtitle { color: var(--xt-ink-muted); margin: 0.4rem 0 0; font-size: 1.02rem; }
.xt-page-header__actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Board workspace layout — shared by Tactics Trainer and Analysis so the board
   is exactly the same size on both. The grid is width-capped so the board
   column ends where the side card begins; without the cap the board hits its
   max-width and leaves dead space between it and the card.
   -------------------------------------------------------------------------- */

:root {
  --xt-board-max: min(660px, 70vh);
  --xt-board-aside: 350px;
  --xt-board-gap: 1.75rem;
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--xt-board-aside);
  gap: var(--xt-board-gap);
  align-items: start;
  /* --xt-board-extra lets a page that puts furniture beside the board (the
     analysis eval bar) widen the column, so the *board* stays the same size
     on every page rather than shrinking by the width of that furniture. */
  max-width: calc(var(--xt-board-max) + var(--xt-board-extra, 0px) + var(--xt-board-aside) + var(--xt-board-gap));
  margin-inline: auto;
}

.analysis-grid--eval { --xt-board-extra: 30px; } /* 20px eval bar + 10px gap */

/* Board fills its column exactly, so it grows with the layout instead of
   sitting at a fixed width with a gap beside it. */
.analysis-grid .board-wrapper,
.analysis-grid #board-wrapper { max-width: 100%; width: 100%; margin: 0; }

/* Analysis pairs the board with an eval bar. The row must not impose its own
   width cap, or the board ends up smaller than the Tactics Trainer's. */
.xt-board-row { display: flex; justify-content: center; gap: 10px; width: 100%; }
.xt-board-row > #board-wrapper { flex: 1 1 auto; min-width: 0; }
.xt-board-row > #eval-bar-container { flex: 0 0 20px; }

@media (max-width: 900px) {
  .analysis-grid { grid-template-columns: minmax(0, 1fr); max-width: var(--xt-board-max); }
}

/* Keep the page title and its icon on a single line (phones may wrap: titles carry pills). */
.xt-page-header__title { flex-wrap: nowrap; white-space: nowrap; }
.xt-page-header__title > i { flex: none; }
@media (max-width: 600px) {
  .xt-page-header__title { flex-wrap: wrap; white-space: normal; }
}

/* --------------------------------------------------------------------------
   Grouped navigation (Self / Preparation dropdowns)
   -------------------------------------------------------------------------- */

.nav-links a.is-active { color: var(--primary); font-weight: 600; }

.xt-nav { align-items: center; gap: 0.35rem; }
.xt-nav .xt-nav__item { position: relative; list-style: none; }

/* inline-flex + nowrap is what keeps every icon on the same line as its label. */
.xt-nav__link {
  display: inline-flex; align-items: center; gap: 0.5rem; white-space: nowrap;
  padding: 0.5rem 0.85rem; border-radius: 10px;
  color: var(--text-muted); font-weight: 600; font-size: 1rem; line-height: 1;
  text-decoration: none; background: none; border: 0; cursor: pointer;
  font-family: inherit; transition: color .2s ease, background .2s ease;
}
.xt-nav__link > i { flex: none; font-size: 0.95em; }
.xt-nav__link:hover { color: var(--primary); background: rgba(240, 126, 19, 0.09); }
.xt-nav__link.is-active { color: var(--primary); background: rgba(240, 126, 19, 0.13); }

.xt-nav__caret { font-size: 0.65em !important; opacity: 0.7; transition: transform .2s ease; }
.xt-nav__item--group.is-open .xt-nav__caret,
.xt-nav__item--group:hover .xt-nav__caret { transform: rotate(180deg); }

.xt-nav__menu {
  position: absolute; top: calc(100% + 0.55rem); left: 0; z-index: 1300;
  min-width: 250px; margin: 0; padding: 0.4rem; list-style: none;
  background: var(--bg-card, #161622);
  border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 14px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
/* Bridges the gap between trigger and menu so hover doesn't drop out. */
.xt-nav__menu::before { content: ''; position: absolute; top: -0.6rem; left: 0; right: 0; height: 0.6rem; }

.xt-nav__item--group:hover .xt-nav__menu,
.xt-nav__item--group:focus-within .xt-nav__menu,
.xt-nav__item--group.is-open .xt-nav__menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}

.xt-nav__sublink {
  display: grid; grid-template-columns: 1.4rem 1fr; align-items: center;
  gap: 0.15rem 0.7rem; padding: 0.6rem 0.7rem; border-radius: 10px;
  color: var(--text-main); text-decoration: none; font-weight: 600; font-size: 0.97rem;
  transition: background .18s ease, color .18s ease;
}
.xt-nav__sublink > i { grid-row: span 2; justify-self: center; color: var(--primary); font-size: 1rem; }
.xt-nav__sublink:hover { background: rgba(240, 126, 19, 0.12); color: var(--primary); }
.xt-nav__sublink.is-active { background: rgba(240, 126, 19, 0.15); color: var(--primary); }
.xt-nav__hint { grid-column: 2; font-size: 0.78rem; font-weight: 500; color: var(--text-muted); line-height: 1.3; }

/* Log Out is deliberately quieter than the rest of the bar. */
.xt-nav__item--logout { margin-left: 0.6rem; padding-left: 0.6rem; border-left: 1px solid rgba(255, 255, 255, 0.12); }
.xt-nav__logout {
  display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap;
  padding: 0.4rem 0.6rem; border-radius: 8px;
  color: rgba(160, 160, 176, 0.62); font-size: 0.85rem; font-weight: 500;
  text-decoration: none; transition: color .2s ease, background .2s ease;
}
.xt-nav__logout > i { font-size: 0.9em; }
.xt-nav__logout:hover { color: var(--text-muted); background: rgba(255, 255, 255, 0.05); }

@media (max-width: 900px) {
  .xt-nav__link { font-size: 0.95rem; padding: 0.45rem 0.6rem; }
  .xt-nav { gap: 0.15rem; }
}

@media (max-width: 768px) {
  .xt-nav .xt-nav__item { width: 100%; }
  .xt-nav__link { width: 100%; justify-content: center; }
  /* Submenus sit inline in the mobile drawer rather than floating. */
  .xt-nav__menu {
    position: static; opacity: 1; visibility: visible; transform: none;
    min-width: 0; background: transparent; border: 0; box-shadow: none;
    max-height: 0; overflow: hidden; padding: 0 1rem;
    transition: max-height .25s ease, padding .25s ease;
  }
  .xt-nav__item--group.is-open .xt-nav__menu { max-height: 30rem; padding: 0.3rem 1rem 0.6rem; }
  .xt-nav__item--group:hover .xt-nav__menu { max-height: 0; }
  .xt-nav__item--group.is-open:hover .xt-nav__menu { max-height: 30rem; }
  .xt-nav__sublink { text-align: left; }
  .xt-nav__item--logout { margin: 0.5rem 0 0; padding: 0.6rem 0 0; border-left: 0; border-top: 1px solid rgba(255, 255, 255, 0.12); }
  .xt-nav__logout { width: 100%; justify-content: center; }
}

/* --------------------------------------------------------------------------
   Impersonation banner
   -------------------------------------------------------------------------- */

.xt-impersonation {
  position: sticky; top: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center; gap: 0.75rem;
  padding: 0.7rem 1rem;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  color: #1a1a1a; font-weight: 600; font-size: 0.95rem;
}
.xt-impersonation a { color: #1a1a1a; text-decoration: underline; font-weight: 700; }

/* --------------------------------------------------------------------------
   Panels & cards
   -------------------------------------------------------------------------- */

.xt-panel {
  background: var(--xt-surface);
  border: 1px solid var(--xt-line);
  border-radius: var(--xt-radius);
  padding: 1.4rem;
}
.xt-panel--flush { padding: 0; overflow: hidden; }
.xt-panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-bottom: 1.1rem; padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--xt-line);
}
.xt-panel__title { color: var(--xt-ink); font-size: 1.08rem; margin: 0; display: flex; align-items: center; gap: 0.55rem; }
.xt-panel__title i { color: var(--primary); }
.xt-panel__hint { color: var(--xt-ink-faint); font-size: 0.82rem; }

.xt-card {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--xt-line);
  border-radius: var(--xt-radius-sm);
  padding: 1rem 1.1rem;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}
.xt-card--link { cursor: pointer; display: block; text-decoration: none; color: inherit; }
.xt-card--link:hover { border-color: rgba(240, 126, 19, 0.5); background: rgba(255, 255, 255, 0.055); transform: translateY(-2px); }
.xt-card__title { color: var(--xt-ink); font-size: 1rem; font-weight: 600; margin: 0 0 0.2rem; }
.xt-card__meta { color: var(--xt-ink-muted); font-size: 0.82rem; }

.xt-stat { display: flex; align-items: center; gap: 0.9rem; }
.xt-stat__icon { font-size: 1.5rem; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 10px; background: rgba(240, 126, 19, 0.12); color: var(--primary); }
.xt-stat__label { color: var(--xt-ink-muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.6px; }
.xt-stat__value { color: var(--xt-ink); font-size: 1.6rem; font-weight: 700; line-height: 1.15; margin: 0; }

/* --------------------------------------------------------------------------
   Buttons (variants layered on the existing .btn)
   -------------------------------------------------------------------------- */

.xt-btn-danger { background: rgba(244, 67, 54, 0.16); color: #ff6b60; border: 1px solid rgba(244, 67, 54, 0.35); }
.xt-btn-danger:hover { background: rgba(244, 67, 54, 0.26); }
.xt-btn-ghost { background: transparent; color: var(--xt-ink-muted); border: 1px solid var(--xt-line); }
.xt-btn-ghost:hover { color: var(--xt-ink); border-color: var(--xt-line-strong); }
.xt-btn-icon { width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center; border-radius: 8px; }

/* --------------------------------------------------------------------------
   Badges, tags, progress
   -------------------------------------------------------------------------- */

.xt-badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 0.74rem; font-weight: 600; letter-spacing: 0.3px;
  border: 1px solid transparent; white-space: nowrap;
}
.xt-badge--neutral { background: rgba(255,255,255,0.07); color: var(--xt-ink-muted); border-color: var(--xt-line); }
.xt-badge--success { background: rgba(76,175,80,0.16); color: var(--xt-success); border-color: rgba(76,175,80,0.35); }
.xt-badge--danger  { background: rgba(244,67,54,0.16); color: #ff6b60; border-color: rgba(244,67,54,0.35); }
.xt-badge--warning { background: rgba(255,152,0,0.16); color: var(--xt-warning); border-color: rgba(255,152,0,0.35); }
.xt-badge--info    { background: rgba(2,136,209,0.16); color: #4fc3f7; border-color: rgba(2,136,209,0.35); }
.xt-badge--primary { background: rgba(240,126,19,0.16); color: var(--primary); border-color: rgba(240,126,19,0.35); }

.xt-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.xt-tag {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 3px 10px; border-radius: 999px; font-size: 0.76rem;
  background: rgba(240, 126, 19, 0.12); color: var(--primary);
  border: 1px solid rgba(240, 126, 19, 0.3);
}
.xt-tag__remove { background: none; border: none; color: inherit; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0; opacity: 0.7; }
.xt-tag__remove:hover { opacity: 1; }
.xt-tag--selectable { cursor: pointer; background: rgba(255,255,255,0.05); color: var(--xt-ink-muted); border-color: var(--xt-line); }
.xt-tag--selectable.is-selected { background: rgba(240,126,19,0.16); color: var(--primary); border-color: rgba(240,126,19,0.4); }

.xt-progress { background: rgba(0,0,0,0.35); height: 8px; border-radius: 4px; overflow: hidden; }
.xt-progress__fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.35s ease; }

/* --------------------------------------------------------------------------
   Async states
   -------------------------------------------------------------------------- */

.xt-skeleton { display: flex; flex-direction: column; gap: 0.75rem; }
.xt-skeleton__row {
  height: 18px; border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 37%, rgba(255,255,255,0.05) 63%);
  background-size: 400% 100%;
  animation: xt-shimmer 1.4s ease infinite;
}
.xt-skeleton__row--card { height: 82px; }
@keyframes xt-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.xt-empty { text-align: center; padding: 3rem 1.5rem; }
.xt-empty__icon { font-size: 2.6rem; color: var(--xt-ink-faint); margin-bottom: 0.9rem; }
.xt-empty__title { color: var(--xt-ink); font-size: 1.12rem; margin: 0 0 0.4rem; }
.xt-empty__message { color: var(--xt-ink-muted); font-size: 0.92rem; max-width: 460px; margin: 0 auto 1.3rem; line-height: 1.6; }
.xt-empty--error .xt-empty__icon { color: var(--xt-danger); }

.xt-autosave { font-size: 0.86rem; color: var(--xt-ink-muted); display: inline-flex; align-items: center; gap: 0.4rem; }
.xt-autosave--saved { color: var(--xt-success); }
.xt-autosave--saving { color: var(--primary); }
.xt-autosave--failed { color: var(--xt-danger); }
.xt-autosave--pending { color: var(--xt-warning); }

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */

.xt-toast-host {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 3000;
  display: flex; flex-direction: column; gap: 0.6rem; max-width: min(380px, calc(100vw - 3rem));
}
.xt-toast {
  display: flex; align-items: center; gap: 0.7rem;
  background: var(--xt-surface-raised); border: 1px solid var(--xt-line-strong);
  border-left: 3px solid var(--xt-info);
  color: var(--xt-ink); padding: 0.85rem 1rem; border-radius: var(--xt-radius-sm);
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  opacity: 0; transform: translateY(12px); transition: opacity 0.22s ease, transform 0.22s ease;
  font-size: 0.92rem;
}
.xt-toast.is-visible { opacity: 1; transform: translateY(0); }
.xt-toast--success { border-left-color: var(--xt-success); }
.xt-toast--success i { color: var(--xt-success); }
.xt-toast--error { border-left-color: var(--xt-danger); }
.xt-toast--error i { color: var(--xt-danger); }
.xt-toast--warning { border-left-color: var(--xt-warning); }
.xt-toast--warning i { color: var(--xt-warning); }
.xt-toast--info i { color: var(--xt-info); }
.xt-toast span { flex: 1; }
.xt-toast__close { background: none; border: none; color: var(--xt-ink-faint); font-size: 1.2rem; cursor: pointer; line-height: 1; }
.xt-toast__close:hover { color: var(--xt-ink); }

/* --------------------------------------------------------------------------
   Modal (extends .modal-overlay / .modal-content from styles.css)
   -------------------------------------------------------------------------- */

.xt-modal__content { max-width: 640px; width: 100%; }
.xt-modal--sm { max-width: 440px; }
.xt-modal--lg { max-width: 900px; }
.xt-modal__title { color: var(--xt-ink); font-size: 1.25rem; margin: 0 0 0.3rem; }
.xt-modal__subtitle { color: var(--xt-ink-muted); font-size: 0.9rem; margin: 0 0 1.1rem; }
.xt-modal__body { max-height: min(65vh, 640px); overflow-y: auto; }
.xt-modal__footer { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.4rem; }
.xt-modal__footer:empty { display: none; }
.xt-confirm__message { color: var(--xt-ink-muted); line-height: 1.6; margin: 0; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.xt-field { margin-bottom: 1.1rem; }
.xt-field > label {
  display: block; color: var(--xt-ink); font-size: 0.88rem; font-weight: 600;
  margin-bottom: 0.4rem;
}
.xt-field__hint { color: var(--xt-ink-faint); font-size: 0.78rem; margin-top: 0.35rem; display: block; }
.xt-field__error { color: #ff6b60; font-size: 0.78rem; margin-top: 0.35rem; display: none; }
.xt-field.is-invalid .xt-field__error { display: block; }
.xt-field.is-invalid .form-control { border-color: rgba(244, 67, 54, 0.6); }
.xt-field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.9rem; }

textarea.form-control { resize: vertical; min-height: 90px; line-height: 1.6; }

.xt-scale { display: flex; gap: 0.4rem; }
.xt-scale__btn {
  flex: 1; padding: 0.55rem 0; border-radius: 8px; cursor: pointer;
  background: rgba(255,255,255,0.04); border: 1px solid var(--xt-line);
  color: var(--xt-ink-muted); font-weight: 600; font-size: 0.95rem;
  transition: all 0.15s ease;
}
.xt-scale__btn:hover { border-color: var(--xt-line-strong); color: var(--xt-ink); }
.xt-scale__btn.is-selected { background: rgba(240,126,19,0.18); border-color: var(--primary); color: var(--primary); }

/* --------------------------------------------------------------------------
   Data tables — collapse to cards on narrow screens
   -------------------------------------------------------------------------- */

.xt-table { width: 100%; border-collapse: collapse; }
.xt-table th {
  text-align: left; color: var(--xt-ink-faint); font-size: 0.74rem;
  text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600;
  padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--xt-line);
}
.xt-table td { padding: 0.9rem; border-bottom: 1px solid rgba(255,255,255,0.05); color: var(--xt-ink); vertical-align: middle; }
.xt-table tbody tr:hover { background: rgba(255,255,255,0.025); }
.xt-table__actions { text-align: right; white-space: nowrap; }

/* --------------------------------------------------------------------------
   Filter bar
   -------------------------------------------------------------------------- */

.xt-filters { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.2rem; }
.xt-filters .form-control { min-width: 150px; width: auto; }
.xt-filters__search { position: relative; flex: 1 1 220px; }
.xt-filters__search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--xt-ink-faint); }
.xt-filters__search .form-control { width: 100%; padding-left: 36px; }
.xt-filter-count { color: var(--xt-ink-muted); font-size: 0.85rem; }

/* --------------------------------------------------------------------------
   Comfort scale (repertoire)
   -------------------------------------------------------------------------- */

.xt-comfort-0 { --xt-comfort: var(--xt-comfort-0); }
.xt-comfort-1 { --xt-comfort: var(--xt-comfort-1); }
.xt-comfort-2 { --xt-comfort: var(--xt-comfort-2); }
.xt-comfort-3 { --xt-comfort: var(--xt-comfort-3); }
.xt-comfort-4 { --xt-comfort: var(--xt-comfort-4); }
.xt-comfort-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--xt-comfort, var(--xt-comfort-0)); display: inline-block; flex: none; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .xt-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .xt-grid--sidebar, .xt-grid--sidebar-left { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .xt-grid--2, .xt-grid--3 { grid-template-columns: minmax(0, 1fr); }
  .xt-page-header { padding-top: calc(var(--xt-nav-h) + 1.5rem); }
  .xt-page-header__title { font-size: 1.7rem; }
  .xt-page-header__inner { align-items: flex-start; }
  .xt-toast-host { left: 1rem; right: 1rem; bottom: 1rem; max-width: none; }

  /* Tables become stacked cards; each cell carries its label via data-label. */
  .xt-table--responsive thead { display: none; }
  .xt-table--responsive tbody tr {
    display: block; margin-bottom: 0.9rem; border: 1px solid var(--xt-line);
    border-radius: var(--xt-radius-sm); padding: 0.5rem 0.75rem; background: rgba(255,255,255,0.03);
  }
  .xt-table--responsive td { display: flex; justify-content: space-between; gap: 1rem; border: none; padding: 0.45rem 0; }
  .xt-table--responsive td::before {
    content: attr(data-label); color: var(--xt-ink-faint); font-size: 0.75rem;
    text-transform: uppercase; letter-spacing: 0.5px; flex: none;
  }
  .xt-table--responsive .xt-table__actions { justify-content: flex-end; }
}

@media (max-width: 560px) {
  .xt-grid--4 { grid-template-columns: minmax(0, 1fr); }
  .xt-panel { padding: 1.05rem; }
}

@media (prefers-reduced-motion: reduce) {
  .xt-skeleton__row { animation: none; }
  .xt-toast, .xt-card, .xt-progress__fill { transition: none; }
}

/* --------------------------------------------------------------------------
   Backend unreachable — shown when the Firebase SDK fails to load, so a CDN
   outage or content blocker produces an explanation instead of a blank page.
   -------------------------------------------------------------------------- */

.xt-backend-error {
  position: sticky; top: 0; z-index: 4000;
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem;
  background: #2a1416; border-bottom: 2px solid var(--xt-danger);
  color: var(--xt-ink);
}
.xt-backend-error > i { font-size: 1.6rem; color: var(--xt-danger); flex: none; }
.xt-backend-error strong { display: block; font-size: 0.98rem; }
.xt-backend-error p { margin: 0.2rem 0 0; color: var(--xt-ink-muted); font-size: 0.86rem; }
.xt-backend-error button { margin-left: auto; flex: none; }

/* --------------------------------------------------------------------------
   Tournament picker (shared: journal + analysis)
   -------------------------------------------------------------------------- */

.xt-tpick { display: block; }
.xt-tpick__label { display: block; margin-bottom: 0.4rem; font-weight: 600; color: var(--xt-ink, #fff); font-size: 0.95rem; }
.xt-tpick__control { position: relative; }
.xt-tpick__input { width: 100%; padding-right: 2.2rem; }
.xt-tpick.is-frozen .xt-tpick__input { opacity: 0.45; cursor: not-allowed; }
.xt-tpick.is-frozen .xt-tpick__label { opacity: 0.55; }

.xt-tpick__clear {
  position: absolute; right: 0.55rem; top: 50%; transform: translateY(-50%);
  background: none; border: 0; color: var(--text-muted); font-size: 1.4rem; line-height: 1;
  cursor: pointer; padding: 0 0.2rem; border-radius: 6px;
}
.xt-tpick__clear:hover { color: var(--white); }

.xt-tpick__menu {
  position: absolute; top: calc(100% + 0.35rem); left: 0; right: 0; z-index: 1400;
  margin: 0; padding: 0.3rem; list-style: none; max-height: 16rem; overflow-y: auto;
  background: var(--bg-card, #161622); border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,0.5);
  display: none;
}
.xt-tpick.is-open .xt-tpick__menu { display: block; }

.xt-tpick__opt {
  display: flex; flex-direction: column; gap: 0.15rem;
  padding: 0.55rem 0.7rem; border-radius: 8px; cursor: pointer;
}
.xt-tpick__opt:hover, .xt-tpick__opt.is-selected { background: rgba(240,126,19,0.14); }
.xt-tpick__opt-name { font-weight: 600; color: var(--white); font-size: 0.95rem; }
.xt-tpick__opt-meta { font-size: 0.8rem; color: var(--text-muted); }
.xt-tpick__empty { padding: 0.7rem; color: var(--text-muted); font-size: 0.9rem; }
.xt-tpick__create {
  display: flex; align-items: center; gap: 0.5rem;
  margin-top: 0.25rem; padding: 0.6rem 0.7rem; border-radius: 8px; cursor: pointer;
  border-top: 1px solid rgba(255,255,255,0.1); color: var(--primary); font-weight: 600; font-size: 0.92rem;
}
.xt-tpick__create:hover { background: rgba(240,126,19,0.12); }

.xt-tpick__casual { display: flex; align-items: center; gap: 0.55rem; margin-top: 0.7rem; cursor: pointer; font-size: 0.92rem; color: var(--text-main); }
.xt-tpick__casual input { width: 1.05rem; height: 1.05rem; accent-color: var(--primary); cursor: pointer; flex: none; }
.xt-tpick__casual small { color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Ask-your-coach + review queue questions
   -------------------------------------------------------------------------- */

.xt-askcoach__context {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.6rem 0.8rem; margin-bottom: 1rem;
  background: rgba(240,126,19,0.1); border: 1px solid rgba(240,126,19,0.28);
  border-radius: 10px; color: var(--primary); font-weight: 600; font-size: 0.9rem;
}

.xt-review-item--question { border-left: 3px solid var(--xt-danger); cursor: default; }
.xt-review-question {
  margin: 0; color: var(--xt-ink); font-size: 0.95rem; line-height: 1.5; font-style: italic;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.xt-review-item__actions { display: flex; gap: 0.4rem; margin-top: 0.55rem; flex-wrap: wrap; }
.xt-review-quote {
  margin: 0 0 1rem; padding: 0.85rem 1rem;
  background: rgba(255,255,255,0.04); border-left: 3px solid var(--primary);
  border-radius: 0 10px 10px 0; color: var(--xt-ink); font-size: 0.95rem; line-height: 1.55;
}

/* --------------------------------------------------------------------------
   Dashboard polish — sectioning, card rhythm, entry animation
   -------------------------------------------------------------------------- */

/* Labelled breaks between different kinds of information, so the page reads as
   sections rather than one undifferentiated run of panels. */
.xt-dash-section { margin: 2.25rem 0 1rem; display: flex; align-items: center; gap: 0.75rem; }
.xt-dash-section::after { content: ''; flex: 1; height: 1px; background: var(--xt-line); }
.xt-dash-section h2 {
  margin: 0; font-size: 0.82rem; font-weight: 700; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--xt-ink-faint); white-space: nowrap;
}
.xt-dash-section i { color: var(--primary); font-size: 0.85rem; }

.stat-card.modern-panel { height: 100%; display: flex; align-items: center; gap: 1rem; }
.modern-panel { transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.modern-panel:hover { transform: translateY(-3px); }

/* Panels fade up on load, staggered. Disabled entirely for anyone who has
   asked for reduced motion. */
@keyframes xt-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.xt-animate-in > * { animation: xt-rise .45s cubic-bezier(.22,.61,.36,1) both; }
.xt-animate-in > *:nth-child(1) { animation-delay: .02s; }
.xt-animate-in > *:nth-child(2) { animation-delay: .07s; }
.xt-animate-in > *:nth-child(3) { animation-delay: .12s; }
.xt-animate-in > *:nth-child(4) { animation-delay: .17s; }
.xt-animate-in > *:nth-child(5) { animation-delay: .22s; }
.xt-animate-in > *:nth-child(6) { animation-delay: .27s; }

@media (prefers-reduced-motion: reduce) {
  .xt-animate-in > * { animation: none; }
  .modern-panel:hover { transform: none; }
}

/* Recent milestones on the student home page */
.xt-milestones { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--xt-gap); }
@media (max-width: 900px) { .xt-milestones { grid-template-columns: 1fr; } }

.xt-milestone {
  position: relative; overflow: hidden;
  padding: 1.15rem 1.15rem 1.15rem 1.3rem;
  background: var(--xt-surface); border: 1px solid var(--xt-line);
  border-radius: var(--xt-radius); text-decoration: none; display: block;
  transition: transform .22s ease, border-color .22s ease;
}
.xt-milestone::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary);
}
.xt-milestone:hover { transform: translateY(-3px); border-color: var(--xt-line-strong); }
.xt-milestone__icon {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(240,126,19,0.14); color: var(--primary); font-size: 0.95rem; margin-bottom: 0.6rem;
}
.xt-milestone__title { color: var(--xt-ink); font-size: 1rem; font-weight: 700; margin: 0 0 0.2rem; }
.xt-milestone__sub { color: var(--xt-ink-muted); font-size: 0.84rem; margin: 0; line-height: 1.45; }
.xt-milestone__date { color: var(--xt-ink-faint); font-size: 0.76rem; margin-top: 0.5rem; display: block; }

/* ==========================================================================
   Interactive Chessboard Styles — Feature 3
   Click-to-move, legal move highlights, capture rings, and smooth transitions.
   ========================================================================== */

.board-b72b1 {
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.square-55d63 {
  position: relative;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

/* Selected square highlight - subtle amber/orange glow */
.square-55d63.xt-sq-selected {
  background-color: rgba(255, 122, 0, 0.45) !important;
  box-shadow: inset 0 0 0 3px rgba(255, 122, 0, 0.85);
}

/* Legal destination square (empty target) - centered subtle translucent dot */
.square-55d63.xt-sq-legal-dest::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.2);
  pointer-events: none;
  z-index: 8;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.square-55d63.black-3c85d.xt-sq-legal-dest::after {
  background: rgba(0, 0, 0, 0.45);
}

.square-55d63.xt-sq-legal-dest:hover::after {
  transform: translate(-50%, -50%) scale(1.25);
  background: rgba(255, 122, 0, 0.65);
}

/* Legal capture target - distinct circular capture ring overlay */
.square-55d63.xt-sq-legal-capture::after {
  content: '';
  position: absolute;
  top: 6%;
  left: 6%;
  width: 88%;
  height: 88%;
  border-radius: 50%;
  border: 4px solid rgba(255, 68, 68, 0.7);
  box-sizing: border-box;
  pointer-events: none;
  z-index: 8;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.square-55d63.xt-sq-legal-capture:hover::after {
  border-color: rgba(255, 68, 68, 0.95);
  transform: scale(1.04);
}

/* Signature Chess.com Canary & Chartreuse Move Highlights */
.square-55d63.xt-sq-last-move {
  background-color: rgba(245, 246, 130, 0.68) !important;
}
.square-55d63.black-3c85d.xt-sq-last-move {
  background-color: rgba(186, 202, 68, 0.76) !important;
}
.square-55d63.white-1e1d7.xt-sq-last-move {
  background-color: rgba(246, 246, 136, 0.76) !important;
}

/* Interactive hover pointer */
.square-55d63:hover,
.square-55d63.xt-sq-legal-dest,
.square-55d63.xt-sq-legal-capture {
  cursor: pointer;
}

/* Smooth piece movement */
.piece-417db {
  transition: transform 0.14s cubic-bezier(0.2, 0, 0.2, 1);
  will-change: transform;
}

/* ==========================================================================
   Platform-wide Responsiveness Enhancements — Feature 1
   14-inch laptops, tablets, and mobile devices.
   ========================================================================== */

/* Prevent horizontal overflow across the entire platform */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

/* Responsive Repertoire Layout */
@media (max-width: 1024px) {
  .xt-rep-layout {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .xt-rep-side-col {
    position: static !important;
    margin-top: 1.5rem;
  }
  .xt-tree-canvas {
    height: 420px;
  }
}

/* Responsive 14-inch laptop & tablet refinements (1024px - 1366px) */
@media (max-width: 1366px) {
  .container {
    max-width: 96%;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
  .analysis-grid {
    gap: 1.25rem;
  }
  .analysis-grid--eval {
    --xt-board-aside: 320px;
  }
}

/* Responsive Mobile & Small Tablets (<= 768px) */
@media (max-width: 768px) {
  .container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  .xt-page-header__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .xt-page-header__title {
    white-space: normal !important;
    font-size: 1.8rem !important;
    line-height: 1.25;
  }
  
  .xt-page-header__actions {
    width: 100%;
    justify-content: flex-start;
  }

  /* Chessboards on mobile */
  .analysis-grid {
    grid-template-columns: 1fr !important;
    max-width: 100% !important;
  }

  .xt-board-row {
    flex-direction: column;
    align-items: center;
  }

  .xt-board-row > #eval-bar-container {
    width: 100%;
    height: 14px;
    flex: 0 0 14px;
    margin-bottom: 8px;
  }

  /* Modals & Dialogs fit mobile screens */
  .modal-content, .xt-modal, .promotion-box {
    max-width: 95vw !important;
    max-height: 88vh !important;
    overflow-y: auto !important;
    margin: 1rem auto !important;
  }

  /* Data tables responsive scroll */
  .table-responsive, .admin-table-container, .xt-scroll-x {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
}

/* Ultra small mobile screens (<= 480px) */
@media (max-width: 480px) {
  .xt-page-header__title {
    font-size: 1.5rem !important;
  }
  .stat-card.modern-panel {
    padding: 1rem;
  }
  .btn {
    padding: 0.65rem 1.25rem;
    font-size: 0.85rem;
  }
}



/* ==========================================================================
   ROLE-AWARE APPLICATION SHELL: SIDEBAR & MINIMAL TOPBAR
   ========================================================================== */

:root {
  --xt-topbar-h: 68px;
  --xt-sidebar-w: 260px;
  --xt-sidebar-collapsed-w: 72px;
}

body.xt-shell-active {
  --xt-surface: rgba(18, 22, 38, 0.45) !important;
  --xt-surface-raised: rgba(24, 29, 48, 0.55) !important;
  --xt-line: rgba(255, 255, 255, 0.035) !important;
  --xt-line-strong: rgba(255, 255, 255, 0.06) !important;
  --bg-card: rgba(18, 22, 38, 0.45) !important;
  --xt-radius: 20px !important;
  padding-top: var(--xt-topbar-h) !important;
  margin-left: var(--xt-sidebar-w) !important;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 100vh;
  background: radial-gradient(ellipse 70% 45% at 15% 15%, rgba(240, 126, 19, 0.05) 0%, transparent 60%),
              radial-gradient(ellipse 60% 50% at 85% 75%, rgba(99, 102, 241, 0.04) 0%, transparent 60%),
              #080910 !important;
}

body.xt-shell-active.xt-sidebar-collapsed {
  margin-left: var(--xt-sidebar-collapsed-w) !important;
}

@media (max-width: 991px) {
  body.xt-shell-active,
  body.xt-shell-active.xt-sidebar-collapsed {
    margin-left: 0 !important;
  }
}

/* --------------------------------------------------------------------------
   Minimal Top Bar
   -------------------------------------------------------------------------- */
body.xt-shell-active .navbar {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: var(--xt-topbar-h) !important;
  z-index: 1050 !important;
  background: rgba(8, 10, 17, 0.8) !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035) !important;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4) !important;
  display: flex !important;
  align-items: center !important;
  padding: 0 1.5rem !important;
  margin: 0 !important;
}

body.xt-shell-active .navbar .container {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Brand (Logo + Academy Name) */
.xt-topbar__brand {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.85rem !important;
  text-decoration: none !important;
  transition: transform 0.2s ease;
}

.xt-topbar__brand:hover {
  transform: scale(1.02);
}

.xt-topbar__logo {
  height: 38px !important;
  width: auto !important;
  object-fit: contain !important;
  filter: drop-shadow(0 2px 8px rgba(240, 126, 19, 0.25));
}

.xt-topbar__title-group {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.xt-topbar__academy-name {
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  background: linear-gradient(135deg, #ffffff 40%, #f07e13 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.xt-topbar__academy-sub {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: rgba(160, 160, 185, 0.7);
  text-transform: uppercase;
}

/* Right Area & Logout Button */
.xt-topbar__right {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
}

.xt-topbar__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  color: #d0d0e0;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.04);
}

.xt-topbar__btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  transform: translateY(-1px);
}

.xt-topbar__btn.is-active {
  background: rgba(240, 126, 19, 0.15);
  border-color: rgba(240, 126, 19, 0.35);
  color: #ff9d42;
}

.xt-topbar__btn--plan {
  background: linear-gradient(135deg, rgba(240, 126, 19, 0.12) 0%, rgba(255, 179, 0, 0.06) 100%);
  border: 1px solid rgba(240, 126, 19, 0.25);
  color: #ff9d42;
}

.xt-topbar__btn--plan:hover {
  background: linear-gradient(135deg, rgba(240, 126, 19, 0.22) 0%, rgba(255, 179, 0, 0.12) 100%);
  border-color: rgba(240, 126, 19, 0.45);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(240, 126, 19, 0.2);
}

.xt-topbar__logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  color: #d0d0e0;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.xt-topbar__logout-btn:hover {
  background: rgba(244, 67, 54, 0.15);
  border-color: rgba(244, 67, 54, 0.35);
  color: #ff5252;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(244, 67, 54, 0.2);
}

/* Mobile Toggle */
.xt-topbar__mobile-btn {
  display: none;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--white);
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  margin-right: 0.75rem;
  transition: all 0.2s ease;
}

.xt-topbar__mobile-btn:hover {
  background: rgba(240, 126, 19, 0.15);
  border-color: rgba(240, 126, 19, 0.3);
  color: var(--primary);
}

@media (max-width: 991px) {
  .xt-topbar__mobile-btn {
    display: inline-flex !important;
    flex-shrink: 0;
  }
  /* The sidebar button above opens the menu; the old page toggle would be a second one. */
  body.xt-shell-active .navbar .mobile-toggle {
    display: none !important;
  }
}

/* Phones: Profile / Plan / Log Out become icon buttons so all three fit. */
@media (max-width: 640px) {
  .xt-topbar__right { gap: 0.4rem; flex-shrink: 0; }
  .xt-topbar__btn,
  .xt-topbar__logout-btn {
    width: 38px; height: 38px; padding: 0; justify-content: center; font-size: 1rem;
  }
  .xt-topbar__btn > span,
  .xt-topbar__logout-btn > span { display: none; }
  .xt-topbar__mobile-btn { margin-right: 0.5rem; }
  .xt-topbar__brand { gap: 0.5rem !important; min-width: 0; }
  .xt-topbar__logo { height: 32px !important; }
  .xt-topbar__academy-name { font-size: 1rem; letter-spacing: 0.8px; }
  .xt-topbar__academy-sub { font-size: 0.55rem; letter-spacing: 1.4px; }
}
@media (max-width: 380px) {
  .xt-topbar__title-group { display: none; }
}

/* --------------------------------------------------------------------------
   Left Sidebar Navigation
   -------------------------------------------------------------------------- */
.xt-sidebar {
  position: fixed;
  top: var(--xt-topbar-h, 68px);
  left: 0;
  bottom: 0;
  width: var(--xt-sidebar-w, 260px);
  z-index: 1040;
  background: rgba(12, 14, 24, 0.94);
  backdrop-filter: blur(24px) saturate(190%);
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  border-right: 1px solid rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Collapse Toggle Header */
.xt-sidebar__header {
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
}

.xt-sidebar__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.45rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 9px;
  color: #a0a0b8;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.xt-sidebar__toggle:hover {
  background: rgba(240, 126, 19, 0.12);
  border-color: rgba(240, 126, 19, 0.3);
  color: var(--primary);
}

.xt-sidebar__nav {
  flex: 1;
  padding: 0.85rem 0.6rem;
}

.xt-sidebar__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.xt-snav__item {
  position: relative;
  list-style: none;
}

/* Section headings in the admin sidebar (Admin / Coaching). */
.xt-snav__heading {
  list-style: none;
  padding: 0.9rem 0.85rem 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #6f6f82;
}
.xt-snav__heading:first-child { padding-top: 0.2rem; }
body.xt-sidebar-collapsed .xt-snav__heading { padding: 0.5rem 0.6rem 0.2rem; }
body.xt-sidebar-collapsed .xt-snav__heading-text { display: none; }
body.xt-sidebar-collapsed .xt-snav__heading::after {
  content: '';
  display: block;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

/* Primary Direct Link */
.xt-snav__link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  color: #a5a5bb;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
}

.xt-snav__icon {
  font-size: 1.05rem;
  width: 1.4rem;
  text-align: center;
  flex-shrink: 0;
  transition: transform 0.2s ease, color 0.2s ease;
}

.xt-snav__link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.xt-snav__link:hover .xt-snav__icon {
  color: var(--primary);
  transform: scale(1.1);
}

.xt-snav__link.is-active {
  background: rgba(240, 126, 19, 0.14);
  color: var(--primary);
  border-color: rgba(240, 126, 19, 0.25);
  box-shadow: 0 2px 10px rgba(240, 126, 19, 0.15);
}

.xt-snav__link.is-active .xt-snav__icon {
  color: var(--primary);
}

/* Group Button & Submenu */
.xt-snav__group-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  background: none;
  border: 1px solid transparent;
  color: #a5a5bb;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.xt-snav__group-main {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.xt-snav__caret {
  font-size: 0.7rem;
  opacity: 0.6;
  transition: transform 0.25s ease;
}

.xt-snav__group-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.xt-snav__group-btn:hover .xt-snav__icon {
  color: var(--primary);
}

.xt-snav__item--group.is-open .xt-snav__caret {
  transform: rotate(180deg);
}

.xt-snav__item--group.is-active-group .xt-snav__group-btn {
  color: #ffffff;
}

.xt-snav__item--group.is-active-group .xt-snav__icon {
  color: var(--primary);
}

/* Submenu */
.xt-snav__submenu {
  list-style: none;
  margin: 0;
  padding: 0.2rem 0 0.4rem 0.75rem;
  display: none;
  flex-direction: column;
  gap: 0.25rem;
}

.xt-snav__item--group.is-open .xt-snav__submenu {
  display: flex !important;
}

.xt-snav__subitem {
  list-style: none;
}

.xt-snav__sublink {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
}

.xt-snav__subicon {
  font-size: 0.92rem;
  margin-top: 2px;
  color: #8c8ca0;
  width: 1.1rem;
  text-align: center;
  flex-shrink: 0;
  transition: color 0.2s ease, transform 0.2s ease;
}

.xt-snav__subtext {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.xt-snav__sublabel {
  font-size: 0.88rem;
  font-weight: 600;
  color: #c5c5d8;
  transition: color 0.2s ease;
}

.xt-snav__subhint {
  font-size: 0.74rem;
  font-weight: 500;
  color: #727288;
  margin-top: 2px;
  line-height: 1.3;
  transition: color 0.2s ease;
}

.xt-snav__sublink:hover {
  background: rgba(240, 126, 19, 0.08);
  border-left-color: var(--primary);
}

.xt-snav__sublink:hover .xt-snav__sublabel {
  color: var(--primary);
}

.xt-snav__sublink:hover .xt-snav__subhint {
  color: #b0b0cc;
}

.xt-snav__sublink:hover .xt-snav__subicon {
  color: var(--primary);
  transform: scale(1.1);
}

.xt-snav__sublink.is-active {
  background: rgba(240, 126, 19, 0.14);
  border-left-color: var(--primary);
}

.xt-snav__sublink.is-active .xt-snav__sublabel {
  color: var(--primary);
  font-weight: 700;
}

.xt-snav__sublink.is-active .xt-snav__subicon {
  color: var(--primary);
}

/* Collapsed Mode */
body.xt-sidebar-collapsed .xt-sidebar {
  width: var(--xt-sidebar-collapsed-w, 72px);
}

body.xt-sidebar-collapsed .xt-snav__label,
body.xt-sidebar-collapsed .xt-snav__lock,
body.xt-sidebar-collapsed .xt-snav__caret,
body.xt-sidebar-collapsed .xt-sidebar__toggle-label {
  display: none !important;
}

body.xt-sidebar-collapsed .xt-sidebar__toggle {
  justify-content: center;
  padding: 0.45rem;
}

body.xt-sidebar-collapsed .xt-snav__link,
body.xt-sidebar-collapsed .xt-snav__group-btn {
  justify-content: center;
  padding: 0.65rem 0;
}

body.xt-sidebar-collapsed .xt-snav__icon {
  margin: 0;
  width: auto;
}

/* Floating Flyout for Groups in Collapsed Mode */
body.xt-sidebar-collapsed .xt-snav__item--group:hover .xt-snav__submenu {
  display: flex !important;
  position: absolute;
  left: 100%;
  top: 0;
  min-width: 260px;
  background: rgba(14, 16, 26, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  padding: 0.6rem;
  z-index: 1500;
  margin-left: 0.4rem;
}

body.xt-sidebar-collapsed .xt-snav__item--group .xt-snav__submenu {
  display: none !important;
}

/* Mobile Sidebar (< 992px) */
@media (max-width: 991px) {
  .xt-sidebar {
    top: 0;
    height: 100vh;
    width: 270px;
    transform: translateX(-100%);
    z-index: 2000;
  }

  body.xt-sidebar-mobile-open .xt-sidebar {
    transform: translateX(0);
  }

  .xt-sidebar__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1990;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  body.xt-sidebar-mobile-open .xt-sidebar__backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}

/* --------------------------------------------------------------------------
   Modern Glassmorphic Surfaces (All Post-Login App Surfaces)
   No harsh 4-sided grey borders; specular top bevel and organic ambient depth.
   -------------------------------------------------------------------------- */
body.xt-shell-active .modern-panel,
body.xt-shell-active .stat-card,
body.xt-shell-active .xt-card,
body.xt-shell-active .dashboard-card,
body.xt-shell-active .xt-panel,
body.xt-shell-active .xt-game-card,
body.xt-shell-active .xt-event-card,
body.xt-shell-active .xt-session-card,
body.xt-shell-active .xt-voice-note,
body.xt-shell-active .admin-card,
body.xt-shell-active .coach-card {
  background: linear-gradient(180deg, rgba(23, 28, 47, 0.55) 0%, rgba(13, 16, 27, 0.45) 100%) !important;
  backdrop-filter: blur(24px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(160%) !important;
  border: 1px solid rgba(255, 255, 255, 0.035) !important;
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.06), 0 20px 40px -15px rgba(0, 0, 0, 0.55) !important;
  border-radius: 20px !important;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease !important;
}

body.xt-shell-active .modern-panel:hover,
body.xt-shell-active .stat-card:hover,
body.xt-shell-active .xt-card:hover,
body.xt-shell-active .xt-panel:hover,
body.xt-shell-active .xt-game-card:hover,
body.xt-shell-active .xt-event-card:hover {
  transform: translateY(-2px) !important;
  background: linear-gradient(180deg, rgba(28, 34, 56, 0.6) 0%, rgba(16, 20, 33, 0.5) 100%) !important;
  border-color: rgba(240, 126, 19, 0.16) !important;
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.1), 0 28px 60px -15px rgba(0, 0, 0, 0.65), 0 0 30px rgba(240, 126, 19, 0.04) !important;
}

/* Post-Login Typography & Hierarchy */
body.xt-shell-active h1,
body.xt-shell-active .page-title,
body.xt-shell-active .xt-page-header h1 {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em !important;
  color: #ffffff !important;
}

body.xt-shell-active h2,
body.xt-shell-active .panel-title,
body.xt-shell-active .xt-panel__title {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em !important;
  color: #ffffff !important;
}

body.xt-shell-active p.text-muted,
body.xt-shell-active .subtitle,
body.xt-shell-active .xt-panel__hint {
  color: #9da3be !important;
}

/* Modern Form Inputs & Selects */
body.xt-shell-active .form-control,
body.xt-shell-active input[type="text"],
body.xt-shell-active input[type="search"],
body.xt-shell-active select,
body.xt-shell-active textarea {
  background: rgba(14, 17, 28, 0.7) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 10px !important;
  color: #ffffff !important;
  padding: 0.6rem 0.9rem !important;
  transition: all 0.2s ease !important;
}

/* Search boxes with a magnifier inside need room for it (the rule above is !important). */
body.xt-shell-active .xt-filters__search input,
body.xt-shell-active .xt-icon-search input,
body.xt-shell-active .aa-search input {
  padding-left: 2.3rem !important;
}

body.xt-shell-active .form-control:focus,
body.xt-shell-active input:focus,
body.xt-shell-active select:focus,
body.xt-shell-active textarea:focus {
  border-color: rgba(240, 126, 19, 0.6) !important;
  box-shadow: 0 0 0 3px rgba(240, 126, 19, 0.2) !important;
  outline: none !important;
}

/* Primary & Secondary Buttons */
body.xt-shell-active .btn-primary {
  background: linear-gradient(135deg, #f07e13 0%, #ff9533 100%) !important;
  border: none !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  border-radius: 10px !important;
  box-shadow: 0 4px 16px rgba(240, 126, 19, 0.35) !important;
  transition: all 0.2s ease !important;
}

body.xt-shell-active .btn-primary:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 22px rgba(240, 126, 19, 0.5) !important;
}

body.xt-shell-active .btn-secondary,
body.xt-shell-active .btn-outline {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.05) !important;
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.05) !important;
  color: #e0e0f0 !important;
  border-radius: 12px !important;
  font-weight: 600 !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  transition: all 0.2s ease !important;
}

body.xt-shell-active .btn-secondary:hover,
body.xt-shell-active .btn-outline:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
}

/* Refined Table Styling */
body.xt-shell-active .table th,
body.xt-shell-active table:not(.scoresheet-table):not(.gr-table) th {
  background: rgba(255, 255, 255, 0.03) !important;
  color: #9da3be !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035) !important;
  padding: 0.85rem 1rem !important;
}

body.xt-shell-active .table td,
body.xt-shell-active table:not(.scoresheet-table):not(.gr-table) td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  padding: 0.85rem 1rem !important;
  color: #d8d8e8 !important;
}

body.xt-shell-active .table tr:hover td,
body.xt-shell-active table:not(.scoresheet-table):not(.gr-table) tr:hover td {
  background: rgba(255, 255, 255, 0.02) !important;
}

/* --------------------------------------------------------------------------
   Header Padding & Top Text Cut-Off Elimination
   -------------------------------------------------------------------------- */
body.xt-shell-active header.py-5,
body.xt-shell-active .xt-page-header,
body.xt-shell-active .page-header {
  padding-top: 1.8rem !important;
  padding-bottom: 1.2rem !important;
}

body.xt-shell-active .container {
  padding-left: 1.5rem !important;
  padding-right: 1.5rem !important;
  max-width: 1400px !important;
}

/* Allow floating flyout outside sidebar in collapsed mode */
body.xt-sidebar-collapsed .xt-sidebar,
body.xt-sidebar-collapsed .xt-sidebar__nav {
  overflow: visible !important;
}

/* --------------------------------------------------------------------------
   Sidebar Footer & Refer and Earn
   -------------------------------------------------------------------------- */
.xt-sidebar__footer {
  margin-top: auto;
  padding: 0.85rem 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.xt-sidebar__refer-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.8rem;
  background: linear-gradient(135deg, rgba(240, 126, 19, 0.12) 0%, rgba(255, 179, 0, 0.06) 100%);
  border: 1px solid rgba(240, 126, 19, 0.22);
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.06), 0 4px 14px rgba(0, 0, 0, 0.25);
}

.xt-sidebar__refer-btn:hover,
.xt-sidebar__refer-btn.is-active {
  background: linear-gradient(135deg, rgba(240, 126, 19, 0.22) 0%, rgba(255, 179, 0, 0.14) 100%);
  border-color: rgba(240, 126, 19, 0.45);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.1), 0 6px 18px rgba(240, 126, 19, 0.18);
}

.xt-sidebar__refer-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(240, 126, 19, 0.18);
  color: #ff9d42;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.xt-sidebar__refer-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.xt-sidebar__refer-title {
  color: #ffffff;
  font-weight: 700;
  font-size: 0.84rem;
  line-height: 1.2;
}

.xt-sidebar__refer-sub {
  color: #ffb74d;
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.xt-sidebar-collapsed .xt-sidebar__refer-text {
  display: none !important;
}

body.xt-sidebar-collapsed .xt-sidebar__refer-btn {
  justify-content: center;
  padding: 0.65rem 0;
}

/* --------------------------------------------------------------------------
   My Plan Modal (Twain Glassmorphic Overlay)
   -------------------------------------------------------------------------- */
.xt-plan-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(4, 5, 10, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.xt-plan-modal-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: linear-gradient(180deg, rgba(26, 32, 54, 0.88) 0%, rgba(14, 18, 30, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 2rem;
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.12), 0 30px 70px -15px rgba(0, 0, 0, 0.8), 0 0 40px rgba(240, 126, 19, 0.1);
  color: #ffffff;
  animation: xtModalScale 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes xtModalScale {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.xt-plan-modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #a0a0b8;
  font-size: 1.3rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.xt-plan-modal-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.xt-plan-modal-header {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-bottom: 1.5rem;
}

.xt-plan-modal-crown {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(240, 126, 19, 0.25) 0%, rgba(255, 179, 0, 0.15) 100%);
  border: 1px solid rgba(240, 126, 19, 0.4);
  color: #ff9d42;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 16px rgba(240, 126, 19, 0.2);
  flex-shrink: 0;
}

.xt-plan-modal-status {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #4ade80;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.xt-plan-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
}

.xt-plan-modal-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.01em;
}

.xt-plan-modal-body {
  margin-bottom: 1.75rem;
}

.xt-plan-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.xt-plan-info-label {
  color: #9898b0;
  font-size: 0.88rem;
  font-weight: 500;
}

.xt-plan-info-val {
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
}

.xt-plan-validity {
  color: #ff9d42;
  font-weight: 700;
}

.xt-plan-benefits {
  margin-top: 1.25rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.025);
}

.xt-plan-benefit-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.82rem;
  color: #d0d0e4;
}

.xt-plan-benefit-item i {
  color: #4ade80;
  font-size: 0.9rem;
}

.xt-plan-modal-footer {
  display: flex;
  gap: 0.75rem;
}

.xt-plan-renew-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.2rem !important;
  font-weight: 700 !important;
  font-size: 0.92rem !important;
  border-radius: 12px !important;
}

.xt-plan-close-btn {
  padding: 0.75rem 1.25rem !important;
  border-radius: 12px !important;
}

/* Free access: paid pages keep their place in the sidebar with a lock */
.xt-snav__lock { margin-left: auto; font-size: 0.7rem; color: #6f6f82; flex-shrink: 0; align-self: center; }
.xt-snav__group-btn .xt-snav__lock { margin-right: 0.5rem; }
.xt-snav__link.is-locked .xt-snav__label,
.xt-snav__sublink.is-locked .xt-snav__sublabel,
.xt-snav__link.is-locked .xt-snav__icon,
.xt-snav__sublink.is-locked .xt-snav__subicon { opacity: 0.6; }
.xt-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; }

/* --------------------------------------------------------------------------
   Profile Avatar & Cropper
   -------------------------------------------------------------------------- */
.profile-avatar-wrapper:hover .avatar-edit-badge {
  transform: scale(1.1);
  background: #ffa726;
}

.avatar-edit-badge:hover {
  transform: scale(1.15) !important;
}

.crop-modal-card {
  background: var(--xt-surface, #161622);
  border: 1px solid var(--xt-line, rgba(255, 255, 255, 0.12));
  border-radius: 20px;
  padding: 1.5rem;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
  animation: grFadeIn 0.2s ease-out;
}

.crop-mask-circle {
  box-shadow: 0 0 0 9999px rgba(8, 9, 13, 0.78);
  border: 2px solid var(--primary, #f07e13);
}

/* Scrollbars: thin, dark, rounded, brand orange on hover (page, side pane, panels).
   Chrome ignores ::-webkit-scrollbar once scrollbar-color is set, so the standard
   properties are only for Firefox. */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background-color: rgba(240, 126, 19, 0.7); }
*::-webkit-scrollbar-corner { background: transparent; }
html::-webkit-scrollbar { width: 10px; }
html::-webkit-scrollbar-track { background: #0b0b12; }
@supports (-moz-appearance: none) {
  * { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent; }
  html { scrollbar-color: rgba(255, 255, 255, 0.2) #0b0b12; }
}

/* Site footer on app/legacy pages (dashboard, about, challenges): same look as the
   public pages' footer (styles.landing.css .landing-footer) without loading that sheet. */
.xt-site-footer { background: #06070A; border-top: 1px solid rgba(255, 255, 255, 0.06); padding: 2.6rem 0 1.8rem; margin-top: 3rem; }
.xt-site-footer__inner { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.xt-site-footer__top { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding-bottom: 2.2rem; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.xt-site-footer__brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; flex-shrink: 0; }
.xt-site-footer__brand img { height: 36px; width: auto; filter: drop-shadow(0 2px 8px rgba(255, 122, 0, 0.35)); }
.xt-site-footer__brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.xt-site-footer__name { font-size: 1.15rem; font-weight: 800; letter-spacing: 0.5px; color: #fff; }
.xt-site-footer__sub { font-size: 0.62rem; font-weight: 600; letter-spacing: 1.5px; color: #ff7a00; }
.xt-site-footer__links { display: flex; flex-wrap: wrap; align-items: center; gap: 1.6rem; list-style: none; margin: 0; padding: 0; }
.xt-site-footer__links a { color: #9aa0ae; font-size: 0.9rem; text-decoration: none; }
.xt-site-footer__links a:hover { color: #fff; }
.xt-site-footer__bottom { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1.8rem; font-size: 0.8rem; color: #6b7080; }
.xt-site-footer__legal { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.xt-site-footer__legal a { color: #6b7080; text-decoration: none; }
.xt-site-footer__legal a:hover { color: #c7cad3; }
@media (max-width: 900px) {
  .xt-site-footer__top, .xt-site-footer__bottom { flex-direction: column; align-items: flex-start; }
  .xt-site-footer__links { gap: 1.1rem; }
}


/* ==========================================================================
   Edges (Dec 2026): fewer flat grey outlines. Search gets a warm gradient edge;
   secondary buttons, chips and toggles are soft filled surfaces that warm to orange
   on hover; cards are lit from the top instead of ringed; inputs are quieter until
   focused. Active and selected states keep their own colours.
   ========================================================================== */

/* Universal search entry (top of the sidebar). */
.xt-sidebar__header { flex-direction: column; align-items: stretch; gap: 0.5rem; }
.xt-sidebar__search {
  display: flex; align-items: center; gap: 0.6rem; width: 100%; padding: 0.6rem 0.75rem;
  border: 1px solid transparent; border-radius: 11px; color: #e4e5ee; font: inherit; font-size: 0.86rem;
  cursor: pointer; text-align: left;
  background:
    linear-gradient(180deg, #171a28, #10121b) padding-box,
    linear-gradient(120deg, rgba(240, 126, 19, 0.85), rgba(255, 201, 40, 0.35) 45%, rgba(255, 255, 255, 0.06) 85%) border-box;
  box-shadow: 0 6px 22px -10px rgba(240, 126, 19, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: box-shadow 0.2s ease, transform 0.2s ease, color 0.2s ease;
}
.xt-sidebar__search:hover { color: #fff; box-shadow: 0 8px 28px -8px rgba(240, 126, 19, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.07); transform: translateY(-1px); }
.xt-sidebar__search:focus-visible { outline: 2px solid var(--primary, #f07e13); outline-offset: 2px; }
.xt-sidebar__search i { color: var(--primary, #f07e13); width: 16px; text-align: center; }
.xt-sidebar__search-label { flex: 1; }
.xt-sidebar__search kbd {
  font: 600 0.68rem/1 inherit; font-family: inherit; padding: 0.22rem 0.4rem; border-radius: 6px;
  background: rgba(240, 126, 19, 0.12); border: 1px solid rgba(240, 126, 19, 0.25); color: #ffb26b;
}
body.xt-sidebar-collapsed .xt-sidebar__search { justify-content: center; padding: 0.6rem; }
body.xt-sidebar-collapsed .xt-sidebar__search-label, body.xt-sidebar-collapsed .xt-sidebar__search kbd { display: none; }
@media (max-width: 991px) { .xt-sidebar__search kbd { display: none; } }
@media (prefers-reduced-motion: reduce) { .xt-sidebar__search:hover { transform: none; } }
.xt-topbar__search { display: none; }
@media (max-width: 991px) {
  .xt-topbar__search { display: inline-flex; color: var(--primary, #f07e13) !important; background: rgba(240, 126, 19, 0.1) !important; border-color: rgba(240, 126, 19, 0.3) !important; }
}

/* Secondary buttons: a soft filled surface instead of a grey ring. */
body.xt-shell-active .btn-secondary,
body.xt-shell-active .btn-outline,
body.xt-shell-active .xt-btn-ghost,
body.xt-shell-active .xt-topbar__btn:not(.xt-topbar__btn--plan),
body.xt-shell-active .xt-topbar__logout-btn,
body.xt-shell-active .xt-sidebar__toggle,
body.xt-shell-active .sleek-btn,
body.xt-shell-active .xt-rep-nav__btn {
  background: rgba(255, 255, 255, 0.045) !important;
  border-color: transparent !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 1px 2px rgba(0, 0, 0, 0.25) !important;
}
body.xt-shell-active .btn-secondary:hover,
body.xt-shell-active .btn-outline:hover,
body.xt-shell-active .xt-btn-ghost:hover,
body.xt-shell-active .xt-topbar__btn:not(.xt-topbar__btn--plan):hover,
body.xt-shell-active .xt-topbar__logout-btn:hover,
body.xt-shell-active .xt-sidebar__toggle:hover,
body.xt-shell-active .sleek-btn:hover,
body.xt-shell-active .xt-rep-nav__btn:hover {
  background: rgba(240, 126, 19, 0.1) !important;
  border-color: rgba(240, 126, 19, 0.35) !important;
  color: #fff !important;
}

/* Chips, options and tags (unselected): filled, no ring. */
body.xt-shell-active .xt-insight-chip:not(.is-active),
body.xt-shell-active .xt-budget__opt:not(.is-active),
body.xt-shell-active .xt-rep-chip:not(.is-active),
body.xt-shell-active .xt-comfort-option:not(.is-active):not(.is-selected),
body.xt-shell-active .xt-tag--selectable:not(.is-selected),
body.xt-shell-active .xt-rep-gap,
body.xt-shell-active .xt-badge--neutral {
  background: rgba(255, 255, 255, 0.05);
  border-color: transparent;
}
body.xt-shell-active .xt-insight-chip:not(.is-active):hover,
body.xt-shell-active .xt-budget__opt:not(.is-active):hover,
body.xt-shell-active .xt-rep-chip:not(.is-active):hover,
body.xt-shell-active .xt-comfort-option:not(.is-active):not(.is-selected):hover,
body.xt-shell-active .xt-tag--selectable:not(.is-selected):hover,
body.xt-shell-active .xt-rep-gap:hover {
  background: rgba(240, 126, 19, 0.08);
  border-color: rgba(240, 126, 19, 0.3);
}

/* Segmented controls: a recessed track instead of an outlined box. */
body.xt-shell-active .xt-hw-tabs,
body.xt-shell-active .xt-hw-viewtoggle,
body.xt-shell-active .xt-tree__controls {
  border-color: transparent;
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* Cards: lit from the top edge, separated by depth rather than a ring. */
body.xt-shell-active .modern-panel,
body.xt-shell-active .stat-card,
body.xt-shell-active .xt-card,
body.xt-shell-active .dashboard-card,
body.xt-shell-active .xt-panel,
body.xt-shell-active .xt-game-card,
body.xt-shell-active .xt-event-card,
body.xt-shell-active .xt-session-card,
body.xt-shell-active .admin-card,
body.xt-shell-active .coach-card {
  border-color: rgba(255, 255, 255, 0.018) !important;
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.075), inset 0 0 0 1px rgba(255, 255, 255, 0.012), 0 18px 40px -18px rgba(0, 0, 0, 0.6) !important;
}
body.xt-shell-active .xt-review-item,
body.xt-shell-active .xt-hw-card,
body.xt-shell-active .xt-hwp-card,
body.xt-shell-active .xt-train-mini,
body.xt-shell-active .xt-train-item,
body.xt-shell-active .xt-milestone-compact,
body.xt-shell-active .puzzle-stats-panel {
  border-color: rgba(255, 255, 255, 0.02) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 24px -16px rgba(0, 0, 0, 0.55) !important;
}
body.xt-shell-active .xt-review-item:hover,
body.xt-shell-active .xt-hw-card:hover,
body.xt-shell-active .xt-hwp-card:hover {
  border-color: rgba(240, 126, 19, 0.22) !important;
}

/* Inputs: quieter at rest, clearly orange when focused (the focus rule above). */
body.xt-shell-active .form-control,
body.xt-shell-active input[type="text"],
body.xt-shell-active input[type="search"],
body.xt-shell-active input[type="email"],
body.xt-shell-active input[type="number"],
body.xt-shell-active select,
body.xt-shell-active textarea {
  border-color: rgba(255, 255, 255, 0.06) !important;
  background: rgba(8, 10, 18, 0.6) !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}
body.xt-shell-active .form-control:hover:not(:focus),
body.xt-shell-active input[type="text"]:hover:not(:focus),
body.xt-shell-active input[type="search"]:hover:not(:focus),
body.xt-shell-active select:hover:not(:focus),
body.xt-shell-active textarea:hover:not(:focus) {
  border-color: rgba(255, 255, 255, 0.12) !important;
}
body.xt-shell-active .xt-streak { border-color: rgba(255, 255, 255, 0.05); background: rgba(255, 255, 255, 0.04); }
body.xt-shell-active .form-control:focus,
body.xt-shell-active input:focus,
body.xt-shell-active select:focus,
body.xt-shell-active textarea:focus {
  border-color: rgba(240, 126, 19, 0.6) !important;
  box-shadow: 0 0 0 3px rgba(240, 126, 19, 0.18) !important;
}

/* Count on a sidebar link (class reports waiting for the coach). */
.xt-snav__link { position: relative; }
.xt-snav__badge {
  margin-left: auto; flex-shrink: 0; min-width: 1.35rem; height: 1.35rem; padding: 0 0.4rem; border-radius: 999px;
  display: inline-grid; place-items: center; background: var(--primary, #f07e13); color: #fff;
  font-size: 0.72rem; font-weight: 700; line-height: 1;
}
body.xt-sidebar-collapsed .xt-snav__badge { position: absolute; top: 0.2rem; right: 0.55rem; min-width: 1.05rem; height: 1.05rem; padding: 0 0.25rem; font-size: 0.62rem; }

/* "Class reports waiting for you" (coach console). */
.xt-review-banner {
  display: flex; align-items: center; gap: 0.9rem; margin: 0 0 1.5rem; padding: 0.95rem 1.1rem; border-radius: 14px;
  background: linear-gradient(180deg, rgba(240, 126, 19, 0.16), rgba(240, 126, 19, 0.07));
  box-shadow: inset 0 0 0 1px rgba(240, 126, 19, 0.45), 0 8px 24px rgba(0, 0, 0, 0.2);
  color: #c7c9d6; text-decoration: none; font-size: 0.9rem; line-height: 1.45;
}
.xt-review-banner > i { color: var(--primary, #f07e13); font-size: 1.3rem; }
.xt-review-banner > span:first-of-type { display: grid; gap: 0.15rem; flex: 1; min-width: 0; }
.xt-review-banner strong { color: #fff; font-size: 1rem; }
.xt-review-banner__go { flex: 0 0 auto; padding: 0.5rem 1rem; border-radius: 10px; background: var(--primary, #f07e13); color: #fff; font-weight: 700; }
.xt-review-banner:hover .xt-review-banner__go { background: #ff8f2a; }
.xt-review-banner:focus-visible { outline: 2px solid #f07e13; outline-offset: 2px; }

/* Profile menu under the top bar's profile picture (XT.shell). */
.xt-profile-wrap { position: relative; display: inline-flex; }
.xt-profile-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 2100; min-width: 210px; padding: 0.35rem;
  border-radius: 12px; background: linear-gradient(180deg, #1b1c2b, #131420);
  box-shadow: 0 18px 40px -10px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.xt-profile-menu[hidden] { display: none; }
.xt-profile-menu a, .xt-profile-menu button {
  display: flex; align-items: center; gap: 0.6rem; width: 100%; padding: 0.6rem 0.75rem; border: 0; border-radius: 8px;
  background: none; color: #e4e5ee; font: inherit; font-size: 0.88rem; text-align: left; text-decoration: none; cursor: pointer;
}
.xt-profile-menu a:hover, .xt-profile-menu button:hover, .xt-profile-menu a:focus-visible, .xt-profile-menu button:focus-visible { background: rgba(240, 126, 19, 0.14); color: #fff; outline: none; }
.xt-profile-menu i { width: 16px; text-align: center; color: #f7a04f; }

