:root {
    --navy: #12355b;
    --navy-2: #0d2744;
    --blue: #1e5aa8;
    --gold: #f59e0b;
    --bg: #f4f6f8;
    --surface: #ffffff;
    --border: #e5e7eb;
    --text: #111827;
    --muted: #6b7280;
    --green: #16a34a;
    --amber: #d97706;
    --red: #dc2626;
}

* {
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    overflow-x: hidden;
}

a {
    color: var(--blue);
}

.auth-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 18% 20%, rgba(245, 158, 11, .14), transparent 28%),
        linear-gradient(135deg, #f8fafc 0%, #edf4fb 100%);
}

.auth-shell {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-card {
    background: rgba(255, 255, 255, .96);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(18, 53, 91, .14);
    max-width: 440px;
    padding: 34px;
    width: 100%;
}

.auth-brand,
.sidebar-brand {
    align-items: center;
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
}

.auth-brand h1 {
    font-size: 24px;
    margin: 0;
}

.auth-brand p,
.sidebar-brand small,
.user-menu small,
.eyebrow,
.page-subtitle {
    color: var(--muted);
}

.auth-brand p,
.sidebar-brand small,
.user-menu small,
.eyebrow {
    display: block;
    font-size: 12px;
    margin: 0;
}

.brand-mark {
    align-items: center;
    background: var(--gold);
    border-radius: 8px;
    color: #111827;
    display: inline-flex;
    font-weight: 800;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.btn {
    border-radius: 8px;
}

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

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

.auth-links {
    margin-top: 18px;
    text-align: center;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 22px 18px;
    position: sticky;
    top: 0;
    width: 278px;
    z-index: 1040;
}

.sidebar .brand-mark {
    background: var(--gold);
}

.sidebar-nav {
    display: grid;
    gap: 5px;
    overflow-y: auto;
    padding-right: 2px;
}

.sidebar-nav a {
    align-items: center;
    border-radius: 8px;
    color: rgba(255, 255, 255, .78);
    display: flex;
    font-size: 14px;
    gap: 10px;
    min-height: 42px;
    padding: 10px 12px;
    text-decoration: none;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

.sidebar-nav i {
    color: rgba(245, 158, 11, .95);
    font-size: 16px;
}

.sidebar-note {
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, .14);
    color: rgba(255, 255, 255, .72);
    display: flex;
    font-size: 13px;
    gap: 8px;
    margin-top: auto;
    padding-top: 18px;
}

.app-main {
    flex: 1;
    min-width: 0;
}

.topbar {
    align-items: center;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 18px;
    justify-content: space-between;
    min-height: 76px;
    padding: 16px 28px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.mobile-menu-toggle {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--navy);
    display: none;
    height: 42px;
    width: 42px;
}

.topbar-heading {
    min-width: 0;
}

.topbar-title {
    font-size: 20px;
    margin: 0;
}

.user-menu {
    align-items: center;
    display: flex;
    gap: 14px;
}

.topbar-time {
    align-items: center;
    color: var(--muted);
    display: flex;
    font-size: 13px;
    gap: 7px;
}

.user-chip {
    align-items: center;
    display: flex;
    gap: 10px;
}

.user-chip > span {
    align-items: center;
    background: rgba(30, 90, 168, .1);
    border-radius: 8px;
    color: var(--blue);
    display: inline-flex;
    font-weight: 800;
    height: 38px;
    justify-content: center;
    text-transform: uppercase;
    width: 38px;
}

.app-content {
    padding: 28px;
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.app-alert {
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(17, 24, 39, .06);
    display: flex;
    gap: 10px;
}

.page-header {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 22px;
}

.page-header h2 {
    font-size: 28px;
    margin: 0;
}

.page-subtitle {
    font-size: 14px;
    margin: 6px 0 0;
}

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

.metric-card,
.quick-card,
.empty-state {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 12px 34px rgba(17, 24, 39, .05);
}

.metric-card {
    min-height: 154px;
    padding: 20px;
}

.metric-icon {
    align-items: center;
    border-radius: 8px;
    display: inline-flex;
    height: 42px;
    justify-content: center;
    margin-bottom: 18px;
    width: 42px;
}

.tone-blue {
    background: rgba(30, 90, 168, .1);
    color: var(--blue);
}

.tone-amber {
    background: rgba(245, 158, 11, .14);
    color: var(--amber);
}

.tone-green {
    background: rgba(22, 163, 74, .11);
    color: var(--green);
}

.metric-card span {
    color: var(--muted);
    display: block;
    font-size: 13px;
}

.metric-card strong {
    display: block;
    font-size: 34px;
    line-height: 1.1;
    margin-top: 10px;
}

.status-pill {
    border-radius: 999px;
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    padding: 7px 10px;
}

.status-info {
    background: rgba(30, 90, 168, .1);
    color: var(--blue);
}

.status-warning {
    background: rgba(245, 158, 11, .14);
    color: var(--amber);
}

.section-block {
    margin-top: 28px;
}

.section-heading h3 {
    font-size: 20px;
    margin: 0 0 14px;
}

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

.quick-card {
    color: var(--text);
    display: grid;
    gap: 7px;
    padding: 18px;
    text-decoration: none;
}

.quick-card i {
    color: var(--gold);
    font-size: 22px;
}

.quick-card span {
    font-weight: 800;
}

.quick-card small,
.empty-inline {
    color: var(--muted);
}

.empty-inline {
    align-items: center;
    background: #fff;
    border: 1px dashed var(--border);
    border-radius: 8px;
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding: 14px 16px;
}

.empty-state {
    padding: 28px;
    text-align: center;
}

.empty-state-wide {
    margin: 0 auto;
    max-width: 760px;
    padding: 44px 28px;
}

.empty-icon {
    align-items: center;
    background: rgba(30, 90, 168, .1);
    border-radius: 8px;
    color: var(--blue);
    display: inline-flex;
    font-size: 30px;
    height: 66px;
    justify-content: center;
    margin-bottom: 18px;
    width: 66px;
}

.empty-icon.danger {
    background: rgba(220, 38, 38, .1);
    color: var(--red);
}

.sidebar-backdrop {
    display: none;
}

.filter-card,
.form-card,
.table-card,
.detail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 12px 34px rgba(17, 24, 39, .05);
}

.filter-card {
    margin-bottom: 18px;
    padding: 18px;
}

.filter-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.filter-actions,
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.table-card {
    overflow: hidden;
}

.pagination-wrap {
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    padding: 14px;
}

.form-card {
    padding: 22px;
}

.form-section {
    border-bottom: 1px solid var(--border);
    margin-bottom: 22px;
    padding-bottom: 22px;
}

.form-section:last-of-type {
    border-bottom: 0;
    margin-bottom: 0;
}

.form-section h3,
.detail-card h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.form-grid,
.skill-grid,
.info-grid,
.rating-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-grid label,
.skill-grid label {
    color: var(--muted);
    display: grid;
    font-size: 13px;
    gap: 7px;
}

.profile-header {
    align-items: center;
    background: linear-gradient(135deg, var(--navy), var(--blue));
    border-radius: 8px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    margin-bottom: 18px;
    padding: 24px;
}

.profile-header .eyebrow,
.profile-header p {
    color: rgba(255, 255, 255, .75);
}

.profile-header h2 {
    margin: 0;
}

.profile-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.profile-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-card {
    padding: 20px;
}

.info-grid div,
.rating-grid div {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
}

.info-grid span,
.rating-grid span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    margin-bottom: 4px;
}

.info-grid strong,
.rating-grid strong {
    font-size: 14px;
}

.upload-form,
.status-form {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}

.document-list {
    display: grid;
    gap: 10px;
}

.document-panel-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
    margin-bottom: 18px;
}

.document-highlight,
.document-upload-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    display: grid;
    gap: 10px;
    padding: 16px;
}

.document-highlight {
    border-color: rgba(30, 90, 168, .2);
}

.document-highlight strong {
    font-size: 16px;
}

.document-upload-card label {
    color: var(--muted);
    display: grid;
    font-size: 12px;
    gap: 6px;
    margin: 0;
}

.resume-upload-inline {
    align-items: stretch;
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
}

.resume-upload-inline label {
    color: var(--muted);
    display: grid;
    font-size: 13px;
    gap: 7px;
}

.compact-section-title {
    color: var(--text);
    font-size: 15px;
    margin: 4px 0 12px;
}

.document-item {
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    padding: 12px;
}

.document-item > div:first-child {
    min-width: 0;
}

.document-item strong {
    display: block;
    margin-top: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-item small {
    color: var(--muted);
    display: block;
}

.document-actions {
    align-items: center;
    display: flex;
    gap: 8px;
}

.timeline-card {
    grid-column: 1 / -1;
}

.student-profile-grid > section {
    order: 10;
}

.student-profile-grid > section:first-child {
    order: 1;
}

.student-profile-grid > .resume-documents-card {
    order: 2;
}

.timeline-item {
    display: grid;
    gap: 12px;
    grid-template-columns: 18px 1fr;
    padding: 12px 0;
}

.timeline-item > span {
    background: var(--gold);
    border-radius: 50%;
    height: 12px;
    margin-top: 5px;
    width: 12px;
}

.timeline-item small {
    color: var(--muted);
    display: block;
}

.timeline-item p {
    margin: 6px 0 0;
}

.status-secondary {
    background: rgba(107, 114, 128, .12);
    color: var(--muted);
}

.status-amber {
    background: rgba(245, 158, 11, .14);
    color: var(--amber);
}

.status-blue {
    background: rgba(30, 90, 168, .1);
    color: var(--blue);
}

.status-green {
    background: rgba(22, 163, 74, .11);
    color: var(--green);
}

.status-primary {
    background: rgba(30, 90, 168, .1);
    color: var(--blue);
}

.status-success {
    background: rgba(22, 163, 74, .11);
    color: var(--green);
}

.status-danger {
    background: rgba(220, 38, 38, .1);
    color: var(--red);
}

@media (max-width: 980px) {
    .sidebar {
        bottom: 0;
        left: 0;
        position: fixed;
        top: 0;
        transform: translateX(-100%);
        transition: transform .2s ease;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-backdrop {
        background: rgba(17, 24, 39, .45);
        display: block;
        inset: 0;
        position: fixed;
        z-index: 1030;
    }

    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .topbar {
        align-items: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 680px) {
    .app-content,
    .topbar {
        padding: 18px;
    }

    .user-menu {
        align-items: flex-start;
        flex-direction: column;
        width: 100%;
    }

    .page-header {
        display: block;
    }

    .status-pill {
        margin-top: 12px;
    }

    .profile-header,
    .document-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .profile-grid {
        grid-template-columns: 1fr;
    }

    .document-panel-grid {
        grid-template-columns: 1fr;
    }

    .resume-upload-inline {
        grid-template-columns: 1fr;
    }

    .document-actions {
        flex-wrap: wrap;
    }
}

/* Table & Filter UI/UX Repairs */
.app-table-card,
.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 12px 34px rgba(17, 24, 39, .05);
    overflow: hidden;
    margin-bottom: 24px;
}

.app-table-responsive,
.table-responsive {
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.app-table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
}

.app-table th {
    background: #f8fafc;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
    border-bottom: 1px solid var(--border);
    white-space: nowrap !important;
}

.app-table th,
.app-table td {
    padding: 14px 16px;
    vertical-align: middle;
}

.app-table td {
    border-bottom-color: #eef2f7;
    white-space: normal;
}

.app-table td small {
    color: var(--muted);
    display: block;
}

.app-table tbody tr:hover {
    background: #f8fafc;
}

.table-title-link {
    color: var(--blue) !important;
    font-weight: 700;
    text-decoration: none;
}

.table-title-link:hover {
    color: var(--navy) !important;
    text-decoration: underline !important;
}

.text-truncate-sm {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

.text-truncate-cell {
    display: block;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-main {
    color: var(--text);
    display: block;
    font-weight: 700;
    line-height: 1.35;
}

.cell-sub,
.muted-line {
    color: var(--muted);
    display: block;
    font-size: 12px;
    line-height: 1.35;
    margin-top: 2px;
}

.cell-stack {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.compact-actions {
    align-items: center;
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    justify-content: flex-end;
}

.compact-actions .btn {
    align-items: center;
    display: inline-flex;
    gap: 4px;
    min-height: 32px;
    white-space: nowrap;
}

.actions-cell,
.app-table .actions-cell {
    white-space: nowrap !important;
    text-align: right;
    width: 1%;
}

.actions-cell .btn {
    margin-left: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Filter Forms Grid UI */
.filter-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 12px 34px rgba(17, 24, 39, .05);
    margin-bottom: 20px;
    padding: 20px;
}

.filter-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
}

.filter-grid label {
    color: var(--muted);
    display: grid;
    font-size: 12px;
    gap: 6px;
    margin: 0;
}

.filter-card .form-label {
    color: var(--muted) !important;
    font-size: 12px;
    margin-bottom: 6px;
}

.filter-grid .form-control,
.filter-grid .form-select,
.filter-card .row .form-control,
.filter-card .row .form-select {
    height: 42px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 14px;
    padding: 0 12px;
    width: 100%;
}

.filter-grid .d-flex {
    min-width: 0;
}

.filter-grid .form-control:focus,
.filter-grid .form-select:focus,
.filter-card .row .form-control:focus,
.filter-card .row .form-select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(30, 90, 168, 0.15);
    outline: none;
}

.filter-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.table-pagination,
.pagination-wrap {
    align-items: center;
    background: #fff;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: space-between;
    padding: 14px 16px;
}

.pagination-buttons {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

@media (max-width: 1200px) {
    .filter-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

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

@media (max-width: 480px) {
    .filter-grid {
        grid-template-columns: 1fr;
    }
}

/* Tom Select Premium Autocomplete Theme overrides */
.ts-wrapper.form-select,
.ts-wrapper.form-control {
    padding: 0 !important;
    border: none !important;
    height: auto !important;
    background: none !important;
}

.ts-control {
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    min-height: 42px !important;
    background-color: var(--surface) !important;
    color: var(--text) !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
}

.ts-wrapper.focus .ts-control {
    border-color: var(--blue) !important;
    box-shadow: 0 0 0 3px rgba(30, 90, 168, 0.15) !important;
}

.ts-dropdown {
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
    margin-top: 4px !important;
    z-index: 2000 !important;
}

.ts-dropdown .option {
    padding: 10px 12px !important;
    font-size: 14px !important;
}

.ts-dropdown .active {
    background-color: var(--blue) !important;
    color: #ffffff !important;
}

.ts-control .item {
    font-size: 14px !important;
}

.ts-wrapper {
    width: 100%;
}

.ts-wrapper .ts-control input {
    min-width: 2rem;
}

.ts-wrapper.single .ts-control::after {
    border-color: var(--muted) transparent transparent transparent !important;
    right: 15px !important;
}
