/* ═══════════════════════════════════════════════════════════
   Echo.Audit.Plus — Client Portal
   Design: Refined corporate, dark navy + warm amber accent
   Font: DM Sans (body) + DM Serif Display (headings)
═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --navy: #0f4c75;
    --navy-mid: #0d3d5e;
    --navy-light: #1a5a8a;
    --amber: #0891b2;
    --amber-dim: #0670a0;
    --surface: #f5f7fa;
    --surface-2: #eef1f6;
    --border: #dce2ec;
    --text: #1a2535;
    --text-mid: #4a5568;
    --text-soft: #8898aa;
    --white: #ffffff;
    --pass: #2f9e44;
    --fail: #f03e3e;
    --radius: 8px;
    --radius-lg: 14px;
    --shadow: 0 2px 8px rgba(15,27,45,0.08);
    --shadow-lg: 0 8px 32px rgba(15,27,45,0.14);
    --sidebar-w: 220px;
    --header-h: 64px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    cursor: pointer;
    font-family: inherit;
}

input, select {
    font-family: inherit;
}

/* ── Login ── */
.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 480px;
}

.login-left {
    background: var(--navy);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
}

    .login-left::before {
        content: '';
        position: absolute;
        inset: 0;
        background: radial-gradient(ellipse 60% 50% at 20% 50%, rgba(232,160,32,0.08) 0%, transparent 70%), radial-gradient(ellipse 40% 60% at 80% 20%, rgba(41,128,185,0.06) 0%, transparent 60%);
    }

.login-brand {
    position: relative;
    z-index: 1;
}

    .login-brand .wordmark {
        font-family: 'Plus Jakarta Sans', sans-serif;
        font-size: 36px;
        color: var(--white);
        letter-spacing: -0.5px;
    }

        .login-brand .wordmark span {
            color: var(--amber);
        }

    .login-brand .tagline {
        margin-top: 12px;
        font-size: 15px;
        color: rgba(255,255,255,0.45);
        font-weight: 300;
    }

.login-features {
    position: relative;
    z-index: 1;
    margin-top: 60px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-feature {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.login-feature-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(232,160,32,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.login-feature-text strong {
    display: block;
    color: var(--white);
    font-size: 13px;
    font-weight: 500;
}

.login-feature-text span {
    color: rgba(255,255,255,0.4);
    font-size: 12px;
}

.login-right {
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 48px;
}

.login-form-wrapper {
    width: 100%;
    max-width: 360px;
}

    .login-form-wrapper h2 {
        font-family: 'Plus Jakarta Sans', sans-serif;
        font-size: 26px;
        color: var(--navy);
        margin-bottom: 6px;
    }

    .login-form-wrapper p {
        color: var(--text-soft);
        font-size: 13px;
        margin-bottom: 32px;
    }

/* ── Form Controls ── */
.form-group {
    margin-bottom: 18px;
}

    .form-group label {
        display: block;
        font-size: 11px;
        font-weight: 700;
        color: var(--text-mid);
        text-transform: uppercase;
        letter-spacing: 0.7px;
        margin-bottom: 6px;
    }

.form-control {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

    .form-control:focus {
        border-color: var(--amber);
        box-shadow: 0 0 0 3px rgba(232,160,32,0.12);
    }

    .form-control::placeholder {
        color: var(--text-soft);
    }

.btn-primary {
    width: 100%;
    height: 44px;
    background: var(--navy);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: background 0.15s, transform 0.1s;
    margin-top: 8px;
}

    .btn-primary:hover {
        background: var(--navy-mid);
    }

    .btn-primary:active {
        transform: scale(0.99);
    }

    .btn-primary:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

.login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 10px 14px;
    color: #dc2626;
    font-size: 13px;
    margin-top: 14px;
    display: none;
}

    .login-error.show {
        display: block;
    }

/* ── App Shell ── */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--header-h) 1fr;
    min-height: 100vh;
}

/* ── Header ── */
.app-header {
    grid-column: 1 / -1;
    background: var(--navy);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

    .header-logo img {
        height: 36px;
        width: auto;
        background: rgba(255,255,255);
        padding: 0px;
        border-radius: 12px;
    }


.header-logo-badge {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: var(--white);
    background: var(--amber);
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.header-brand {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 20px;
    color: var(--white);
}

    .header-brand span {
        color: var(--amber);
    }

.header-divider {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.1);
}

.header-client-name {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
}

    .header-client-name strong {
        color: var(--white);
        font-weight: 500;
    }

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-user {
    font-size: 12px;
    color: rgba(255,255,255,0.45);
}

.btn-logout {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.18);
    color: rgba(255,255,255,0.65);
    border-radius: 6px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s;
}

    .btn-logout:hover {
        border-color: rgba(255,255,255,0.45);
        color: var(--white);
    }

/* ── Sidebar ── */
.app-sidebar {
    background: var(--white);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
}

.nav-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-soft);
    padding: 0 20px;
    margin: 16px 0 4px;
}

    .nav-label:first-child {
        margin-top: 0;
    }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-mid);
    border-left: 3px solid transparent;
    transition: all 0.12s;
    cursor: pointer;
}

    .nav-item:hover {
        background: var(--surface);
        color: var(--text);
    }

    .nav-item.active {
        background: rgba(232,160,32,0.08);
        color: var(--navy);
        border-left-color: var(--amber);
        font-weight: 600;
    }

.nav-icon {
    font-size: 15px;
    width: 18px;
    text-align: center;
}

/* ── Sidebar project selector ── */
#sidebarProjects {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.sidebar-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-soft);
    padding: 0 20px;
    margin-bottom: 4px;
}

.sidebar-project-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 20px 7px 17px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-mid);
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: all 0.12s;
    gap: 6px;
}

    .sidebar-project-item:hover {
        background: var(--surface);
        color: var(--text);
    }

    .sidebar-project-item.active {
        background: rgba(8,145,178,0.08);
        color: #0891b2;
        border-left-color: #0891b2;
        font-weight: 600;
    }

.proj-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Main ── */
.app-main {
    overflow-y: auto;
    padding: 32px;
    background: var(--surface);
}

.page-header {
    margin-bottom: 28px;
}

    .page-header h1 {
        font-family: 'Plus Jakarta Sans', sans-serif;
        font-size: 26px;
        color: var(--navy);
        line-height: 1.2;
    }

    .page-header p {
        margin-top: 4px;
        color: var(--text-soft);
        font-size: 13px;
    }

/* ── Card ── */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.card-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

    .card-header h2 {
        font-size: 14px;
        font-weight: 600;
        color: var(--navy);
    }

.card-body {
    padding: 22px;
}

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow);
}

.stat-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-soft);
}

.stat-value {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 36px;
    color: var(--navy);
    line-height: 1.1;
    margin-top: 4px;
}

.stat-sub {
    font-size: 12px;
    color: var(--text-soft);
    margin-top: 4px;
}

.stat-card.accent {
    border-top: 3px solid var(--amber);
}

.stat-card.stat-pass {
    border-top: 3px solid var(--pass);
}

.stat-card.stat-fail {
    border-top: 3px solid var(--fail);
}

/* ── Filters ── */
.filters-bar {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    box-shadow: var(--shadow);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.filter-select, .filter-input {
    height: 32px;
    padding: 0 10px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color 0.15s;
}

    .filter-select:focus, .filter-input:focus {
        border-color: var(--amber);
    }

.search-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    pointer-events: none;
}

.search-input {
    height: 32px;
    width: 200px;
    padding: 0 10px 0 30px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color 0.15s;
}

    .search-input:focus {
        border-color: var(--amber);
    }

.btn-reset {
    height: 32px;
    padding: 0 14px;
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-mid);
    transition: all 0.15s;
    margin-left: auto;
}

    .btn-reset:hover {
        border-color: var(--navy);
        color: var(--navy);
    }

/* ── Table ── */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-soft);
    padding: 10px 16px;
    border-bottom: 1.5px solid var(--border);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--surface-2);
    transition: background 0.1s;
}

    tbody tr:hover {
        background: var(--surface);
    }

    tbody tr:last-child {
        border-bottom: none;
    }

tbody td {
    padding: 11px 16px;
    font-size: 13px;
    color: var(--text);
}

.td-name {
    font-weight: 600;
    color: var(--navy);
}

.td-muted {
    color: var(--text-soft);
    font-size: 12px;
}

/* ── CEFR Badge ── */
.cefr-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 24px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--white);
    padding: 0 7px;
}

    .cefr-badge.lg {
        min-width: 64px;
        height: 42px;
        font-size: 20px;
        border-radius: 9px;
    }

.cefr-PreA1 {
    background: #c92a2a;
}

.cefr-A1 {
    background: #f03e3e;
}

.cefr-A2 {
    background: #f76707;
}

.cefr-B1 {
    background: #e67700;
}

.cefr-B2 {
    background: #2f9e44;
}

.cefr-B2P {
    background: #0c8599;
}

.cefr-C1 {
    background: #1971c2;
}

.cefr-C2 {
    background: #7048e8;
}

.cefr-NA {
    background: #bbb;
    color: #555;
}

/* ── Result Pill ── */
.result-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 22px;
    padding: 0 9px;
    border-radius: 11px;
    font-size: 11px;
    font-weight: 600;
}

    .result-pill.pass {
        background: rgba(47,158,68,0.12);
        color: #1e6b30;
    }

    .result-pill.fail {
        background: rgba(240,62,62,0.10);
        color: #c92a2a;
    }

    .result-pill.none {
        background: var(--surface-2);
        color: var(--text-soft);
    }

/* ── Buttons ── */
.btn-view {
    height: 26px;
    padding: 0 10px;
    background: var(--navy);
    color: var(--white);
    border: none;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 500;
    transition: background 0.15s;
    white-space: nowrap;
}

    .btn-view:hover {
        background: var(--navy-mid);
    }

.btn-icon {
    width: 26px;
    height: 26px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.15s;
    margin-left: 3px;
}

    .btn-icon:hover {
        background: var(--navy);
        border-color: var(--navy);
        color: var(--white);
    }

.btn-amber {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 18px;
    background: var(--amber);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s;
}

    .btn-amber:hover {
        background: var(--amber-dim);
    }

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-top: 1px solid var(--border);
}

.pagination-info {
    font-size: 12px;
    color: var(--text-soft);
}

.pagination-controls {
    display: flex;
    gap: 4px;
}

.btn-page {
    width: 28px;
    height: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 12px;
    color: var(--text-mid);
    transition: all 0.12s;
}

    .btn-page:hover, .btn-page.active {
        background: var(--navy);
        border-color: var(--navy);
        color: var(--white);
    }

    .btn-page:disabled {
        opacity: 0.35;
        cursor: not-allowed;
    }

/* ── Candidate Detail ── */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-soft);
    margin-bottom: 18px;
    transition: color 0.12s;
    cursor: pointer;
}

    .back-link:hover {
        color: var(--navy);
    }

.candidate-hero {
    background: #f0f6ff;
    border: 1px solid #c5d8f0;
    border-radius: var(--radius-lg);
    margin-bottom: 22px;
    display: flex;
    align-items: stretch;
    overflow: hidden;
    position: relative;
}

    .candidate-hero::before {
        display: none;
    }

.candidate-hero-main {
    padding: 26px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex: 1;
}

.candidate-hero-info h2 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 22px;
    color: var(--navy);
}

.candidate-hero-info .meta {
    margin-top: 6px;
    display: flex;
    gap: 14px;
    font-size: 12px;
    color: #4a7a9b;
}

.candidate-hero-levels {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 1;
}

.level-block {
    text-align: center;
}

.level-block-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6b8fa8;
    margin-bottom: 5px;
}

.level-vs {
    font-size: 11px;
    color: #a0b8cc;
    font-weight: 300;
}

.candidate-hero-result {
    min-width: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 28px;
}

.hero-result-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 8px;
}

.hero-result-value {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    text-align: center;
    line-height: 1.3;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 20px;
    margin-bottom: 20px;
}

.skill-row {
    display: flex;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--surface-2);
}

    .skill-row:last-child {
        border-bottom: none;
    }

.skill-name {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-soft);
    width: 150px;
    flex-shrink: 0;
    padding-top: 1px;
}

.skill-val {
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
}

    .skill-val.empty {
        color: var(--text-soft);
        font-style: italic;
    }

.interp-section {
    margin-bottom: 14px;
}

    .interp-section:last-child {
        margin-bottom: 0;
    }

.interp-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-soft);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
}

    .interp-title.green {
        color: #1e6b30;
    }

    .interp-title.orange {
        color: #a05c00;
    }

    .interp-title.blue {
        color: #1a5fa8;
    }

.interp-body {
    font-size: 13px;
    color: var(--text);
    line-height: 1.65;
}

/* ── Charts ── */
.charts-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.charts-grid-equal {
    grid-template-columns: 1fr 1fr;
}

.charts-grid-thirds {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.chart-full {
    grid-column: 1 / -1;
}

.chart-box {
    min-height: 260px;
    overflow: visible;
}

/* ── States ── */
.state-empty, .state-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 56px 20px;
    color: var(--text-soft);
    font-size: 13px;
    gap: 10px;
}

.empty-icon {
    font-size: 32px;
}

.spinner {
    width: 26px;
    height: 26px;
    border: 3px solid var(--border);
    border-top-color: #0f4c75;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Toast ── */
.toast-container {
    position: fixed;
    bottom: 22px;
    right: 22px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--navy);
    color: var(--white);
    padding: 11px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.2s ease;
    max-width: 300px;
}

    .toast.error {
        background: #b83232;
    }

    .toast.success {
        background: #1a7a42;
    }

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .login-page {
        grid-template-columns: 1fr;
    }

    .login-left {
        display: none;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}
