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

:root {
    --primary-color: #1a2744;
    --primary-light: #2d3e5f;
    --accent-color: #3b82f6;
    --text-dark: #1f2937;
    --text-medium: #4b5563;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ee 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 30px 20px;
}

.app-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px 32px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
}

.app-logo {
    height: 62px;
    width: auto;
}

.login-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.login-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 48px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.login-logo {
    height: 70px;
    width: auto;
    margin-bottom: 24px;
}

.login-card h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.login-card p {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 28px;
}

.login-card .form-group {
    margin-bottom: 16px;
}

.login-card input {
    text-align: center;
    font-size: 16px;
}

.login-error {
    color: #ef4444;
    font-size: 13px;
    margin-bottom: 16px;
    padding: 10px;
    background: #fef2f2;
    border-radius: var(--radius-sm);
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.app-title-section h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.subtitle {
    color: var(--text-light);
    font-size: 14px;
    font-weight: 400;
}

.form-section {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.step-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
}

.section-title h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header .section-title {
    margin-bottom: 0;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    flex: 1;
}

.form-group-btn {
    display: flex;
    align-items: flex-end;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-medium);
    margin-bottom: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    color: var(--text-dark);
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input::placeholder {
    color: var(--text-light);
}

.form-actions {
    margin-top: 28px;
    display: flex;
    gap: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: transparent;
    color: var(--text-medium);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background: var(--bg-light);
    border-color: var(--text-light);
}

.btn-small {
    padding: 8px 14px;
    font-size: 13px;
}

.btn-large {
    padding: 14px 28px;
    font-size: 15px;
}

.btn-danger {
    background: #ef4444;
    color: white;
    padding: 6px 12px;
    font-size: 12px;
}

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

.hidden {
    display: none !important;
}

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

.summary-card {
    background: var(--bg-light);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.summary-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.summary-value {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
}

.invoice-form {
    padding: 24px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 28px;
}

.invoice-form .form-row:last-child {
    margin-bottom: 0;
}

.invoice-form .form-actions {
    margin-top: 0;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-medium);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    background: var(--bg-white);
    color: var(--text-dark);
}

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

.text-center {
    text-align: center;
}

.totals-row td {
    background: var(--bg-light);
    font-weight: 600;
}

#invoiceTableContainer h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 16px;
}

.preview-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
}

.soa-preview {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 48px;
    max-width: 900px;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
}

.soa-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--primary-color);
}

.soa-logo {
    height: 75px;
    width: auto;
}

.soa-header-right {
    text-align: right;
}

.company-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 6px;
}

.company-address {
    font-size: 13px;
    color: var(--text-medium);
    margin-bottom: 2px;
}

.company-tax {
    font-size: 13px;
    color: var(--text-medium);
    font-weight: 500;
    margin-top: 8px;
}

.soa-title-bar {
    background: var(--primary-color);
    color: white;
    text-align: center;
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 28px;
}

.soa-title-bar h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 2px;
}

.soa-details {
    display: flex;
    justify-content: space-between;
    margin-bottom: 28px;
    padding: 20px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
}

.soa-detail-item {
    margin-bottom: 10px;
}

.soa-detail-item:last-child {
    margin-bottom: 0;
}

.soa-detail-item .label {
    font-weight: 600;
    color: var(--text-medium);
    font-size: 13px;
}

.soa-detail-item .value {
    color: var(--text-dark);
    font-size: 14px;
    margin-left: 6px;
}

.soa-table {
    margin-bottom: 32px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.soa-table th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.soa-table td {
    border-color: var(--border-color);
}

.soa-table .totals-row td {
    background: var(--bg-light);
    border-top: 2px solid var(--primary-color);
}

.soa-declaration {
    margin: 36px 0;
    padding: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-light);
    text-align: center;
    font-style: italic;
    color: var(--text-medium);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.soa-signature {
    display: flex;
    justify-content: space-between;
    margin-top: 48px;
    gap: 40px;
}

.signature-box {
    flex: 1;
    text-align: center;
}

.signature-box.with-stamp {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stamp-image {
    width: 140px;
    height: 140px;
    object-fit: contain;
    margin-bottom: 12px;
}

.signature-line {
    border-bottom: 1px solid var(--text-dark);
    height: 80px;
    margin-bottom: 12px;
}

.signature-box p {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
}

@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    .app-header {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

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

    .header-summary {
        grid-template-columns: 1fr 1fr;
    }

    .soa-header {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    .soa-header-right {
        text-align: center;
    }

    .soa-details {
        flex-direction: column;
        gap: 16px;
    }

    .soa-signature {
        flex-direction: column;
        gap: 40px;
    }

    .preview-actions {
        flex-direction: column;
        gap: 12px;
    }

    .preview-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .soa-preview {
        padding: 24px;
    }
}

@media print {
    .preview-actions {
        display: none;
    }
    
    .soa-preview {
        border: none;
        box-shadow: none;
        padding: 0;
    }
}
