* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #faf9f5;
    color: #1a1a1a;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: #faf9f5;
    border-radius: 16px;
    padding: 40px 60px;
}

.header {
    margin-bottom: 32px;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: #000;
}

.subtitle {
    color: #64748b;
    margin-bottom: 0;
    font-size: 0.95rem;
}

.warning-banner {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 24px;
    display: flex;
    align-items: start;
    gap: 12px;
}

.warning-banner svg {
    color: #f59e0b;
    flex-shrink: 0;
    margin-top: 2px;
}

.warning-text {
    font-size: 0.875rem;
    color: #92400e;
}

.input-section {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #334155;
    font-size: 0.95rem;
}

.required {
    color: #dc2626;
    margin-left: 4px;
}

input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    background: white;
}

input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

input[aria-invalid="true"] {
    border-color: #dc2626;
}

.error-message {
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 4px;
    display: none;
}

.error-message.visible {
    display: block;
}

.button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

button {
    padding: 11px 23px;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button svg {
    flex-shrink: 0;
}

button:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #fff;
    color: #000;
    border: 2px solid #000;
}

.btn-primary:hover:not(:disabled) {
    background: #f5f5f5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background: #fff;
    color: #000;
    border: 2px solid #000;
}

.btn-secondary:hover:not(:disabled) {
    background: #f5f5f5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-danger {
    background: #fff;
    color: #000;
    border: 2px solid #000;
}

.btn-danger:hover:not(:disabled) {
    background: #f5f5f5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-warning {
    background: #fff;
    color: #000;
    border: 2px solid #000;
}

.btn-warning:hover:not(:disabled) {
    background: #f5f5f5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#cancelEditBtn {
    display: none;
}

#cancelEditBtn[style*="display: inline-flex"],
#cancelEditBtn[style*="display: flex"] {
    display: inline-flex !important;
}

.data-table-container {
    margin-bottom: 32px;
    overflow-x: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

thead {
    background: #fff;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

th {
    font-weight: 700;
    color: #475569;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.action-btn {
    padding: 6px 12px;
    font-size: 0.875rem;
    margin-right: 4px;
}

.edit-btn {
    background: #fff;
    color: #1e40af;
    border: 2px solid #1e40af;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.edit-btn:hover:not(:disabled) {
    background: #f0f4ff;
}

.delete-btn {
    background: #fff;
    color: #dc2626;
    border: 2px solid #dc2626;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.delete-btn:hover:not(:disabled) {
    background: #fef2f2;
}

.action-btn svg {
    width: 14px;
    height: 14px;
}

.chart-container {
    margin-bottom: 32px;
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

.chart-header h2 {
    color: #334155;
    font-size: 1.25rem;
    font-weight: 600;
}

.btn-toggle {
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
}

.btn-toggle:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-toggle:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.chevron-icon {
    transition: transform 0.3s ease;
}

.chevron-icon.rotated {
    transform: rotate(-180deg);
}

.pie-chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 8px 0;
    transition: all 0.3s ease;
    overflow: hidden;
}

.pie-chart-container.collapsed {
    max-height: 0;
    padding: 0;
    opacity: 0;
}

.pie-chart {
    max-width: 300px;
    width: 100%;
    height: auto;
}

.pie-slice {
    transition: opacity 0.2s ease;
    cursor: pointer;
}

.pie-slice:hover {
    opacity: 0.8;
}

.pie-tooltip {
    position: fixed;
    background: #1e293b;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    pointer-events: none;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

.pie-tooltip.visible {
    display: block;
}

.pie-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    width: 100%;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
}

.legend-text {
    flex: 1;
    font-size: 0.875rem;
    color: #334155;
    font-weight: 500;
}

.legend-value {
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
}

.legend-percentage {
    font-size: 0.75rem;
    color: #64748b;
    margin-left: 4px;
}

.summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.summary-card-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.card-icon {
    margin-bottom: 12px;
    opacity: 0.9;
}

.card-icon svg {
    width: 32px;
    height: 32px;
}

.summary-card h3 {
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 8px;
}

.summary-card .value {
    font-size: 1.75rem;
    font-weight: 700;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
    background: #fff;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.entry-limit {
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 8px;
}

@media (max-width: 768px) {
    body {
        padding: 20px 0;
    }

    .container {
        padding: 20px;
        border-radius: 0;
    }

    h1 {
        font-size: 1.5rem;
    }

    .button-group {
        flex-direction: column;
    }

    button {
        width: 100%;
    }

    .action-btn {
        margin-bottom: 8px;
    }

    .pie-chart {
        max-width: 250px;
    }

    .pie-legend {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}