@media screen {
    body {
        font-family: Arial, sans-serif;
        margin: 0;
        padding: 20px;
        background: #f5f5f5;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .page {
        width: 210mm;
        min-height: 297mm;
        margin: 10px auto;
        padding: 15mm;
        background: white;
        border: 1px solid #ccc;
        box-shadow: 0 0 10px rgba(0,0,0,0.1);
        box-sizing: border-box;
        position: relative;
        page-break-after: always;
    }

    .no-print-screen {
        display: block;
        text-align: center;
        margin: 20px;
    }

    .print-controls {
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 1000;
        display: flex;
        gap: 10px;
    }
}

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

    body {
        margin: 0;
        padding: 0;
        font-family: Arial, sans-serif;
        background: white;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        color-adjust: exact;
        width: 100%;
        height: 100%;
    }

    .page {
        width: 100%;
        height: 100%;
        page-break-after: always;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding: 0;
        margin: 0;
        border: none;
        box-shadow: none;
        position: relative;
        box-sizing: border-box;
    }

    .page:last-child {
        page-break-after: auto;
    }

    .no-print, .no-print-screen {
        display: none !important;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    .layout-wrapper {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    table {
        page-break-inside: auto;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
}

h1, h2, h3, h4 {
    color: #1e293b;
    margin-top: 0;
    margin-bottom: 15px;
}

.summary {
    background: #f0f9ff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #bae6fd;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
}

.summary h2 {
    color: #0369a1;
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 2px solid #0ea5e9;
    padding-bottom: 5px;
}

.sheet-title {
    background: #1e293b;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.layout-wrapper {
    width: 100%;
    height: 65vh;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px;
    overflow: hidden;
    position: relative;
    background: #f8fafc;
    border: 2px solid #334155;
    border-radius: 8px;
    box-sizing: border-box;
}

.layout-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lamiera-wrapper {
    position: relative;
    border: 1px solid #000;
    background: #ffffff;
    box-sizing: border-box;
    overflow: visible;
    margin: 0 auto;
}

.lamiera-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px solid #334155;
    box-sizing: border-box;
    pointer-events: none;
}

.shape-item {
    position: absolute;
    box-sizing: border-box;
    background-color: rgba(59, 130, 246, 0.3);
    border: 1px solid #1e40af;
    pointer-events: none;
    transform-origin: center center;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
}

.info-card {
    background: #f8fafc;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    box-sizing: border-box;
}

.info-card h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #2563eb;
    font-size: 14px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 5px;
}

.info-card p {
    margin: 8px 0;
    font-size: 13px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 20px 0;
    width: 100%;
}

.stat-item {
    text-align: center;
    padding: 10px;
    background: #f1f5f9;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    box-sizing: border-box;
}

.stat-value {
    font-size: 20px;
    font-weight: bold;
    color: #1e293b;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 12px;
    box-sizing: border-box;
}

th {
    background: #f1f5f9;
    font-weight: 600;
    text-align: left;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
}

td {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
}

.page-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #e2e8f0;
    text-align: center;
    font-size: 11px;
    color: #64748b;
    width: 100%;
    box-sizing: border-box;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #64748b;
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

@media print {
    .layout-wrapper {
        height: 60vh !important;
        max-height: 60vh !important;
    }

    .lamiera-wrapper {
        max-width: 95% !important;
        max-height: 95% !important;
    }

    .sheet-title {
        font-size: 16px;
        padding: 10px 15px;
        margin-bottom: 15px;
    }

    .info-card {
        padding: 10px;
        margin-bottom: 10px;
    }

    .info-card p {
        font-size: 12px;
        margin: 4px 0;
    }

    .info-card h4 {
        font-size: 13px;
        margin-bottom: 8px;
    }

    table {
        font-size: 11px;
        margin: 10px 0;
    }

    th, td {
        padding: 6px 8px;
    }

    .stats-grid {
        margin: 15px 0;
    }

    .stat-item {
        padding: 8px;
    }

    .stat-value {
        font-size: 18px;
    }

    .stat-label {
        font-size: 10px;
    }

    .page-footer {
        margin-top: 15px;
        padding-top: 10px;
        font-size: 10px;
    }

    .shape-svg {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .lamiera-wrapper {
        background: white !important;
    }
}

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

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .layout-wrapper {
        height: 50vh;
    }
}

@media (max-width: 480px) {
    .page {
        padding: 10mm;
    }

    .sheet-title {
        font-size: 16px;
        padding: 8px 12px;
    }

    .layout-wrapper {
        height: 35vh;
    }
}

.shape-svg {
    position: absolute;
    overflow: visible;
}

.shape-rect {
    fill: rgba(59, 130, 246, 0.3);
    stroke: #1e40af;
    stroke-width: 1;
}

.shape-circle {
    fill: rgba(59, 130, 246, 0.3);
    stroke: #1e40af;
    stroke-width: 1;
}

.shape-triangle {
    fill: rgba(59, 130, 246, 0.3);
    stroke: #1e40af;
    stroke-width: 1;
}

.shape-trapezoid {
    fill: rgba(59, 130, 246, 0.3);
    stroke: #1e40af;
    stroke-width: 1;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.summary-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    box-sizing: border-box;
}

.summary-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.summary-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.summary-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.summary-stat-label {
    font-size: 13px;
    color: #64748b;
}

.summary-stat-value {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 8px;
    max-width: 800px;
    max-height: 90vh;
    width: 90%;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    background: #1e293b;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h4 {
    margin: 0;
    color: white;
    font-size: 16px;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
}

.modal-content {
    padding: 20px;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

[style*="color: #2563eb"] {
    color: #2563eb !important;
}

[style*="color: #1e293b"] {
    color: #1e293b !important;
}

[style*="color: #64748b"] {
    color: #64748b !important;
}

[style*="background: #f0f9ff"] {
    background: #f0f9ff !important;
}

[style*="background: #f8fafc"] {
    background: #f8fafc !important;
}

[style*="background: #f1f5f9"] {
    background: #f1f5f9 !important;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
}
