:root {
    --primary-color: #18345c;
    --secondary-color: #2563eb;
    --accent-color: #0f766e;
    --success-color: #16a34a;
    --danger-color: #e53e3e;
    --warning-color: #dd6b20;
    --info-color: #3182ce;
    --light-bg: #f5f7fb;
    --dark-text: #172033;
    --muted-text: #667085;
    --border-color: #e6eaf0;
}

html {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background:
        linear-gradient(180deg, #f8fafc 0, #f4f7fb 260px),
        var(--light-bg);
    color: var(--dark-text);
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
}

.app-shell {
    padding-left: 0;
    padding-right: 0;
}

.app-shell > .row {
    display: flex;
    flex-wrap: nowrap;
}

.app-content {
    min-width: 0;
}

.app-main {
    flex: 1 1 auto;
    max-width: 100%;
}

.app-content > .py-4 {
    padding: 28px 32px;
}

.navbar {
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 0 rgba(16, 24, 40, 0.02);
    backdrop-filter: blur(14px);
}

.app-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
}

.navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: #111827 !important;
    font-size: 1.35rem;
    letter-spacing: 0;
}

.app-logo-navbar {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

.app-navbar .nav-link,
.app-navbar .dropdown-toggle {
    color: #475467 !important;
    font-weight: 600;
}

.app-navbar .dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.12);
}

.app-navbar .navbar-toggler {
    border-color: #d0d5dd;
}

.app-navbar .navbar-toggler-icon {
    filter: invert(1);
}

.sidebar {
    flex: 0 0 76px;
    min-height: calc(100vh - 56px);
    background: rgba(255, 255, 255, 0.78);
    border-right: 1px solid var(--border-color);
    backdrop-filter: blur(16px);
    padding: 12px;
    transition: flex-basis 0.2s ease, width 0.2s ease, box-shadow 0.2s ease;
    width: 76px;
    z-index: 5;
}

.sidebar:hover {
    box-shadow: 18px 0 36px rgba(15, 23, 42, 0.08);
    flex-basis: 260px;
    width: 260px;
}

.sidebar .nav-link {
    color: #344054;
    height: 52px;
    margin: 0 auto 6px;
    padding: 0;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    font-weight: 600;
    justify-content: center;
    overflow: hidden;
    white-space: nowrap;
    width: 52px;
}

.sidebar:hover .nav-link {
    gap: 8px;
    height: 44px;
    justify-content: flex-start;
    margin: 0 0 6px;
    padding: 10px 12px;
    width: 100%;
}

.sidebar .nav-link i {
    flex: 0 0 auto;
    font-size: 1.15rem;
    margin-right: 0 !important;
}

.sidebar .nav-label {
    display: none;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar:hover .nav-label {
    display: inline;
}

.sidebar .nav-link:hover {
    background-color: #eef4ff;
    color: var(--primary-color);
}

.sidebar .nav-link.active {
    background-color: #eaf1ff;
    color: #1d4ed8;
    box-shadow: inset 3px 0 0 #2563eb;
}

.nav-section-label {
    color: #8a95a6;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0;
    padding: 18px 12px 6px;
    text-transform: uppercase;
    display: none;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar:hover .nav-section-label {
    display: block;
}

nav[aria-label="breadcrumb"] {
    margin-bottom: 18px;
}

nav[aria-label="breadcrumb"] .breadcrumb {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    margin-bottom: 0;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

nav[aria-label="breadcrumb"] .breadcrumb-item {
    display: inline-flex;
    align-items: center;
    color: #64748b;
    font-size: 0.95rem;
    font-weight: 600;
}

nav[aria-label="breadcrumb"] .breadcrumb-item + .breadcrumb-item {
    padding-left: 8px;
}

nav[aria-label="breadcrumb"] .breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    padding-right: 8px;
    color: #94a3b8;
    font-size: 1.2rem;
    line-height: 1;
}

nav[aria-label="breadcrumb"] .breadcrumb-item a {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 3px 8px;
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
}

nav[aria-label="breadcrumb"] .breadcrumb-item a:hover {
    background: #edf2f7;
    color: var(--secondary-color);
}

nav[aria-label="breadcrumb"] .breadcrumb-item.active {
    padding: 3px 4px;
    color: #475569;
}

.card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.badge-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.85rem;
}

.badge-aberta { background-color: #c6f6d5; color: #22543d; }
.badge-em-andamento { background-color: #bee3f8; color: #2a4365; }
.badge-concluida { background-color: #e2e8f0; color: #4a5568; }
.badge-cancelada { background-color: #fed7d7; color: #822727; }

.turma-card { cursor: pointer; height: 100%; }
.turma-card .card-body { display: flex; flex-direction: column; }

.table thead { background-color: var(--primary-color); color: white; }
.table th, .table td { vertical-align: middle; }

.table-responsive {
    -webkit-overflow-scrolling: touch;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.user-list-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
    background: #e2e8f0;
}

.user-list-avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-weight: 700;
    text-transform: uppercase;
}

.stats-card { text-align: center; padding: 20px; }
.stat-icon {
    align-items: center;
    background: #eef4ff;
    border-radius: 8px;
    color: #2563eb;
    display: inline-flex;
    height: 42px;
    justify-content: center;
    margin-bottom: 10px;
    width: 42px;
}
.stats-card .stats-number,
.stats-card .stat-number {
    color: var(--primary-color);
    font-size: 2.5rem;
    font-weight: 700;
}

.stats-card .stats-label,
.stats-card .stat-label {
    color: #718096;
    font-size: 0.9rem;
}

.report-kpi {
    align-items: center;
    display: flex;
    flex-direction: row;
    gap: 12px;
    min-height: 86px;
    padding: 14px 16px;
    text-align: left;
}

.report-kpi .stat-icon {
    height: 38px;
    margin-bottom: 0;
    width: 38px;
}

.report-kpi .stat-number {
    font-size: 1.55rem;
    line-height: 1;
}

.report-kpi .stat-label {
    font-size: 0.82rem;
    margin-top: 3px;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.modal-header .btn-close { filter: invert(1); }

.alert { border-radius: 8px; }

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(30, 58, 95, 0.25);
}

.footer {
    background-color: white;
    border-top: 1px solid #e2e8f0;
    padding: 20px 0;
    margin-top: 40px;
}

.empty-icon-xl {
    font-size: 4rem;
}

.instructor-avatar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    object-fit: cover;
    flex: 0 0 auto;
}

.progress-thin {
    height: 0.45rem;
}

.profile-card {
    background: linear-gradient(135deg, #1e3a5f, #2c5282);
    border-radius: 12px;
    padding: 30px;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    object-fit: cover;
    object-position: center center;
    border: 4px solid white;
}

.profile-avatar-placeholder {
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.2);
}

.profile-placeholder-icon {
    font-size: 3rem;
}

.pending-approval-alert {
    border-left: 4px solid #dd6b20;
}

.photo-position-stage {
    width: min(300px, 72vw);
    aspect-ratio: 1;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid white;
    box-shadow: 0 0 0 1px #cbd5e0, 0 14px 36px rgba(30, 58, 95, 0.22);
    background: #e2e8f0;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.photo-position-stage:active {
    cursor: grabbing;
}

.photo-position-stage img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.especialidade-form-preview {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.especialidade-card-img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid #edf2f7;
}

.especialidades-accordion {
    --bs-accordion-border-color: transparent;
    --bs-accordion-active-bg: #ffffff;
    --bs-accordion-active-color: var(--primary-color);
    --bs-accordion-btn-focus-box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.16);
}

.especialidades-area {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.especialidades-area-button {
    gap: 12px;
    padding: 16px 18px;
    font-size: 1.05rem;
    font-weight: 700;
}

.especialidades-area-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.especialidades-area-title span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.especialidades-area .accordion-body {
    padding: 18px;
    background: #f8fafc;
}

@media (max-width: 768px) {
    body {
        font-size: 0.95rem;
    }

    h1, .h1 { font-size: 1.8rem; }
    h2, .h2 { font-size: 1.45rem; }
    h3, .h3 { font-size: 1.25rem; }
    h4, .h4 { font-size: 1.1rem; }

    .especialidades-area-button {
        align-items: flex-start;
        padding: 14px;
        font-size: 0.98rem;
    }

    .especialidades-area-title {
        align-items: flex-start;
    }

    .especialidades-area .accordion-body {
        padding: 12px;
    }

    .navbar {
        box-shadow: 0 3px 12px rgba(0, 0, 0, 0.16);
    }

    .navbar .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }

    .navbar-brand {
        gap: 8px;
        font-size: 1.12rem;
        max-width: calc(100vw - 88px);
    }

    .app-logo-navbar {
        width: 34px;
        height: 34px;
    }

    .navbar-collapse {
        margin-top: 10px;
        padding: 8px 0 4px;
        border-top: 1px solid rgba(255, 255, 255, 0.18);
    }

    .navbar-nav .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
        gap: 8px;
        border-radius: 8px;
        padding: 10px 12px;
    }

    .sidebar {
        min-height: auto;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }

    .app-content {
        padding-left: 0;
        padding-right: 0;
    }

    .app-content > .py-4 {
        padding: 18px 12px !important;
    }

    .app-content > .py-4 > .d-flex.justify-content-between {
        align-items: flex-start !important;
        flex-direction: column;
        gap: 12px;
    }

    .app-content > .py-4 > .d-flex.justify-content-between > div,
    .app-content > .py-4 > .d-flex.justify-content-between > a,
    .app-content > .py-4 > .d-flex.justify-content-between > span {
        max-width: 100%;
    }

    nav[aria-label="breadcrumb"] {
        margin-bottom: 14px;
    }

    nav[aria-label="breadcrumb"] .breadcrumb {
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
        width: 100%;
        padding: 8px 10px;
    }

    nav[aria-label="breadcrumb"] .breadcrumb-item {
        font-size: 0.9rem;
    }

    .card {
        border-radius: 8px;
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
        transition: none;
    }

    .card:hover {
        transform: none;
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
    }

    .card-body {
        padding: 16px;
    }

    .card-header {
        padding: 12px 16px;
    }

    .btn {
        min-height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }

    .btn-sm {
        min-height: 36px;
        padding: 0.35rem 0.55rem;
    }

    .btn-group {
        flex-wrap: wrap;
        gap: 4px;
    }

    .btn-group > .btn,
    .btn-group > form > .btn {
        border-radius: 6px !important;
    }

    .table-responsive {
        margin-left: -8px;
        margin-right: -8px;
        padding-left: 8px;
        padding-right: 8px;
    }

    .table {
        min-width: 720px;
        font-size: 0.9rem;
    }

    .table th,
    .table td {
        padding: 0.65rem;
    }

    .form-control,
    .form-select,
    .input-group-text {
        min-height: 44px;
    }

    .modal-dialog {
        margin: 12px;
    }

    .footer {
        margin-top: 20px;
        padding: 14px 12px;
        font-size: 0.85rem;
    }

    .profile-card {
        padding: 22px 16px;
    }

    .profile-avatar,
    .profile-avatar-placeholder {
        width: 96px;
        height: 96px;
    }
}

@media (max-width: 576px) {
    .app-content > .py-4 {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .row {
        --bs-gutter-x: 0.75rem;
    }

    .row.g-4 {
        --bs-gutter-y: 0.75rem;
    }

    .empty-icon-xl {
        font-size: 3rem;
    }

    .stats-card {
        padding: 14px;
    }

    .stats-card .stats-number,
    .stats-card .stat-number {
        font-size: 1.8rem;
    }
}
