:root { --bg-color: #f4f6f9; --primary: #16a085; --dark: #2c3e50; --success: #27ae60; --info: #2980b9; --danger: #e74c3c; }
body, html { margin: 0; padding: 0; font-family: 'Segoe UI', sans-serif; background: var(--bg-color); color: var(--dark); }

.master-nav { background: #ffffff; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 4px solid var(--primary); position: sticky; top: 0; z-index: 100;}
.nav-title { font-size: 18px; font-weight: 900; margin: 0; text-transform: uppercase;}

.btn-back { background: #eee; color: #333; padding: 8px 15px; border-radius: 20px; text-decoration: none; font-size: 13px; font-weight: bold; border: 1px solid #ccc; display: flex; align-items: center; gap: 5px; transition: 0.2s; }
.btn-back:hover { background: #ddd; }

.container { max-width: 1250px; margin: 20px auto; padding: 0 15px; }
.card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 4px 10px rgba(0,0,0,0.05); margin-bottom: 20px; border-top: 3px solid var(--primary); }
h3 { margin-top: 0; color: var(--dark); font-size: 16px; border-bottom: 1px dashed #eee; padding-bottom: 10px; margin-bottom: 15px;}

.info-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.form-group { display: flex; flex-direction: column; }
.form-group label { font-size: 10px; font-weight: bold; color: #7f8c8d; margin-bottom: 5px; text-transform: uppercase; }
.form-group input { padding: 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; font-weight:bold; color:#2c3e50;}
.readonly-bg { background: #fdfdfd !important; border: 1px dashed #ccc !important;}
.pin-status { font-size:11px; font-weight:bold; margin-top:4px; }
.alert-box { background: #fdebd0; color: #d35400; border: 1px dashed #e67e22; padding: 10px; border-radius: 6px; font-size: 12px; font-weight: bold; margin-bottom: 15px;}

.table-header { display: grid; grid-template-columns: 30px 1.5fr 0.8fr 1fr 1fr 0.8fr 1.2fr 1fr 1fr 1fr 1fr 40px; gap: 5px; background: #2c3e50; color: white; padding: 12px; border-radius: 4px; text-align: center; font-size: 10px; font-weight: 900; }
.table-row { display: grid; grid-template-columns: 30px 1.5fr 0.8fr 1fr 1fr 0.8fr 1.2fr 1fr 1fr 1fr 1fr 40px; gap: 5px; background: #fff; padding: 10px; border-bottom: 1px dashed #eee; align-items: center; text-align:center;}
.table-row input, .table-row select { width: 100%; padding: 8px 4px; border: 1px solid #ccc; border-radius: 3px; font-size: 12px; font-weight: bold; text-align: center; box-sizing: border-box;}

.btn-add { background: #3498db; color: white; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; font-weight: bold; margin-top: 15px; }
.btn-del { background: var(--danger); color: white; border: none; padding: 8px; border-radius: 3px; cursor: pointer; }

.flex-wrapper { display: flex; gap: 20px; align-items: stretch; flex-wrap: wrap; }
.preview-sidebar { flex: 1; min-width: 300px; background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.05); border-left: 4px solid #9b59b6; box-sizing: border-box;}
.summary-container { flex: 1; min-width: 300px; background: #fff; padding: 20px; border-radius: 8px; border-top: 4px solid var(--success); box-shadow: 0 4px 10px rgba(0,0,0,0.05); box-sizing: border-box;}

.summary-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 13px; color: #555; font-weight: bold;}
.summary-total { display: flex; justify-content: space-between; padding: 15px 0 5px 0; font-size: 18px; font-weight: 900; color: var(--success); border-top: 2px dashed #ccc; margin-top: 10px; }
.markup-input, .discount-row input { width: 50px; text-align: center; padding:4px; font-weight:bold; border-radius:3px;}
.gst-row { margin-top:10px; align-items:center; display:flex; }

.sidebar-gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px;}
.gallery-item { text-align: center; border: 1px solid #eee; padding: 5px; border-radius: 6px; background: #fafafa; }
.gallery-item img { max-width: 100%; height: 120px; object-fit: cover; border-radius: 4px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.gallery-item-name { font-size: 12px; font-weight: 900; margin-top: 8px; color: #2c3e50; }
.gallery-item-qty { font-size: 11px; color: var(--danger); font-weight: bold; }

.seamless-wall-container { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.05); margin-bottom: 20px; position:relative;}
.wastage-badge { position:absolute; top: 15px; right: 20px; border: 1px dashed var(--danger); color: var(--danger); padding: 5px 10px; border-radius: 4px; font-size: 11px; font-weight: bold;}

.p-box { color: white; border-radius: 4px; box-shadow: 0 4px 10px rgba(0,0,0,0.15); border: 2px solid #16a085; position: relative; overflow: hidden; width: 120px; height: 210px; display: flex; flex-direction: column; justify-content: flex-start; padding: 10px; box-sizing: border-box; }
.p-box-data { position: relative; z-index: 3; text-shadow: 0 1px 3px rgba(0,0,0,0.9); }
.waste-box { border: 2px dashed var(--danger); border-radius: 4px; padding: 5px; width: 60px; height: 80px; display:flex; flex-direction:column; justify-content:center; align-items:center; text-align:center; background:#fdf2e9; color:var(--danger); font-size: 11px;}

.btn-action { color: white; border: none; padding: 15px 15px; border-radius: 6px; font-weight: 900; font-size: 12px; cursor: pointer; transition: 0.3s; flex: 1; min-width: 150px; text-align:center;}
.btn-save { background: #2980b9; } .btn-save:hover { background: #2471a3; }
.btn-pdf { background: #e67e22; } .btn-pdf:hover { background: #d35400; }
.btn-print-only { background: #2c3e50; } .btn-print-only:hover { background: #1a252f; }
.btn-work-order { background: #8e44ad; } .btn-work-order:hover { background: #732d91; }
.btn-wo-image { background: #27ae60; } .btn-wo-image:hover { background: #229954; }

@media print {
    body { background: white; -webkit-print-color-adjust: exact; }
    .no-print { display: none !important; }
    .container { margin: 0; padding: 0; max-width: 100%; }
    .card, .summary-container, .seamless-wall-container, .preview-sidebar { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
    .flex-wrapper { flex-direction: row; display: flex; align-items: flex-start; }
    .preview-sidebar, .summary-container { margin-bottom:15px; }
}

body.work-order-mode #section-requirements { display: none !important; }
body.work-order-mode #section-billing { display: none !important; }
body.work-order-mode #main-render-area { display: none !important; }
body.work-order-mode #wg-whatsapp { visibility: hidden !important; } 

body.work-order-mode #wo-packing-info { display: block !important; margin-bottom: 25px; font-size: 24px; padding: 20px;}
body.work-order-mode .preview-sidebar { flex: 1; width: 100%; border: none; box-shadow: none; padding: 0; }
body.work-order-mode .flex-wrapper { flex-direction: column; }

body.work-order-mode h3 { font-size: 24px; border-bottom: 3px solid #ccc; padding-bottom: 15px; color: #333;}
body.work-order-mode .info-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; }
body.work-order-mode .form-group label { font-size: 14px; color: #555; }
body.work-order-mode .form-group input { font-size: 18px; padding: 12px; background: transparent; border: 1px solid #ddd; color:#000;}

body.work-order-mode .sidebar-gallery { grid-template-columns: repeat(3, 1fr); gap: 25px; margin-top: 20px;}
body.work-order-mode .gallery-item img { height: 220px; border: 1px solid #ccc; }
body.work-order-mode .gallery-item-name { font-size: 18px; margin-top: 10px;}
body.work-order-mode .gallery-item-qty { font-size: 16px; }