/* ========================================
   CEAT Tool - Custom Styles
   Mobile-first approach
   ======================================== */

:root {
    --sidebar-width: 260px;
    --sidebar-width-collapsed: 76px;
    --sidebar-bg: #212529;
    --primary-color: #0d6efd;
}

/* ---- Sidebar ---- */
#sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    overflow-y: auto;
}

#page-content-wrapper {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
}

/* Sidebar logo area */
#sidebar .sidebar-header {
    background-color: #ffffff;
    text-align: center;
    border-right: 1px solid #dee2e6;
}

.sidebar-logo {
    max-width: 100%;
    max-height: 50px;
    object-fit: contain;
    display: inline-block;
}

/* Sidebar nav links — uniform vertical spacing */
#sidebar .sidebar-nav .nav-item {
    margin: 0;
    padding: 0;
}

#sidebar .nav-link {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    line-height: 1.4;
}

#sidebar .nav-link:hover,
#sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary-color);
}

/* Sidebar section separator — same vertical rhythm */
#sidebar .sidebar-separator {
    padding: 0.5rem 1rem 0.15rem;
    list-style: none;
}

#sidebar .sidebar-separator small {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6c757d;
}

/* Sidebar collapsible section header — same look as separator, but clickable + chevron */
#sidebar .sidebar-section {
    list-style: none;
}

#sidebar .sidebar-section-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem 0.2rem;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s;
}

#sidebar .sidebar-section-toggle small {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6c757d;
}

#sidebar .sidebar-section-toggle:hover small {
    color: #adb5bd;
}

#sidebar .sidebar-section-toggle .sidebar-collapse-icon {
    color: #6c757d;
    font-size: 0.7rem;
    transition: transform 0.25s, color 0.15s;
}

#sidebar .sidebar-section-toggle.collapsed .sidebar-collapse-icon {
    transform: rotate(-90deg);
}

#sidebar .sidebar-section-toggle:hover .sidebar-collapse-icon {
    color: #adb5bd;
}

/* Sidebar collapse toggle */
.sidebar-collapse-icon {
    transition: transform 0.25s;
    font-size: 0.7rem;
}

.sidebar-collapse-toggle.collapsed .sidebar-collapse-icon {
    transform: rotate(-90deg);
}

#sidebar .collapse .nav-link,
#sidebar .collapsing .nav-link {
    font-size: 0.85rem;
}

/* Sidebar collapse toggle button (desktop) — fixed to the screen so it sits over the
   sidebar's right edge without being clipped by the sidebar's own overflow. */
.sidebar-collapse-btn {
    display: none;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 1rem;
    left: calc(var(--sidebar-width) - 14px);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: #343a40;
    color: #cbd5e1;
    box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.25);
    cursor: pointer;
    z-index: 1042;
    transition: background 0.18s, color 0.18s, transform 0.25s, left 0.3s ease;
}
html.sidebar-collapsed .sidebar-collapse-btn {
    left: calc(var(--sidebar-width-collapsed) - 14px);
}
.sidebar-collapse-btn:hover {
    background: var(--primary-color);
    color: #fff;
    transform: scale(1.08);
}
.sidebar-collapse-btn i {
    font-size: 0.85rem;
    transition: transform 0.25s;
}
html.sidebar-collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
}

/* ---- Desktop collapsed sidebar (only ≥992px; mobile keeps slide-in behaviour) ---- */
@media (min-width: 992px) {
    html.sidebar-collapsed #sidebar {
        min-width: var(--sidebar-width-collapsed);
        max-width: var(--sidebar-width-collapsed);
    }
    html.sidebar-collapsed #page-content-wrapper {
        margin-left: var(--sidebar-width-collapsed);
    }
    /* Header: hide app name + shrink logo */
    html.sidebar-collapsed #sidebar .sidebar-header h5 { display: none; }
    html.sidebar-collapsed #sidebar .sidebar-header { padding: 0.6rem 0.4rem !important; }
    html.sidebar-collapsed #sidebar .sidebar-logo { max-height: 38px; }
    /* User block: keep avatar, drop name/role */
    html.sidebar-collapsed #sidebar .border-bottom > .d-flex > .small,
    html.sidebar-collapsed #sidebar .border-bottom > .d-flex > div.small { display: none; }
    html.sidebar-collapsed #sidebar .border-bottom > .d-flex { justify-content: center; }
    html.sidebar-collapsed #sidebar .border-bottom > .d-flex > img,
    html.sidebar-collapsed #sidebar .border-bottom > .d-flex > .rounded-circle { margin-right: 0 !important; }
    /* Section headers: hide entirely; force-expand their children */
    html.sidebar-collapsed #sidebar .sidebar-section-toggle,
    html.sidebar-collapsed #sidebar .sidebar-separator { display: none; }
    html.sidebar-collapsed #sidebar .sidebar-section .collapse,
    html.sidebar-collapsed #sidebar .sidebar-section .collapsing {
        display: block !important;
        height: auto !important;
        visibility: visible !important;
    }
    /* Nav links: icon-only, centered, hide text via font-size:0 (then reset for the icon) */
    html.sidebar-collapsed #sidebar .nav-link {
        padding: 0.65rem 0;
        font-size: 0;
        text-align: center;
        border-left-width: 0;
        white-space: nowrap;
    }
    html.sidebar-collapsed #sidebar .nav-link i {
        margin: 0 !important;
        font-size: 1.25rem;
    }
    html.sidebar-collapsed #sidebar .nav-link.active {
        border-left: 3px solid var(--primary-color);
    }
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
}

.sidebar-overlay.show {
    display: block;
}

/* ---- Mobile: hide sidebar by default ---- */
@media (max-width: 991.98px) {
    #sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }

    #sidebar.show {
        margin-left: 0;
    }

    #page-content-wrapper {
        margin-left: 0;
    }
}

/* ---- Auth pages ---- */
.auth-card {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.1);
}

.auth-card .card-body {
    padding: 2rem;
}

/* ---- Tables responsive ---- */
.table-responsive {
    font-size: 0.9rem;
}

/* ---- Cards ---- */
.stat-card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.08);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

/* ---- Calendar (availability) ---- */
.availability-table {
    border-collapse: separate;
    border-spacing: 4px;
}

.availability-table td,
.availability-table th {
    padding: 0;
    border: none;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    border: 2px solid transparent;
    min-width: 36px;
    min-height: 36px;
}

.calendar-day:hover {
    border-color: var(--primary-color);
}

.calendar-day.available {
    background-color: #d1e7dd;
    color: #0f5132;
}

.calendar-day.unavailable {
    background-color: #f8d7da;
    color: #842029;
}

.calendar-day.empty {
    cursor: default;
    background: transparent;
}

.calendar-day.empty:hover {
    border-color: transparent;
}

.calendar-day-header {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #6c757d;
    text-align: center;
    padding: 0.25rem 0;
}

/* Week number column */
.week-header {
    width: 36px;
}

.week-number-cell {
    vertical-align: middle;
    text-align: center;
    width: 36px;
}

.week-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #6c757d;
    background: transparent;
    color: #6c757d;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
}

.week-btn:hover {
    background-color: #e9ecef;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.week-btn.week-all-available {
    background-color: #198754;
    border-color: #198754;
    color: #fff;
}

.week-btn.week-all-unavailable {
    background-color: #dc3545;
    border-color: #dc3545;
    color: #fff;
}

.week-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #adb5bd;
}

@media (max-width: 575.98px) {
    .calendar-day {
        min-width: 28px;
        min-height: 28px;
        font-size: 0.75rem;
    }
    .week-btn {
        width: 24px;
        height: 24px;
        font-size: 0.6rem;
    }
}

/* ---- Badges ---- */
.badge-status-pending { background-color: #ffc107; color: #000; }
.badge-status-approved { background-color: #198754; }
.badge-status-rejected { background-color: #dc3545; }
.badge-status-suspended { background-color: #6c757d; }
.badge-status-published { background-color: #0d6efd; }
.badge-status-draft { background-color: #6c757d; }
.badge-status-closed { background-color: #495057; }
.badge-status-confirmed { background-color: #198754; }
.badge-status-declined { background-color: #dc3545; }
.badge-status-withdrawn { background-color: #6c757d; }

/* ---- Photo upload ---- */
.photo-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #dee2e6;
}

.photo-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.photo-upload-area:hover {
    border-color: var(--primary-color);
}

/* ---- Form improvements for mobile ---- */
@media (max-width: 575.98px) {
    .card-body {
        padding: 1rem;
    }

    .table td, .table th {
        padding: 0.5rem 0.4rem;
        font-size: 0.8rem;
    }

    .btn {
        font-size: 0.85rem;
    }

    h1, .h1 { font-size: 1.5rem; }
    h2, .h2 { font-size: 1.3rem; }
    h3, .h3 { font-size: 1.1rem; }
}

/* ---- Form cards (tournament create/edit) ---- */
.card-form {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    overflow: visible;
}

.card-form .card-header {
    border-bottom: none;
    padding: 0.9rem 1.25rem;
}

.card-form .card-header h5 {
    font-size: 1rem;
    font-weight: 600;
}

.card-form .card-body {
    padding: 1.25rem;
}

/* Color themes for each panel */
.card-form--info .card-header {
    background: linear-gradient(135deg, #e8f0fe 0%, #d2e3fc 100%);
    color: #1a56db;
}

.card-form--calendar .card-header {
    background: linear-gradient(135deg, #fef3e2 0%, #fde5c0 100%);
    color: #b45309;
}

.card-form--travel .card-header {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    color: #0369a1;
}

.card-form--accommodation .card-header {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #15803d;
}

.card-form--meals .card-header {
    background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
    color: #be185d;
}

.card-form--requirements .card-header {
    background: linear-gradient(135deg, #fef9c3 0%, #fde68a 100%);
    color: #92400e;
}

.card-form--notes .card-header {
    background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
    color: #7e22ce;
}

/* Per-function aid card inside the requirements panel */
.req-card {
    background-color: #fafbfc;
    border-color: #e9ecef !important;
}

.req-card .aid-details {
    background: #fff;
    padding: 0.5rem 0.6rem;
    border-radius: 0.35rem;
    border: 1px solid #eef0f3;
}

/* Meal cards inside meals panel */
.meal-card {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    transition: all 0.2s;
}

.meal-card:hover {
    background-color: #fff;
    border-color: #dee2e6;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

/* Categories list with inline badges style */
.categories-list {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.75rem;
    max-height: 160px;
    overflow-y: auto;
    background: #f8f9fa;
}

.categories-list .form-check-inline {
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

.categories-list .form-check-label {
    font-size: 0.85rem;
}

/* Color helpers */
.text-orange { color: #ea580c; }
.text-indigo { color: #6366f1; }

/* Extra breathing room between panel header and switch toggle */
.card-form--travel > .card-body,
.card-form--accommodation > .card-body,
.card-form--meals > .card-body {
    padding-top: 1.25rem;
}

/* Form switch style upgrade */
.form-switch .form-check-input {
    width: 2.5em;
    height: 1.25em;
    cursor: pointer;
    margin-right: 0.6em;
}

/* Switch color matches its panel header */
.card-form--travel .form-switch .form-check-input:checked {
    background-color: #0369a1;
    border-color: #0369a1;
}

.card-form--accommodation .form-switch .form-check-input:checked {
    background-color: #15803d;
    border-color: #15803d;
}

.card-form--meals .form-switch .form-check-input:checked {
    background-color: #be185d;
    border-color: #be185d;
}

/* ---- Multiselect tall (referee functions) ---- */
.multiselect-tall {
    min-height: 160px !important;
    height: 160px;
}

/* ---- Checkbox list with scroll (badges, etc.) ---- */
.checkbox-list-tall {
    min-height: 160px;
    max-height: 160px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: #fff;
}

.checkbox-list-xl {
    min-height: 280px;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: #fff;
}

.checkbox-list-xl .form-check {
    padding-top: 0.15rem;
    padding-bottom: 0.15rem;
}

.checkbox-list-xl .form-check-label {
    font-size: 0.875rem;
    line-height: 1.3;
}

.checkbox-list-tall .form-check {
    padding-top: 0.15rem;
    padding-bottom: 0.15rem;
}

.checkbox-list-tall .form-check-label {
    font-size: 0.875rem;
    line-height: 1.3;
}

.badge-desc {
    display: block;
    font-size: 0.75rem;
    color: #9ca3af;
    font-weight: 400;
    line-height: 1.2;
    margin-top: 1px;
}

/* Invalid state for checkbox lists */
.checkbox-list-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.15);
}

.checkbox-list-group-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6366f1;
    padding: 0.35rem 0 0.1rem 0;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 0.2rem;
}

.checkbox-list-group-label:not(:first-child) {
    margin-top: 0.4rem;
}

/* ---- Badge soft purple ---- */
.bg-purple-soft {
    background-color: #e9d5ff;
    color: #6b21a8;
}

/* ---- Config: active type in list ---- */
.active-type {
    background-color: rgba(13, 110, 253, 0.1) !important;
    border-left: 3px solid #0d6efd;
    font-weight: 600;
}

/* ---- Sortable table headers ---- */
th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th.sortable:hover {
    background-color: #e9ecef;
}

th.sortable .sort-icon {
    font-size: 0.65rem;
    opacity: 0.35;
    margin-left: 0.25rem;
    transition: opacity 0.15s;
}

th.sortable:hover .sort-icon {
    opacity: 0.7;
}

th.sortable.sort-asc .sort-icon::before {
    content: "\F148";
}

th.sortable.sort-desc .sort-icon::before {
    content: "\F128";
}

th.sortable.sort-asc .sort-icon,
th.sortable.sort-desc .sort-icon {
    opacity: 1;
    color: var(--primary-color);
}

/* ---- Custom function dropdown (requirements) ---- */
.dropdown-menu-fn {
    z-index: 1050;
    overflow: hidden;
}

.fn-dropdown-list {
    overflow-y: auto;
    max-height: 300px;
}

.fn-dropdown-item {
    padding: 0.55rem 0.85rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f1f1;
    transition: background 0.15s;
}

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

.fn-dropdown-item:hover {
    background-color: #f0f7ff;
}

.fn-dropdown-item.active {
    background-color: #e0edff;
    border-left: 3px solid var(--primary-color);
}

.fn-dropdown-item .fw-semibold {
    font-size: 0.875rem;
}

.custom-fn-dropdown .form-select {
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.custom-fn-dropdown .dropdown-menu {
    top: 100% !important;
    bottom: auto !important;
    transform: none !important;
}

/* ---- Tournaments grid ---- */
.tournaments-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.75rem;
    padding: 0.5rem 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.tournaments-toolbar .form-select-sm,
.tournaments-toolbar .btn-sm {
    height: 32px;
}

.status-pills {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.status-pill {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    border: 1px solid #dee2e6;
    color: #495057;
    background: #fff;
    text-decoration: none;
    transition: all 0.15s;
    line-height: 1.4;
}

.status-pill:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.status-pill.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.t-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border: 1px solid #eef0f3;
    border-radius: 0.85rem;
    padding: 0.95rem 1rem 0.85rem;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.t-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.6rem 1.25rem rgba(0,0,0,0.08);
    border-color: #dde2ea;
    color: inherit;
}

.t-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: #adb5bd;
}

.t-card.status-draft::before     { background: linear-gradient(90deg, #adb5bd, #6c757d); }
.t-card.status-published::before { background: linear-gradient(90deg, #4dabf7, #0d6efd); }
.t-card.status-closed::before    { background: linear-gradient(90deg, #6c757d, #343a40); }

.t-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.t-card-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.55rem;
}

.t-logo {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 0.55rem;
    background: #f8f9fa;
    border: 1px solid #eef0f3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #adb5bd;
    font-size: 1.1rem;
}

.t-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.t-head-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    min-width: 0;
    flex-grow: 1;
}

.t-head-info .t-type {
    max-width: 100%;
}

.t-head-info .t-status-dot {
    font-size: 0.65rem;
}

.t-type {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6366f1;
    background: #eef2ff;
    padding: 0.18rem 0.5rem;
    border-radius: 0.35rem;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.t-status-dot {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.t-status-dot::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #adb5bd;
}

.t-card.status-published .t-status-dot::before { background: #0d6efd; }
.t-card.status-published .t-status-dot         { color: #0d6efd; }
.t-card.status-draft .t-status-dot::before     { background: #adb5bd; }
.t-card.status-closed .t-status-dot::before    { background: #343a40; }
.t-card.status-closed .t-status-dot            { color: #343a40; }

.t-name {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}

.t-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.7rem;
    font-size: 0.78rem;
    color: #6c757d;
    margin-bottom: 0.6rem;
}

.t-meta i {
    margin-right: 0.2rem;
    opacity: 0.8;
}

.t-date {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #495057;
    padding: 0.2rem 0.55rem;
    border-radius: 0.4rem;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.t-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.t-chip {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    padding: 0.18rem 0.5rem;
    border-radius: 0.4rem;
    border: 1px solid transparent;
    line-height: 1.3;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.t-chip--applicants {
    background: #eef2ff;
    color: #4338ca;
    border-color: #e0e7ff;
}

.t-chip--filled {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.t-chip--partial {
    background: #fef9c3;
    color: #854d0e;
    border-color: #fde68a;
}

.t-chip--empty {
    background: #f1f5f9;
    color: #64748b;
    border-color: #e2e8f0;
}

.t-services {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: auto;
    padding-top: 0.55rem;
    border-top: 1px dashed #eef0f3;
}

.t-svc {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    border-radius: 50%;
    background: #f1f3f5;
    color: #495057;
    transition: all 0.15s;
}

.t-card:hover .t-svc {
    background: #e7f1ff;
    color: var(--primary-color);
}

.t-empty {
    padding: 3rem 1rem;
    text-align: center;
    color: #adb5bd;
    background: #fff;
    border: 1px dashed #dee2e6;
    border-radius: 0.85rem;
}

.t-empty i {
    font-size: 2.5rem;
    opacity: 0.4;
}

/* ---- Function pill button (clickable, opens conditions modal) ---- */
.btn-fn-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 0.4rem;
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    color: #5b21b6;
    font-size: 0.75rem;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s;
}

.btn-fn-pill:hover {
    background: #ede9fe;
    border-color: #c4b5fd;
    color: #4c1d95;
}

/* ---- Designations card grid ---- */
.d-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    height: 100%;
    background: #fff;
    border: 1px solid #eef0f3;
    border-radius: 0.85rem;
    padding: 0.95rem 1rem;
    overflow: hidden;
    transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.d-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.6rem 1.25rem rgba(0,0,0,0.08);
    border-color: #dde2ea;
}

.d-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: #adb5bd;
}

.d-card.status-pending::before   { background: linear-gradient(90deg, #fbbf24, #d97706); }
.d-card.status-confirmed::before { background: linear-gradient(90deg, #4ade80, #16a34a); }
.d-card.status-declined::before  { background: linear-gradient(90deg, #f87171, #dc2626); }
.d-card.status-cancelled::before { background: linear-gradient(90deg, #9ca3af, #4b5563); }

.d-card-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.d-card-logo {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 0.55rem;
    background: #f8f9fa;
    border: 1px solid #eef0f3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #adb5bd;
    font-size: 1.1rem;
}

.d-card-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.d-card-head-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    flex-grow: 1;
    align-items: flex-start;
}

.d-card-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    color: #212529;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.d-card-title:hover {
    color: var(--primary-color);
}

.d-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.7rem;
    font-size: 0.78rem;
    color: #6c757d;
}

.d-card-arbitro {
    font-size: 0.85rem;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.5rem;
    background: #f8f9fa;
    border-radius: 0.4rem;
}

.d-card-fn {
    margin-top: -0.1rem;
}

.d-fn-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    border-radius: 0.45rem;
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    color: #5b21b6;
    font-size: 0.78rem;
    font-weight: 600;
}

.d-fn-pill small {
    font-weight: 400;
}

.d-card-aids {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0;
    border-top: 1px dashed #eef0f3;
    border-bottom: 1px dashed #eef0f3;
}

.d-aid-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.45rem;
    border-radius: 0.35rem;
    background: #e7f5ff;
    color: #1864ab;
    font-size: 0.72rem;
    border: 1px solid #c5e0fb;
}

.d-aid-chip small { font-weight: 600; }

.d-card-reason {
    font-size: 0.78rem;
    color: #6c757d;
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    padding: 0.4rem 0.6rem;
    border-radius: 0.3rem;
}

.d-card-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: auto;
}

/* ---- Tournament show page ---- */
.t-show-header {
    border: 1px solid #eef0f3;
    border-radius: 0.85rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.t-show-logo {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 0.85rem;
    background: #f8f9fa;
    border: 1px solid #eef0f3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #adb5bd;
    font-size: 2rem;
}

.t-show-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.t-info {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
}

.t-info > i {
    font-size: 1.05rem;
    margin-top: 0.15rem;
    flex-shrink: 0;
}

.t-info > div {
    min-width: 0;
}

.t-info small {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

/* Function chip — unified container with two interactive zones (modal | apply/status) */
.t-fn-chip {
    display: inline-flex;
    align-items: stretch;
    border-radius: 0.6rem;
    border: 1px solid #ddd6fe;
    overflow: hidden;
    background: #f5f3ff;
    color: #5b21b6;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.t-fn-chip:hover {
    border-color: #c4b5fd;
    box-shadow: 0 1px 4px rgba(91, 33, 182, 0.12);
}

.t-fn-main {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.7rem 0.45rem 0.45rem;
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.t-fn-main:hover {
    background: rgba(255,255,255,0.55);
}

.t-fn-action,
.t-fn-action-form > .t-fn-action {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.45rem 0.7rem;
    border: none;
    border-left: 1px solid #ddd6fe;
    background: rgba(255,255,255,0.5);
    color: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.t-fn-action-form { display: flex; margin: 0; }

.t-fn-action--apply {
    background: #16a34a;
    color: #fff;
}
.t-fn-action--apply:hover { background: #15803d; color: #fff; }

.t-fn-action--withdraw {
    background: #fff;
    color: #b91c1c;
}
.t-fn-action--withdraw:hover { background: #fee2e2; color: #991b1b; }

.t-fn-action--accepted {
    background: #16a34a;
    color: #fff;
    cursor: default;
}

.t-fn-action--rejected {
    background: #dc2626;
    color: #fff;
    cursor: default;
}

.t-fn-qty {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    background: #6d28d9;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.t-fn-info {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    min-width: 0;
}

.t-fn-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.t-fn-fee {
    font-size: 0.7rem;
    color: #6d28d9;
}

.t-aid {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.6rem;
    border-radius: 0.45rem;
    background: #f8f9fa;
    border: 1px solid #eef0f3;
    color: #adb5bd;
    font-size: 0.78rem;
    text-decoration: line-through;
    text-decoration-color: #ced4da;
}

.t-aid.on {
    background: #e7f5ff;
    border-color: #c5e0fb;
    color: #1864ab;
    text-decoration: none;
}

.t-aid i {
    font-size: 0.95rem;
}

.t-aid small {
    color: inherit;
    opacity: 0.85;
}

/* ---- Global availability grid ---- */
.avail-grid-card {
    border: 1px solid #eef0f3;
    border-radius: 0.85rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.avail-grid-wrap {
    overflow: auto;
    max-height: 70vh;
    border-radius: 0.85rem;
}

.avail-grid {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    font-size: 0.78rem;
}

.avail-grid thead th {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    z-index: 2;
    border-bottom: 1px solid #e9ecef;
    padding: 0.35rem 0.2rem;
    text-align: center;
    font-weight: 600;
    color: #495057;
}

.avail-grid thead th.weekend {
    background: #eef2f6;
    color: #6c757d;
}

.avail-grid thead th .dow {
    font-size: 0.65rem;
    color: #adb5bd;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.avail-grid thead th .num {
    font-size: 0.85rem;
}

.avail-grid-name-col {
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 1;
    text-align: left !important;
    padding: 0.4rem 0.6rem !important;
    min-width: 220px;
    border-right: 1px solid #e9ecef;
    box-shadow: 2px 0 4px -2px rgba(0,0,0,0.05);
}

.avail-grid thead .avail-grid-name-col {
    z-index: 3;
    background: #f8f9fa;
}

.avail-grid tbody tr:nth-child(even) .avail-grid-name-col {
    background: #fcfcfd;
}

.avail-cell {
    width: 24px;
    height: 28px;
    padding: 0;
    background: #f8f9fa;
    border-right: 1px solid #f1f3f5;
    border-bottom: 1px solid #f1f3f5;
    transition: background 0.1s;
}

.avail-cell.weekend {
    background: #eef2f6;
}

.avail-cell.available {
    background: #198754;
}

.avail-cell.unavailable {
    background: #dc3545;
}

.avail-cell.available:hover,
.avail-cell.unavailable:hover {
    filter: brightness(1.15);
}

.legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 0.25rem;
}

/* ---- Extra small buttons ---- */
.btn-xs {
    padding: 0.05rem 0.35rem;
    font-size: 0.7rem;
    line-height: 1.2;
    border-radius: 0.25rem;
}

/* ---- General utilities ---- */
.cursor-pointer {
    cursor: pointer;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.min-h-100 {
    min-height: 100vh;
}

/* ============================================
   Quiz module
   ============================================ */

/* Hero header used across quiz pages */
.quiz-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
    border: 1px solid #e0e7ff;
    border-radius: 0.85rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.quiz-hero-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #312e81;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.quiz-hero-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.6rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.quiz-hero-sub {
    font-size: 0.8rem;
    color: #6366f1;
    margin: 0.15rem 0 0 0;
    opacity: 0.85;
}

.quiz-hero-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Category grid card */
.quiz-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border: 1px solid #eef0f3;
    border-radius: 0.85rem;
    padding: 1.1rem 1.1rem 0.9rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}

.quiz-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.6rem 1.25rem var(--qc-shadow, rgba(99, 102, 241, 0.10));
    border-color: var(--qc-border, #c7d2fe);
}

.quiz-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, var(--qc-grad-from, #6366f1), var(--qc-grad-to, #8b5cf6));
}

/* Per-body color variants. Override the gradient + accent colours via CSS vars. */
.quiz-card--rfet { --qc-grad-from: #dc2626; --qc-grad-to: #991b1b; --qc-bg: #fef2f2; --qc-fg: #991b1b; --qc-border: #fecaca; --qc-shadow: rgba(220,38,38,0.15); }
.quiz-card--itf  { --qc-grad-from: #16a34a; --qc-grad-to: #15803d; --qc-bg: #dcfce7; --qc-fg: #166534; --qc-border: #bbf7d0; --qc-shadow: rgba(22,163,74,0.15); }
.quiz-card--atp  { --qc-grad-from: #2563eb; --qc-grad-to: #1e40af; --qc-bg: #dbeafe; --qc-fg: #1e3a8a; --qc-border: #bfdbfe; --qc-shadow: rgba(37,99,235,0.15); }
.quiz-card--wta  { --qc-grad-from: #9333ea; --qc-grad-to: #7e22ce; --qc-bg: #f3e8ff; --qc-fg: #6b21a8; --qc-border: #e9d5ff; --qc-shadow: rgba(147,51,234,0.15); }

.quiz-card-head {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    margin-bottom: 0.55rem;
}

.quiz-card-icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 0.6rem;
    background: var(--qc-bg, linear-gradient(135deg, #eef2ff, #ede9fe));
    color: var(--qc-fg, #6366f1);
    border: 1px solid var(--qc-border, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* Body-logo badge (used in place of .quiz-card-icon when a body logo exists) */
.quiz-card-logo {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 0.7rem;
    background: #fff;
    border: 1px solid var(--qc-border, #e2e8f0);
    box-shadow: 0 0.15rem 0.45rem var(--qc-shadow, rgba(15, 23, 42, 0.08));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 4px;
    transition: transform 0.18s ease;
}
.quiz-card:hover .quiz-card-logo {
    transform: scale(1.05);
}
.quiz-card-logo img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.quiz-card-title {
    font-size: 0.98rem;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.3;
    margin: 0.15rem 0 0;
    flex-grow: 1;
}

.quiz-card-count {
    flex-shrink: 0;
    background: var(--qc-bg, #eef2ff);
    color: var(--qc-fg, #4338ca);
    border: 1px solid var(--qc-border, #e0e7ff);
    border-radius: 0.4rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1.4;
}

.quiz-card-meta {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 50%;
}

.quiz-card-meta .lang-pill {
    font-size: 0.65rem;
    padding: 0.18rem 0.4rem;
}

.quiz-card-desc {
    font-size: 0.8rem;
    color: #6b7280;
    margin: 0 0 0.85rem;
    line-height: 1.4;
}

/* Stats triplet inside category card */
.quiz-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    margin-bottom: 0.85rem;
}

.quiz-stat {
    background: #f8fafc;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 0.5rem 0.4rem;
    text-align: center;
}

.quiz-stat-label {
    font-size: 0.62rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.2;
    margin-bottom: 0.18rem;
}

.quiz-stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.quiz-stat-value.success { color: #16a34a; }
.quiz-stat-value.warning { color: #d97706; }
.quiz-stat-value.danger  { color: #dc2626; }

.quiz-card-foot-meta {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Start button at the bottom of the card */
.quiz-card-cta {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: linear-gradient(135deg, var(--qc-grad-from, #6366f1), var(--qc-grad-to, #8b5cf6));
    color: #fff;
    border: none;
    border-radius: 0.55rem;
    padding: 0.6rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.quiz-card-cta:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px var(--qc-shadow, rgba(99, 102, 241, 0.25));
    color: #fff;
}

.quiz-card-cta:disabled {
    background: #e5e7eb;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
}

/* Empty state */
.quiz-empty {
    padding: 3rem 1.5rem;
    text-align: center;
    color: #94a3b8;
    background: #fff;
    border: 1px dashed #e5e7eb;
    border-radius: 0.85rem;
}

.quiz-empty i {
    font-size: 2.5rem;
    opacity: 0.4;
    display: block;
    margin-bottom: 0.5rem;
}

/* ---- Play view ---- */
.quiz-player-wrap {
    max-width: 760px;
    margin: 0 auto;
}

.quiz-play-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.quiz-play-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.quiz-play-title-icon {
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.quiz-play-meta {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.quiz-progress-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: #eef2ff;
    color: #4338ca;
    border: 1px solid #e0e7ff;
    border-radius: 0.4rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.quiz-timer {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 0.4rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.quiz-timer.warning { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.quiz-timer.danger  { background: #fee2e2; color: #991b1b; border-color: #fca5a5; animation: quiz-timer-pulse 1s ease-in-out infinite; }

@keyframes quiz-timer-pulse {
    50% { transform: scale(1.05); }
}

.quiz-progress-bar-wrap {
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.quiz-progress-bar-wrap .progress-bar {
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    height: 100%;
    border-radius: 999px;
    transition: width 0.3s ease;
}

/* Question card */
.quiz-question {
    background: #fff;
    border: 1px solid #eef0f3;
    border-radius: 0.85rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    margin-bottom: 1rem;
}

.quiz-q-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.22rem 0.55rem;
    border-radius: 0.35rem;
    margin-bottom: 0.85rem;
}

.quiz-q-tag.literal  { background: #dbeafe; color: #1e40af; }
.quiz-q-tag.aplicada { background: #fef3c7; color: #92400e; }

.quiz-q-statement {
    font-size: 1.08rem;
    font-weight: 600;
    color: #111827;
    line-height: 1.5;
    margin-bottom: 1.25rem;
}

/* Answer options */
.quiz-options {
    display: grid;
    gap: 0.55rem;
}

.quiz-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 0.6rem;
    padding: 0.7rem 0.9rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1.4;
    margin: 0;
}

.quiz-option:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.quiz-option-letter {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 0.45rem;
    background: #fff;
    border: 2px solid #e5e7eb;
    color: #6b7280;
    font-weight: 700;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.quiz-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.quiz-option-text {
    flex-grow: 1;
    color: #1f2937;
    font-size: 0.95rem;
}

.quiz-option.selected {
    background: #ede9fe;
    border-color: #8b5cf6;
}

.quiz-option.selected .quiz-option-letter {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: #6366f1;
    color: #fff;
}

/* Immediate-feedback mode: lock + reveal correct/incorrect */
.quiz-question.revealed .quiz-option {
    cursor: default;
}
.quiz-option.is-correct {
    background: #dcfce7;
    border-color: #16a34a;
}
.quiz-option.is-correct .quiz-option-letter {
    background: #16a34a;
    border-color: #15803d;
    color: #fff;
}
.quiz-option.is-wrong {
    background: #fee2e2;
    border-color: #dc2626;
}
.quiz-option.is-wrong .quiz-option-letter {
    background: #dc2626;
    border-color: #b91c1c;
    color: #fff;
}
.quiz-feedback {
    margin-top: 0.9rem;
    padding: 0.75rem 0.9rem;
    border-radius: 0.6rem;
    border: 1px solid transparent;
    font-size: 0.92rem;
}
.quiz-feedback.is-correct {
    background: #f0fdf4;
    border-color: #86efac;
    color: #14532d;
}
.quiz-feedback.is-wrong {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #7f1d1d;
}
.quiz-feedback-head {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}
.quiz-feedback-head i {
    font-size: 1.15rem;
}
.quiz-feedback-expl {
    line-height: 1.4;
    opacity: 0.92;
}

/* Bottom navigation */
.quiz-nav {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 1rem;
}

.quiz-nav .btn {
    border-radius: 0.55rem;
    padding: 0.55rem 1.1rem;
    font-weight: 600;
}

.quiz-nav .btn-quiz-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    color: #fff;
}

.quiz-nav .btn-quiz-primary:hover { color: #fff; opacity: 0.92; }

.quiz-nav .btn-quiz-finish {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    border: none;
    color: #fff;
}

.quiz-nav .btn-quiz-finish:hover { color: #fff; opacity: 0.92; }

/* ---- Results page ---- */
.quiz-result-hero {
    background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
    border: 1px solid #e0e7ff;
    border-radius: 0.85rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.quiz-result-hero.success { background: linear-gradient(135deg, #dcfce7 0%, #d1fae5 100%); border-color: #bbf7d0; }
.quiz-result-hero.warning { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); border-color: #fcd34d; }
.quiz-result-hero.danger  { background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%); border-color: #fca5a5; }

.quiz-score-circle {
    flex-shrink: 0;
    position: relative;
    width: 130px;
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quiz-score-circle svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.quiz-score-circle .ring-bg { fill: none; stroke-width: 12; }
.quiz-score-circle .ring-fg { fill: none; stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }

.quiz-result-hero .ring-bg          { stroke: rgba(99,102,241,0.15); }
.quiz-result-hero .ring-fg          { stroke: #6366f1; }
.quiz-result-hero.success .ring-bg  { stroke: rgba(22,163,74,0.18); }
.quiz-result-hero.success .ring-fg  { stroke: #16a34a; }
.quiz-result-hero.warning .ring-bg  { stroke: rgba(217,119,6,0.18); }
.quiz-result-hero.warning .ring-fg  { stroke: #d97706; }
.quiz-result-hero.danger  .ring-bg  { stroke: rgba(220,38,38,0.18); }
.quiz-result-hero.danger  .ring-fg  { stroke: #dc2626; }

.quiz-score-text {
    position: absolute;
    text-align: center;
    line-height: 1;
}

.quiz-score-pct {
    font-size: 2.2rem;
    font-weight: 800;
    color: #4338ca;
    font-variant-numeric: tabular-nums;
}

.quiz-result-hero.success .quiz-score-pct { color: #16a34a; }
.quiz-result-hero.warning .quiz-score-pct { color: #d97706; }
.quiz-result-hero.danger  .quiz-score-pct { color: #dc2626; }

.quiz-score-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    font-weight: 700;
    margin-top: 0.3rem;
}

.quiz-result-info {
    flex-grow: 1;
    min-width: 0;
}

.quiz-result-title {
    margin: 0 0 0.25rem;
    font-size: 1.3rem;
    font-weight: 700;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quiz-result-cat {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.85rem;
}

.quiz-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.quiz-result-actions .btn {
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
}

/* KPI strip */
.quiz-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 575.98px) {
    .quiz-kpis { grid-template-columns: repeat(2, 1fr); }
}

.quiz-kpi {
    background: #fff;
    border: 1px solid #eef0f3;
    border-radius: 0.7rem;
    padding: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.quiz-kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.quiz-kpi-icon.success { background: #dcfce7; color: #16a34a; }
.quiz-kpi-icon.danger  { background: #fee2e2; color: #dc2626; }
.quiz-kpi-icon.muted   { background: #f1f5f9; color: #64748b; }
.quiz-kpi-icon.indigo  { background: #eef2ff; color: #4338ca; }

.quiz-kpi-body {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}

.quiz-kpi-label {
    font-size: 0.68rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.quiz-kpi-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    font-variant-numeric: tabular-nums;
}

.quiz-kpi-sub {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 0.1rem;
}

/* Review list */
.quiz-review-card {
    background: #fff;
    border: 1px solid #eef0f3;
    border-radius: 0.85rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.quiz-review-card-header {
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid #eef0f3;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quiz-review-item {
    padding: 1rem 1.1rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    gap: 0.85rem;
}

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

.quiz-review-status {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
}

.quiz-review-status.ok       { background: #16a34a; }
.quiz-review-status.fail     { background: #dc2626; }
.quiz-review-status.skipped  { background: #94a3b8; }

.quiz-review-body { flex-grow: 1; min-width: 0; }

.quiz-review-meta {
    font-size: 0.68rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-weight: 700;
}

.quiz-review-meta .ref {
    background: #eef2ff;
    color: #4338ca;
    padding: 0.05rem 0.45rem;
    border-radius: 0.25rem;
}

.quiz-review-statement {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.6rem;
    line-height: 1.4;
}

.quiz-review-line {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    color: #475569;
}

.quiz-review-line .lbl {
    color: #94a3b8;
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    font-weight: 700;
    margin-right: 0.3rem;
}

.quiz-review-line .val.ok   { color: #16a34a; font-weight: 600; }
.quiz-review-line .val.fail { color: #dc2626; font-weight: 600; }

.quiz-review-explanation {
    margin-top: 0.55rem;
    background: #fef9c3;
    border-left: 3px solid #f59e0b;
    padding: 0.55rem 0.75rem;
    border-radius: 0.3rem;
    font-size: 0.82rem;
    color: #78350f;
    line-height: 1.45;
}

/* Stats history compact pill */
.pct-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border-radius: 0.4rem;
    padding: 0.2rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.pct-pill.success { background: #dcfce7; color: #166534; }
.pct-pill.warning { background: #fef9c3; color: #854d0e; }
.pct-pill.danger  { background: #fee2e2; color: #991b1b; }

.lang-pill {
    display: inline-flex;
    align-items: center;
    background: #eef2ff;
    color: #4338ca;
    border: 1px solid #e0e7ff;
    border-radius: 0.4rem;
    padding: 0.3rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
}

/* Resume banner on /quiz */
.quiz-resume-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fcd34d;
    border-radius: 0.85rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.quiz-resume-icon {
    width: 44px;
    height: 44px;
    border-radius: 0.6rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.quiz-resume-body { flex: 1 1 280px; min-width: 0; }

.quiz-resume-title {
    font-weight: 700;
    color: #78350f;
    font-size: 1rem;
    margin-bottom: 0.15rem;
}

.quiz-resume-meta {
    font-size: 0.82rem;
    color: #92400e;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.quiz-resume-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Save indicator on player */
.quiz-save-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    color: #94a3b8;
    margin-left: 0.5rem;
    transition: opacity 0.2s;
    opacity: 0;
}

.quiz-save-status.visible { opacity: 1; }
.quiz-save-status.saving  { color: #6366f1; }
.quiz-save-status.saved   { color: #16a34a; }
.quiz-save-status.error   { color: #dc2626; }

/* ============================================
   AI Assistant (chat-like view)
   ============================================ */
.assistant-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
    border: 1px solid #e0e7ff;
    border-radius: 1rem;
}
.assistant-hero-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    color: #312e81;
    font-size: 1.6rem;
    font-weight: 800;
}
.assistant-hero-icon {
    width: 44px;
    height: 44px;
    border-radius: 0.7rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}
.assistant-hero-sub {
    margin: 0.35rem 0 0 0;
    color: #4338ca;
    font-size: 0.95rem;
}

.assistant-thread {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}
.assistant-msg {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}
.assistant-msg-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.assistant-msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.assistant-msg-avatar--bot {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: 1.05rem;
}
.assistant-msg-body {
    flex: 1;
    min-width: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    padding: 0.85rem 1rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.assistant-msg--user .assistant-msg-body {
    background: #eef2ff;
    border-color: #c7d2fe;
}
.assistant-msg-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 0.3rem;
}
.assistant-msg-text {
    color: #0f172a;
    line-height: 1.55;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.assistant-cost {
    font-weight: 500;
    color: #94a3b8;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

.assistant-sources-toggle {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #334155;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    border-radius: 0.5rem;
    transition: background 0.15s;
}
.assistant-sources-toggle:hover { background: #e2e8f0; }
.assistant-sources-toggle[aria-expanded="true"] .bi-chevron-down { transform: rotate(180deg); }
.assistant-sources-toggle .bi-chevron-down { transition: transform 0.2s; display: inline-block; }

.assistant-sources-list {
    list-style: none;
    padding: 0;
    margin: 0.6rem 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.assistant-source {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.6rem;
    padding: 0.7rem 0.85rem;
}
.assistant-source-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.82rem;
    margin-bottom: 0.35rem;
}
.assistant-source-num {
    background: #6366f1;
    color: #fff;
    border-radius: 0.4rem;
    padding: 0.1rem 0.45rem;
    font-weight: 700;
    font-size: 0.75rem;
}
.assistant-source-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 0.4rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: 2px;
    flex-shrink: 0;
    overflow: hidden;
}
.assistant-source-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* ============================================
   Evaluaciones
   ============================================ */
.evaluations-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    background: linear-gradient(135deg, #ecfeff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 1rem;
}
.evaluations-hero-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    color: #0c4a6e;
    font-size: 1.6rem;
    font-weight: 800;
}
.evaluations-hero-icon {
    width: 44px;
    height: 44px;
    border-radius: 0.7rem;
    background: linear-gradient(135deg, #0ea5e9, #0369a1);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}
.evaluations-hero-sub {
    margin: 0.35rem 0 0 0;
    color: #075985;
    font-size: 0.95rem;
}

.evaluations-tabs {
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 1.25rem;
    gap: 0.25rem;
}
.evaluations-tabs .nav-link {
    color: #475569;
    font-weight: 600;
    padding: 0.7rem 1.1rem;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: 0.5rem 0.5rem 0 0;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.evaluations-tabs .nav-link:hover {
    color: #0c4a6e;
    background: #f1f5f9;
}
.evaluations-tabs .nav-link.active {
    color: #0c4a6e;
    background: transparent;
    border-bottom-color: #0ea5e9;
}

.evaluations-content {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    padding: 1.5rem;
    min-height: 280px;
}
.evaluations-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2.5rem 1rem;
    color: #475569;
}
.evaluations-empty i {
    font-size: 3rem;
    color: #cbd5e1;
    margin-bottom: 0.5rem;
}
.evaluations-empty-msg {
    font-weight: 600;
    color: #1e293b;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

/* Read-only function display in evaluation form */
.eval-function-display {
    background: linear-gradient(135deg, #ecfeff, #e0f2fe);
    border: 1px solid #bae6fd;
    color: #0c4a6e;
    border-radius: 0.6rem;
    padding: 0.65rem 0.85rem;
    font-weight: 700;
    font-size: 0.95rem;
    display: inline-block;
}

/* Score picker 1-7 (rojo→verde) */
.eval-score-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}
.eval-score-opt {
    cursor: pointer;
    margin: 0;
    user-select: none;
}
.eval-score-opt input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0; height: 0;
}
.eval-score-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #e2e8f0;
    background: #fff;
    color: #475569;
    font-weight: 800;
    font-size: 1.1rem;
    transition: transform 0.15s, box-shadow 0.18s, border-color 0.15s, background 0.18s, color 0.15s;
    position: relative;
}
.eval-score-opt:hover .eval-score-bubble {
    transform: translateY(-2px) scale(1.05);
    border-color: #94a3b8;
    box-shadow: 0 0.25rem 0.5rem rgba(15,23,42,0.10);
}

/* Active state — colour by score (red 1 → green 7) */
.eval-score-opt--1 input:checked + .eval-score-bubble { background:#ef4444; border-color:#dc2626; color:#fff; box-shadow:0 0.4rem 0.9rem rgba(239,68,68,0.4); }
.eval-score-opt--2 input:checked + .eval-score-bubble { background:#f97316; border-color:#ea580c; color:#fff; box-shadow:0 0.4rem 0.9rem rgba(249,115,22,0.4); }
.eval-score-opt--3 input:checked + .eval-score-bubble { background:#f59e0b; border-color:#d97706; color:#fff; box-shadow:0 0.4rem 0.9rem rgba(245,158,11,0.4); }
.eval-score-opt--4 input:checked + .eval-score-bubble { background:#eab308; border-color:#ca8a04; color:#0f172a; box-shadow:0 0.4rem 0.9rem rgba(234,179,8,0.4); }
.eval-score-opt--5 input:checked + .eval-score-bubble { background:#84cc16; border-color:#65a30d; color:#fff; box-shadow:0 0.4rem 0.9rem rgba(132,204,22,0.4); }
.eval-score-opt--6 input:checked + .eval-score-bubble { background:#22c55e; border-color:#16a34a; color:#fff; box-shadow:0 0.4rem 0.9rem rgba(34,197,94,0.4); }
.eval-score-opt--7 input:checked + .eval-score-bubble { background:#10b981; border-color:#059669; color:#fff; box-shadow:0 0.4rem 0.9rem rgba(16,185,129,0.4); }

.eval-score-opt input:checked + .eval-score-bubble {
    transform: scale(1.12);
}
.eval-score-opt input:focus-visible + .eval-score-bubble {
    outline: 3px solid rgba(99, 102, 241, 0.45);
    outline-offset: 2px;
}

/* Score pill in listings (matches the picker palette) */
.eval-score-pill {
    display: inline-block;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.78rem;
    color: #fff;
    font-variant-numeric: tabular-nums;
}
.eval-score-1 { background:#ef4444; }
.eval-score-2 { background:#f97316; }
.eval-score-3 { background:#f59e0b; }
.eval-score-4 { background:#eab308; color:#0f172a; }
.eval-score-5 { background:#84cc16; }
.eval-score-6 { background:#22c55e; }
.eval-score-7 { background:#10b981; }

/* ============================================
   Dashboard hero + access widgets
   ============================================ */
.dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.4rem 1.6rem;
    margin-bottom: 1.5rem;
    border-radius: 1.1rem;
    background: linear-gradient(120deg, #1e293b 0%, #312e81 60%, #4338ca 100%);
    color: #f8fafc;
    box-shadow: 0 0.5rem 1.4rem rgba(15, 23, 42, 0.18);
    position: relative;
    overflow: hidden;
}
.dashboard-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 100% 0%, rgba(255,255,255,0.18), transparent 45%);
    pointer-events: none;
}
.dashboard-hero-text { position: relative; z-index: 1; }
.dashboard-hero-greet {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 0.15rem;
}
.dashboard-hero-sub {
    font-size: 0.95rem;
    color: rgba(248, 250, 252, 0.75);
}
.dashboard-hero-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 0.4rem 0.9rem rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}
.dashboard-hero-avatar img {
    width: 100%; height: 100%; object-fit: cover;
}
.dashboard-hero-avatar i {
    font-size: 1.7rem;
    color: rgba(255, 255, 255, 0.85);
}

/* Section blocks (admin vs personal) */
.dashboard-section {
    margin-bottom: 1.75rem;
    padding: 1.25rem 1.25rem 1.5rem;
    border-radius: 1.1rem;
    position: relative;
}
.dashboard-section--admin {
    background: linear-gradient(180deg, #fff1f2 0%, #fff 60%);
    border: 1px solid #fecdd3;
    box-shadow: 0 0.4rem 1rem rgba(244, 63, 94, 0.06);
}
.dashboard-section--admin::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    border-top-left-radius: 1.1rem;
    border-top-right-radius: 1.1rem;
    background: linear-gradient(90deg, #f43f5e, #be123c);
}
.dashboard-section--personal {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.dashboard-section-head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1rem;
}
.dashboard-section-text { flex: 1 1 auto; min-width: 0; }

.dashboard-section-collapse {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.dashboard-section-collapse:hover {
    background: #f1f5f9;
    color: #1e293b;
    box-shadow: 0 0.2rem 0.4rem rgba(15, 23, 42, 0.08);
}
.dashboard-section-collapse i {
    transition: transform 0.25s ease;
}
.dashboard-section--admin .dashboard-section-collapse {
    border-color: #fecdd3;
    color: #be123c;
}
.dashboard-section--admin .dashboard-section-collapse:hover {
    background: #fff1f2;
    color: #9f1239;
}

/* Collapse animation: animate max-height + opacity */
.dashboard-section .dashboard-widgets {
    overflow: hidden;
    max-height: 5000px;
    opacity: 1;
    transition: max-height 0.35s ease, opacity 0.25s ease;
}
html.dash-admin-collapsed .dashboard-section--admin .dashboard-widgets,
html.dash-personal-collapsed .dashboard-section--personal .dashboard-widgets {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}
html.dash-admin-collapsed .dashboard-section--admin .dashboard-section-collapse i,
html.dash-personal-collapsed .dashboard-section--personal .dashboard-section-collapse i {
    transform: rotate(180deg);
}
html.dash-admin-collapsed .dashboard-section--admin,
html.dash-personal-collapsed .dashboard-section--personal {
    padding-bottom: 0.5rem;
}
html.dash-admin-collapsed .dashboard-section--admin .dashboard-section-head,
html.dash-personal-collapsed .dashboard-section--personal .dashboard-section-head {
    margin-bottom: 0;
}
.dashboard-section-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
    color: #fff;
}
.dashboard-section--admin .dashboard-section-icon {
    background: linear-gradient(135deg, #f43f5e, #be123c);
    box-shadow: 0 0.3rem 0.6rem rgba(244, 63, 94, 0.3);
}
.dashboard-section--personal .dashboard-section-icon {
    background: linear-gradient(135deg, #475569, #1e293b);
    box-shadow: 0 0.3rem 0.6rem rgba(15, 23, 42, 0.18);
}
.dashboard-section-title {
    font-size: 1.05rem;
    font-weight: 800;
    margin: 0;
    color: #0f172a;
    letter-spacing: -0.005em;
}
.dashboard-section-sub {
    margin: 0.1rem 0 0;
    font-size: 0.82rem;
    color: #64748b;
}

/* Widget grid */
.dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 0;
}

.dashboard-widget {
    --wg-from: #6366f1;
    --wg-to:   #4338ca;
    --wg-fg:   #312e81;
    --wg-bg:   #eef2ff;
    --wg-border: #e0e7ff;
    position: relative;
    background: #fff;
    border: 1px solid var(--wg-border);
    border-radius: 1rem;
    padding: 1.25rem;
    text-decoration: none;
    color: #1e293b;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
    min-height: 168px;
}
.dashboard-widget::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--wg-from), var(--wg-to));
}
.dashboard-widget::after {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 130px; height: 130px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--wg-from), var(--wg-to));
    opacity: 0.07;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.dashboard-widget:hover {
    transform: translateY(-4px);
    box-shadow: 0 0.8rem 1.6rem rgba(15, 23, 42, 0.10);
    border-color: var(--wg-from);
    color: #1e293b;
}
.dashboard-widget:hover::after {
    transform: scale(1.15);
    opacity: 0.13;
}

.dashboard-widget-icon {
    width: 52px;
    height: 52px;
    border-radius: 0.85rem;
    background: linear-gradient(135deg, var(--wg-from), var(--wg-to));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 0.85rem;
    box-shadow: 0 0.4rem 0.9rem rgba(99, 102, 241, 0.25);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.dashboard-widget-body {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.dashboard-widget-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}
.dashboard-widget-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    line-height: 1.25;
    flex-grow: 1;
}
.dashboard-widget-count {
    background: var(--wg-bg);
    color: var(--wg-fg);
    border: 1px solid var(--wg-border);
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.dashboard-widget-sub {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0 0 0.85rem;
    line-height: 1.4;
}
.dashboard-widget-cta {
    margin-top: auto;
    color: var(--wg-fg);
    font-size: 0.82rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: gap 0.2s ease;
}
.dashboard-widget:hover .dashboard-widget-cta { gap: 0.55rem; }

/* Per-widget colour palette */
.dashboard-widget.wg--blue   { --wg-from: #3b82f6; --wg-to: #1d4ed8; --wg-fg: #1e3a8a; --wg-bg: #dbeafe; --wg-border: #bfdbfe; }
.dashboard-widget.wg--amber  { --wg-from: #f59e0b; --wg-to: #b45309; --wg-fg: #92400e; --wg-bg: #fef3c7; --wg-border: #fde68a; }
.dashboard-widget.wg--green  { --wg-from: #10b981; --wg-to: #047857; --wg-fg: #065f46; --wg-bg: #d1fae5; --wg-border: #a7f3d0; }
.dashboard-widget.wg--teal   { --wg-from: #14b8a6; --wg-to: #0f766e; --wg-fg: #115e59; --wg-bg: #ccfbf1; --wg-border: #99f6e4; }
.dashboard-widget.wg--violet { --wg-from: #8b5cf6; --wg-to: #6d28d9; --wg-fg: #5b21b6; --wg-bg: #ede9fe; --wg-border: #ddd6fe; }
.dashboard-widget.wg--indigo { --wg-from: #6366f1; --wg-to: #4338ca; --wg-fg: #3730a3; --wg-bg: #e0e7ff; --wg-border: #c7d2fe; }
.dashboard-widget.wg--cyan   { --wg-from: #06b6d4; --wg-to: #0e7490; --wg-fg: #155e75; --wg-bg: #cffafe; --wg-border: #a5f3fc; }
.dashboard-widget.wg--rose   { --wg-from: #f43f5e; --wg-to: #be123c; --wg-fg: #9f1239; --wg-bg: #ffe4e6; --wg-border: #fecdd3; }
.dashboard-widget.wg--gold   { --wg-from: #f59e0b; --wg-to: #b45309; --wg-fg: #92400e; --wg-bg: #fef3c7; --wg-border: #fde68a; }
.dashboard-widget.wg--slate  { --wg-from: #64748b; --wg-to: #334155; --wg-fg: #1e293b; --wg-bg: #f1f5f9; --wg-border: #cbd5e1; }
.dashboard-widget.wg--pink   { --wg-from: #ec4899; --wg-to: #be185d; --wg-fg: #9d174d; --wg-bg: #fce7f3; --wg-border: #fbcfe8; }

/* Pulse on the count badge when there's something needing attention */
.dashboard-widget.is-pulse .dashboard-widget-count {
    position: relative;
    animation: dashWidgetPulse 1.6s ease-out infinite;
    background: var(--wg-from);
    color: #fff;
    border-color: transparent;
}
@keyframes dashWidgetPulse {
    0%   { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(244, 63, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}
.assistant-source-cat {
    font-weight: 700;
    color: #1e293b;
}
.assistant-source-ref {
    color: #64748b;
    font-style: italic;
}
.assistant-source-text {
    font-size: 0.85rem;
    color: #334155;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.assistant-feedback {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #e2e8f0;
}
.assistant-feedback-label {
    font-size: 0.82rem;
    color: #64748b;
    margin-right: 0.3rem;
}
.assistant-fb-btn {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: #64748b;
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    cursor: pointer;
}
.assistant-fb-btn:hover {
    background: #f1f5f9;
    color: #334155;
}
.assistant-fb-btn.is-active {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}
.assistant-fb-btn[data-value="not_useful"].is-active {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}
.assistant-fb-status {
    color: #64748b;
}

/* Audit panel: stat-card content + table */
.card-stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.card-stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.card-stat-foot {
    margin-top: 0.35rem;
}
.assistant-q-cell {
    color: #1e293b;
    font-size: 0.9rem;
    line-height: 1.4;
    word-break: break-word;
}
.table-danger-soft td {
    background: #fef2f2;
}

/* ---- Body filter pills on /quiz ---- */
.quiz-body-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}
.quiz-body-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 0.45rem 0.95rem 0.45rem 0.85rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s, background 0.12s;
}
.quiz-body-pill:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.6rem rgba(15, 23, 42, 0.08);
}
.quiz-body-pill:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}
.quiz-body-pill-dot {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    background: #cbd5e1;
    flex-shrink: 0;
}
.quiz-body-pill-icon {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 0.35rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    padding: 2px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.quiz-body-pill-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}
.quiz-body-pill-icon i {
    font-size: 0.85rem;
    color: #475569;
}
.quiz-body-pill:hover:not(:disabled) .quiz-body-pill-icon {
    box-shadow: 0 0.15rem 0.4rem rgba(15, 23, 42, 0.12);
}
.quiz-body-pill.is-active .quiz-body-pill-icon {
    background: #fff;
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0.1rem 0.35rem rgba(0, 0, 0, 0.18);
}
.quiz-body-pill-count {
    background: #f1f5f9;
    color: #475569;
    border-radius: 999px;
    padding: 0.05rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 800;
    min-width: 1.6rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.quiz-body-pill.is-active {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, #475569, #1e293b);
}
.quiz-body-pill.is-active .quiz-body-pill-count {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

/* Body-coloured pills, reusing the same palette as the cards */
.quiz-body-pill--rfet .quiz-body-pill-dot { background: #dc2626; }
.quiz-body-pill--itf  .quiz-body-pill-dot { background: #16a34a; }
.quiz-body-pill--atp  .quiz-body-pill-dot { background: #2563eb; }
.quiz-body-pill--wta  .quiz-body-pill-dot { background: #9333ea; }

.quiz-body-pill--rfet.is-active { background: linear-gradient(135deg, #dc2626, #991b1b); }
.quiz-body-pill--itf.is-active  { background: linear-gradient(135deg, #16a34a, #15803d); }
.quiz-body-pill--atp.is-active  { background: linear-gradient(135deg, #2563eb, #1e40af); }
.quiz-body-pill--wta.is-active  { background: linear-gradient(135deg, #9333ea, #7e22ce); }
.quiz-body-pill--rfet.is-active .quiz-body-pill-dot,
.quiz-body-pill--itf.is-active  .quiz-body-pill-dot,
.quiz-body-pill--atp.is-active  .quiz-body-pill-dot,
.quiz-body-pill--wta.is-active  .quiz-body-pill-dot { background: #fff; }

/* ============================================================
   My Tournaments — card grid
   ============================================================ */
.mt-page-header h2 {
    font-weight: 700;
    letter-spacing: -0.01em;
}

.mt-card {
    --mt-accent-from: #f59e0b;
    --mt-accent-to:   #d97706;
    --mt-accent-bg:   #fffbeb;

    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.mt-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px -8px rgba(15, 23, 42, 0.18);
    border-color: transparent;
}

/* Surface accents */
.mt-card.surf-clay   { --mt-accent-from: #f97316; --mt-accent-to: #c2410c; --mt-accent-bg: #ffedd5; }
.mt-card.surf-hard   { --mt-accent-from: #3b82f6; --mt-accent-to: #1d4ed8; --mt-accent-bg: #dbeafe; }
.mt-card.surf-carpet { --mt-accent-from: #10b981; --mt-accent-to: #047857; --mt-accent-bg: #d1fae5; }

/* Cover (image or gradient placeholder) */
.mt-card-cover {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--mt-accent-bg);
    text-decoration: none;
}
.mt-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}
.mt-card:hover .mt-card-cover img {
    transform: scale(1.04);
}
.mt-card-cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--mt-accent-from), var(--mt-accent-to));
    color: rgba(255, 255, 255, 0.85);
}
.mt-card-cover-placeholder i {
    font-size: 3rem;
    opacity: 0.85;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.mt-card-surface-pill {
    position: absolute;
    top: 0.65rem;
    left: 0.65rem;
    background: rgba(255, 255, 255, 0.95);
    color: #0f172a;
    border-radius: 999px;
    padding: 0.25rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
    display: inline-flex;
    align-items: center;
}
.mt-card-surface-pill i {
    color: var(--mt-accent-from);
}

/* Body */
.mt-card-body {
    padding: 0.95rem 1rem 0.5rem;
    flex: 1 1 auto;
}
.mt-card-title-link {
    color: inherit;
    text-decoration: none;
}
.mt-card-title-link:hover .mt-card-title {
    color: var(--mt-accent-to);
}
.mt-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    transition: color 0.15s;
    /* clamp to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mt-card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.82rem;
    color: #475569;
    margin-bottom: 0.6rem;
}
.mt-card-meta-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}
.mt-card-meta-row i {
    width: 0.95rem;
    color: var(--mt-accent-from);
    flex-shrink: 0;
}
.mt-card-meta-row span {
    min-width: 0;
}

/* Category chips inside a tournament card */
.mt-card-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.6rem;
    margin-bottom: 0.2rem;
}
.mt-card-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--mt-accent-bg);
    color: #0f172a;
    border-radius: 999px;
    padding: 0.15rem 0.55rem 0.15rem 0.45rem;
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.4;
    max-width: 100%;
}
.mt-card-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 9rem;
}
.mt-card-chip-gender {
    font-size: 0.85rem;
    line-height: 1;
    flex-shrink: 0;
}
.mt-card-chip-more {
    background: #e2e8f0;
    color: #475569;
    padding: 0.15rem 0.5rem;
    font-weight: 700;
}
.mt-card-chips-empty {
    margin-top: 0.55rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.mt-card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.55rem;
}
.mt-stat-label {
    font-weight: 600;
    color: inherit;
    margin-left: 0.1rem;
}
.mt-stat.is-zero {
    background: #f8fafc;
    color: #94a3b8;
}
.mt-stat.is-zero i {
    color: #cbd5e1;
}
.mt-stat-link {
    text-decoration: none;
    color: #475569;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.12s;
}
.mt-stat-link:hover {
    background: var(--mt-accent-bg);
    color: var(--mt-accent-ink);
    transform: translateY(-1px);
}
.mt-stat-link:hover i {
    color: var(--mt-accent-from);
}
.mt-stat {
    background: #f1f5f9;
    color: #475569;
    border-radius: 0.5rem;
    padding: 0.2rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.mt-stat i {
    font-size: 0.78rem;
    color: var(--mt-accent-from);
}

/* Actions footer */
.mt-card-actions {
    display: flex;
    gap: 0.4rem;
    padding: 0.7rem 1rem 0.85rem;
    border-top: 1px solid #f1f5f9;
}
.mt-card-actions .btn-sm {
    border-radius: 0.5rem;
    font-weight: 600;
}

/* Empty state */
.mt-empty {
    border-radius: 0.85rem;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}
.mt-empty-icon {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    margin: 0 auto;
    background: linear-gradient(135deg, #fef3c7, #fed7aa);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d97706;
}
.mt-empty-icon i {
    font-size: 2.4rem;
}

/* ============================================================
   My Tournaments — form (new/edit)
   ============================================================ */
.mt-form {
    --mt-accent-from: #f97316;
    --mt-accent-to:   #c2410c;
    --mt-accent-bg:   #ffedd5;
    --mt-accent-ink:  #9a3412;
}
.mt-form.surf-clay   { --mt-accent-from: #f97316; --mt-accent-to: #c2410c; --mt-accent-bg: #ffedd5; --mt-accent-ink: #9a3412; }
.mt-form.surf-hard   { --mt-accent-from: #3b82f6; --mt-accent-to: #1d4ed8; --mt-accent-bg: #dbeafe; --mt-accent-ink: #1e3a8a; }
.mt-form.surf-carpet { --mt-accent-from: #10b981; --mt-accent-to: #047857; --mt-accent-bg: #d1fae5; --mt-accent-ink: #065f46; }

/* Hero header */
.mt-form-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    background: linear-gradient(135deg, var(--mt-accent-from), var(--mt-accent-to));
    color: #fff;
    border-radius: 0.85rem 0.85rem 0 0;
    transition: background 0.3s ease;
}
.mt-form-hero-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.mt-form-hero-icon i {
    font-size: 1.5rem;
}
.mt-form-hero-text {
    flex: 1;
    min-width: 0;
}
.mt-form-hero-text h2 {
    color: #fff;
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1.2;
}
.mt-form-hero-text p {
    color: rgba(255, 255, 255, 0.85);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mt-form-hero-back {
    color: #fff;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.4rem 0.8rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.15s;
    flex-shrink: 0;
}
.mt-form-hero-back:hover {
    background: rgba(255, 255, 255, 0.28);
    color: #fff;
}

/* Body */
.mt-form-body {
    background: #fff;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    border-top: 0;
}

/* Sections */
.mt-section {
    padding: 1.25rem 0;
    border-top: 1px solid #f1f5f9;
}
.mt-section:first-child {
    padding-top: 0.25rem;
    border-top: 0;
}
.mt-section-head {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 0.95rem;
}
.mt-section-head i {
    color: var(--mt-accent-from);
    font-size: 1rem;
}
.mt-section-head .mt-day-count {
    color: var(--mt-accent-ink);
    background: var(--mt-accent-bg);
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-weight: 700;
    margin-left: 0.3rem;
}

.mt-input-bold {
    font-weight: 600;
}

/* Surface toggle (radio button group) */
.mt-surface-toggle {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
}
.mt-surface-toggle .btn {
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.4rem 0.5rem;
    border-radius: 0.5rem;
}
.mt-surface-toggle .surf-opt-clay   { color: #c2410c; border-color: #fed7aa; }
.mt-surface-toggle .surf-opt-hard   { color: #1d4ed8; border-color: #bfdbfe; }
.mt-surface-toggle .surf-opt-carpet { color: #047857; border-color: #a7f3d0; }
.mt-surface-toggle .btn-check:checked + .surf-opt-clay   { background: #f97316; border-color: #f97316; color: #fff; }
.mt-surface-toggle .btn-check:checked + .surf-opt-hard   { background: #3b82f6; border-color: #3b82f6; color: #fff; }
.mt-surface-toggle .btn-check:checked + .surf-opt-carpet { background: #10b981; border-color: #10b981; color: #fff; }

/* Poster uploader */
.mt-poster-block {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.9rem;
}
@media (min-width: 576px) {
    .mt-poster-block {
        grid-template-columns: 180px 1fr;
        align-items: center;
    }
}
.mt-poster-preview {
    aspect-ratio: 3 / 4;
    width: 100%;
    max-width: 220px;
    border-radius: 0.65rem;
    overflow: hidden;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
}
.mt-poster-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.mt-poster-preview-empty {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
}
.mt-poster-preview-empty i {
    font-size: 2.5rem;
}

.mt-poster-controls {
    min-width: 0;
}
.mt-uploader {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    background: var(--mt-accent-bg);
    border: 1px dashed var(--mt-accent-from);
    border-radius: 0.65rem;
    cursor: pointer;
    transition: background 0.15s, transform 0.12s;
    color: var(--mt-accent-ink);
}
.mt-uploader:hover {
    background: #fff;
    transform: translateY(-1px);
}
.mt-uploader i {
    font-size: 1.6rem;
    color: var(--mt-accent-from);
    flex-shrink: 0;
}
.mt-uploader strong {
    font-size: 0.9rem;
    color: #0f172a;
}

/* Category chips */
.mt-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.95rem;
}
.mt-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}
.mt-chip:hover {
    border-color: var(--mt-accent-from);
    color: var(--mt-accent-ink);
}
.mt-chip-check {
    color: transparent;
    transition: color 0.15s;
}
.btn-check:checked + .mt-chip {
    background: var(--mt-accent-bg);
    border-color: var(--mt-accent-from);
    color: var(--mt-accent-ink);
}
.btn-check:checked + .mt-chip .mt-chip-check {
    color: var(--mt-accent-from);
}
.mt-chip-gender {
    font-size: 0.95rem;
    line-height: 1;
    color: #94a3b8;
}
.mt-chip-gender--male   { color: #2563eb; }
.mt-chip-gender--female { color: #db2777; }
.mt-chip-gender--mixed  { color: #7c3aed; }

.mt-newcat-block {
    padding-top: 0.6rem;
    border-top: 1px dashed #e2e8f0;
}

/* Days grid */
.mt-days-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.7rem;
}
@media (min-width: 576px) { .mt-days-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 992px) { .mt-days-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1400px) { .mt-days-grid { grid-template-columns: repeat(4, 1fr); } }

.mt-day {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.65rem;
    padding: 0.65rem 0.75rem;
    transition: border-color 0.15s, background 0.15s;
}
.mt-day:focus-within {
    border-color: var(--mt-accent-from);
    background: #fff;
}
.mt-day-head {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    margin-bottom: 0.45rem;
}
.mt-day-num {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--mt-accent-from);
    background: var(--mt-accent-bg);
    padding: 0.1rem 0.4rem;
    border-radius: 0.3rem;
    letter-spacing: 0.03em;
}
.mt-day-date {
    font-size: 0.82rem;
    font-weight: 700;
    color: #0f172a;
}
.mt-day-notes {
    resize: vertical;
    font-size: 0.82rem;
}

/* Inline-editable cells in the inscritos list */
.editable-field {
    display: inline-block;
    min-width: 1.5rem;
    padding: 0 0.25rem;
    border-radius: 0.25rem;
    outline: none;
    transition: background 0.12s ease, box-shadow 0.12s ease;
    cursor: text;
}
.editable-field:hover {
    background: #f0f9ff;
    box-shadow: inset 0 0 0 1px #bae6fd;
}
.editable-field:focus {
    background: #fff;
    box-shadow: inset 0 0 0 2px #3b82f6;
}
.editable-field.is-empty {
    color: #94a3b8;
}
.editable-field.is-saving {
    background: #fef9c3;
    box-shadow: inset 0 0 0 1px #fde68a;
}
.editable-field.is-saved {
    background: #d1fae5;
    box-shadow: inset 0 0 0 1px #6ee7b7;
}
.editable-field.is-error {
    background: #fee2e2;
    box-shadow: inset 0 0 0 1px #fca5a5;
}

/* Purple "Femenino" radio variant — used where the default Bootstrap "danger"
   (red) is too aggressive for a gender selector. */
.btn-outline-female {
    color: #9333ea;
    border-color: #9333ea;
}
.btn-outline-female:hover,
.btn-outline-female:focus,
.btn-check:checked + .btn-outline-female {
    color: #fff;
    background-color: #9333ea;
    border-color: #9333ea;
}
.btn-outline-female .mt-chip-gender--female,
.btn-check:checked + .btn-outline-female .mt-chip-gender--female {
    color: inherit;
}

/* Paid toggle — fixed width so "Pagado" and "No pagado" align visually
   no matter which state is active. */
.paid-toggle {
    min-width: 7rem;
    text-align: center;
    font-weight: 600;
}

/* Sex cell toggle (click cycles M↔F). */
.sex-toggle-cell {
    cursor: pointer;
    user-select: none;
    border-radius: 0.25rem;
    transition: background 0.12s ease, box-shadow 0.12s ease;
}
.sex-toggle-cell:hover {
    background: #f0f9ff;
    box-shadow: inset 0 0 0 1px #bae6fd;
}
.sex-toggle-cell.is-saving { background: #fef9c3; }
.sex-toggle-cell.is-saved  { background: #d1fae5; }
.sex-toggle-cell.is-error  { background: #fee2e2; }

/* Inline category select: shrink to fit content; keep border subtle. */
.inline-category-select {
    width: auto;
    min-width: 7rem;
    max-width: 14rem;
    background-color: #f8fafc;
    border-color: #e2e8f0;
}
.inline-category-select:focus {
    background-color: #fff;
}
.inline-category-select.is-saving {
    background-color: #fef9c3;
    border-color: #fde68a;
}

/* Group "pills" — selectable cards at the top of /groups page */
.group-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.group-pill {
    display: inline-flex;
    align-items: center;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 999px;
    padding: 0.1rem 0.2rem 0.1rem 0.85rem;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.group-pill:hover {
    border-color: var(--mt-accent-from, #f97316);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}
.group-pill.is-active {
    background: var(--mt-accent-bg, #ffedd5);
    border-color: var(--mt-accent-from, #f97316);
}
.group-pill-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #0f172a;
    text-decoration: none;
    padding: 0.4rem 0;
    font-weight: 600;
}
.group-pill.is-active .group-pill-link {
    color: var(--mt-accent-ink, #9a3412);
}
.group-pill-link i {
    color: var(--mt-accent-from, #f97316);
}
.group-pill-count {
    background: #f1f5f9;
    color: #475569;
    border-radius: 999px;
    padding: 0.05rem 0.5rem;
    font-size: 0.78rem;
    font-weight: 800;
    min-width: 1.6rem;
    text-align: center;
}
.group-pill.is-active .group-pill-count {
    background: var(--mt-accent-from, #f97316);
    color: #fff;
}
.group-pill-delete {
    background: transparent;
    border: 0;
    color: #94a3b8;
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    line-height: 1;
    transition: background 0.12s, color 0.12s;
}
.group-pill-delete:hover {
    background: #fee2e2;
    color: #b91c1c;
}

/* Sortable table headers */
th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
th.sortable:hover {
    background: #e9ecef;
}
th.sortable .sort-icon {
    font-size: 0.78em;
    margin-left: 0.35rem;
    opacity: 0.35;
    transition: opacity 0.12s ease, color 0.12s ease;
}
th.sortable:hover .sort-icon {
    opacity: 0.7;
}
th.sortable.is-active {
    color: var(--mt-accent-ink, #0f172a);
}
th.sortable.is-active .sort-icon {
    opacity: 1;
    color: var(--mt-accent-from, #3b82f6);
}

/* Sticky footer */
.mt-form-footer {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 0.85rem 1.25rem;
    border: 1px solid #e2e8f0;
    border-top: 0;
    border-radius: 0 0 0.85rem 0.85rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    box-shadow: 0 -2px 8px rgba(15, 23, 42, 0.04);
    z-index: 5;
}
