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

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f5f5;
    color: #333;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 0.375rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

.header {
    background: linear-gradient(135deg, #2a2421 0%, #3d3d3d 100%);
    color: #d4a574;
    padding: 2.5rem 2rem;
    text-align: center;
}

.header h1 {
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header p {
    font-size: 1rem;
    opacity: 0.85;
}

.error {
    background-color: #fef2f2;
    border-left: 4px solid #dc2626;
    color: #991b1b;
    padding: 1rem;
    margin: 1.5rem 2rem 0;
    border-radius: 0.25rem;
    font-size: 0.95rem;
}

.form {
    padding: 2rem;
}

fieldset {
    border: none;
    padding: 0;
    margin-bottom: 2rem;
}

.title-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    padding: 1rem;
    background: #fafafa;
    border-radius: 0.375rem;
    border: 1px solid #e5e5e5;
}

.title-row input {
    padding: 0.625rem 0.75rem;
    border: 1px solid #d0d0d0;
    border-radius: 0.25rem;
    font-size: 1.1rem;
    font-family: inherit;
    font-weight: 600;
    text-transform: uppercase;
    background: white;
    transition: all 0.2s ease;
}

.title-row input:focus {
    outline: none;
    border-color: #d4a574;
    box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
    background: #fffbf7;
}

legend {
    font-size: 1.375rem;
    font-weight: 600;
    color: #2a2421;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #d4a574;
}

.items-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #fafafa;
    border-radius: 0.375rem;
    border: 1px solid #e5e5e5;
}

.item-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 0.25rem;
}

.item-row-top {
    display: grid;
    grid-template-columns: 5rem 4rem 1fr auto;
    gap: 0.5rem;
    align-items: center;
}

.item-row-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.item-row input {
    padding: 0.625rem 0.75rem;
    border: 1px solid #d0d0d0;
    border-radius: 0.25rem;
    font-size: 0.95rem;
    font-family: inherit;
    background: white;
    transition: all 0.2s ease;
}

.item-row input:focus {
    outline: none;
    border-color: #d4a574;
    box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
    background: #fffbf7;
}

.item-row input::placeholder {
    color: #999;
    font-size: 0.9rem;
}

.btn-remove {
    padding: 0.625rem 1rem;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 0.25rem;
    color: #666;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-remove:hover {
    background: #fee8e8;
    border-color: #dc2626;
    color: #dc2626;
}

.btn-add {
    padding: 0.75rem 1.5rem;
    background: white;
    border: 2px dashed #d4a574;
    border-radius: 0.25rem;
    color: #d4a574;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
    margin-top: 1rem;
}

.btn-add:hover:not(:disabled) {
    background: #fffbf7;
    border-style: solid;
    box-shadow: 0 2px 8px rgba(212, 165, 116, 0.15);
}

.btn-add:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    padding: 0 2rem 2rem;
}

.btn-submit {
    padding: 0.875rem 2.5rem;
    background: linear-gradient(135deg, #2a2421 0%, #3d3d3d 100%);
    color: #d4a574;
    border: none;
    border-radius: 0.25rem;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(42, 36, 33, 0.15);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(42, 36, 33, 0.25);
}

.btn-submit:active {
    transform: translateY(0);
}

.preview-section {
    padding: 2rem;
    border-top: 1px solid #e8e8e8;
    background: #fafafa;
}

.preview-section h2 {
    font-size: 1.375rem;
    color: #2a2421;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.preview-container {
    background: white;
    border: 2px solid #d4a574;
    border-radius: 0.375rem;
    padding: 2rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.preview-container svg {
    max-width: 100%;
    height: auto;
    display: block;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

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

.btn-download {
    padding: 0.875rem 2.5rem;
    background: linear-gradient(135deg, #d4a574 0%, #e8b88a 100%);
    color: #2a2421;
    border: none;
    border-radius: 0.25rem;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(212, 165, 116, 0.25);
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(212, 165, 116, 0.35);
}

.btn-download:active {
    transform: translateY(0);
}

@media print {
    @page {
        size: A4 portrait;
        margin: 0;
    }

    html, body {
        background: none;
        padding: 0;
        margin: 0;
        width: 100%;
        height: 100%;
    }

    .container {
        box-shadow: none;
        border-radius: 0;
        max-width: none;
        background: none;
    }

    .header,
    .form,
    .form-actions,
    .preview-section h2,
    .download-section,
    .error {
        display: none;
    }

    .preview-section {
        padding: 0;
        border: none;
        background: none;
    }

    .preview-container {
        border: none;
        padding: 0;
        margin: 0;
        box-shadow: none;
        min-height: auto;
        display: block;
    }

    .preview-container svg {
        box-shadow: none;
        width: 100vw;
        height: 100vh;
        display: block;
    }
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .header {
        padding: 1.5rem 1rem;
    }

    .header h1 {
        font-size: 1.75rem;
    }

    .form {
        padding: 1.5rem;
    }

    .items-container {
        padding: 1rem;
        gap: 1rem;
    }

    .item-row-top {
        grid-template-columns: 1fr 1fr;
    }

    .item-row-bottom {
        grid-template-columns: 1fr;
    }

    .form-actions {
        padding: 0 1.5rem 1.5rem;
        flex-direction: column;
    }

    .btn-submit,
    .btn-download {
        width: 100%;
    }

    .preview-section {
        padding: 1.5rem;
    }

    .preview-section h2 {
        font-size: 1.125rem;
    }

    .preview-container {
        padding: 1rem;
        min-height: 300px;
    }
}
