:root {
    --bg: #f3f8f4;
    --card: #ffffff;
    --text: #123524;
    --muted: #5f7569;

    --primary: #0f7a3a;
    --primary-dark: #064e3b;
    --primary-soft: #eaf7ef;

    --border: #d6e6dc;

    --success: #15803d;
    --danger: #dc2626;
    --warning: #f2b705;
    --warning-dark: #b7791f;

    --dark: #123524;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(135deg, #f7fbf7, #eaf7ef);
    color: var(--text);
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 32px auto;
}

/* =========================
   HERO
========================= */

.hero {
    padding: 28px;
    border-radius: 24px;
    color: #ffffff;
    background: linear-gradient(135deg, #064e3b, #0f7a3a, #f2b705);
    box-shadow: 0 20px 45px rgba(15, 122, 58, .25);
}

.hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.hero h1 {
    margin: 8px 0 10px;
    font-size: clamp(28px, 4vw, 46px);
    line-height: 1.1;
}

.hero p {
    max-width: 820px;
    line-height: 1.7;
    margin: 0;
}

.badge {
    display: inline-block;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(242, 183, 5, .22);
    border: 1px solid rgba(242, 183, 5, .45);
    color: #fffbe6;
    font-weight: 700;
    font-size: 13px;
}

.clock-box {
    min-width: 210px;
    padding: 10px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(242, 183, 5, .45);
    text-align: right;
}

.clock-box span {
    display: block;
    font-size: 12px;
    font-weight: 700;
    opacity: .9;
}

.clock-box strong {
    display: block;
    margin-top: 4px;
    font-size: 14px;
}

/* =========================
   CARD
========================= */

.card,
.summary-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 14px 32px rgba(6, 78, 59, .08);
}

.card:not(.upload-card) {
    padding: 20px;
}

.upload-card {
    margin: 22px 0;
    padding: 20px;
}

.sheet-summary {
    margin-bottom: 22px;
}

.result-card {
    margin-bottom: 22px;
}

/* =========================
   UPLOAD
========================= */

.dropzone {
    min-height: 150px;
    border: 2px dashed #7cc99a;
    background: #eaf7ef;
    border-radius: 18px;
    display: grid;
    place-items: center;
    text-align: center;
    cursor: pointer;
    padding: 22px;
    transition: .2s ease;
}

.dropzone.dragover,
.dropzone:hover {
    border-color: var(--primary);
    background: #d9f2e2;
}

.dropzone input {
    display: none;
}

.dropzone .icon {
    display: block;
    font-size: 42px;
    margin-bottom: 8px;
}

.dropzone strong {
    display: block;
}

.dropzone small {
    display: block;
    color: var(--muted);
    margin-top: 4px;
}

.actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    flex-wrap: wrap;
}

.file-name {
    color: var(--muted);
    font-weight: 600;
    word-break: break-word;
}

.upload-status {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #f7fbf7;
    color: var(--muted);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 700;
}

.upload-status.status-success {
    color: #166534;
    background: #dcfce7;
    border-color: #bbf7d0;
}

.upload-status.status-warning {
    color: #92400e;
    background: #fef3c7;
    border-color: #fde68a;
}

.upload-status.status-error {
    color: #991b1b;
    background: #fee2e2;
    border-color: #fecaca;
}

/* =========================
   BUTTON
========================= */

button {
    border: 0;
    border-radius: 12px;
    padding: 12px 18px;
    color: #ffffff;
    background: var(--primary);
    font-weight: 700;
    cursor: pointer;
    transition: .2s ease;
}

button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

button:disabled {
    opacity: .7;
    cursor: not-allowed;
    transform: none;
}

button.secondary {
    background: var(--warning);
    color: #123524;
}

button.secondary:hover {
    background: #d99f00;
}

button.ghost {
    color: #123524;
    background: #d9f2e2;
}

button.ghost:hover {
    background: #bfe8cc;
}

/* =========================
   ALERT
========================= */

.alert {
    padding: 14px 16px;
    border-radius: 14px;
    margin: 18px 0;
    font-weight: 700;
}

.alert.error {
    color: #991b1b;
    background: #fee2e2;
    border: 1px solid #fecaca;
}

.alert.success {
    color: #166534;
    background: #dcfce7;
    border: 1px solid #bbf7d0;
}

.alert.warning {
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fde68a;
}

/* =========================
   SUMMARY
========================= */

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin: 22px 0;
}

.summary-card {
    padding: 18px;
    border-top: 4px solid var(--primary);
}

.summary-card span {
    color: var(--muted);
    font-weight: 700;
    font-size: 13px;
}

.summary-card strong {
    display: block;
    margin-top: 8px;
    font-size: 24px;
    color: var(--primary-dark);
    word-break: break-word;
}

/* =========================
   TABLE
========================= */

.table-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    align-items: end;
    margin-bottom: 16px;
}

.table-header h2 {
    margin: 0;
    color: var(--primary-dark);
}

.table-header p {
    margin: 6px 0 0;
    color: var(--muted);
}

.table-tools {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

input[type="search"] {
    min-width: 260px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    outline: none;
}

input[type="search"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(15, 122, 58, .14);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

th,
td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #eaf7ef;
    color: #064e3b;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

tbody tr:hover {
    background: #f2fbf5;
}

.name {
    font-weight: 800;
}

.rank {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #ffffff;
    background: #64748b;
    font-weight: 900;
}

.rank-1 {
    background: var(--warning);
    color: #123524;
}

.rank-2 {
    background: var(--primary);
    color: #ffffff;
}

.rank-3 {
    background: var(--primary-dark);
    color: #ffffff;
}

.details {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 180px;
}

.details span {
    padding: 5px 8px;
    border-radius: 999px;
    background: #eaf7ef;
    color: #064e3b;
    border: 1px solid #bfe8cc;
    font-size: 12px;
    font-weight: 700;
}

.filtered-match td {
    background: #fff8d6;
}

.empty-state {
    margin-top: 14px;
    padding: 16px;
    text-align: center;
    color: var(--muted);
    background: #f7fbf7;
    border: 1px dashed var(--border);
    border-radius: 14px;
    font-weight: 700;
}

/* =========================
   FOOTER
========================= */

.footer {
    width: min(1180px, calc(100% - 32px));
    margin: -10px auto 28px;
    padding: 18px;
    text-align: center;
    color: var(--muted);
}

.footer p {
    margin: 0 0 6px;
    font-weight: 800;
    color: var(--primary-dark);
}

.footer small {
    display: block;
}

/* =========================
   PRINT ELEMENT DEFAULT
========================= */

.print-report-header,
.print-signature {
    display: none;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 920px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 760px) {
    .container {
        width: min(100% - 24px, 1180px);
        margin: 20px auto;
    }

    .hero {
        padding: 22px;
        border-radius: 20px;
    }

    .clock-box {
        width: 100%;
        text-align: left;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .actions,
    .table-header {
        align-items: stretch;
    }

    .table-tools {
        width: 100%;
    }

    button,
    input[type="search"] {
        width: 100%;
        min-width: 0;
    }

    .card:not(.upload-card),
    .upload-card {
        padding: 16px;
        border-radius: 16px;
    }
}

/* =========================
   PRINT REPORT STYLE
========================= */

@media print {
    @page {
        size: A4 landscape;
        margin: 12mm;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    html,
    body {
        width: 100%;
        margin: 0;
        padding: 0;
        background: #ffffff !important;
        color: #111827 !important;
        font-family: Arial, Helvetica, sans-serif;
        font-size: 11px;
    }

    .hero,
    .upload-card,
    .summary-grid,
    .table-tools,
    .footer,
    .clock-box,
    .upload-status,
    .empty-state,
    .sheet-summary {
        display: none !important;
    }

    .container {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .card {
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        background: transparent !important;
    }

    .result-card {
        margin: 0 !important;
    }

    .print-report-header {
        display: block !important;
        margin-bottom: 14px;
        padding-bottom: 10px;
        border-bottom: 3px double #064e3b;
    }

    .print-kop {
        text-align: center;
        margin-bottom: 12px;
    }

    .print-kop h1 {
        margin: 0;
        font-size: 19px;
        font-weight: 900;
        letter-spacing: .5px;
        text-transform: uppercase;
        color: #064e3b !important;
    }

    .print-kop p {
        margin: 5px 0 0;
        font-size: 12px;
        color: #374151 !important;
    }

    .print-info-grid {
        display: grid;
        grid-template-columns: 2fr 1fr 1fr 1fr;
        gap: 8px;
        margin-top: 10px;
    }

    .print-info-grid div {
        border: 1px solid #0f7a3a;
        padding: 7px 8px;
        border-radius: 6px;
        background: #eaf7ef !important;
    }

    .print-info-grid span {
        display: block;
        font-size: 9px;
        text-transform: uppercase;
        color: #064e3b !important;
        font-weight: 700;
        margin-bottom: 3px;
    }

    .print-info-grid strong {
        display: block;
        font-size: 11px;
        color: #111827 !important;
        word-break: break-word;
    }

    .table-header {
        display: block !important;
        margin: 0 0 10px !important;
    }

    .table-header h2 {
        margin: 0;
        font-size: 15px;
        text-align: center;
        text-transform: uppercase;
        color: #064e3b !important;
    }

    .table-header p {
        margin: 4px 0 0;
        text-align: center;
        font-size: 10px;
        color: #374151 !important;
    }

    .table-wrap {
        overflow: visible !important;
    }

    table {
        width: 100% !important;
        min-width: 0 !important;
        border-collapse: collapse !important;
        table-layout: fixed;
        page-break-inside: auto;
    }

    thead {
        display: table-header-group;
    }

    tfoot {
        display: table-footer-group;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    th,
    td {
        border: 1px solid #064e3b !important;
        padding: 5px 6px !important;
        font-size: 9.2px !important;
        line-height: 1.3;
        color: #111827 !important;
        vertical-align: middle;
        background: #ffffff !important;
    }

    th {
        position: static !important;
        background: #0f7a3a !important;
        color: #ffffff !important;
        text-align: center;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: 0;
    }

    td {
        text-align: center;
    }

    td.name {
        text-align: left;
        font-weight: 800;
    }

    #rankingTable th:nth-child(1),
    #rankingTable td:nth-child(1) {
        width: 8%;
    }

    #rankingTable th:nth-child(2),
    #rankingTable td:nth-child(2) {
        width: 26%;
    }

    #rankingTable th:nth-child(3),
    #rankingTable td:nth-child(3) {
        width: 13%;
    }

    #rankingTable th:nth-child(4),
    #rankingTable td:nth-child(4) {
        width: 15%;
    }

    #rankingTable th:nth-child(5),
    #rankingTable td:nth-child(5) {
        width: 6%;
    }

    #rankingTable th:nth-child(6),
    #rankingTable td:nth-child(6) {
        width: 12%;
    }

    #rankingTable th:nth-child(7),
    #rankingTable td:nth-child(7) {
        width: 10%;
    }

    #rankingTable th:nth-child(8),
    #rankingTable td:nth-child(8) {
        width: 10%;
    }

    #rankingTable th:nth-child(9),
    #rankingTable td:nth-child(9) {
        display: none !important;
    }

    .rank {
        width: 24px !important;
        height: 24px !important;
        border-radius: 50%;
        font-size: 10px !important;
        color: #ffffff !important;
        background: #64748b !important;
        display: inline-grid;
        place-items: center;
        font-weight: 900;
    }

    .rank-1 {
        background: #f2b705 !important;
        color: #123524 !important;
    }

    .rank-2 {
        background: #0f7a3a !important;
        color: #ffffff !important;
    }

    .rank-3 {
        background: #064e3b !important;
        color: #ffffff !important;
    }

    .details {
        display: block !important;
        min-width: 0 !important;
    }

    .details span {
        display: block !important;
        margin: 1px 0;
        padding: 2px;
        border-radius: 2px;
        background: transparent !important;
        color: #111827 !important;
        border: none !important;
        font-size: 7.2px !important;
        font-weight: 700;
        line-height: 1.15;
    }

    .filtered-match td {
        background: #ffffff !important;
    }

    .print-signature {
        display: grid !important;
        grid-template-columns: 1fr 260px;
        margin-top: 26px;
        page-break-inside: avoid;
    }

    .signature-box {
        text-align: center;
        font-size: 11px;
        color: #111827 !important;
    }

    .signature-box p {
        margin: 0 0 4px;
    }

    .signature-box strong {
        display: block;
        margin-top: 4px;
        font-size: 11px;
    }

    .signature-box span {
        display: block;
        margin-top: 4px;
        font-size: 10px;
    }
}