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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f4f6f9;
    color: #1a1a2e;
    min-height: 100vh;
}

header {
    background: #1a1a2e;
    color: #fff;
    padding: 1.5rem 2rem;
    border-bottom: 3px solid #e8a300;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

header .subtitle {
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: #a8b2c1;
}

.container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    max-width: 1100px;
    margin: 1.5rem auto;
    padding: 0 1.5rem;
}

@media (max-width: 700px) {
    .container {
        grid-template-columns: 1fr;
    }
}

.input-panel, .results-panel, .error-panel {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: #1a1a2e;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e8a300;
}

.results-panel h3,
.results-tier h3,
.net-receipts-section h3 {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6c757d;
    margin: 1.5rem 0 0.75rem 0;
}

.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #444;
    margin-bottom: 0.35rem;
}

input[type="number"], select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    font-size: 0.9rem;
    color: #1a1a2e;
    background: #fafafa;
    transition: border-color 0.15s;
}

input[type="number"]:focus, select:focus {
    outline: none;
    border-color: #e8a300;
    background: #fff;
}

select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f0f0f0;
}

.currency-badge {
    font-size: 0.75rem;
    background: #e8f0fe;
    color: #1a73e8;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-weight: 600;
}

.dims-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dims-row input {
    flex: 1;
}

.dim-sep {
    color: #888;
    font-weight: 500;
}

.calc-btn {
    width: 100%;
    padding: 0.75rem;
    background: #e8a300;
    color: #1a1a2e;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background 0.15s;
}

.calc-btn:hover {
    background: #d49600;
}

.calc-btn:active {
    background: #bf8800;
}

/* Results */
.results-summary {
    margin-bottom: 1rem;
}

.result-card {
    border-radius: 6px;
    padding: 1rem;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.result-card.total {
    background: #1a1a2e;
    color: #fff;
}

.result-card.total .result-label {
    font-size: 0.85rem;
    color: #a8b2c1;
    flex: 1;
}

.result-card.total .result-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #e8a300;
}

.result-card.total .result-currency {
    font-size: 0.85rem;
    color: #a8b2c1;
}

.results-detail, .results-tier {
    border-top: 1px solid #f0f0f0;
    padding-top: 0.75rem;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.4rem 0;
    border-bottom: 1px solid #f8f8f8;
}

.result-row[hidden] {
    display: none;
}

.result-row.small {
    font-size: 0.8rem;
    color: #666;
}

.result-row .result-label {
    font-size: 0.85rem;
    color: #555;
}

.result-row .result-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a1a2e;
    text-align: right;
    max-width: 60%;
}


.error-panel {
    border-left: 4px solid #dc3545;
    grid-column: 1 / -1;
}

.error-panel h2 {
    color: #dc3545;
    border-color: #dc3545;
}

#error-message {
    color: #dc3545;
    font-size: 0.9rem;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Info icon and tooltip */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    background: #888;
    color: #fff;
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: 700;
    cursor: pointer;
    vertical-align: middle;
    position: relative;
    line-height: 1;
    flex-shrink: 0;
}

.info-icon::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #2c2c3e;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.45;
    white-space: pre-wrap;
    max-width: 280px;
    width: max-content;
    padding: 0.55rem 0.7rem;
    border-radius: 5px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 100;
    text-align: left;
}

.info-icon::after {
    content: "";
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #2c2c3e;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 100;
}

.info-icon:hover::before,
.info-icon:hover::after {
    opacity: 1;
}

/* Net Receipts breakdown */
.net-receipts-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e9ecef;
}


.net-receipts-table {
    width: 100%;
    border-collapse: collapse;
}

.nr-row td {
    padding: 0.35rem 0;
    font-size: 0.9rem;
}

.nr-label {
    color: #6c757d;
    text-align: left;
}

.nr-value {
    text-align: right;
    font-weight: 500;
    color: #212529;
}

.nr-deduction .nr-value {
    color: #6c757d;
}

.nr-total td {
    border-top: 1px solid #dee2e6;
    padding-top: 0.5rem;
    margin-top: 0.25rem;
    font-weight: 700;
    font-size: 1rem;
    color: #212529;
}

.nr-total .nr-label {
    color: #212529;
}

.result-row--total {
    font-weight: 700;
    font-size: 1rem;
    border-top: 2px solid #dee2e6;
    margin-top: 0.25rem;
    padding-top: 0.5rem;
    border-bottom: none;
}

.result-row--total .result-label {
    color: #212529;
}
