* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
}

/* Server Link Setup */
#link-input-container {
    background: #16213e;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    text-align: center;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 400px;
    z-index: 100;
}

#link-input-container h3 {
    margin-bottom: 16px;
    color: #00ffff;
}

#link-input-container input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #533483;
    background: #1a1a2e;
    color: #eee;
    font-size: 14px;
    margin-bottom: 12px;
    outline: none;
    transition: border 0.2s;
}

#link-input-container input:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 8px rgba(124, 58, 237, 0.3);
}

#link-input-container button {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #7c3aed, #2563eb);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

#link-input-container button:hover {
    background: linear-gradient(135deg, #6d28d9, #1d4ed8);
    box-shadow: 0 0 16px rgba(124, 58, 237, 0.4);
}

/* Main Container */
#main-container {
    width: 100%;
    max-width: 900px;
    animation: fadeIn 0.3s ease;
}

/* Top Bar */
#top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #0f3460, #1a1040);
    padding: 14px 20px;
    border-radius: 14px;
    margin-bottom: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(124, 58, 237, 0.15);
}

#top-bar h3 {
    color: #00ffff;
    font-size: 18px;
    text-shadow: 0 0 12px rgba(0, 255, 255, 0.3);
}

#top-bar-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Selects */
#report-type, #sort-order {
    padding: 8px 12px;
    background: #1a1a2e;
    color: #eee;
    border: 1px solid #533483;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
}

#report-type:focus, #sort-order:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 8px rgba(124, 58, 237, 0.3);
}

#report-type option, #sort-order option {
    background: #1a1a2e;
    color: #eee;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #533483;
    color: #eee;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: #7c3aed;
    transform: scale(1.05);
    box-shadow: 0 0 8px rgba(124, 58, 237, 0.3);
}

/* Summary Bar */
#summary-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.summary-item {
    flex: 1;
    background: #16213e;
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(124, 58, 237, 0.15);
}

.summary-label {
    color: #888;
    font-size: 14px;
}

.summary-value {
    color: #00ffff;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
}

/* Report Groups */
.report-group {
    background: #16213e;
    border-radius: 14px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(124, 58, 237, 0.15);
    animation: fadeIn 0.3s ease;
}

.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: linear-gradient(135deg, #0f3460, #1a1040);
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.group-header:hover {
    background: linear-gradient(135deg, #133a6b, #1e1250);
}

.group-label {
    color: #00ffff;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 0 0 12px rgba(0, 255, 255, 0.3);
}

.group-stats {
    display: flex;
    gap: 16px;
    align-items: center;
}

.group-total {
    color: #00ffff;
    font-weight: bold;
    font-size: 16px;
}

.group-count {
    color: #888;
    font-size: 13px;
}

.group-toggle {
    color: #7c3aed;
    font-size: 14px;
    transition: transform 0.3s;
}

.group-toggle.expanded {
    transform: rotate(180deg);
}

/* Group Table */
.group-table-wrapper {
    border-top: 1px solid rgba(124, 58, 237, 0.1);
}

.group-table {
    width: 100%;
    border-collapse: collapse;
}

.group-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(15, 52, 96, 0.4);
}

.group-table td {
    padding: 10px 16px;
    font-size: 14px;
    border-bottom: 1px solid rgba(124, 58, 237, 0.08);
    transition: background 0.2s;
}

.group-table tbody tr:hover {
    background: rgba(124, 58, 237, 0.08);
}

.group-table tbody tr:last-child td {
    border-bottom: none;
}

.id-cell {
    color: #7c3aed;
    font-weight: bold;
}

.amount-cell {
    color: #00ffff;
    font-weight: bold;
}

.category-cell {
    background: rgba(124, 58, 237, 0.2);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    display: inline-block;
    color: #a78bfa;
}

.date-cell {
    color: #888;
}

/* Empty Message */
#empty-msg {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

#empty-msg strong {
    color: #00ffff;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #7c3aed, #533483);
    border-radius: 3px;
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    #top-bar {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    #top-bar-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    #summary-bar {
        flex-direction: column;
    }

    .summary-item {
        padding: 12px 14px;
    }

    .summary-value {
        font-size: 16px;
    }

    .group-header {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        padding: 12px 16px;
    }

    .group-label {
        font-size: 14px;
    }

    .group-stats {
        gap: 10px;
    }

    .group-total {
        font-size: 14px;
    }

    /* Group Table → Card Layout */
    .group-table thead {
        display: none;
    }

    .group-table tbody tr {
        display: block;
        padding: 12px 14px;
        border-bottom: 1px solid rgba(124, 58, 237, 0.1);
    }

    .group-table tbody tr:last-child {
        border-bottom: none;
    }

    .group-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 4px 0;
        border-bottom: 1px solid rgba(124, 58, 237, 0.04);
        font-size: 13px;
    }

    .group-table td:last-child {
        border-bottom: none;
    }

    .group-table td::before {
        content: attr(data-label);
        font-size: 11px;
        color: #888;
        font-weight: 600;
        text-transform: uppercase;
    }
}
