/* ═══════════════════════════════════════════════════════════
   Echo.Audit.Plus — Internal (/echo/) Design System
   Purple / Indigo palette — distinct from client portal
═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* ── Colour tokens ── */
:root {
    --indigo: #1e1b4b;
    --indigo-mid: #312e81;
    --indigo-light: #4338ca;
    --purple: #7c3aed;
    --purple-light: #a78bfa;
    --amber: #e8a020;
    --amber-light: #fbbf24;
    --navy: var(--indigo);
    --accent: var(--purple);
    --white: #ffffff;
    --surface: #f5f3ff;
    --surface-2: #ede9fe;
    --border: #ddd6fe;
    --text: #1e1b4b;
    --text-mid: #4338ca;
    --text-soft: #6d6aab;
    --green: #16a34a;
    --green-light: #dcfce7;
    --red: #dc2626;
    --red-light: #fee2e2;
    --orange: #d97706;
    --shadow: 0 1px 4px rgba(124,58,237,0.08);
    --radius: 8px;
    --radius-lg: 12px;
    --font: 'Plus Jakarta Sans', system-ui, sans-serif;
}

/* ── Reset ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    background: #f0effe;
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}

/* ── App shell ── */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.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);
    height: 64px;
    min-height: 64px;
}

.header-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

    .header-logo img {
        height: 36px;
        width: auto;
        display: block;
        background: #ffffff;
        padding: 0;
        border-radius: 12px;
    }

.header-badge {
    height: 22px;
    display: inline-flex;
    align-items: center;
    padding: 0 9px;
    border-radius: 4px;
    background: var(--purple);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    opacity: 0.95;
}

.header-label {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    margin-left: 4px;
}

.header-spacer {
    flex: 1;
}

.header-user {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
}

.btn-logout {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-family: var(--font);
}

    .btn-logout:hover {
        background: rgba(255,255,255,0.2);
    }

.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── Sidebar ── */
.app-sidebar {
    width: 220px;
    background: white;
    border-right: 1px solid var(--border);
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.nav-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-soft);
    padding: 0 16px;
    margin: 12px 0 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #4b4b80;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: all 0.12s;
}

    .nav-item:hover {
        background: var(--surface);
        color: var(--indigo);
    }

    .nav-item.active {
        background: rgba(124,58,237,0.08);
        color: var(--purple);
        border-left-color: var(--purple);
        font-weight: 600;
    }

.nav-icon {
    font-size: 14px;
    width: 16px;
    text-align: center;
}

/* ── Main content ── */
.app-main {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.page-header {
    margin-bottom: 20px;
}

    .page-header h1 {
        font-size: 22px;
        font-weight: 700;
        color: var(--indigo);
    }

    .page-header p {
        font-size: 13px;
        color: var(--text-soft);
        margin-top: 2px;
    }

/* ── Cards ── */
.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.card-header {
    padding: 14px 20px;
    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(--indigo);
    }

.card-body {
    padding: 20px;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: var(--font);
    transition: all 0.12s;
}

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

    .btn-primary:hover {
        background: var(--indigo-light);
    }

.btn-indigo {
    background: var(--indigo);
    color: white;
}

    .btn-indigo:hover {
        background: var(--indigo-mid);
    }

.btn-amber {
    background: var(--amber);
    color: white;
}

    .btn-amber:hover {
        background: #c97a10;
    }

.btn-outline {
    background: white;
    color: var(--purple);
    border: 1.5px solid var(--purple);
}

    .btn-outline:hover {
        background: var(--surface);
    }

.btn-danger {
    background: var(--red);
    color: white;
}

    .btn-danger:hover {
        background: #b91c1c;
    }

.btn-ghost {
    background: transparent;
    color: var(--text-soft);
    border: 1px solid var(--border);
}

    .btn-ghost:hover {
        background: var(--surface);
    }

.btn-sm {
    height: 28px;
    padding: 0 10px;
    font-size: 12px;
}

/* ── Forms ── */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font);
    font-size: 13px;
    color: var(--text);
    background: white;
    transition: border-color 0.12s;
}

    .form-control:focus {
        outline: none;
        border-color: var(--purple);
        box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
    }

textarea.form-control {
    height: auto;
    padding: 10px 12px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236d6aab' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

/* ── Tables ── */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-soft);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

td {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text);
    border-bottom: 1px solid #f3f0ff;
}

tr:hover td {
    background: var(--surface);
}

tr:last-child td {
    border-bottom: none;
}

.td-muted {
    color: var(--text-soft);
}

.td-name {
    font-weight: 600;
    color: var(--indigo);
}

/* ── CEFR badges (same as portal) ── */
.cefr-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    min-width: 38px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    color: white;
    padding: 0 6px;
}

    .cefr-badge.lg {
        height: 36px;
        min-width: 56px;
        font-size: 17px;
        border-radius: 7px;
    }

.cefr-PreA1 {
    background: #c92a2a;
}

.cefr-A1 {
    background: #f03e3e;
}

.cefr-A2 {
    background: #f76707;
}

.cefr-B1 {
    background: #e67700;
}

.cefr-B2 {
    background: #2f9e44;
}

.cefr-C1 {
    background: #1971c2;
}

.cefr-C2 {
    background: #7048e8;
}

.cefr-NA {
    background: #adb5bd;
}

/* ── Status badges ── */
.status-badge {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 10px;
    border-radius: 11px;
    font-size: 11px;
    font-weight: 600;
}

.status-pending {
    background: #ede9fe;
    color: #5b21b6;
}

.status-assigned {
    background: #fef3c7;
    color: #92400e;
}

.status-submitted {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-closed {
    background: #d1fae5;
    color: #065f46;
}

/* ── Result pills ── */
.result-pill {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 10px;
    border-radius: 11px;
    font-size: 11px;
    font-weight: 600;
}

    .result-pill.pass {
        background: #d1fae5;
        color: #065f46;
    }

    .result-pill.fail {
        background: #fee2e2;
        color: #991b1b;
    }

/* ── Release badge ── */
.released-badge {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
}

.released-yes {
    background: #d1fae5;
    color: #065f46;
}

.released-no {
    background: #f3f0ff;
    color: #6d28d9;
}

/* ── Filters bar ── */
.filters-bar {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 20px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-soft);
}

.filter-select, .filter-input {
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-family: var(--font);
    font-size: 12px;
    color: var(--text);
    background: white;
}

    .filter-select:focus, .filter-input:focus {
        outline: none;
        border-color: var(--purple);
    }

.btn-reset {
    height: 32px;
    padding: 0 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--purple);
    cursor: pointer;
    font-family: var(--font);
}

    .btn-reset:hover {
        background: var(--surface);
    }

/* ── Login page ── */
.login-shell {
    min-height: 100vh;
    display: flex;
}

.login-brand {
    width: 380px;
    background: var(--indigo);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    flex-shrink: 0;
}

.login-brand-logo {
    background: rgba(255,255,255,0.9);
    padding: 6px 14px;
    border-radius: 6px;
    margin-bottom: 24px;
}

    .login-brand-logo img {
        height: 36px;
    }

.login-brand h1 {
    color: white;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

.login-brand p {
    color: rgba(255,255,255,0.55);
    font-size: 13px;
    text-align: center;
    line-height: 1.5;
}

.login-brand-badge {
    background: var(--purple);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    margin-top: 16px;
}

.login-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: #f0effe;
}

.login-box {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px;
    width: 360px;
    box-shadow: 0 4px 24px rgba(124,58,237,0.1);
}

    .login-box h2 {
        font-size: 18px;
        font-weight: 700;
        color: var(--indigo);
        margin-bottom: 6px;
    }

    .login-box p {
        font-size: 13px;
        color: var(--text-soft);
        margin-bottom: 24px;
    }

/* ── Toast ── */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: white;
    min-width: 220px;
    animation: slideIn 0.2s ease;
}

.toast-success {
    background: #16a34a;
}

.toast-error {
    background: #dc2626;
}

.toast-info {
    background: var(--purple);
}

@keyframes slideIn {
    from {
        transform: translateX(40px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ── Modal ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(30,27,75,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

    .modal-overlay.open {
        display: flex;
    }

.modal {
    background: white;
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 520px;
    max-width: 90vw;
    box-shadow: 0 8px 40px rgba(124,58,237,0.2);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

    .modal-header h2 {
        font-size: 16px;
        font-weight: 700;
        color: var(--indigo);
    }

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-soft);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

/* ── Grid helpers ── */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.grid-4 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 16px;
}

/* ── Spinner ── */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--purple);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}

.pagination-info {
    font-size: 12px;
    color: var(--text-soft);
}

.pagination-controls {
    display: flex;
    gap: 4px;
}

.btn-page {
    height: 28px;
    min-width: 28px;
    padding: 0 8px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
    color: var(--text-soft);
}

    .btn-page:hover:not(:disabled) {
        background: var(--surface);
        color: var(--purple);
        border-color: var(--purple);
    }

    .btn-page.active {
        background: var(--purple);
        color: white;
        border-color: var(--purple);
    }

    .btn-page:disabled {
        opacity: 0.4;
        cursor: default;
    }
