:root {
    --ink: #0f1117;
    --paper: #f5f2eb;
    --cream: #fffdf7;
    --accent: #c8472b;
    --accent2: #1a5c96;
    --gold: #d4a843;
    --muted: #8a8478;
    --border: #d8d2c4;
    --success: #2a7a4b;
    --card-bg: #ffffff;
    --shadow: 0 2px 20px rgba(15, 17, 23, 0.08);
    --shadow-lg: 0 8px 48px rgba(15, 17, 23, 0.14);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--paper);
    color: var(--ink);
    min-height: 100vh;
}

header {
    background: var(--ink);
    color: #fff;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 3px solid var(--accent);
}

.logo {
    font-family: 'DM Serif Display', serif;
    font-size: 1.25rem;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-badge {
    background: var(--accent);
    color: #fff;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    padding: 2px 8px;
    border-radius: 2px;
    text-transform: uppercase;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.75);
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.2s;
    letter-spacing: 0.05em;
}

.admin-btn:hover {
    border-color: rgba(255, 255, 255, 0.7);
    color: #fff;
}

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

.hero {
    text-align: center;
    margin-bottom: 48px;
}

.hero-eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 12px;
}

.hero h1 {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(2rem, 5vw, 3.2rem);
    line-height: 1.15;
    color: var(--ink);
    margin-bottom: 16px;
}

.hero p {
    color: var(--muted);
    font-size: 1rem;
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.7;
}

.year-tag {
    display: inline-block;
    background: var(--gold);
    color: var(--ink);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    padding: 3px 10px;
    border-radius: 2px;
    margin-bottom: 20px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
    box-shadow: var(--shadow);
    margin-bottom: 28px;
}

.section-title {
    font-family: 'DM Serif Display', serif;
    font-size: 1.3rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media(max-width:600px) {
    .fields-grid {
        grid-template-columns: 1fr;
    }
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-group label {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.field-group label span {
    color: var(--accent);
    margin-left: 2px;
}

.field-group input,
.field-group textarea {
    border: 1.5px solid var(--border);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.95rem;
    font-family: 'DM Sans', sans-serif;
    background: var(--cream);
    color: var(--ink);
    transition: border-color 0.2s;
    outline: none;
}

.field-group input:focus,
.field-group textarea:focus {
    border-color: var(--accent2);
    background: #fff;
}

.field-group input.error,
.field-group textarea.error {
    border-color: var(--accent);
}

.field-group textarea {
    resize: vertical;
    min-height: 70px;
    line-height: 1.5;
}

.track-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media(max-width:550px) {
    .track-grid {
        grid-template-columns: 1fr;
    }
}

.track-card {
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--cream);
    position: relative;
    overflow: hidden;
}

.track-card:hover {
    border-color: var(--accent2);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.track-card.selected {
    border-color: var(--accent2);
    background: #edf4fc;
}

.track-card.selected::before {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 12px;
    color: var(--accent2);
    font-weight: 700;
    font-size: 1rem;
}

.track-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.track-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--ink);
    margin-bottom: 6px;
}

.track-desc {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.5;
}

.level-select {
    border: 1.5px solid var(--border);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.95rem;
    font-family: 'DM Sans', sans-serif;
    background: var(--cream);
    color: var(--ink);
    cursor: pointer;
    outline: none;
    width: 100%;
    transition: border-color 0.2s;
}

.level-select:focus {
    border-color: var(--accent2);
}

#ratings-section {
    display: none;
}

.competency-row {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 16px;
    background: var(--cream);
    transition: box-shadow 0.2s;
}

.competency-row:hover {
    box-shadow: var(--shadow);
}

.comp-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--ink);
    margin-bottom: 4px;
}

.comp-level-desc {
    font-size: 0.78rem;
    color: var(--accent2);
    font-style: italic;
    line-height: 1.4;
    background: rgba(26, 92, 150, 0.07);
    padding: 6px 10px;
    border-radius: 4px;
    border-left: 3px solid var(--accent2);
    margin-bottom: 12px;
}

.stars-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.stars {
    display: flex;
    gap: 4px;
}

.star {
    font-size: 1.6rem;
    cursor: pointer;
    color: #d8d2c4;
    transition: color 0.15s, transform 0.1s;
    user-select: none;
    line-height: 1;
}

.star:hover,
.star.active {
    color: var(--gold);
    transform: scale(1.12);
}

.star-label {
    font-size: 0.75rem;
    color: var(--muted);
    margin-left: 8px;
}

.justification-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
    display: block;
}

.justification-input {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-family: 'DM Sans', sans-serif;
    background: var(--cream);
    color: var(--ink);
    resize: vertical;
    min-height: 60px;
    transition: border-color 0.2s;
    outline: none;
    line-height: 1.5;
}

.justification-input:focus {
    border-color: var(--accent2);
    background: #fff;
}

.submit-area {
    text-align: center;
    margin-top: 36px;
}

.btn-submit {
    background: var(--ink);
    color: #fff;
    border: none;
    padding: 14px 48px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: background 0.2s, transform 0.1s;
}

.btn-submit:hover {
    background: var(--accent2);
    transform: translateY(-1px);
}

.submit-note {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 12px;
}

#success-screen {
    display: none;
    text-align: center;
    padding: 60px 24px;
}

.success-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.success-title {
    font-family: 'DM Serif Display', serif;
    font-size: 2rem;
    margin-bottom: 12px;
    color: var(--success);
}

.success-sub {
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.7;
}

.btn-new {
    display: inline-block;
    margin-top: 28px;
    background: var(--cream);
    border: 1.5px solid var(--border);
    padding: 10px 28px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: border-color 0.2s;
}

.btn-new:hover {
    border-color: var(--ink);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 17, 23, 0.55);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-backdrop.open {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: 14px;
    padding: 36px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--muted);
    line-height: 1;
}

.modal h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.modal p {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 20px;
}

.modal .field-group {
    margin-bottom: 14px;
}

.btn-login {
    width: 100%;
    background: var(--ink);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s;
}

.btn-login:hover {
    background: var(--accent2);
}

.login-error {
    color: var(--accent);
    font-size: 0.8rem;
    margin-top: 8px;
    display: none;
}

#admin-dash {
    display: none;
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-topbar h1 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.9rem;
}

.admin-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-logout {
    background: none;
    border: 1.5px solid var(--border);
    padding: 8px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.2s;
}

.btn-logout:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-download {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--success);
    color: #fff;
    border: none;
    padding: 9px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    letter-spacing: 0.03em;
    transition: background 0.2s, transform 0.1s;
}

.btn-download:hover {
    background: #1e5e39;
    transform: translateY(-1px);
}

.btn-delete-all {
    display: flex;
    align-items: center;
    gap: 7px;
    background: none;
    color: var(--accent);
    border: 1.5px solid var(--accent);
    padding: 8px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.2s;
}

.btn-delete-all:hover {
    background: var(--accent);
    color: #fff;
}

.btn-reset-admin {
    display: flex;
    align-items: center;
    gap: 7px;
    background: none;
    color: var(--accent2);
    border: 1.5px solid var(--accent2);
    padding: 8px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.2s;
}

.btn-reset-admin:hover {
    background: var(--accent2);
    color: #fff;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-num {
    font-family: 'DM Serif Display', serif;
    font-size: 2.2rem;
    color: var(--accent2);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 7px 18px;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    background: var(--cream);
    cursor: pointer;
    font-size: 0.82rem;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}

.tab-btn:hover:not(.active) {
    border-color: var(--ink);
}

.table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-bottom: 32px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}

thead {
    background: var(--ink);
    color: #fff;
}

thead th {
    padding: 12px 14px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--cream);
}

tbody td {
    padding: 12px 14px;
    font-size: 0.85rem;
}

.track-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.track-badge.pm {
    background: rgba(26, 92, 150, 0.1);
    color: var(--accent2);
}

.track-badge.fc {
    background: rgba(200, 71, 43, 0.1);
    color: var(--accent);
}

.avg-score {
    font-weight: 700;
    font-size: 1rem;
    color: var(--ink);
}

.view-detail-btn {
    background: none;
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.2s;
}

.view-detail-btn:hover {
    border-color: var(--accent2);
    color: var(--accent2);
}

.analytics-title {
    font-family: 'DM Serif Display', serif;
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--ink);
}

.comp-analytics-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.comp-bar-row {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
}

.comp-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.comp-bar-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.comp-bar-avg {
    font-size: 0.85rem;
    color: var(--muted);
}

.bar-track {
    background: var(--border);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--accent2), var(--gold));
    transition: width 0.6s ease;
}

.no-data {
    text-align: center;
    padding: 48px;
    color: var(--muted);
    font-style: italic;
}

.detail-modal {
    background: #fff;
    border-radius: 14px;
    padding: 36px;
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.detail-modal h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.detail-meta {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 24px;
}

.detail-comp-row {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.detail-comp-row:last-child {
    border-bottom: none;
}

.detail-comp-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.detail-comp-name {
    font-size: 0.88rem;
    font-weight: 600;
    flex: 1;
}

.detail-stars {
    color: var(--gold);
    font-size: 0.95rem;
    margin-right: 8px;
}

.detail-score {
    font-weight: 700;
    color: var(--accent2);
    min-width: 30px;
    text-align: right;
}

.detail-justification {
    font-size: 0.8rem;
    color: var(--muted);
    font-style: italic;
    line-height: 1.5;
    background: var(--cream);
    padding: 6px 10px;
    border-radius: 4px;
    margin-top: 4px;
}

.confirm-modal {
    background: #fff;
    border-radius: 14px;
    padding: 36px 32px 28px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    position: relative;
    text-align: center;
}

.confirm-modal .ci {
    font-size: 3rem;
    margin-bottom: 14px;
}

.confirm-modal h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.confirm-modal p {
    font-size: 0.88rem;
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 28px;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-confirm-cancel {
    padding: 10px 24px;
    border-radius: 6px;
    border: 1.5px solid var(--border);
    background: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: 'DM Sans', sans-serif;
    transition: border-color 0.2s;
}

.btn-confirm-cancel:hover {
    border-color: var(--ink);
}

.btn-confirm-delete {
    padding: 10px 24px;
    border-radius: 6px;
    border: none;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    transition: background 0.2s;
}

.btn-confirm-delete:hover {
    background: #a83522;
}

.reset-modal {
    background: #fff;
    border-radius: 14px;
    padding: 36px;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.reset-modal h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.reset-modal .note {
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 20px;
    padding: 10px 14px;
    background: rgba(26, 92, 150, 0.07);
    border-radius: 6px;
    border-left: 3px solid var(--accent2);
}

.btn-send-reset {
    width: 100%;
    background: var(--accent2);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s;
}

.btn-send-reset:hover {
    background: #134877;
}

.reset-success {
    display: none;
    text-align: center;
    padding: 16px 0;
}

.reset-success .rs-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.reset-success p {
    font-size: 0.9rem;
    color: var(--success);
    font-weight: 500;
}

#set-credentials-screen {
    display: none;
    max-width: 480px;
    margin: 60px auto;
    padding: 24px;
}

.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--ink);
    color: #fff;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: transform 0.3s;
    z-index: 500;
    white-space: nowrap;
    max-width: 90vw;
    text-overflow: ellipsis;
    overflow: hidden;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.progress-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-bottom: 24px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent2), var(--gold));
    border-radius: 2px;
    transition: width 0.4s;
}

.progress-label {
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 6px;
}

.rating-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.67rem;
    color: var(--muted);
    margin-top: 4px;
    padding: 0 2px;
}
