/* Shared visual system for the SPORTIVA workspace and its dialogs. */
:where(.app-shell, #dialog) {
  --navy: #0b1730;
  --navy-deep: #081226;
  --ink: #142447;
  --blue: #2146b9;
  --royal: #2a53d3;
  --blue-light: #eaf0ff;
  --canvas: #f4f7fd;
  --white: #fff;
  --line: #dce5f4;
  --muted: #4c5e79;
  --mint: #bdf4d8;
  --green: #166449;
  --orange: #835215;
  --red: #a62e42;
  --radius: 16px;
  --panel-shadow: 0 2px 3px #0b173006, 0 12px 28px -24px #0b173046;
  color: var(--ink);
}

.app-shell {
  --sidebar-width: 248px;
  --workspace-inset: clamp(22px, 3vw, 44px);
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  background: var(--canvas);
  font-size: 1rem;
}

.app-shell .sidebar {
  width: var(--sidebar-width);
  padding: 28px 16px 16px;
  background: linear-gradient(165deg, #14274c, var(--navy) 42%);
  border-right: 1px solid #ffffff10;
}

.app-shell .sidebar .brand {
  gap: 10px;
  padding: 0 6px 25px;
  font-size: 21px;
  letter-spacing: .065em;
}

.app-shell .sidebar .brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  background: var(--royal);
  color: #fff;
  font-size: 24px;
  box-shadow: inset 0 1px 0 #ffffff22;
}

.app-shell .sidebar .brand-word > span {
  margin-top: 5px;
  color: #bbcae4;
  letter-spacing: .12em;
}

.app-shell .club-label {
  margin: 0 5px 18px;
  padding: 12px 13px;
  border: 1px solid #ffffff19;
  border-radius: 11px;
  background: #ffffff08;
}

.app-shell .club-label small {
  color: #bccbe5;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .085em;
}

.app-shell .club-label strong {
  margin-top: 4px;
  color: #fff;
  font-size: .875rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.app-shell .sidebar nav { gap: 4px; }

.app-shell .nav-link {
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #d0dcf2;
  font-size: .875rem;
  font-weight: 550;
  line-height: 1.35;
}

.app-shell .nav-link > span:nth-child(2) { overflow-wrap: anywhere; }
.app-shell .nav-link .lucide { color: #aabde0; }
.app-shell .nav-link:hover,
.app-shell .sidebar-bottom button:hover { background: #ffffff15; color: #fff; }

.app-shell .nav-link.active {
  border-color: #ffffff24;
  background: #25478f;
  color: #fff;
  font-weight: 700;
  box-shadow: inset 3px 0 var(--mint);
}

.app-shell .nav-link.active .lucide { color: var(--mint); }

.app-shell .nav-count {
  margin-left: auto;
  min-width: 20px;
  padding: 2px 4px;
  border-radius: 6px;
  background: var(--mint);
  color: #123c2d;
  font-size: .75rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.app-shell .sidebar-bottom {
  display: grid;
  gap: 2px;
  border-color: #ffffff22;
}

.app-shell .sidebar-bottom button {
  min-height: 36px;
  padding: 7px 9px;
  border-radius: 8px;
  color: #c0cfea;
  font-size: .8125rem;
  text-align: left;
  line-height: 1.4;
}

.app-shell .sidebar-bottom .lucide { width: 16px; height: 16px; }

.app-shell .topbar {
  height: 68px;
  padding-inline: var(--workspace-inset);
  background: var(--white);
  box-shadow: 0 4px 20px -19px #0b17308f;
}

.app-shell .breadcrumb {
  min-width: 0;
  color: var(--muted);
  font-size: .875rem;
  overflow: hidden;
}

.app-shell .breadcrumb strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
}

.app-shell .demo-pill {
  padding: 5px 9px;
  border: 1px solid #c4d6ff;
  border-radius: 7px;
  background: #edf3ff;
  color: #294788;
  font-size: .75rem;
  letter-spacing: .035em;
}

.app-shell .demo-dot { background: var(--royal); }

.app-shell .lang-control {
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--canvas);
}

.app-shell .lang-control button {
  min-width: 34px;
  min-height: 34px;
  padding: 5px 7px;
  background: var(--canvas);
  color: var(--muted);
  font-size: .75rem;
}

.app-shell .lang-control button.active {
  background: #e1eaff;
  color: var(--blue);
}

.app-shell .lang-control button:focus-visible { outline-offset: -3px; }
.app-shell .user-info { min-width: 0; }
.app-shell .user-name { font-size: .875rem; }
.app-shell .user-role { color: var(--muted); font-size: .75rem; }
.app-shell .user-action { min-height: 40px; }

.app-shell .page-content {
  padding: clamp(26px, 4vw, 52px) var(--workspace-inset) 42px;
  max-width: 1640px;
}

.app-shell .page-heading { align-items: flex-start; margin-bottom: clamp(22px, 3vw, 35px); }

.app-shell .page-heading h1 {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: clamp(1.875rem, 2.8vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: -.045em;
  overflow-wrap: anywhere;
}

.app-shell .page-heading .subtitle { color: var(--muted); font-size: 1rem; }
.app-shell .page-heading .button-group { padding-top: 0; }
.app-shell .eyebrow { font-size: .75rem; color: var(--blue); }
.app-shell .muted, #dialog .muted { color: var(--muted); }

.app-shell .card, #dialog .card,
.app-shell .welcome-player {
  border-color: var(--line);
  border-radius: var(--radius);
  box-shadow: var(--panel-shadow);
}

.app-shell .card-header, #dialog .card-header {
  border-color: var(--line);
  background: linear-gradient(180deg, #fff, #fcfdff);
}

.app-shell .card-header h2, #dialog .card-header h2 {
  font-size: clamp(1.125rem, 1.4vw, 1.375rem);
  line-height: 1.35;
  letter-spacing: -.02em;
}

.app-shell .card-header h3, #dialog .card-header h3 { font-size: 1rem; }
.app-shell .card-body > :last-child, #dialog .card-body > :last-child { margin-bottom: 0; }

.app-shell .stat, #dialog .stat {
  border-color: var(--line);
  border-radius: var(--radius);
  box-shadow: var(--panel-shadow);
}

.app-shell .stat.featured, #dialog .stat.featured {
  border-color: #203f83;
  background: linear-gradient(135deg, #122345, #244890);
  color: #fff;
}

.app-shell .stat-label, #dialog .stat-label {
  padding-right: 23px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 650;
  line-height: 1.35;
}

.app-shell .card.stat .stat-label, #dialog .card.stat .stat-label { margin-bottom: 0; }
.app-shell .stat-note, #dialog .stat-note { color: var(--muted); font-size: .8125rem; }
.app-shell .stat-icon, #dialog .stat-icon { color: #5875b1; }
.app-shell .stat.featured .stat-label, #dialog .stat.featured .stat-label,
.app-shell .stat.featured .stat-note, #dialog .stat.featured .stat-note { color: #d5e4ff; }
.app-shell .stat.featured .stat-icon, #dialog .stat.featured .stat-icon { color: var(--mint); }
.app-shell .stat-value, .app-shell .metric-value { font-size: clamp(1.5rem, 2.3vw, 2.125rem); }

.app-shell .avatar, #dialog .avatar { background: #e7eeff; color: #27469b; }
.app-shell .avatar.large, #dialog .avatar.large { border-radius: 15px; }
.app-shell :is(.event-row, .activity-row) { border-color: var(--line); }
.app-shell .date-box { background: #edf3ff; }
.app-shell .date-box small { color: var(--muted); font-size: .75rem; }
.app-shell .date-box strong { color: var(--blue); }
.app-shell .event-details h3 { font-size: .9375rem; }
.app-shell :is(.event-details p, .activity-row, .welcome-player p) { font-size: .875rem; }
.app-shell .activity-row small { color: var(--muted); font-size: .8125rem; }
.app-shell .activity-dot { background: var(--royal); }
.app-shell .child-tab { min-height: 52px; border-color: var(--line); border-radius: 12px; }
.app-shell .child-tab.active { background: #eaf1ff; border-color: #91acf1; }
.app-shell .child-tab.active strong { color: var(--blue); }
.app-shell .child-tab small { color: var(--muted); font-size: .75rem; }
.app-shell .demo-footnote { color: var(--muted); font-size: .8125rem; }

/* Use the same quiet surfaces and readable controls in each module. */
.app-shell .table-wrap, #dialog .table-wrap {
  max-width: 100%;
  border-color: var(--line);
  border-radius: 12px;
}

.app-shell .card > .table-wrap, #dialog .card > .table-wrap { border: 0; border-radius: 0; }
.app-shell table, #dialog table { font-size: .875rem; }

.app-shell th, #dialog th {
  border-color: var(--line);
  background: #edf3ff;
  color: #435a7d;
  font-size: .75rem;
  font-weight: 750;
  letter-spacing: .035em;
}

.app-shell td, #dialog td { border-color: #e8eef8; }
.app-shell tbody tr:hover, #dialog tbody tr:hover { background: #f7faff; }
.app-shell .table-link, #dialog .table-link { color: var(--blue); }
.app-shell .player-cell small, #dialog .player-cell small { font-size: .8125rem; }
.app-shell .pagination, #dialog .pagination { border-color: var(--line); font-size: .875rem; }

.app-shell .button, #dialog .button {
  min-height: 42px;
  padding: 9px 13px;
  border-color: #cddaf0;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: .875rem;
  font-weight: 650;
}

.app-shell .button:hover, #dialog .button:hover { border-color: #9eb4ed; background: #f2f6ff; }

.app-shell .button.primary, #dialog .button.primary {
  border-color: var(--royal);
  background: var(--royal);
  color: #fff;
  box-shadow: 0 2px 4px #0d2a781a;
}

.app-shell .button.primary:hover, #dialog .button.primary:hover { border-color: var(--blue); background: var(--blue); }

.app-shell .button.danger, #dialog .button.danger {
  border-color: #f2cbd2;
  background: #fff5f6;
  color: var(--red);
}

.app-shell .button.danger:hover, #dialog .button.danger:hover { border-color: #db96a4; background: #ffe9ed; }
.app-shell .button.ghost, #dialog .button.ghost { border-color: transparent; background: transparent; }
.app-shell .button.ghost:hover, #dialog .button.ghost:hover { background: #eaf0ff; }
.app-shell .button.small, #dialog .button.small { min-height: 36px; padding: 6px 10px; font-size: .8125rem; }
.app-shell .button.icon-only, #dialog .button.icon-only { width: 42px; padding: 8px; }
.app-shell .button.icon-only.small, #dialog .button.icon-only.small { width: 36px; }

.app-shell :is(button, a, input, select, textarea):focus-visible,
#dialog :is(button, a, input, select, textarea):focus-visible {
  outline: 3px solid #5679e5;
  outline-offset: 2px;
}

.app-shell .sidebar :is(button, a):focus-visible { outline-color: var(--mint); outline-offset: -3px; }
.app-shell .lang-control button:focus-visible,
.app-shell .sport-calendar-day:focus-visible { outline-offset: -3px; }

.app-shell .badge, #dialog .badge {
  border: 1px solid transparent;
  border-radius: 7px;
  background: #edf1f7;
  color: #465771;
  font-size: .75rem;
  font-weight: 700;
}

.app-shell .badge:is(.blue, .primary), #dialog .badge:is(.blue, .primary) { background: #e7efff; color: #2346a9; }
.app-shell .badge:is(.green, .success), #dialog .badge:is(.green, .success) { background: #e1f6eb; color: var(--green); }
.app-shell .badge:is(.orange, .warning), #dialog .badge:is(.orange, .warning) { background: #fff0d8; color: var(--orange); }
.app-shell .badge:is(.red, .danger), #dialog .badge:is(.red, .danger) { background: #fce8ed; color: var(--red); }
.app-shell .badge.purple, #dialog .badge.purple { background: #efeaff; color: #594494; }
.app-shell .badge:is(.neutral, .gray), #dialog .badge:is(.neutral, .gray) { background: #edf1f7; color: #465771; }

.app-shell .segmented, #dialog .segmented {
  max-width: 100%;
  flex-wrap: wrap;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #edf3ff;
}

.app-shell .segmented button, #dialog .segmented button {
  min-height: 36px;
  border-radius: 7px;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.35;
}

.app-shell .segmented button:is(.active, [aria-pressed="true"], .primary),
#dialog .segmented button:is(.active, [aria-pressed="true"], .primary) {
  border-color: transparent;
  background: #fff;
  color: var(--blue);
  box-shadow: 0 2px 5px #0b173012;
}

.app-shell .segmented button:hover, #dialog .segmented button:hover { color: var(--blue); }
.app-shell .segmented .button.secondary, #dialog .segmented .button.secondary { border-color: transparent; background: transparent; }
.app-shell .field-note, #dialog .field-note { font-size: .8125rem; color: var(--muted); }
.app-shell .field > span, .app-shell .field label, .app-shell label.field,
#dialog .field > span, #dialog .field label, #dialog label.field { font-size: .875rem; color: var(--ink); }

.app-shell :is(input, select, textarea), #dialog :is(input, select, textarea) {
  border-color: #bfcde5;
  border-radius: 8px;
  font-size: .9375rem;
}

.app-shell :is(input, select, textarea):focus, #dialog :is(input, select, textarea):focus {
  border-color: #6888e1;
  box-shadow: 0 0 0 2px #dce7ff;
}

.app-shell select:not([multiple]):not([size]), #dialog select:not([multiple]):not([size]) {
  appearance: none;
  padding-right: 35px;
  background-image: linear-gradient(45deg, transparent 50%, #4c5e79 50%),
                    linear-gradient(135deg, #4c5e79 50%, transparent 50%);
  background-position: right 18px center, right 13px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.app-shell :is(.info-note, .empty-state p), #dialog :is(.info-note, .empty-state p) { color: var(--muted); font-size: .875rem; }
.app-shell .info-note, #dialog .info-note { border-color: var(--line); border-radius: 10px; background: #edf3ff; }
.app-shell .empty-state .lucide, #dialog .empty-state .lucide { color: #607fbd; }
.app-shell .form-error, #dialog .form-error { font-size: .875rem; color: var(--red); }
.app-shell .progress-track, #dialog .progress-track { background: #e5edfb; }
.app-shell .progress-track > span, #dialog .progress-track > span { background: var(--royal); }

/* Keep the sports calendar, live match and Store visually tied to the dashboard. */
.app-shell .sport-calendar-grid { border-radius: 13px; }
.app-shell .sport-calendar-weekday { background: #edf3ff; color: var(--muted); font-size: .75rem; }
.app-shell .sport-calendar-day > strong { font-size: .875rem; }
.app-shell .sport-calendar-day:hover { background: #f1f5ff; }
.app-shell .sport-calendar-today { background: #ebf2ff; box-shadow: inset 0 0 0 1px #a8bef5; }
.app-shell .sport-type-training { background: #e7efff; color: #25469c; }
.app-shell .sport-type-extra { background: #efeaff; color: #594494; }
.app-shell .sport-type-official { background: #e1f6eb; color: var(--green); }
.app-shell .sport-type-friendly { background: #e1f4fb; color: #235d75; }
.app-shell .sport-type-rest { background: #edf1f7; color: #465771; }
.app-shell .sport-type-review { background: #fff0d8; color: var(--orange); }
.app-shell .sport-score, .app-shell .sport-clock { font-variant-numeric: tabular-nums; }
.app-shell .sport-match-times > div > span, .app-shell .sport-match-times > p { font-size: .8125rem; }
.app-shell .sport-match-times strong { font-size: .875rem; }
.app-shell .sport-fieldset, #dialog .sport-fieldset { border-color: var(--line); border-radius: 12px; }
.app-shell .sport-fieldset legend, #dialog .sport-fieldset legend { color: var(--muted); font-size: .875rem; }
.app-shell .sport-counter > .button { min-width: 38px; min-height: 38px; }
.app-shell .sport-counter > .button:last-child { border-color: var(--royal); background: var(--royal); color: #fff; }
.app-shell .sport-counter > .button:last-child:hover { background: var(--blue); }
.app-shell .shop-products .shop-product { box-shadow: var(--panel-shadow); }
.app-shell .shop-products .shop-product:hover { border-color: #a2b8eb; }
.app-shell .shop-products .shop-product-image,
.app-shell .shop-products .shop-product-image img,
#dialog .shop-gallery { background: #eaf1ff; }
.app-shell .shop-products .card-body > .row:first-child .small { font-size: .8125rem; }
.app-shell .shop-products .card-body > .row:last-child .button { min-height: 42px; font-size: .875rem; }
.app-shell .shop-products .card-body > .row:last-child .button:hover { background: #e7efff; }

#dialog {
  border-color: var(--line);
  border-radius: 18px;
  background: var(--white);
  box-shadow: 0 24px 64px #08122640;
  font-size: 1rem;
}

#dialog::backdrop { background: #0b173098; backdrop-filter: blur(4px); }
#dialog .dialog-header, #dialog .dialog-footer { border-color: var(--line); }
#dialog .dialog-header h2 { color: var(--ink); font-size: 1.25rem; line-height: 1.35; }

#dialog .dialog-header button {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 8px;
  background: #edf3ff;
  color: var(--blue);
}

#dialog .dialog-header button:hover { background: #dfe9ff; }
#dialog .dialog-footer { flex-wrap: wrap; background: #f7faff; }
#toast { background: #0b1730; border: 1px solid #345286; border-radius: 12px; font-size: .875rem; }

@media (max-width: 1100px) {
  .app-shell { --sidebar-width: 215px; }
  .app-shell .sidebar { padding-inline: 12px; }
  .app-shell .sidebar .brand { font-size: 19px; }
  .app-shell .sidebar .brand-mark { width: 36px; height: 36px; flex-basis: 36px; font-size: 22px; }
}

@media (max-width: 760px) {
  .app-shell { --workspace-inset: clamp(15px, 4vw, 22px); }
  .app-shell .sidebar { width: min(292px, calc(100vw - 42px)); visibility: hidden; }
  .app-shell .sidebar.mobile-open { visibility: visible; }
  .app-shell .mobile-overlay { background: #0b17308f; }
  .app-shell .mobile-menu { min-width: 42px; min-height: 42px; align-items: center; justify-content: center; background: #edf3ff; color: var(--blue); }
  .app-shell .topbar { height: 64px; }
  .app-shell .topbar-left, .app-shell .topbar-right { gap: 8px; }
  .app-shell .topbar-right { flex-shrink: 0; }
  .app-shell .user-info { position: relative; min-width: 44px; }
  .app-shell .user-action { position: absolute; inset: -7px 0; width: 100%; border-radius: 8px; }
  .app-shell .user-info > .user-action :is(.user-name, .user-role) {
    display: block;
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .app-shell .page-content { padding-bottom: 33px; }
  .app-shell .stat-label, #dialog .stat-label { font-size: .8125rem; }
  .app-shell .stat-note, #dialog .stat-note { font-size: .75rem; }
  .app-shell .button, #dialog .button { min-height: 44px; }
  .app-shell .button.small, #dialog .button.small { min-height: 38px; }
  .app-shell :is(input, select, textarea), #dialog :is(input, select, textarea) { font-size: 1rem; }
  .app-shell .toolbar select { width: auto; max-width: 100%; }
  .app-shell .sport-counter > .button { min-width: 38px; }
  #dialog .dialog-header h2 { font-size: 1.125rem; }
}

@media (max-width: 420px) {
  .app-shell .user-info { padding-left: 7px; }
  .app-shell .shop-products .card-body > .row:last-child .button { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell .sidebar, .app-shell .button, #dialog .button, #toast { transition: none; }
}
