* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background: #f1f5f9;
    color: #0f172a;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: #0f172a;
    border-bottom: 3px solid #e11d48;
    padding: 8px 12px;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn.disabled {
    opacity: 0.35;
    pointer-events: none;
}

.btn-blue { background: #2563eb; color: #fff; }
.btn-red { background: #e11d48; color: #fff; }
.btn-export { background: linear-gradient(90deg, #2563eb, #e11d48); color: #fff; margin-left: auto; }
.btn-ghost { background: #1e293b; color: #f8fafc; border: 1px solid #334155; }
.btn-ghost-dark { background: #e2e8f0; color: #0f172a; }

.ee-dropdown {
    position: relative;
}

.ee-dropdown summary {
    list-style: none;
}

.ee-active {
    border-color: #e11d48;
    color: #fda4af;
}

.ee-panel {
    position: absolute;
    top: 44px;
    left: 0;
    width: 250px;
    background: #ffffff;
    border: 2px solid #1e3a8a;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    z-index: 40;
    color: #0f172a;
    font-size: 13px;
}

.ee-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-weight: 600;
}

.ee-panel input[type="number"] {
    width: 55px;
    padding: 5px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

.ee-panel input[type="text"] {
    width: 100%;
    padding: 7px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

.alert {
    background: #ffe4e6;
    color: #be123c;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 14px;
}

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
}

.muted-text {
    font-size: 13px;
    color: #475569;
    line-height: 1.4;
}

.dashboard-wrap {
    max-width: 820px;
    width: 100%;
    margin: 24px auto;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.empty-box, .archive-box {
    background: #ffffff;
    border-radius: 12px;
    padding: 18px;
    border: 1.5px solid #cbd5e1;
    border-top: 4px solid #1e3a8a;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.empty-box h2 {
    color: #1e3a8a;
    margin-bottom: 6px;
}

.archive-box {
    border-top-color: #e11d48;
}

.archive-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.archive-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.archive-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #2563eb;
    border-radius: 8px;
}

.archive-meta {
    font-size: 12px;
    color: #64748b;
}

.archive-btns {
    display: flex;
    align-items: center;
    gap: 6px;
}

.grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 8px;
    padding: 10px;
    height: calc(100vh - 57px);
}

.card {
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-left: 5px solid #1e3a8a;
    border-radius: 10px;
    padding: 8px 10px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    transition: transform 0.05s;
}

.card:active {
    transform: scale(0.98);
}

.card-active {
    background: #eff6ff;
    border-color: #3b82f6;
    border-left-color: #2563eb;
}

.card-max {
    background: #fff1f2;
    border-color: #fb7185;
    border-left-color: #e11d48;
}

.card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.card-num {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
}

.card-name {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.card-note {
    display: inline-block;
    margin-top: 2px;
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    background: #e11d48;
    padding: 1px 6px;
    border-radius: 4px;
    width: fit-content;
}

.card-badge {
    min-width: 54px;
    height: 50px;
    border-radius: 8px;
    background: #f1f5f9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-active .card-badge {
    background: #2563eb;
    color: #ffffff;
}

.card-max .card-badge {
    background: #e11d48;
    color: #ffffff;
}

.card-grade {
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
    color: #1e3a8a;
}

.card-active .card-grade,
.card-max .card-grade {
    color: #ffffff;
}

.card-pts {
    font-size: 10px;
    font-weight: 600;
    opacity: 0.8;
    margin-top: 2px;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    z-index: 50;
}

.hidden {
    display: none !important;
}

.modal-box {
    background: #ffffff;
    border-top: 5px solid #2563eb;
    border-bottom: 5px solid #e11d48;
    border-radius: 12px;
    padding: 18px;
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.col-picker {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
}

.col-picker select,
.file-name-input {
    padding: 9px 10px;
    border-radius: 8px;
    border: 1.5px solid #2563eb;
    font-size: 14px;
    font-weight: 600;
    background: #f8fafc;
    width: 100%;
}

.preview-list {
    overflow-y: auto;
    padding-left: 20px;
    font-size: 14px;
    line-height: 1.6;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding-top: 8px;
    padding-bottom: 8px;
}

.muted {
    color: #64748b;
    list-style: none;
}

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

@media (max-width: 768px) {
    .topbar {
        padding: 6px 8px;
    }

    .topbar-actions {
        gap: 5px;
    }

    .btn {
        height: 32px;
        padding: 0 10px;
        font-size: 12px;
        border-radius: 6px;
    }

    .btn-export {
        margin-left: 0;
    }

    .topbar-actions .btn,
    .topbar-actions form,
    .topbar-actions details {
        flex: 1 1 auto;
    }

    .topbar-actions form .btn,
    .topbar-actions details summary {
        width: 100%;
    }

    .grid {
        display: flex;
        flex-direction: column;
        height: auto;
        gap: 5px;
        padding: 8px;
    }

    .card {
        flex-direction: row;
        align-items: center;
        padding: 6px 10px;
        min-height: 46px;
        border-radius: 8px;
        border-left-width: 4px;
    }

    .card-info {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 6px;
    }

    .card-num {
        font-size: 12px;
        min-width: 18px;
    }

    .card-name {
        font-size: 14px;
    }

    .card-note {
        margin-top: 0;
        font-size: 10px;
        padding: 1px 5px;
    }

    .card-badge {
        flex-direction: row;
        gap: 5px;
        min-width: 66px;
        height: 32px;
        padding: 0 8px;
        border-radius: 6px;
    }

    .card-grade {
        font-size: 16px;
    }

    .card-pts {
        font-size: 11px;
        margin-top: 0;
    }
}
