/* CoachTrack Pro 7.29 - Phase 2 optimized static styles */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800;900&family=DM+Sans:wght@400;500;600;700;800&display=swap');
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: 'DM Sans', Arial, sans-serif; color: #374151; background: #fff; padding: 0; }
  .pdf-page { max-width: 820px; margin: 0 auto; padding: 32px; }

  /* Header — same style as pages & emails */
  .pdf-header {
    display: flex; align-items: center; gap: 16px;
    border-bottom: 4px solid #E31E24; padding-bottom: 18px; margin-bottom: 28px;
  }
  .pdf-header-logo { height: 52px; object-fit: contain; }
  .pdf-header-brand { flex: 1; }
  .pdf-header-title { font-size: 22px; font-weight: 900; color: #E31E24; letter-spacing: -0.5px; }
  .pdf-header-sub   { font-size: 13px; color: #6b7280; margin-top: 3px; }
  .pdf-header-meta  { text-align: right; font-size: 12px; color: #9ca3af; line-height: 1.6; }

  h2 { font-size: 17px; font-weight: 900; color: #1e293b; margin: 24px 0 12px; }
  h3 { font-size: 13px; font-weight: 800; color: #6b7280; text-transform: uppercase;
       letter-spacing: .6px; border-bottom: 1px solid #e5e7eb; padding-bottom: 6px; margin: 20px 0 10px; }
  table { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-size: 13px; }
  th, td { padding: 8px 10px; border-bottom: 1px solid #f3f4f6; text-align: left; }
  th { background: #f9fafb; font-weight: 800; font-size: 11px; color: #6b7280; text-transform: uppercase; }
  tr:hover td { background: #fafafa; }
  .badge-done    { color: #16a34a; font-weight: 700; }
  .badge-pending { color: #f97316; font-weight: 700; }
  .badge-rest    { color: #6b7280; font-weight: 700; }
  .tipo-badge { display: inline-block; background: #fef2f2; color: #E31E24;
                padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; }
  .session-card { border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; page-break-inside: avoid; }
  .session-card-title { font-size: 15px; font-weight: 900; color: #1e293b; margin-bottom: 6px; }
  .session-card-meta  { font-size: 12px; color: #6b7280; display: flex; gap: 12px; flex-wrap: wrap; }
  .session-card-body  { font-size: 13px; color: #374151; margin-top: 10px; line-height: 1.6; }
  .pill { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
  .pill-orange { background: #fef2f2; color: #E31E24; }
  .pill-green  { background: #f0fdf4; color: #16a34a; }
  .pill-gray   { background: #f3f4f6; color: #6b7280; }
  .week-header { background: #1e293b; color: #fff; font-size: 14px; font-weight: 900;
                 padding: 8px 14px; border-radius: 8px; margin: 20px 0 10px; page-break-after: avoid; }
  .footer { margin-top: 36px; padding-top: 14px; border-top: 1px solid #e5e7eb;
            font-size: 11px; color: #9ca3af; text-align: center; }
  @media print {
    body { padding: 0; }
    .pdf-page { padding: 20px; }
    .no-print { display: none; }
    .session-card { page-break-inside: avoid; }
  }

body{font-family:Arial,sans-serif;color:#374151;margin:0;padding:24px;}
    .header{display:flex;align-items:center;gap:16px;border-bottom:3px solid #E31E24;padding-bottom:16px;margin-bottom:24px;}
    .logo{height:48px;} .title{font-size:24px;font-weight:900;color:#E31E24;}
    .subtitle{font-size:14px;color:#6b7280;margin-top:4px;}
    .week{margin-bottom:24px;page-break-inside:avoid;}
    .week-title{font-size:16px;font-weight:900;background:#1e293b;color:#fff;padding:8px 16px;border-radius:8px 8px 0 0;margin:0;}
    table{width:100%;border-collapse:collapse;} th,td{padding:8px 12px;text-align:left;border-bottom:1px solid #e5e7eb;font-size:13px;}
    th{background:#f9fafb;font-weight:800;color:#6b7280;font-size:11px;text-transform:uppercase;}
    .tipo-badge{display:inline-block;background:#fef2f2;color:#E31E24;padding:2px 8px;border-radius:12px;font-size:11px;font-weight:700;}
    @media print{body{padding:8px;}.week{page-break-inside:avoid;}}

body{font-family:Arial,sans-serif;color:#374151;margin:0;padding:24px;}
    .header{display:flex;align-items:center;gap:16px;border-bottom:3px solid #E31E24;padding-bottom:16px;margin-bottom:24px;}
    .logo{height:48px;} h2{font-size:18px;font-weight:900;color:#1e293b;margin:0 0 16px;}
    h3{font-size:14px;font-weight:800;color:#6b7280;text-transform:uppercase;letter-spacing:.5px;border-bottom:1px solid #e5e7eb;padding-bottom:6px;margin:20px 0 10px;}
    table{width:100%;border-collapse:collapse;margin-bottom:20px;} th,td{padding:7px 10px;border-bottom:1px solid #e5e7eb;font-size:13px;text-align:left;}
    th{background:#f9fafb;font-weight:800;color:#6b7280;font-size:11px;text-transform:uppercase;}
    .done{color:#16a34a;font-weight:700;} .pending{color:#f97316;font-weight:700;}
    @media print{.no-print{display:none;}}

]*>.*?

#ct-msg-modal{display:none}#ct-msg-modal.ct-msg-open{display:flex}

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800;900&family=DM+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --orange:       #E31E24;
    --orange-light: #ff4a50;
    --orange-pale:  #fef2f2;
    --orange-dark:  #b8151a;
    --green:        #16a34a;
    --green-pale:   #f0fdf4;
    --red:          #dc2626;
    --red-pale:     #fef2f2;
    --yellow:       #d97706;
    --yellow-pale:  #fffbeb;
    --blue:         #3b82f6;
    --blue-pale:    #eff6ff;
    --gray-50:      #f9fafb;
    --gray-100:     #f3f4f6;
    --gray-200:     #e5e7eb;
    --gray-300:     #d1d5db;
    --gray-400:     #9ca3af;
    --gray-500:     #6b7280;
    --gray-700:     #374151;
    --gray-900:     #111827;
    --bg:           #f4f5f7;
    --card-bg:      #ffffff;
    --card-border:  #e8eaed;
    --text:         #111827;
    --text-muted:   #6b7280;
    --shadow-sm:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow:       0 4px 12px rgba(0,0,0,.08);
    --shadow-lg:    0 12px 32px rgba(0,0,0,.12);
    --shadow-orange: 0 4px 14px rgba(227,30,36,.25);
    --radius:       14px;
    --radius-sm:    8px;
    --radius-xs:    6px;
    --font:         'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Barlow Condensed', 'Oswald', system-ui, sans-serif;
    --transition:   .18s cubic-bezier(.4,0,.2,1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:          #0d0d10;
        --card-bg:     #18181c;
        --card-border: #2a2a30;
        --text:        #f1f1f3;
        --text-muted:  #9ca3af;
        --gray-50:     #18181c;
        --gray-100:    #222228;
        --gray-200:    #36363f;
        --shadow-sm:   0 1px 3px rgba(0,0,0,.4);
        --shadow:      0 4px 12px rgba(0,0,0,.5);
        --shadow-lg:   0 12px 32px rgba(0,0,0,.6);
    }
    .ct-input, .ct-session-content, .ct-rpe-label, .ct-week-day.has-session {
        background: #222228; color: var(--text); border-color: var(--gray-200);
    }
}

/* ── Reset & Base ────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

.ct-wrap {
    font-family: var(--font);
    color: var(--text);
    max-width: 780px;
    margin: 0 auto;
    padding: 0 16px 80px;
    -webkit-font-smoothing: antialiased;
}
/* ── Sticky header bar (brand + nav) ───────── */
.ct-sticky-bar {
    position: sticky;
    top: 0;
    z-index: 500;
    background: #f8fafc;
    margin: 0 -16px;
    padding: 12px 16px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
/* Mobile nav — compact bottom-tab style */
.ct-nav-toggle { display:none; }
@media (max-width: 640px) {
    /* Hide brand header on mobile to save space */
    .ct-sticky-bar > div:first-child {
        display:none !important;
    }
    /* Main nav becomes a compact horizontal scroll row */
    .ct-sticky-bar nav {
        border-radius:0 !important;
        border-left:none !important;
        border-right:none !important;
        padding:0 !important;
        margin-bottom:8px !important;
    }
    .ct-sticky-bar nav > div {
        flex-wrap:nowrap !important;
        overflow-x:auto !important;
        -webkit-overflow-scrolling:touch !important;
        scrollbar-width:none !important;
        gap:0 !important;
        align-items:stretch !important;
    }
    .ct-sticky-bar nav > div::-webkit-scrollbar { display:none; }
    /* Nav links — horizontal scrollable chips */
    .ct-nav-links {
        display:flex !important;
        flex-direction:row !important;
        flex-wrap:nowrap !important;
        gap:0 !important;
        overflow-x:auto !important;
        scrollbar-width:none !important;
        flex:1 !important;
        min-width:0 !important;
    }
    .ct-nav-links::-webkit-scrollbar { display:none; }
    .ct-nav-links a, .ct-nav-links button {
        flex-shrink:0 !important;
        display:flex !important;
        flex-direction:column !important;
        align-items:center !important;
        gap:2px !important;
        padding:8px 10px !important;
        border-radius:0 !important;
        font-size:10px !important;
        font-weight:700 !important;
        white-space:nowrap !important;
        border:none !important;
        border-bottom:2px solid transparent !important;
        background:none !important;
        color:#6b7280 !important;
        min-width:52px !important;
    }
    .ct-nav-links a[style*="background:#E31E24"],
    .ct-nav-links a[style*="background: #E31E24"] {
        background:none !important;
        color:#E31E24 !important;
        border-bottom-color:#E31E24 !important;
    }
    /* Right side — bell + logout compact */
    .ct-nav-right {
        flex-shrink:0 !important;
        display:flex !important;
        align-items:center !important;
        padding:0 6px !important;
        border-left:1px solid #f3f4f6 !important;
        gap:4px !important;
    }
}

/* ── Cards ───────────────────────────────────── */
.ct-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}
.ct-card:hover { box-shadow: var(--shadow); }

.ct-card-header {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    justify-content: space-between; margin-bottom: 18px;
}
.ct-card-title {
    font-family: var(--font-display); text-transform: uppercase; letter-spacing: .3px;
    font-size: 17px; font-weight: 700; color: var(--text);
    display: flex; align-items: center; gap: 10px; margin: 0;
}
.ct-card-title-line {
    display: inline-block; width: 4px; height: 20px;
    background: linear-gradient(180deg, var(--orange), var(--orange-light));
    border-radius: 2px; flex-shrink: 0;
}

/* ── Session Hero ────────────────────────────── */
.ct-session-hero {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    overflow: hidden; margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.ct-session-hero-banner {
    height: 5px;
    background: linear-gradient(90deg, var(--orange), var(--orange-light), #ffb347);
}
.ct-session-hero-body { padding: 24px; }
.ct-session-meta-row {
    display: flex; align-items: center; gap: 10px;
    flex-wrap: wrap; margin-bottom: 14px;
}
.ct-session-type-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--orange-pale); color: var(--orange-dark);
    border-radius: 20px; padding: 4px 12px;
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
}
.ct-session-date-badge { color: var(--text-muted); font-size: 13px; font-weight: 500; }
.ct-session-title { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .3px; font-size: 30px; font-weight: 800; color: var(--text); margin: 0 0 18px; line-height: 1.15; }
.ct-session-specs {
    display: flex; gap: 24px; flex-wrap: wrap;
    padding: 16px 0; border-top: 1px solid var(--card-border);
}
.ct-spec-item { display: flex; flex-direction: column; gap: 3px; }
.ct-spec-label { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .7px; color: var(--text-muted); }
.ct-spec-value { font-size: 15px; font-weight: 800; color: var(--text); }

/* ── Navigation ──────────────────────────────── */
.ct-nav-link {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 16px; border-radius: 9px; font-size: 13px; font-weight: 600;
    color: var(--text-muted); text-decoration: none; white-space: nowrap;
    transition: background var(--transition), color var(--transition);
}
.ct-nav-link:hover  { background: var(--orange-pale); color: var(--orange); text-decoration: none; }
.ct-nav-link.active { background: var(--orange-pale); color: var(--orange); font-weight: 700; }

/* ── Buttons ─────────────────────────────────── */
.ct-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 22px; border-radius: 10px; font-size: 14px; font-weight: 700;
    font-family: var(--font); text-decoration: none; cursor: pointer; border: none;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}
.ct-btn-primary {
    background: var(--orange); color: #fff;
    box-shadow: var(--shadow-orange);
}
.ct-btn-primary:hover { background: var(--orange-dark); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(227,30,36,.35); }
.ct-btn-primary:active { transform: translateY(0); }

.ct-btn-ghost {
    background: transparent; color: var(--text-muted);
    border: 1.5px solid var(--card-border);
}
.ct-btn-ghost:hover { background: var(--gray-50); color: var(--text); border-color: var(--gray-300); }

/* ── Input ───────────────────────────────────── */
.ct-input {
    width: 100%; padding: 12px 14px;
    border: 1.5px solid var(--card-border); border-radius: 9px;
    font-size: 14px; font-family: var(--font); color: var(--text);
    background: var(--card-bg); transition: border-color var(--transition), box-shadow var(--transition);
}
.ct-input:focus { border-color: var(--orange); outline: none; box-shadow: 0 0 0 3px rgba(227,30,36,.1); }

/* ── Form label ──────────────────────────────── */
.ct-form-label {
    font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .6px; color: var(--text-muted); margin-bottom: 6px; display: block;
}
.ct-form-group { margin-bottom: 18px; }

/* ── Notice ──────────────────────────────────── */
.ct-notice {
    padding: 14px 18px; border-radius: 10px;
    font-size: 14px; font-weight: 600; line-height: 1.5; margin-bottom: 14px;
    display: flex; align-items: flex-start; gap: 10px;
}
.ct-notice-success { background: var(--green-pale);  color: #14532d; border: 1px solid #bbf7d0; }
.ct-notice-error   { background: var(--red-pale);    color: #7f1d1d; border: 1px solid #fca5a5; }
.ct-notice-warning { background: var(--yellow-pale); color: #78350f; border: 1px solid #fde68a; }
.ct-notice-info    { background: var(--blue-pale);   color: #1e3a5f; border: 1px solid #bfdbfe; }

/* ── Feed cards ──────────────────────────────── */
.ct-feed-item {
    background: var(--card-bg); border: 1px solid var(--card-border);
    border-radius: var(--radius); margin-bottom: 12px;
    overflow: hidden; transition: box-shadow var(--transition), transform var(--transition);
    display: flex;
}
.ct-feed-item:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.ct-feed-stripe { width: 5px; flex-shrink: 0; }
.ct-feed-body   { flex: 1; padding: 16px 18px; }
.ct-feed-title  { font-size: 15px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.ct-feed-meta   { font-size: 12px; color: var(--text-muted); display: flex; gap: 12px; flex-wrap: wrap; }
.ct-feed-meta span { display: flex; align-items: center; gap: 4px; }
.ct-feed-action { display: flex; align-items: center; padding: 16px 14px; }

/* ── Stat pills ──────────────────────────────── */
.ct-stat-pill {
    display: inline-flex; flex-direction: column; align-items: center;
    padding: 14px 18px; background: var(--gray-50); border-radius: 12px;
    border: 1px solid var(--card-border);
}
.ct-stat-pill-val { font-size: 22px; font-weight: 900; color: var(--orange); line-height: 1; }
.ct-stat-pill-lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); margin-top: 4px; }

/* ── Loading skeleton ────────────────────────── */
@keyframes ct-shimmer { 0%{background-position:-200% 0} 100%{background-position:200% 0} }
.ct-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #fafafa 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: ct-shimmer 1.5s infinite;
    border-radius: 6px; height: 16px;
}

/* ── RPE Scale ───────────────────────────────── */
.ct-rpe-label {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 20px; font-size: 14px; font-weight: 700;
}

/* ── Calendar ────────────────────────────────── */
.ct-calendar-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; margin-top: 12px; }
.ct-week-label { text-align: center; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); padding: 8px 0; }
.ct-week-day {
    aspect-ratio: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; border-radius: 9px; font-size: 13px; font-weight: 600;
    cursor: default; border: 1.5px solid transparent; transition: all var(--transition);
    position: relative; min-height: 44px;
}
.ct-week-day.has-session { background: var(--card-bg); border-color: var(--card-border); cursor: pointer; }
.ct-week-day.has-session:hover { border-color: var(--orange); box-shadow: 0 2px 8px rgba(227,30,36,.15); }
.ct-week-day.done   { background: var(--green-pale);  border-color: #bbf7d0; }
.ct-week-day.today  { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(227,30,36,.15); font-weight: 900; }
.ct-week-day.rest   { background: var(--gray-50); border-color: var(--gray-200); }

/* ── Progress bar ────────────────────────────── */
.ct-progress-bar { height: 8px; background: var(--gray-100); border-radius: 20px; overflow: hidden; }
.ct-progress-fill { height: 100%; background: linear-gradient(90deg, var(--orange), var(--orange-light)); border-radius: 20px; transition: width .6s cubic-bezier(.4,0,.2,1); }

/* ── Section header on pages ─────────────────── */
.ct-page-header {
    display: flex; align-items: center; gap: 14px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 18px; margin-bottom: 24px;
}
.ct-page-logo { height: 36px; width: auto; object-fit: contain; }
.ct-page-brand { font-size: 18px; font-weight: 900; color: var(--orange); }

/* ── Stats grid ─────────────────────────────── */
.ct-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.ct-stat-box {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 10px;
    text-align: center;
}
.ct-stat-box.record { background: #fef2f2; border-color: #fecaca; }
.ct-stat-val { font-size: 22px; font-weight: 900; color: var(--orange); }
.ct-stat-lbl { font-size: 11px; font-weight: 700; color: var(--text-muted); margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; }

/* ── 2-col responsive grid ────────────────── */
.ct-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }

/* ── Table scroll wrapper ─────────────────── */
.ct-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Responsive ──────────────────────────────── */
@keyframes ct-spin { to { transform: rotate(360deg); } }
@media (max-width: 640px) {
    .ct-wrap { padding: 0 12px 60px; }
    .ct-session-title { font-size: 20px; }
    .ct-card { padding: 18px 16px; }
    .ct-session-specs { gap: 14px; }
    .ct-feed-item { flex-direction: column; }
    .ct-feed-action { padding: 0 18px 16px; justify-content: flex-end; }
    /* Stats grid: 2 columnas en móvil */
    .ct-stats-grid { grid-template-columns: repeat(2, 1fr); }
    /* 2-col grid pasa a 1 columna */
    .ct-2col { grid-template-columns: 1fr; }
    /* Calendario: ocultar cuadrícula, mostrar lista en móvil */
    .ct-cal-grid-wrap { display: none !important; }
    .ct-cal-list-wrap { display: block !important; }
    /* Cabecera mes: apilada verticalmente en móvil */
    .ct-cal-header { flex-direction: column; align-items: flex-start !important; gap: 10px; }
    .ct-cal-nav { justify-content: flex-start; }
    /* Nav items wrap on mobile */
    .ct-nav { flex-wrap: wrap; gap: 6px; }
    .ct-nav a, .ct-nav button { font-size: 12px !important; padding: 7px 10px !important; }
}
@media (min-width: 641px) {
    /* Calendario: mostrar cuadrícula, ocultar lista en desktop */
    .ct-cal-grid-wrap { display: block !important; }
    .ct-cal-list-wrap { display: none !important; }
}
/* ── Tablet: 2 columnas para widgets del panel atleta ───────── */
@media (min-width: 641px) and (max-width: 1024px) {
    /* Stats en 2 columnas compactas */
    .ct-stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
    /* Los bloques de 2col se mantienen en tablet */
    .ct-2col { grid-template-columns: 1fr 1fr; }
    /* Sesiones del panel: cabecera más compacta */
    .ct-sess-row > div[style*="grid-template-columns"] {
        grid-template-columns: 70px 1fr auto auto !important;
    }
    /* Ficha física: chips en 2 cols */
    .ct-phys-grid { grid-template-columns: repeat(2, 1fr); }
}
}


/* ── Print styles for session view ──────────── */
@media print {
    .ct-nav, nav, .ct-notif-panel, #ct-unavail-modal, #ct-strava-modal,
    .ct-btn-ghost, form.ct-feedback-form, .ct-chat-wrap,
    [onclick], button:not(.ct-kudos-btn) { display: none !important; }
    .ct-wrap { padding: 0 !important; }
    .ct-card {
        box-shadow: none !important;
        border: 1px solid #d1d5db !important;
        break-inside: avoid;
        margin-bottom: 12px;
    }
    .ct-session-title { font-size: 22px !important; }
    .ct-session-specs { gap: 16px; padding: 12px 0; }
    .ct-progress-bar, .ct-progress-fill { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    a[href]::after { content: none !important; } /* suppress URL printing */
    .ct-session-header-actions { display: none !important; }
    .ct-strava-row { break-inside: avoid; }
    body { font-size: 13px; }
}

/* ── Respeta prefers-reduced-motion ──────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .ct-skeleton { animation: none; background: #f0f0f0; }
    .ct-progress-fill { transition: none; }
}

.ct-login-wrap {
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #0f172a 100%);
        padding: 24px 16px;
        margin: 0 auto;
        font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    }
    .ct-login-card {
        background: #fff;
        border-radius: 20px;
        padding: 48px 40px 40px;
        width: 100%;
        max-width: 420px;
        box-shadow: 0 24px 64px rgba(0,0,0,.35);
    }
    .ct-login-brand {
        text-align: center;
        margin-bottom: 36px;
    }
    .ct-login-logo {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 120px;
        height: 120px;
        background: transparent;
        border-radius: 0;
        margin-bottom: 16px;
        box-shadow: none;
    }
    .ct-login-logo img {
        width: 120px;
        height: 120px;
        object-fit: contain;
        border-radius: 0;
    }
    .ct-login-logo span { font-size: 36px; }
    .ct-login-club {
        font-family: 'Barlow Condensed', 'Oswald', system-ui, sans-serif;
        text-transform: uppercase; letter-spacing: .3px;
        font-size: 25px;
        font-weight: 800;
        color: #111827;
        line-height: 1.2;
        margin-bottom: 4px;
    }
    .ct-login-sub {
        font-size: 13px;
        color: #6b7280;
        font-weight: 500;
    }
    .ct-login-divider {
        height: 1px;
        background: #f3f4f6;
        margin: 0 0 28px;
    }
    .ct-login-field {
        margin-bottom: 18px;
    }
    .ct-login-label {
        display: block;
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .6px;
        color: #6b7280;
        margin-bottom: 8px;
    }
    .ct-login-input {
        width: 100%;
        padding: 13px 16px;
        border: 1.5px solid #e5e7eb;
        border-radius: 10px;
        font-family: inherit;
        font-size: 15px;
        color: #111827;
        background: #f9fafb;
        outline: none;
        transition: border-color .15s, box-shadow .15s, background .15s;
        box-sizing: border-box;
    }
    .ct-login-input:focus {
        border-color: #E31E24;
        background: #fff;
        box-shadow: 0 0 0 3px rgba(227,30,36,.12);
    }
    .ct-login-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 24px;
        font-size: 13px;
    }
    .ct-login-remember {
        display: flex;
        align-items: center;
        gap: 7px;
        color: #6b7280;
        font-weight: 500;
        cursor: pointer;
    }
    .ct-login-remember input { accent-color: #E31E24; width: 15px; height: 15px; cursor: pointer; }
    .ct-login-forgot {
        color: #E31E24;
        font-weight: 700;
        text-decoration: none;
        transition: color .15s;
    }
    .ct-login-forgot:hover { color: #b8151a; text-decoration: underline; }
    .ct-login-btn {
        width: 100%;
        padding: 14px;
        background: linear-gradient(135deg, #E31E24, #ff4a50);
        color: #fff;
        border: none;
        border-radius: 10px;
        font-family: inherit;
        font-size: 16px;
        font-weight: 800;
        cursor: pointer;
        transition: opacity .15s, transform .1s, box-shadow .15s;
        box-shadow: 0 4px 16px rgba(227,30,36,.35);
        letter-spacing: .3px;
    }
    .ct-login-btn:hover { opacity: .92; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(227,30,36,.4); }
    .ct-login-btn:active { transform: translateY(0); }
    .ct-login-error {
        display: flex;
        align-items: center;
        gap: 10px;
        background: #fef2f2;
        border: 1px solid #fecaca;
        border-radius: 10px;
        padding: 12px 16px;
        margin-bottom: 20px;
        font-size: 14px;
        font-weight: 600;
        color: #dc2626;
    }
    .ct-login-footer {
        text-align: center;
        margin-top: 24px;
        font-size: 12px;
        color: #9ca3af;
    }
    @media (max-width: 480px) {
        .ct-login-card { padding: 36px 24px 28px; }
        .ct-login-club { font-size: 19px; }
    }

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800;900&family=DM+Sans:wght@400;500;600;700;800&display=swap');

    /* ── Globals ───────────────────────────────────── */
    #wpbody-content { font-family: 'DM Sans', -apple-system, sans-serif; }
    #wpbody-content * { box-sizing: border-box; }

    /* ── Admin header ──────────────────────────────── */
    .ct-admin-header {
        display: flex; align-items: center; gap: 14px;
        margin-bottom: 0; padding: 18px 24px 18px;
        background: #fff; border: 1px solid #e5e7eb;
        border-radius: 14px 14px 0 0; margin-top: 10px;
        border-bottom: none;
        flex-wrap: wrap;
    }
    .ct-admin-logo {
        font-size: 20px; font-weight: 900; color: #E31E24;
        letter-spacing: -0.5px; display: flex; align-items: center; gap: 8px;
    }
    .ct-admin-logo::before {
        content: ''; display: inline-block; width: 32px; height: 32px;
        background: linear-gradient(135deg, #E31E24, #ff4a50);
        border-radius: 8px;
        /* lightning bolt via clip-path */
        -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M13 2L3 14h9l-1 8 10-12h-9l1-8z'/%3E%3C/svg%3E") center/20px no-repeat;
        mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M13 2L3 14h9l-1 8 10-12h-9l1-8z'/%3E%3C/svg%3E") center/20px no-repeat;
    }
    .ct-admin-version {
        font-size: 10px; font-weight: 700; background: #fef2f2; color: #E31E24;
        padding: 2px 8px; border-radius: 20px; letter-spacing: .3px;
    }

    /* ── Tabs ───────────────────────────────────────── */
    .ct-admin-tabs {
        display: flex; gap: 0; margin-bottom: 28px;
        background: #fff; border: 1px solid #e5e7eb;
        border-radius: 0 0 0 0; border-top: none;
        padding: 0 16px;
        border-radius: 0 0 0 0;
        overflow-x: auto;
    }
    .ct-admin-tab {
        padding: 14px 18px; font-weight: 600; font-size: 13px;
        text-decoration: none; color: #6b7280; white-space: nowrap;
        border-bottom: 3px solid transparent; transition: color .15s, border-color .15s;
        display: inline-flex; align-items: center; gap: 6px;
    }
    .ct-admin-tab:hover  { color: #E31E24; text-decoration: none; border-bottom-color: #fecaca; }
    .ct-admin-tab.active { color: #E31E24; border-bottom-color: #E31E24; font-weight: 700; }
    .ct-admin-tab-icon { width:18px; height:18px; display:inline-flex; align-items:center; justify-content:center; flex:0 0 18px; color:currentColor; }
    .ct-admin-tab-icon svg { width:17px; height:17px; display:block; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
    .ct-admin-tab-label { display:inline-flex; align-items:center; }


    /* ── Stat cards ─────────────────────────────────── */
    .ct-admin-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 24px; }
    .ct-admin-stat {
        background: #fff; border: 1px solid #e5e7eb; border-radius: 14px;
        padding: 20px 22px; transition: box-shadow .2s, transform .15s;
        position: relative; overflow: hidden;
    }
    .ct-admin-stat::before {
        content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
        background: linear-gradient(90deg, #E31E24, #ff4a50);
    }
    .ct-admin-stat:hover { box-shadow: 0 6px 20px rgba(227,30,36,.12); transform: translateY(-2px); }
    .ct-admin-stat-val { font-size: 2.4em; font-weight: 900; color: #E31E24; line-height: 1; margin-bottom: 6px; }
    .ct-admin-stat-lbl { font-size: 11px; color: #9ca3af; text-transform: uppercase; letter-spacing: .7px; font-weight: 700; }

    /* ── Kanban ─────────────────────────────────────── */
    .ct-kanban { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
    .ct-kanban-col { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 12px; padding: 16px; }
    .ct-kanban-col-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
    .ct-kanban-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
    /* ── Tarjeta unificada (kanban = atleta card) ───────────── */
    .ct-kanban-card {
        background: #fff; border: 1px solid #e5e7eb; border-radius: 14px;
        padding: 14px 16px; margin-bottom: 10px;
        transition: box-shadow .2s, transform .15s; cursor: pointer;
        position: relative; overflow: hidden;
    }
    .ct-kanban-card::after {
        content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
        background: linear-gradient(90deg, #E31E24, #ff4a50);
        opacity: 0; transition: opacity .2s;
    }
    .ct-kanban-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.10); transform: translateY(-2px); }
    .ct-kanban-card:hover::after { opacity: 1; }
    .ct-kanban-card-title { font-weight: 800; font-size: 13px; margin-bottom: 6px; color: #1e293b; }
    .ct-kanban-card-meta { font-size: 11px; color: #9ca3af; display: flex; gap: 10px; flex-wrap: wrap; }
    .ct-kanban-card-meta span { display: flex; align-items: center; gap: 4px; }

    /* ── Filter bar ─────────────────────────────────── */
    .ct-filter-bar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
    .ct-filter-bar select, .ct-filter-bar input {
        padding: 8px 12px; border: 1.5px solid #e5e7eb; border-radius: 8px;
        font-size: 13px; font-family: inherit; background: #fff; color: #374151;
        transition: border-color .15s;
    }
    .ct-filter-bar select:focus, .ct-filter-bar input:focus { outline: none; border-color: #E31E24; box-shadow: 0 0 0 3px rgba(227,30,36,.08); }

    /* ── Buttons ────────────────────────────────────── */
    .ct-admin-btn {
        background: #E31E24; color: #fff; padding: 9px 18px; border-radius: 8px;
        font-weight: 700; font-size: 13px; text-decoration: none;
        display: inline-flex; align-items: center; gap: 6px; border: none; cursor: pointer;
        transition: background .15s, transform .1s, box-shadow .15s; font-family: inherit;
        box-shadow: 0 1px 3px rgba(227,30,36,.3);
    }
    .ct-admin-btn:hover { background: #b8151a; color: #fff; text-decoration: none; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(227,30,36,.35); }
    .ct-admin-btn:active { transform: translateY(0); }
    .ct-admin-btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
    .ct-admin-btn-ghost { background: transparent; color: #6b7280; border: 1.5px solid #e5e7eb; box-shadow: none; }
    .ct-admin-btn-ghost:hover { background: #f9fafb; color: #374151; border-color: #d1d5db; box-shadow: none; }

    /* ── Athlete grid ───────────────────────────────── */
    .ct-atleta-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(300px,1fr)); gap: 18px; margin-top: 20px; }
    .ct-atleta-card {
        background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 20px;
        transition: box-shadow .2s, transform .15s; overflow: hidden; position: relative;
    }
    .ct-atleta-card::after {
        content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
        background: linear-gradient(90deg, #E31E24, #ff4a50);
        opacity: 0; transition: opacity .2s;
    }
    .ct-atleta-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.10); transform: translateY(-2px); }
    .ct-atleta-card:hover::after { opacity: 1; }
    .ct-atleta-card.desactivado { opacity: .55; border-style: dashed; }
    .ct-atleta-avatar {
        width: 46px; height: 46px; border-radius: 12px;
        background: linear-gradient(135deg, #E31E24, #ff4a50);
        display: flex; align-items: center; justify-content: center;
        font-size: 16px; font-weight: 900; color: #fff; flex-shrink: 0;
    }
    .ct-atleta-name  { font-weight: 800; font-size: 15px; color: #1e293b; }
    .ct-atleta-email { font-size: 11px; color: #9ca3af; margin-top: 2px; }
    .ct-atleta-stats { display: flex; gap: 0; margin-top: 14px; padding-top: 14px; border-top: 1px solid #f3f4f6; }
    .ct-atleta-stat  { text-align: center; flex: 1; position: relative; }
    .ct-atleta-stat + .ct-atleta-stat::before {
        content: ''; position: absolute; left: 0; top: 20%; height: 60%; width: 1px; background: #f3f4f6;
    }
    .ct-atleta-stat-val { font-size: 20px; font-weight: 900; color: #E31E24; }
    .ct-atleta-stat-lbl { font-size: 10px; color: #9ca3af; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; margin-top: 2px; }
    .ct-atleta-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

    /* ── Badge ──────────────────────────────────────── */
    .ct-badge-desactivado { background: #f3f4f6; color: #9ca3af; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }

    /* ── Modal ──────────────────────────────────────── */
    .ct-modal-overlay { display: none; position: fixed; inset: 0; background: rgba(15,15,20,.6); z-index: 99999; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
    .ct-modal-overlay.open { display: flex; }
    .ct-modal { background: #fff; border-radius: 18px; padding: 28px; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
    .ct-modal-title { font-size: 18px; font-weight: 900; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; color: #1e293b; }
    .ct-modal-close { background: #f3f4f6; border: none; font-size: 16px; cursor: pointer; color: #6b7280; padding: 6px 10px; border-radius: 8px; transition: background .15s; }
    .ct-modal-close:hover { background: #e5e7eb; color: #374151; }

    /* ── Forms ──────────────────────────────────────── */
    .ct-form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
    .ct-form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
    .ct-form-field label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: #6b7280; }
    .ct-form-field input, .ct-form-field textarea, .ct-form-field select {
        padding: 10px 14px; border: 1.5px solid #e5e7eb; border-radius: 8px;
        font-size: 13px; font-family: inherit; color: #374151; background: #fff;
        transition: border-color .15s, box-shadow .15s;
    }
    .ct-form-field input:focus, .ct-form-field textarea:focus, .ct-form-field select:focus {
        border-color: #E31E24; outline: none; box-shadow: 0 0 0 3px rgba(227,30,36,.1);
    }
    .ct-notas-field { grid-column: 1/-1; }

    /* ── Search ─────────────────────────────────────── */
    .ct-search-bar { position: relative; margin-bottom: 20px; }
    .ct-search-bar input { width: 100%; padding: 10px 16px 10px 42px; border: 1.5px solid #e5e7eb; border-radius: 10px; font-size: 14px; font-family: inherit; transition: border-color .15s, box-shadow .15s; }
    .ct-search-bar input:focus { border-color: #E31E24; outline: none; box-shadow: 0 0 0 3px rgba(227,30,36,.08); }
    .ct-search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #9ca3af; font-size: 15px; pointer-events: none; }

    /* ── Section headings inside tabs ───────────────── */
    .ct-section-title {
        font-size: 18px; font-weight: 900; color: #1e293b; margin: 0 0 20px;
        display: flex; align-items: center; gap: 10px;
    }
    .ct-section-title::before {
        content: ''; width: 4px; height: 22px; background: #E31E24; border-radius: 2px; flex-shrink: 0;
    }

    /* ── Table improvements ─────────────────────────── */
    .ct-table { width: 100%; border-collapse: collapse; font-size: 13px; }
    .ct-table th { padding: 10px 14px; background: #f9fafb; font-weight: 800; font-size: 11px; color: #6b7280; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid #e5e7eb; text-align: left; }
    .ct-table td { padding: 12px 14px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
    .ct-table tr:last-child td { border-bottom: none; }
    .ct-table tr:hover td { background: #fafafa; }

    /* ── Empty states ───────────────────────────────── */
    .ct-empty-state {
        background: #fff; border: 2px dashed #e5e7eb; border-radius: 14px;
        padding: 56px 32px; text-align: center; color: #9ca3af;
    }
    .ct-empty-state-icon { font-size: 48px; margin-bottom: 12px; }
    .ct-empty-state-title { font-size: 16px; font-weight: 800; color: #374151; margin-bottom: 6px; }
    .ct-empty-state-desc  { font-size: 13px; line-height: 1.6; }

    /* ── Admin responsive ──────────────────────── */
    @media (max-width: 782px) {
        .ct-admin-header {
            flex-wrap: wrap;
            padding: 12px 16px;
            gap: 8px;
        }
        .ct-admin-header img { height: 24px; }
        .ct-admin-tabs {
            padding: 0 8px;
            -webkit-overflow-scrolling: touch;
        }
        .ct-admin-tab {
            padding: 10px 12px;
            font-size: 12px;
            white-space: nowrap;
            flex-shrink: 0;
        }
        /* Kanban and wide grids scroll horizontally */
        .ct-kanban { overflow-x: auto; }
        /* Session cards stack */
        .ct-session-card { min-width: 0; }
        /* Table wrappers */
        .ct-admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    }

.ct-perio-tab {
        padding:12px 16px;font-size:13px;font-weight:700;border:none;background:none;cursor:pointer;
        color:#6b7280;border-bottom:3px solid transparent;margin-bottom:-2px;transition:all .15s;
    }
    .ct-perio-tab:hover { color:#E31E24; }
    .ct-perio-tab-active { color:#E31E24 !important; border-bottom-color:#E31E24 !important; }
    .ct-cycle-card {
        background:#fff;border:1.5px solid #e5e7eb;border-radius:12px;padding:16px 18px;margin-bottom:10px;
        transition:box-shadow .15s;
    }
    .ct-cycle-card:hover { box-shadow:0 4px 16px rgba(227,30,36,.1); }
    .ct-perio-form-row { display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:12px; }
    .ct-perio-form-row.three { grid-template-columns:1fr 1fr 1fr; }
    .ct-perio-form-row label, .ct-perio-form-field label {
        display:block;font-size:11px;font-weight:800;color:#6b7280;text-transform:uppercase;letter-spacing:.05em;margin-bottom:4px;
    }
    .ct-perio-form-row input, .ct-perio-form-row select, .ct-perio-form-row textarea,
    .ct-perio-form-field input, .ct-perio-form-field select, .ct-perio-form-field textarea {
        width:100%;box-sizing:border-box;padding:8px 12px;border:1.5px solid #d1d5db;border-radius:8px;font-size:13px;
        font-family:inherit;transition:border-color .15s;
    }
    .ct-perio-form-row input:focus, .ct-perio-form-row select:focus,
    .ct-perio-form-field input:focus, .ct-perio-form-field select:focus { outline:none;border-color:#E31E24; }
    .ct-perio-btn-primary {
        background:linear-gradient(135deg,#E31E24,#ff4a50);color:#fff;border:none;padding:10px 20px;
        border-radius:8px;font-size:13px;font-weight:800;cursor:pointer;transition:opacity .15s;
    }
    .ct-perio-btn-primary:hover { opacity:.88; }
    .ct-perio-btn-danger {
        background:#fee2e2;color:#dc2626;border:none;padding:6px 12px;border-radius:7px;
        font-size:12px;font-weight:700;cursor:pointer;
    }
    .ct-perio-btn-danger:hover { background:#fecaca; }
    .ct-perio-btn-edit {
        background:#f0f9ff;color:#0369a1;border:none;padding:6px 12px;border-radius:7px;
        font-size:12px;font-weight:700;cursor:pointer;
    }
    .ct-perio-btn-edit:hover { background:#e0f2fe; }
    .ct-range-bar { height:8px;border-radius:4px;background:#f3f4f6;position:relative;overflow:visible;margin:4px 0; }
    .ct-range-fill { height:100%;border-radius:4px;position:absolute;top:0; }
    .ct-today-marker { position:absolute;top:-4px;width:3px;height:16px;background:#d97706;border-radius:2px;z-index:2; }

/* Free-session modal: mobile-safe viewport and touch interaction. */
@media (max-width: 640px) {
    #ct-free-session-modal {
        position: fixed !important;
        inset: 0 !important;
        width: 100vw !important;
        height: 100dvh !important;
        min-height: 100dvh !important;
        padding: 0 !important;
        align-items: flex-end !important;
        overflow: hidden !important;
        -webkit-overflow-scrolling: touch;
        touch-action: manipulation;
    }
    #ct-free-session-modal > div {
        width: 100% !important;
        max-width: none !important;
        max-height: 92dvh !important;
        padding: 20px 16px calc(24px + env(safe-area-inset-bottom)) !important;
        box-sizing: border-box !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    #ct-free-session-modal input,
    #ct-free-session-modal select,
    #ct-free-session-modal textarea,
    #ct-free-session-modal button {
        font-size: 16px !important;
    }
    #ct-free-session-modal button {
        min-height: 48px;
        touch-action: manipulation;
    }
}


/* ── Phase 41: Mobile UX hardening ───────────────────────────── */
@media (max-width: 640px) {
    html, body { max-width:100%; overflow-x:hidden; }
    body.ct-mobile-modal-open { overflow:hidden !important; overscroll-behavior:none; }
    .ct-wrap { width:100%; max-width:100%; box-sizing:border-box; }
    .ct-card { min-width:0; }
    .ct-session-header, .ct-session-header-actions { min-width:0; }
    .ct-session-header-actions { flex-wrap:wrap !important; gap:8px !important; }
    .ct-session-header-actions a, .ct-session-header-actions button,
    .ct-btn, .ct-button, button.ct-perio-btn-primary, button.ct-perio-btn-danger,
    button.ct-perio-btn-edit { min-height:44px; touch-action:manipulation; }
    .ct-table-wrap, .ct-admin-table-wrap, .ct-kanban { max-width:100%; overflow-x:auto; overscroll-behavior-x:contain; }
    .ct-table-wrap table, .ct-admin-table-wrap table { min-width:620px; }
    .ct-form-row, .ct-perio-form-row, .ct-perio-form-row.three { grid-template-columns:1fr !important; }
    .ct-perio-form-row > *, .ct-perio-form-field { min-width:0; }
    input, select, textarea { max-width:100%; }
    .ct-feed-action { width:100%; box-sizing:border-box; }
    .ct-feed-action button, .ct-feed-action a { min-height:44px; }
    /* Keep action labels readable without forcing horizontal page scroll. */
    .ct-session-card, .ct-sess-row { max-width:100%; overflow:hidden; }
    /* Safe-area support for bottom sheets / sticky controls. */
    .ct-mobile-bottom-safe { padding-bottom:calc(12px + env(safe-area-inset-bottom)); }
}
@media (max-width: 380px) {
    .ct-wrap { padding-left:10px; padding-right:10px; }
    .ct-card { padding-left:12px; padding-right:12px; }
    .ct-stats-grid { gap:7px; }
    .ct-stat-val { font-size:20px; }
}
/* Prevent accidental text selection/ghost clicks on interactive controls. */
.ct-touch-action, [data-ct-action] { touch-action:manipulation; -webkit-tap-highlight-color:transparent; }


/* ============================================================
 * Phase 56.2 — Mobile athlete navigation: clear, labelled, no
 * hidden horizontal scroll. Designed for thumb use and readability.
 * ============================================================ */
@media (max-width: 640px) {
    #ct-nav-main {
        padding: 10px !important;
        margin-bottom: 14px !important;
        border-radius: 16px !important;
        background: #ffffff !important;
        border: 1px solid #e5e7eb !important;
        box-shadow: 0 4px 14px rgba(0,0,0,.07) !important;
    }
    #ct-nav-main > div {
        display: block !important;
    }
    /* Keep a small identity header, then give the actions their own grid. */
    #ct-nav-main > div > div:first-child {
        display: flex !important;
        min-height: 34px !important;
        margin-bottom: 8px !important;
        padding: 2px 4px 8px !important;
        border-bottom: 1px solid #f0f1f3 !important;
    }
    #ct-nav-main > div > div:first-child span {
        font-size: 15px !important;
        color: #111827 !important;
        font-weight: 850 !important;
    }
    #ct-nav-main > div > div:last-child {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 7px !important;
        width: 100% !important;
        overflow: visible !important;
    }
    #ct-nav-main > div > div:last-child > a,
    #ct-nav-main > div > div:last-child > button,
    #ct-nav-main > div > div:last-child > div > button {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 62px !important;
        height: auto !important;
        padding: 7px 4px 6px !important;
        border-radius: 11px !important;
        border: 1px solid #e5e7eb !important;
        background: #f8fafc !important;
        color: #374151 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        text-decoration: none !important;
        font-size: 12px !important;
        font-weight: 800 !important;
        line-height: 1.15 !important;
        box-sizing: border-box !important;
    }
    #ct-nav-main > div > div:last-child > a:hover,
    #ct-nav-main > div > div:last-child > button:hover,
    #ct-nav-main > div > div:last-child > div > button:hover {
        background: #fef2f2 !important;
        border-color: #fecaca !important;
        color: #E31E24 !important;
    }
    #ct-nav-main > div > div:last-child svg {
        width: 22px !important;
        height: 22px !important;
        flex: 0 0 22px !important;
    }
    /* Use each existing accessible title as the visible label. */
    #ct-nav-main > div > div:last-child > a::after,
    #ct-nav-main > div > div:last-child > button::after,
    #ct-nav-main > div > div:last-child > div > button::after {
        content: attr(title) !important;
        display: block !important;
        max-width: 100% !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        font-size: 11px !important;
        font-weight: 850 !important;
        line-height: 1.15 !important;
    }
    /* The notification wrapper participates as a normal grid cell. */
    #ct-nav-main > div > div:last-child > div {
        display: block !important;
        min-width: 0 !important;
    }
    #ct-nav-main > div > div:last-child > span {
        display: none !important;
    }
    /* Active page is obvious without relying on colour alone. */
    #ct-nav-main > div > div:last-child > a[style*="background:#fef2f2"],
    #ct-nav-main > div > div:last-child > a[style*="background: #fef2f2"] {
        background: #fef2f2 !important;
        border: 2px solid #E31E24 !important;
        color: #E31E24 !important;
    }
    /* Never hide the navigation behind an invisible horizontal scroller. */
    #ct-nav-main,
    #ct-nav-main > div,
    #ct-nav-main > div > div:last-child {
        overflow: visible !important;
    }
}
@media (max-width: 380px) {
    #ct-nav-main > div > div:last-child {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }
    #ct-nav-main > div > div:last-child > a,
    #ct-nav-main > div > div:last-child > button,
    #ct-nav-main > div > div:last-child > div > button {
        min-height: 58px !important;
        flex-direction: row !important;
        justify-content: flex-start !important;
        padding: 8px 10px !important;
        text-align: left !important;
    }
    #ct-nav-main > div > div:last-child > a::after,
    #ct-nav-main > div > div:last-child > button::after,
    #ct-nav-main > div > div:last-child > div > button::after {
        font-size: 13px !important;
        white-space: normal !important;
    }
}

/* Phase 56.2 — larger heart-rate zones on athlete mobile panel. */
@media (max-width: 640px) {
    .ct-wrap .ct-card:has(> div > div[style*="Mis zonas FC"]) {
        padding: 18px !important;
    }
    .ct-wrap .ct-card:has(> div > div[style*="Mis zonas FC"]) div[style*="font-size:12px"] {
        font-size: 15px !important;
        line-height: 1.35 !important;
    }
    .ct-wrap .ct-card:has(> div > div[style*="Mis zonas FC"]) div[style*="font-size:11px"] {
        font-size: 14px !important;
    }
}
