* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.5;
}

.header {
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%);
    color: white;
    padding: 1.5rem 2rem;
    text-align: center;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.header p {
    opacity: 0.8;
    font-size: 0.9rem;
}

.privacy-badge {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.privacy-badge::before {
    content: "🔒 ";
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

/* Drop Zone */
.drop-zone {
    border: 3px dashed #cbd5e0;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    background: white;
    transition: all 0.2s;
    cursor: pointer;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: #4299e1;
    background: #ebf8ff;
}

.drop-zone h2 {
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.drop-zone p {
    color: #718096;
    margin-bottom: 1rem;
}

.drop-zone input[type="file"] {
    display: none;
}

.btn {
    display: inline-block;
    background: #4299e1;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn:hover {
    background: #3182ce;
}

.btn-secondary {
    background: #718096;
}

.btn-secondary:hover {
    background: #4a5568;
}

.or-divider {
    margin: 1rem 0;
    color: #a0aec0;
}

/* Invoice Preview */
.invoice-container {
    display: none;
    margin-top: 2rem;
}

.invoice-container.visible {
    display: block;
}

.invoice-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    justify-content: flex-end;
}

.invoice {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Invoice Header */
.invoice-header {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    color: white;
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
}

.invoice.credit-note .invoice-header {
    background: linear-gradient(135deg, #742a2a 0%, #9b2c2c 100%);
}

.invoice-type {
    font-size: 0.85rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.invoice-number {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.25rem 0;
}

.invoice-dates {
    text-align: right;
}

.invoice-dates .label {
    font-size: 0.75rem;
    opacity: 0.7;
    text-transform: uppercase;
}

.invoice-dates .value {
    font-size: 1.1rem;
    font-weight: 600;
}

.due-date {
    margin-top: 0.75rem;
}

/* Parties */
.parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
    border-bottom: 1px solid #e2e8f0;
}

.party h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #718096;
    margin-bottom: 0.5rem;
}

.party-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.party-details {
    font-size: 0.9rem;
    color: #4a5568;
}

.party-details div {
    margin-bottom: 0.25rem;
}

.party-id {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.85rem;
    color: #718096;
}

.operator-badge {
    display: inline-block;
    background: #ebf8ff;
    color: #2b6cb0;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* Line Items */
.line-items {
    padding: 2rem;
}

.line-items h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #718096;
    margin-bottom: 1rem;
}

.line-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto auto;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #e2e8f0;
    align-items: start;
}

.line-item:last-child {
    border-bottom: none;
}

.line-num {
    background: #e2e8f0;
    color: #4a5568;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
}

.line-details h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.25rem;
}

.line-description {
    font-size: 0.85rem;
    color: #718096;
    margin-top: 0.5rem;
}

.line-classification {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.75rem;
    color: #a0aec0;
    margin-top: 0.25rem;
}

.line-qty, .line-price, .line-total {
    text-align: right;
    white-space: nowrap;
}

.line-qty .label, .line-price .label {
    font-size: 0.7rem;
    color: #a0aec0;
    text-transform: uppercase;
}

.line-total {
    font-weight: 600;
    font-size: 1.1rem;
    min-width: 100px;
}

/* Totals */
.totals {
    background: #f7fafc;
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
}

.tax-breakdown h3, .amounts h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #718096;
    margin-bottom: 1rem;
}

.tax-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.9rem;
}

.amount-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.amount-row:last-child {
    border-bottom: none;
}

.amount-row.total {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2d3748;
    border-top: 2px solid #2d3748;
    margin-top: 0.5rem;
    padding-top: 1rem;
}

/* Payment Info */
.payment-info {
    padding: 1.5rem 2rem;
    background: #edf2f7;
    border-top: 1px solid #e2e8f0;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: center;
}

.payment-details h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #718096;
    margin-bottom: 0.75rem;
}

.iban {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.copy-btn {
    background: #e2e8f0;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: #cbd5e0;
}

.copy-btn.copied {
    background: #c6f6d5;
    color: #276749;
}

.qr-section {
    text-align: center;
}

.qr-section .qr-label {
    font-size: 0.7rem;
    color: #718096;
    margin-top: 0.5rem;
    text-transform: uppercase;
}

#qrcode {
    background: white;
    padding: 8px;
    border-radius: 8px;
    display: inline-block;
}

#qrcode canvas {
    display: block;
}

/* Footer */
.invoice-footer {
    padding: 1rem 2rem;
    background: #2d3748;
    color: #a0aec0;
    font-size: 0.75rem;
    display: flex;
    justify-content: space-between;
}

.invoice-footer a {
    color: #63b3ed;
    text-decoration: none;
}

/* Responsive */
@media (max-width: 768px) {
    .parties {
        grid-template-columns: 1fr;
    }
    
    .line-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .line-num {
        display: none;
    }
    
    .totals {
        grid-template-columns: 1fr;
    }
}

/* Print styles */
@media print {
    body { background: white; }
    .header, .drop-zone, .invoice-actions, .ecosystem-links { display: none !important; }
    .invoice-container { margin: 0; }
    .invoice { box-shadow: none; }
    .container { max-width: 100%; padding: 0; }
    .qr-section { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    #qrcode { background: white !important; }
}

/* Error state */
.error {
    background: #fed7d7;
    color: #c53030;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

/* Links section */
.ecosystem-links {
    margin-top: 2rem;
    padding: 1rem;
    background: #edf2f7;
    border-radius: 8px;
    text-align: center;
}

.ecosystem-links a {
    color: #4299e1;
    margin: 0 1rem;
}