/* Premium Invoice Builder Layout & Design */
body { background-color: #f1f5f9; font-family: 'Inter', sans-serif; margin: 0; }

.builder-wrapper { max-width: 1200px; margin: 40px auto; padding: 0 20px; display: grid; grid-template-columns: 1fr 320px; gap: 30px; align-items: start; min-height: 70vh;}

.invoice-editor { background: #ffffff; padding: 50px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); border: 1px solid #e2e8f0; }

.invoice-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 40px; }

.logo-upload { width: 150px; height: 100px; border: 2px dashed #cbd5e1; border-radius: 8px; display: flex; flex-direction: column; justify-content: center; align-items: center; cursor: pointer; color: #64748b; transition: 0.3s; background: #f8fafc;}
.logo-upload:hover { border-color: #10b981; color: #10b981; background: #ecfdf5;}

.invoice-title-sec { text-align: right; }
.inv-title-input { font-size: 40px; font-weight: 800; text-align: right; border: none; outline: none; color: #0f172a; width: 100%; text-transform: uppercase;}
.inv-no-group { display: flex; align-items: center; justify-content: flex-end; margin-top: 10px; color: #64748b; font-weight: 600;}
.inv-no-group input { border: 1px solid #e2e8f0; padding: 8px 12px; border-radius: 6px; margin-left: 10px; width: 120px; outline: none; font-weight: 600; transition: 0.3s;}
.inv-no-group input:focus { border-color: #10b981; }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-bottom: 40px;}
.editable-label { font-weight: 700; color: #334155; font-size: 14px; margin-bottom: 8px; display: block;}
.text-area-box { width: 100%; padding: 12px; border: 1px solid transparent; border-radius: 6px; background: #f8fafc; outline: none; resize: vertical; min-height: 80px; transition: 0.3s; font-family: 'Inter', sans-serif;}
.text-area-box:hover, .text-area-box:focus { border-color: #cbd5e1; background: #fff;}

.meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 40px;}
.meta-item { display: flex; justify-content: flex-end; align-items: center; gap: 15px;}
.meta-item input[type="text"], .meta-item input[type="date"] { padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 6px; width: 180px; outline: none;}
.meta-item input:focus { border-color: #10b981; }

.items-table { width: 100%; border-collapse: collapse; margin-bottom: 15px;}
.items-table th { background: #0f172a; color: white; padding: 12px 15px; text-align: left; font-size: 14px; font-weight: 600;}
.items-table th:first-child { border-radius: 8px 0 0 8px; }
.items-table th:last-child { border-radius: 0 8px 8px 0; text-align: right;}
.items-table td { padding: 15px 10px; border-bottom: 1px solid #e2e8f0; vertical-align: middle;}

.item-input { width: 100%; border: none; outline: none; padding: 8px; background: transparent;}
.item-input:hover, .item-input:focus { background: #f8fafc; border-radius: 4px;}
.item-num { text-align: right; font-weight: 600; color: #0f172a; white-space: nowrap;}
.btn-remove-row { color: #ef4444; cursor: pointer; margin-left: 10px; opacity: 0.7; transition: 0.3s;}
.btn-remove-row:hover { opacity: 1; }

.btn-add-line { background: #ecfdf5; color: #10b981; border: 1.5px dashed #10b981; padding: 10px 20px; border-radius: 6px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: 0.3s; width: 100%; justify-content: center;}
.btn-add-line:hover { background: #10b981; color: white;}

.totals-section { display: flex; justify-content: flex-end; margin-top: 30px; margin-bottom: 40px;}
.totals-box { width: 350px; }
.total-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 15px; color: #334155;}
.total-row input { width: 100px; padding: 6px 10px; border: 1px solid #e2e8f0; border-radius: 4px; text-align: right; outline: none;}
.total-row input:focus { border-color: #10b981;}
.grand-total { font-size: 20px; font-weight: 800; color: #0f172a; border-top: 2px solid #e2e8f0; padding-top: 15px; margin-top: 15px;}
.balance-due { font-size: 22px; color: #10b981; font-weight: 800;}

.actions-panel { background: #ffffff; padding: 25px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); border: 1px solid #e2e8f0; position: sticky; top: 100px;}
.action-label { font-size: 13px; font-weight: 700; color: #64748b; text-transform: uppercase; margin-bottom: 8px; display: block;}
.custom-select { width: 100%; padding: 12px; border: 1px solid #cbd5e1; border-radius: 8px; margin-bottom: 20px; font-size: 14px; outline: none; background: #f8fafc;}

.btn-download { width: 100%; background: linear-gradient(135deg, #10b981, #059669); color: white; border: none; padding: 16px; border-radius: 8px; font-size: 16px; font-weight: 700; cursor: pointer; transition: 0.3s; display: flex; justify-content: center; align-items: center; gap: 10px; box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);}
.btn-download:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);}

.btn-save { width: 100%; background: white; color: #0f172a; border: 1px solid #cbd5e1; padding: 14px; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; transition: 0.3s; margin-top: 10px; display: flex; justify-content: center; align-items: center; gap: 8px;}
.btn-save:hover { background: #f8fafc; border-color: #94a3b8;}

@media (max-width: 1024px) {
    .builder-wrapper { grid-template-columns: 1fr; }
    .actions-panel { position: relative; top: 0;}
    .invoice-editor { padding: 30px 20px;}
    .info-grid, .meta-grid { grid-template-columns: 1fr; gap: 20px;}
    .meta-item { justify-content: space-between;}
}