/*
 * The Lesson - shared UI theme.
 * Loaded last in every layout so it can normalise Bootstrap + legacy styles.
 */

:root {
    --brand: #3F87C6;
    --brand-600: #2C6DAA;
    --brand-700: #22598D;
    --navy: #1E4466;
    --navy-900: #14304A;
    --accent: #F5A623;

    --bg: #F4F6FA;
    --surface: #FFFFFF;
    --surface-muted: #F8FAFC;
    --border: #E3E8EF;
    --border-strong: #CBD3DE;

    --text: #1F2A37;
    --text-muted: #5B6778;
    --text-subtle: #8792A2;

    --success: #1F9D63;
    --success-bg: #E7F6EE;
    --danger: #D64545;
    --danger-bg: #FDECEC;
    --warning-bg: #FFF5E0;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-lg: 0 12px 24px -6px rgba(16, 24, 40, .14), 0 4px 8px -4px rgba(16, 24, 40, .06);
    --ring: 0 0 0 3px rgba(63, 135, 198, .25);

    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Base ---------- */

html { -webkit-text-size-adjust: 100%; }

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main { flex: 1 0 auto; }

h1, h2, h3, h4, h5, h6 { color: var(--text); font-weight: 700; letter-spacing: -.01em; }

a { color: var(--brand-600); }
a:hover { color: var(--brand-700); }

hr { border-top-color: var(--border); }

::selection { background: rgba(63, 135, 198, .2); }

:focus-visible { outline: none; box-shadow: var(--ring); }

@media (min-width: 1200px) {
    .container { max-width: 1200px !important; }
}

.text-muted { color: var(--text-muted) !important; }

/* ---------- Header ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--border);
}

.site-header__inner {
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 68px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none !important;
    flex-shrink: 0;
}

.brand__logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.brand__name {
    font-weight: 800;
    font-size: 18px;
    letter-spacing: .02em;
    color: var(--navy);
    text-transform: uppercase;
}

.site-search {
    flex: 1;
    max-width: 440px;
    position: relative;
    align-items: center;
    margin: 0;
}

.site-search .fa {
    position: absolute;
    left: 14px;
    color: var(--text-subtle);
    pointer-events: none;
}

.site-search input {
    width: 100%;
    height: 40px;
    padding: 0 14px 0 38px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-muted);
    font-size: 14px;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}

.site-search input:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--brand);
    box-shadow: var(--ring);
}

.site-nav {
    margin-left: auto;
    align-items: center;
    gap: 4px;
}

.site-nav__link,
.hdr-dd__toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none !important;
    cursor: pointer;
    transition: background-color .15s, color .15s;
}

.site-nav__link:hover,
.hdr-dd__toggle:hover,
.hdr-dd.is-open .hdr-dd__toggle {
    background: var(--surface-muted);
    color: var(--text);
}

.site-nav__link.is-active {
    color: var(--brand-600);
    background: rgba(63, 135, 198, .08);
}

.hdr-dd { position: relative; }

.hdr-dd__toggle .fa-angle-down { transition: transform .15s; }
.hdr-dd.is-open .hdr-dd__toggle .fa-angle-down { transform: rotate(180deg); }

.hdr-dd__panel {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 220px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1040;
}

.hdr-dd.is-open .hdr-dd__panel { display: block; }

.hdr-dd__panel a,
.hdr-dd__panel button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--text);
    font-size: 14px;
    text-align: left;
    text-decoration: none !important;
    cursor: pointer;
}

.hdr-dd__panel a:hover,
.hdr-dd__panel button:hover { background: var(--surface-muted); color: var(--brand-600); }

.hdr-dd__panel .fa { width: 16px; color: var(--text-subtle); text-align: center; }

.hdr-dd__label {
    padding: 8px 10px 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-subtle);
}

.hdr-dd__divider { height: 1px; margin: 6px 0; background: var(--border); }

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--navy));
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.nav-toggle {
    margin-left: auto;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--navy);
    font-size: 18px;
}

.mobile-nav {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 12px 0 16px;
    max-height: calc(100vh - 68px);
    overflow-y: auto;
}

.mobile-nav .site-search { max-width: none; margin-bottom: 12px; display: flex; }

.mobile-nav__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-weight: 500;
    text-decoration: none !important;
}

.mobile-nav__link:hover { background: var(--surface-muted); }
.mobile-nav__link .fa { width: 18px; color: var(--text-subtle); text-align: center; }

.mobile-nav__group {
    margin: 12px 8px 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-subtle);
}

.btn-signup {
    padding: 8px 16px !important;
    background: var(--brand-600) !important;
    color: #fff !important;
}
.btn-signup:hover { background: var(--brand-700) !important; }

/* ---------- Page scaffolding ---------- */

#app { padding-bottom: 48px; }
#app > .site-header + * { margin-top: 28px; }
#app > .site-header + hr { margin: 0; border: 0; }

.page { padding-bottom: 8px; }

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.page-head__title {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
}

.page-head__subtitle {
    margin: 4px 0 0;
    color: var(--text-muted);
}

.section-title {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 800;
}

.section-subtitle { margin: 0 0 20px; color: var(--text-muted); }

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    padding: 0 !important;
    margin: 0 0 12px !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0;
    font-size: 13px;
}

.breadcrumb-item { font-size: 13px; color: var(--text-subtle); }
.breadcrumb-item a { color: var(--text-muted); text-decoration: none; }
.breadcrumb-item a:hover { color: var(--brand-600); }
.breadcrumb-item.active { color: var(--text-subtle); }

.breadcrumb-item + .breadcrumb-item::before {
    content: "\203A" !important;
    color: var(--border-strong) !important;
    padding: 0 8px !important;
}

/* Legacy surface used across most pages */
.content-div {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-sm);
    padding: 0 20px 20px !important;
    margin-bottom: 24px;
}

.content-div .content-header {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.content-div div.content-header > :nth-child(1) {
    margin-left: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.content-div div.content-header > :nth-child(2) { margin-right: 0; font-size: 13px; }

@media (max-width: 576px) {
    .content-div { padding: 0 14px 14px !important; }
}

/* ---------- Status pill ---------- */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none !important;
    white-space: nowrap;
}

.pill--success { background: var(--success-bg); color: var(--success) !important; }
.pill--warning { background: var(--warning-bg); color: #A05E00 !important; }
.pill--warning:hover { background: #FFEBC2; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- Tiles (levels, classes, subjects) ---------- */

.tile-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.tile-grid--wide { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.tile-grid--lg { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text) !important;
    text-decoration: none !important;
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.tile:hover {
    transform: translateY(-2px);
    border-color: rgba(63, 135, 198, .45);
    box-shadow: var(--shadow-lg);
}

.tile__media {
    aspect-ratio: 4 / 3;
    background: linear-gradient(135deg, #DCE8F4, #EEF3F9) center / cover no-repeat;
}

.tile__body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    padding: 14px 16px;
}

.tile__title { margin: 0; font-size: 16px; font-weight: 700; color: var(--text); }
.tile__meta { font-size: 13px; color: var(--text-muted); }

.tile__desc {
    font-size: 14px;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tile__cta {
    margin-top: auto;
    padding-top: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-600);
}

.tile:hover .tile__cta .fa { transform: translateX(3px); }
.tile__cta .fa { transition: transform .15s; }

.tile--compact {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.tile__icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: rgba(63, 135, 198, .1);
    color: var(--brand-600);
    font-size: 18px;
    font-weight: 800;
}

.tile--compact .tile__title { font-size: 15px; }

/* ---------- Lesson cards ---------- */

.lesson-tile .tile__media {
    aspect-ratio: 16 / 9;
    position: relative;
    background-color: #D9E2EC;
}

.lesson-tile .tile__media::after {
    content: "\f04b";
    font-family: FontAwesome;
    position: absolute;
    inset: 0;
    margin: auto;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 4px;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: 18px;
    opacity: 0;
    transition: opacity .15s;
}

.lesson-tile:hover .tile__media::after { opacity: 1; }
.lesson-tile--pdf .tile__media::after { content: "\f1c1"; padding-left: 0; }

.lesson-tile .duration {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(0, 0, 0, .7);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

.lesson-tile__number {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--brand-600);
}

.lesson-tile .tile__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 15px;
}

/* ---------- Empty state ---------- */

.empty-state {
    max-width: 460px;
    margin: 24px auto;
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state img { width: 88px; height: 88px; margin-bottom: 16px; opacity: .9; }
.empty-state h3 { font-size: 18px; margin-bottom: 6px; }
.empty-state p { margin-bottom: 18px; }

/* ---------- Legacy card styles (still used in a few places) ---------- */

.card-elm {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: none;
    transition: transform .15s ease, box-shadow .15s ease;
}

.card-elm:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card-text { color: var(--navy); }

/* ---------- Bootstrap: cards ---------- */

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 20px;
    font-weight: 700;
    font-size: 16px;
}

.card-header:first-child { border-radius: 0; }
.card-body { padding: 20px; }

.card-footer {
    background: var(--surface-muted);
    border-top: 1px solid var(--border);
}

/* ---------- Bootstrap: buttons ---------- */

.btn {
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 16px;
    transition: background-color .15s, border-color .15s, box-shadow .15s, color .15s;
}

.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-lg { padding: 12px 22px; font-size: 16px; }

.btn:focus, .btn.focus { box-shadow: var(--ring) !important; }

.btn-primary, .btn-info, .custom-btn-primary {
    background-color: var(--brand-600) !important;
    border-color: var(--brand-600) !important;
    color: #fff !important;
}

.btn-primary:hover, .btn-info:hover, .custom-btn-primary:hover {
    background-color: var(--brand-700) !important;
    border-color: var(--brand-700) !important;
}

.btn-outline-primary {
    color: var(--brand-600);
    border-color: var(--border-strong);
    background: var(--surface);
}

.btn-outline-primary:hover {
    background: rgba(63, 135, 198, .08);
    color: var(--brand-700);
    border-color: var(--brand);
}

.btn-light-on-dark {
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .35);
    color: #fff !important;
}

.btn-light-on-dark:hover { background: rgba(255, 255, 255, .2); }

.btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: #1F2A37 !important;
}

.btn-accent:hover { background: #E8961A; border-color: #E8961A; }

/* ---------- Bootstrap: forms ---------- */

.form-control, select.form-control {
    height: auto;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}

.form-control:focus {
    border-color: var(--brand);
    box-shadow: var(--ring);
}

label { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 6px; }

.material-form-field { font-family: var(--font); }
.material-form-field input { background: transparent; border-bottom-color: var(--border-strong); }
.material-form-field .material-form-field-label { font-weight: 500; color: var(--text-muted); }

.material-form-field input:focus,
.body .material-form-field input:focus {
    color: var(--text) !important;
    border-bottom-color: var(--brand) !important;
}

.material-form-field input:focus ~ .material-form-field-label { color: var(--brand-600); }

/* ---------- Bootstrap: tables & DataTables ---------- */

.table { color: var(--text); font-size: 14px; margin-bottom: 0; }

.table thead th,
.table > thead > tr > th,
table.dataTable thead th {
    background: var(--surface-muted);
    border-top: 0;
    border-bottom: 1px solid var(--border) !important;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 12px;
    white-space: nowrap;
}

.table td, table.dataTable tbody td {
    padding: 12px;
    border-top: 1px solid var(--border);
    vertical-align: middle;
}

.table-striped tbody tr:nth-of-type(odd) { background-color: transparent; }
.table-hover tbody tr:hover,
table.dataTable tbody tr:hover { background-color: #F3F7FC !important; }

table.dataTable.no-footer { border-bottom: 1px solid var(--border); }
table.dataTable.stripe tbody tr.odd,
table.dataTable.display tbody tr.odd { background-color: var(--surface); }

.dataTables_wrapper { font-size: 14px; color: var(--text-muted); }
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 6px 10px;
    margin-left: 6px;
}
.dataTables_wrapper .dataTables_filter input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length { margin-bottom: 12px; }
.dataTables_wrapper .dataTables_info { padding-top: 14px; }
.dataTables_wrapper .dataTables_paginate { padding-top: 10px; }

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border: 1px solid transparent !important;
    border-radius: 6px;
    padding: 4px 10px !important;
    background: none !important;
    color: var(--text-muted) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--surface-muted) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--brand-600) !important;
    border-color: var(--brand-600) !important;
    color: #fff !important;
}

.dt-buttons { margin-bottom: 12px; }
.dt-buttons .dt-button {
    margin: 0 6px 6px 0 !important;
    padding: 5px 12px !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: 6px !important;
    background: var(--surface) !important;
    color: var(--text) !important;
    font-size: 13px !important;
    font-weight: 500;
}
.dt-buttons .dt-button:hover { background: var(--surface-muted) !important; border-color: var(--brand) !important; }

/* ---------- Bootstrap: misc components ---------- */

.alert { border: 0; border-radius: var(--radius); font-size: 14px; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-danger { background: var(--danger-bg); color: #9B2C2C; }
.alert-success { background: var(--success-bg); color: #176B45; }
.alert-info { background: #E8F1FA; color: var(--navy); }

.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    font-size: 14px;
}

.dropdown-item { border-radius: var(--radius-sm); padding: 7px 12px; }
.dropdown-item:hover { background: var(--surface-muted); color: var(--brand-600) !important; }

.modal-content {
    border: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header { border-bottom: 1px solid var(--border); padding: 16px 20px; }
.modal-footer { border-top: 1px solid var(--border); }

/* Vue-driven modals in admin pages */
#overlay {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
    background: rgba(20, 48, 74, .45);
}

#overlay .modal-dialog { width: 100%; margin: 0 auto; }

.badge { border-radius: 999px; padding: .35em .7em; font-weight: 600; }

.video_wrapper {
    position: relative;
    padding-bottom: 56.25%;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
}

.video_wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ---------- Watch page ---------- */

.lesson-page {
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-sm);
    padding: 16px !important;
}

.lesson-meta .title { font-size: 22px; font-weight: 800; line-height: 1.3; }
.lesson-meta .description { color: var(--text-muted); }
.comments-sec .comments-count { font-size: 17px; font-weight: 700; }
.playlist-item { border-radius: var(--radius-sm); transition: background-color .15s; }
.playlist-videos a:hover .playlist-item { background: var(--surface-muted); }
.video-thumb { border-radius: var(--radius-sm); }

/* ---------- Dashboard ---------- */

.stat-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: 24px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    color: var(--text) !important;
    text-decoration: none !important;
    transition: box-shadow .15s, transform .15s;
}

a.stat:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.stat__icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    font-size: 20px;
    background: rgba(63, 135, 198, .12);
    color: var(--brand-600);
}

.stat__icon--green { background: var(--success-bg); color: var(--success); }
.stat__icon--amber { background: var(--warning-bg); color: #C27803; }
.stat__icon--violet { background: #EFEBFB; color: #6941C6; }

.stat__label { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.stat__value { font-size: 24px; font-weight: 800; line-height: 1.2; }
.stat__hint { font-size: 12px; color: var(--text-subtle); }

.people-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; }

.people-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.people-list li:last-child { border-bottom: 0; }
.people-list small { display: block; color: var(--text-muted); }

/* ---------- Landing page ---------- */

.hero {
    position: relative;
    overflow: hidden;
    color: #fff;
    background: var(--navy);
}

.hero__bg {
    position: absolute;
    inset: 0 0 0 auto;
    width: min(60%, 900px);
    background: url('/images/background-img.jpeg') center / cover no-repeat;
}

.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--navy) 40%, rgba(30, 68, 102, .75) 65%, rgba(30, 68, 102, .2) 100%);
}

.hero__content {
    position: relative;
    z-index: 1;
    max-width: 580px;
    padding: 72px 0 80px;
}

.hero__eyebrow {
    display: inline-block;
    margin-bottom: 16px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .02em;
}

.hero__title {
    margin-bottom: 16px;
    color: #fff;
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 800;
    line-height: 1.1;
}

.hero__text {
    margin-bottom: 28px;
    color: rgba(255, 255, 255, .85);
    font-size: 16.5px;
}

.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

@media (max-width: 767px) {
    .hero__bg { width: 100%; opacity: .35; }
    .hero::after { background: linear-gradient(180deg, rgba(30, 68, 102, .85), var(--navy)); }
    .hero__content { padding: 48px 0 56px; }
}

.announcements {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: -28px;
    position: relative;
    z-index: 2;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.announcements__icon { color: #C27803; font-size: 18px; line-height: 1.4; }
.announcements__label { font-weight: 700; margin-right: 6px; }
.announcements p { margin: 0; }
.announcements p + p { margin-top: 4px; }

.landing-section { padding: 48px 0; }
.landing-section--alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.plan-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 260px));
    justify-content: center;
}

.plan {
    display: flex;
    flex-direction: column;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: box-shadow .15s, transform .15s, border-color .15s;
}

.plan:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: rgba(63, 135, 198, .45); }

.plan__name {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--brand-600);
}

.plan__price { margin: 12px 0 4px; font-size: 32px; font-weight: 800; line-height: 1; }
.plan__price small { font-size: 14px; font-weight: 600; color: var(--text-muted); vertical-align: top; margin-right: 4px; }

.plan__features {
    list-style: none;
    margin: 16px 0 20px;
    padding: 0;
    font-size: 14px;
    color: var(--text-muted);
}

.plan__features li { padding: 4px 0; }
.plan__features .fa { color: var(--success); margin-right: 6px; }
.plan .btn { margin-top: auto; }

.video-frame { max-width: 820px; margin: 0 auto; box-shadow: var(--shadow-lg); }

/* ---------- Footer ---------- */

.site-footer {
    margin-top: auto;
    padding: 48px 0 0;
    background: var(--navy-900);
    color: rgba(255, 255, 255, .78);
    font-size: 14px;
}

.site-footer h5 {
    margin-bottom: 14px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.site-footer a { color: rgba(255, 255, 255, .78); text-decoration: none; }
.site-footer a:hover { color: #fff; }

.site-footer .brand__name { color: #fff; }

.site-footer__about { margin: 14px 0 18px; max-width: 420px; }

.site-footer__list { list-style: none; margin: 0; padding: 0; }
.site-footer__list li { display: flex; gap: 10px; padding: 4px 0; }
.site-footer__list .fa { width: 16px; margin-top: 4px; color: var(--brand); text-align: center; }

.site-footer label { color: rgba(255, 255, 255, .85); font-weight: 500; }

.site-footer .form-control {
    background: rgba(255, 255, 255, .06);
    border-color: rgba(255, 255, 255, .18);
    color: #fff;
}

.site-footer .form-control::placeholder { color: rgba(255, 255, 255, .45); }
.site-footer .form-control:focus { background: rgba(255, 255, 255, .1); border-color: var(--brand); }

.site-footer__notify { min-height: 20px; margin: 8px 0; font-size: 13px; }
.site-footer__notify.is-error { color: #FFB4B4; }
.site-footer__notify.is-success { color: #9BE6BF; }

.site-footer__bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    margin-top: 32px;
    padding: 18px 0;
    border-top: 1px solid rgba(255, 255, 255, .1);
    font-size: 13px;
    color: rgba(255, 255, 255, .55);
}

/* ---------- Auth pages ---------- */

.auth-body {
    background:
        radial-gradient(1200px 500px at 10% -10%, rgba(63, 135, 198, .45), transparent 60%),
        linear-gradient(160deg, var(--navy) 0%, var(--navy-900) 100%);
}

.auth-page {
    min-height: 100vh;
    width: 100%;
    height: auto;
    padding: 32px 16px;
}

.login-sec { width: 100%; max-width: 420px; }

.auth-head { padding: 0 4px 16px !important; }
.auth-head .brand__name { color: #fff; }
.auth-head .brand__logo { background: #fff; }

.auth-head .action a {
    font-size: 14px;
    font-weight: 600;
    opacity: .9;
}

.auth-card {
    padding: 28px !important;
    margin-top: 0 !important;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, .35);
    border: 0;
}

.auth-card .head { align-items: flex-start; margin-bottom: 4px; }
.auth-card .head h1 { font-size: 24px; font-weight: 800; margin: 0; }
.auth-card .head p { margin: 4px 0 0; color: var(--text-muted); font-size: 14px; }
.auth-card .head a { font-size: 13px; white-space: nowrap; }

.auth-card .btn { min-width: 120px; }
.auth-card .btn-primary { background-color: var(--brand-600) !important; }
.auth-card .btn-primary:hover { background-color: var(--brand-700) !important; }
.auth-card .end { gap: 12px; }
.auth-card .end label { font-weight: 500; margin: 0; }

.auth-foot { padding: 18px 8px 0; text-align: center; color: rgba(255, 255, 255, .75); font-size: 14px; }
.auth-foot a { color: #fff; font-weight: 600; }

@media (max-width: 410px) {
    .auth-card { border-radius: var(--radius-lg); padding: 20px !important; }
}

/* ---------- Icons ---------- */

.title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-right: 12px;
    border-radius: 10px;
    background: rgba(63, 135, 198, .12);
    color: var(--brand-600);
    font-size: 18px;
    vertical-align: middle;
    flex-shrink: 0;
}

.page-head__title { display: flex; align-items: center; }
.section-title .fa { margin-right: 8px; color: var(--brand); }
.content-div div.content-header > :nth-child(1) .fa { margin-right: 8px; color: var(--brand); }
.site-nav__link .fa { font-size: 15px; opacity: .8; }
.site-footer h5 .fa { margin-right: 6px; color: var(--brand); }
.breadcrumb-item .fa-home { font-size: 14px; }
.tile__meta .fa { margin-right: 3px; color: var(--text-subtle); }

.plan__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: rgba(63, 135, 198, .1);
    color: var(--brand-600);
    font-size: 22px;
}

.features {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.feature {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.feature h3 { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.feature p { margin: 0; font-size: 13.5px; color: var(--text-muted); }

.empty-state__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin-bottom: 16px;
    border-radius: 50%;
    background: rgba(63, 135, 198, .1);
    color: var(--brand-600);
    font-size: 30px;
}

.lesson-meta .views_date .fa,
.lesson-meta .teacher .fa { margin-right: 4px; color: var(--text-subtle); }
.auth-card .head { justify-content: flex-start; align-items: center; }

/* ---------- Filter bar (admin lists) ---------- */

.filter-bar {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    align-items: end;
    padding: 16px;
    margin-bottom: 16px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.filter-bar label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.filter-bar .form-control { min-height: 38px; background-color: var(--surface); }

.filter-bar__search { grid-column: span 2; position: relative; }
.filter-bar__search .fa { position: absolute; left: 12px; bottom: 12px; color: var(--text-subtle); }
.filter-bar__search .form-control { padding-left: 34px; }

.filter-bar__actions { display: flex; gap: 8px; }
.filter-bar__actions .btn { flex: 1; white-space: nowrap; }

@media (max-width: 575px) {
    .filter-bar__search { grid-column: 1 / -1; }
}

.result-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13.5px;
    color: var(--text-muted);
}

.result-summary strong { color: var(--text); }
.result-summary .fa { margin-right: 4px; color: var(--text-subtle); }

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
    background: var(--danger-bg);
    color: #9B2C2C;
}

.status-badge--successful { background: var(--success-bg); color: #176B45; }
.status-badge--pending { background: var(--warning-bg); color: #A05E00; }

.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(63, 135, 198, .1);
    color: var(--brand-700);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.type-badge--pdf { background: var(--danger-bg); color: #9B2C2C; }

.pagination { margin: 16px 0 0; flex-wrap: wrap; }
.page-link { color: var(--brand-600); border-color: var(--border); }
.page-item.active .page-link { background: var(--brand-600); border-color: var(--brand-600); }
.filter-bar label + .form-control,
.filter-bar label + select { margin-bottom: 0; }

/* ---------- Scrollable tables: rows scroll, header stays put ---------- */

.table-scroll {
    max-height: max(320px, calc(100vh - 240px));
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.table-scroll > .table,
.table-scroll > table.dataTable { margin: 0 !important; width: 100% !important; }

.table-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface-muted);
    border-bottom: 0 !important;
    box-shadow: inset 0 -1px 0 var(--border);
}

.table-scroll tbody tr:first-child td { border-top: 0; }
.table-scroll table.dataTable.no-footer { border-bottom: 0; }

.table-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid var(--surface); }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
.dataTables_wrapper .table-scroll { clear: both; }

/* ---------- Tools hub ---------- */

.tools-group { margin-bottom: 28px; }

.tools-group__title {
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-subtle);
}

.tool-tile { align-items: flex-start; }
.tool-tile .tile__meta { margin-top: 2px; line-height: 1.4; }
.tool-tile__arrow { margin-left: auto; align-self: center; color: var(--border-strong); font-size: 18px; transition: transform .15s, color .15s; }
.tool-tile:hover .tool-tile__arrow { color: var(--brand); transform: translateX(3px); }

/* ---------- Finance ---------- */

.fin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 20px;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.fin-tabs__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
    cursor: pointer;
}

.fin-tabs__link:hover { background: var(--surface-muted); color: var(--text); }
.fin-tabs__link.is-active { background: rgba(63, 135, 198, .1); color: var(--brand-700); }
.hdr-dd__panel--left { left: 0; right: auto; }

.verdict {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 32px;
    margin-bottom: 24px;
    padding: 20px 24px;
    border-radius: var(--radius-lg);
    border: 1px solid;
}

.verdict--profit { background: var(--success-bg); border-color: #BDE5CF; color: #145A3A; }
.verdict--loss { background: var(--danger-bg); border-color: #F5C2C2; color: #7F1D1D; }
.verdict--break_even { background: var(--warning-bg); border-color: #F7DCA6; color: #7A4A00; }

.verdict__main { display: flex; align-items: center; gap: 14px; }
.verdict__icon { font-size: 34px; }
.verdict__title { font-size: 20px; font-weight: 800; }
.verdict__text { font-size: 14px; opacity: .9; }

.verdict__figures { display: flex; flex-wrap: wrap; gap: 12px 28px; }
.verdict__figures span { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; opacity: .75; }
.verdict__figures strong { font-size: 17px; font-weight: 800; white-space: nowrap; }

.range-links { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.range-links__link {
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none !important;
}
.range-links__link:hover { border-color: var(--brand); color: var(--brand-700); }
.range-links__link.is-active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

.report { padding-top: 24px !important; }

.report-head { margin-bottom: 20px; text-align: center; }
.report-head__org { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-600); }
.report-head__title { margin: 4px 0; font-size: 24px; font-weight: 800; }
.report-head__period { font-size: 14px; color: var(--text-muted); }

.report-subtitle { margin: 24px 0 8px; font-size: 16px; font-weight: 700; }
.report-note { margin: 16px 0 0; font-size: 13px; color: var(--text-muted); }

.report-check { margin: 16px 0 0; font-size: 14px; font-weight: 600; }
.report-check.is-ok { color: var(--success); }
.report-check.is-bad { color: var(--danger); }

.statement { max-width: 760px; margin: 0 auto; font-size: 14.5px; }
.statement--columns, .report .row .statement, .daybook { max-width: none; }
.statement td, .statement th { padding: 8px 12px; border-top: 0; }
.statement td:last-child, .statement th:last-child,
.statement--columns td:nth-last-child(-n+2), .statement--columns th:nth-last-child(-n+2) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.daybook td:nth-last-child(2), .daybook th:nth-last-child(2),
.daybook td:nth-last-child(3), .daybook th:nth-last-child(3) { text-align: left !important; white-space: normal !important; }

.statement__section th {
    padding-top: 18px !important;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--brand-700);
    background: transparent !important;
    border-bottom: 1px solid var(--border) !important;
}

.statement__line td:first-child { padding-left: 24px; }
.statement--columns .statement__line td:first-child { padding-left: 12px; }
.statement__subtotal td { font-weight: 700; border-top: 1px solid var(--border-strong) !important; }
.statement__subtotal--strong td { background: var(--surface-muted); }

.statement__total td {
    font-size: 15.5px;
    font-weight: 800;
    border-top: 1px solid var(--text) !important;
    border-bottom: 3px double var(--text) !important;
}

.statement__total.is-negative td:last-child { color: var(--danger); }

.daybook__link { color: var(--text); }
.daybook__link:hover { color: var(--brand-600); }

.tx-type {
    display: inline-block;
    margin: 0 4px 2px 0;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

.tx-type--investment { background: #EFEBFB; border-color: #DDD3F6; color: #5B33B6; }
.tx-type--income { background: var(--success-bg); border-color: #BDE5CF; color: #176B45; }
.tx-type--expense { background: var(--danger-bg); border-color: #F5C2C2; color: #9B2C2C; }

.fin-form { max-width: 860px; }

.type-picker { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.type-picker__option { margin: 0; cursor: pointer; }
.type-picker__option input { position: absolute; opacity: 0; pointer-events: none; }

.type-picker__option > span {
    display: flex;
    flex-direction: column;
    gap: 2px;
    height: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}

.type-picker__option .fa { font-size: 18px; color: var(--brand-600); margin-bottom: 4px; }
.type-picker__option strong { font-size: 14.5px; }
.type-picker__option small { font-weight: 400; color: var(--text-muted); }
.type-picker__option input:checked + span { border-color: var(--brand); background: rgba(63, 135, 198, .06); box-shadow: var(--ring); }
.type-picker__option input:focus-visible + span { box-shadow: var(--ring); }

@media print {
    .site-header, .site-footer, .no-print, .fin-tabs, .filter-bar, .alert-success, .dt-buttons { display: none !important; }
    body { background: #fff !important; }
    #app { padding: 0 !important; }
    .content-div { border: 0 !important; box-shadow: none !important; padding: 0 !important; }
    .table-scroll { max-height: none !important; overflow: visible !important; border: 0 !important; }
    .table-scroll thead th { position: static; }
    .verdict { break-inside: avoid; }
    a { color: inherit !important; text-decoration: none !important; }
}
.statement--numeric td:not(:first-child),
.statement--numeric th:not(:first-child) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.statement__section th:first-child { text-align: left !important; }
.daybook th:nth-child(2), .daybook th:nth-child(3) { width: 22%; }
.daybook td:nth-child(2), .daybook td:nth-child(3) { white-space: nowrap !important; }

/* ---------- Retention ---------- */

.segment-bar {
    display: flex;
    height: 34px;
    margin-bottom: 14px;
    overflow: hidden;
    border-radius: var(--radius);
    font-size: 12.5px;
    font-weight: 700;
}

.segment-bar__part {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    flex-basis: 0;
    color: #fff;
    white-space: nowrap;
}

.segment--loyal { background: #1F9D63; color: #fff; }
.segment--new { background: #3F87C6; color: #fff; }
.segment--lapsed { background: #E8961A; color: #fff; }
.segment--never_returned { background: #D64545; color: #fff; }

.segment-legend {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: 8px;
}

.segment-legend__item { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.segment-legend__icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 13px;
}

.cohort-table td, .cohort-table th { text-align: center !important; }
.cohort-table td:first-child, .cohort-table th:first-child { text-align: left !important; }
.cohort-cell {
    font-size: 13px;
    font-weight: 600;
    background: rgba(31, 157, 99, calc(var(--share, 0) * .85));
    color: var(--text);
}
.cohort-cell.is-future { background: repeating-linear-gradient(45deg, var(--surface-muted), var(--surface-muted) 4px, var(--surface) 4px, var(--surface) 8px); }
.cohort-cell.is-strong { color: #fff; }
