/* ── Reset & Base ──────────────────────────────────────────────── */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
    padding: 20px;
}

h1 {
    font-size: 1.6rem;
    color: #1a1a2e;
    margin-bottom: 4px;
}

h2 {
    font-size: 1.15rem;
    color: #1a1a2e;
    margin-bottom: 12px;
}

h3 {
    font-size: 1.05rem;
    color: #16213e;
    margin-bottom: 10px;
}

/* ── Layout ────────────────────────────────────────────────────── */

.app-container {
    max-width: 960px;
    margin: 0 auto;
}

.app-header {
    text-align: center;
    margin-bottom: 24px;
}

.app-header p {
    color: #666;
    font-size: 0.9rem;
}

/* ── Cards ─────────────────────────────────────────────────────── */

.card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.card-row {
    display: flex;
    gap: 16px;
}

.card-row > .card {
    flex: 1;
}

/* ── Form elements ─────────────────────────────────────────────── */

label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: #444;
}

input[type="file"] {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
}

/* ── Drop zones ───────────────────────────────────────────────── */

.dropzone {
    position: relative;
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.dropzone:hover {
    border-color: #999;
    background: #fafbfc;
}

.dropzone.drag-over {
    border-color: #3498db;
    background: #ebf5fb;
}

.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    margin: 0;
}

.dropzone-content {
    pointer-events: none;
}

.dropzone-icon {
    font-size: 2rem;
    margin-bottom: 6px;
    opacity: 0.6;
}

.dropzone-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 2px;
}

.dropzone-hint {
    font-size: 0.78rem;
    color: #999;
    margin-bottom: 6px;
}

.dropzone-format {
    font-size: 0.75rem;
    color: #aaa;
    font-family: monospace;
}

input[type="number"] {
    width: 120px;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
}

select {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 160px;
}

/* ── Buttons ───────────────────────────────────────────────────── */

.btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
}

/* ── Status badges ─────────────────────────────────────────────── */

.status-success {
    color: #27ae60;
    font-size: 0.82rem;
}

.status-warning {
    color: #e67e22;
    font-size: 0.82rem;
}

/* ── Alerts ────────────────────────────────────────────────────── */

.alert {
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ── Month tabs ────────────────────────────────────────────────── */

.month-tabs-bar {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 0;
    background: #fff;
    border-radius: 8px 8px 0 0;
    padding: 12px 16px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.month-tab {
    padding: 8px 16px;
    border: none;
    background: #f0f2f5;
    color: #666;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.month-tab:hover {
    background: #e2e6ea;
    color: #333;
}

.month-tab.active {
    background: #1a1a2e;
    color: #fff;
}

.month-panels {
    background: #fff;
    border-radius: 0 0 8px 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.month-panel {
    display: none;
}

.month-panel.active {
    display: block;
}

/* ── Results ───────────────────────────────────────────────────── */

.month-section {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.results-table th,
.results-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.results-table th {
    background: #f7f8fa;
    font-weight: 600;
    color: #555;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.results-table .num {
    text-align: right;
}

.results-table tbody tr:hover {
    background: #fafbfc;
}

/* Row highlight for missing client price */
.results-table tr.price-not-found {
    background: #fff8e1;
}

.results-table tr.price-not-found:hover {
    background: #fff3cd;
}

.warning-badge {
    color: #e67e22;
    cursor: help;
    font-size: 0.95rem;
}

/* Footer rows */
.results-table tfoot td {
    border-bottom: none;
    padding-top: 10px;
}

.results-table .subtotal-row td {
    border-top: 2px solid #ddd;
    color: #666;
}

.minimum-fee-note {
    color: #e67e22;
    font-weight: 600;
    font-size: 0.82rem;
}

.minimum-fee-legend {
    margin-top: 8px;
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
}

.results-table tr.minimum-fee-applied td:last-child {
    color: #e67e22;
}

.results-table .invoice-total-row td {
    border-top: 2px solid #333;
    font-size: 0.95rem;
}

/* ── Year summary ──────────────────────────────────────────────── */

.year-summary {
    background: #1a1a2e;
    color: #fff;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    margin-top: 8px;
}

.year-summary h3 {
    color: #ccc;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.year-total {
    font-size: 2rem;
    font-weight: 700;
}

/* ── No data ───────────────────────────────────────────────────── */

.no-data {
    color: #999;
    font-size: 0.9rem;
    padding: 20px 0;
    text-align: center;
}

/* ── Utility ───────────────────────────────────────────────────── */

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

.settings-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.settings-group {
    display: flex;
    flex-direction: column;
}

.settings-group label {
    margin-bottom: 4px;
}

.settings-group-wide {
    flex: 1;
    min-width: 0;
}

.settings-group-wide input[type="text"] {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* ── Responsive ────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .card-row {
        flex-direction: column;
    }

    .settings-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .results-table th,
    .results-table td {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
}
