/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #fafafa;
    color: #1a1a1a;
    line-height: 1.5;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    min-height: 100vh;
}

/* Header */
.header {
    text-align: center;
    padding-bottom: 20px;
    margin-bottom: 30px;
    border-bottom: 1px solid #e0e0e0;
}

.title {
    font-size: 24px;
    font-weight: 300;
    color: #1a1a1a;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.subtitle {
    font-size: 13px;
    color: #666;
    font-weight: 400;
}

/* Sections */
.section {
    background: #fafafa;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 2px;
}

.section-title {
    font-size: 13px;
    font-weight: 500;
    color: #1a1a1a;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Fields */
.field {
    margin-bottom: 16px;
}

.label {
    display: block;
    font-size: 12px;
    color: #666;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.input,
.input-display {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    border: 1px solid #ddd;
    background: #fff;
    color: #1a1a1a;
    border-radius: 2px;
    font-family: inherit;
}

.input:focus {
    outline: none;
    border-color: #1a1a1a;
}

.input-display {
    background: #f5f5f5;
    border-color: #e0e0e0;
    color: #1a1a1a;
}

.info-text {
    font-size: 13px;
    color: #666;
    margin-top: 8px;
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Buttons */
.buttons {
    text-align: center;
    margin: 20px 0;
}

.btn {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    background: #1a1a1a;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    margin: 0 6px 10px 6px;
    min-width: 140px;
    transition: background 0.2s;
}

.btn:hover {
    background: #333;
}

.btn-secondary {
    background: #999;
}

.btn-secondary:hover {
    background: #777;
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Result box */
.result-box {
    background: #f5f5f5;
    padding: 20px;
    text-align: center;
    margin: 20px 0;
    border-left: 3px solid #1a1a1a;
}

.result-label {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.result-value {
    font-size: 26px;
    font-weight: 300;
    color: #1a1a1a;
}

/* Table */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 16px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.table thead {
    background: #f8f9fa;
}

.table th {
    padding: 10px 8px;
    text-align: left;
    font-size: 11px;
    font-weight: 500;
    color: #666;
    border-bottom: 2px solid #e0e0e0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.table th.align-right {
    text-align: right;
}

.table td {
    padding: 10px 8px;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.table td.align-right {
    text-align: right;
}

/* Expand button */
.expand-btn {
    cursor: pointer;
    color: #666;
    font-size: 16px;
    font-weight: bold;
    background: none;
    border: none;
    padding: 0 8px;
    user-select: none;
}

.expand-btn:hover {
    color: #1a1a1a;
}

/* Desglose row */
.desglose-row {
    background: #fafafa;
}

.desglose-content {
    padding: 16px 20px;
    font-size: 13px;
    line-height: 1.8;
}

.desglose-title {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    margin-bottom: 12px;
}

.desglose-line {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.desglose-line.total {
    border-top: 2px solid #ddd;
    margin-top: 8px;
    padding-top: 12px;
    font-weight: 500;
    font-size: 14px;
}

.desglose-label {
    color: #666;
}

.desglose-value {
    font-weight: 500;
    color: #1a1a1a;
}

/* Total box */
.total-box {
    background: #1a1a1a;
    color: #fff;
    padding: 16px;
    text-align: center;
    margin-top: 16px;
}

.total-label {
    font-size: 11px;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.total-value {
    font-size: 24px;
    font-weight: 300;
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 40px;
    border-top: 1px solid #e0e0e0;
    color: #999;
    font-size: 13px;
}

.footer a {
    color: #666;
    text-decoration: none;
}

.footer a:hover {
    color: #1a1a1a;
}

.small {
    font-size: 12px;
    margin-top: 6px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .header {
        margin-bottom: 20px;
        padding-bottom: 16px;
    }

    .title {
        font-size: 20px;
    }

    .subtitle {
        font-size: 12px;
    }

    .section {
        padding: 16px;
        margin-bottom: 16px;
    }

    .section-title {
        font-size: 12px;
        margin-bottom: 12px;
    }

    .field {
        margin-bottom: 12px;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .btn {
        width: 100%;
        margin: 0 0 8px 0;
    }

    .result-box {
        padding: 16px;
        margin: 16px 0;
    }

    .result-value {
        font-size: 22px;
    }

    .table {
        font-size: 12px;
    }

    .table th,
    .table td {
        padding: 8px 4px;
        font-size: 11px;
    }

    .desglose-content {
        padding: 12px;
        font-size: 12px;
    }

    .total-box {
        padding: 14px;
    }

    .total-value {
        font-size: 20px;
    }
}

/* Select dropdown arrow */
select {
    appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"%3E%3Cpath fill="%23666" d="M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z"/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}
