/* =====================================================
   OFFER - GLOBALT
   ===================================================== */
.offer-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
}

.offer-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.offer-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.offer-filter-row {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.offer-filter-row input,
.offer-filter-row select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background: white;
    box-sizing: border-box;
}

.offer-filter-row input {
    width: 100%;
    max-width: 300px;
}

/* =====================================================
   OFFER - HEADER
   ===================================================== */
.offer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
}

.offer-header h1 {
    margin: 0;
    font-size: 28px;
    color: #2f4050;
}

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

/* =====================================================
   OFFER - BOXAR / GRID
   ===================================================== */
.offer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.offer-box {
    background: #f9fafc;
    border: 1px solid #e3e7ee;
    border-radius: 8px;
    padding: 15px;
}

.offer-box h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 16px;
    color: #2f4050;
}

.offer-box p {
    margin: 0;
    line-height: 1.6;
}

/* =====================================================
   OFFER - TABELLER
   ===================================================== */
.offer-table,
.print-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
}

.offer-table th,
.offer-table td,
.print-items-table th,
.print-items-table td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
    vertical-align: top;
}

.offer-table th,
.print-items-table th {
    background: #f2f2f2;
    text-align: left;
}

.offer-table .right,
.print-items-table .right {
    text-align: right;
}
table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 12px;
}

th, td {
    padding: 5px 6px;
    border-bottom: 1px solid #ddd;
    vertical-align: top;
}
/* Rubriker lite tydligare */
th {
    font-size: 12px;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th.sortable:hover {
    background: #e9ecef;
}

.nowrap {
    white-space: nowrap;
}

.actions-cell {
    white-space: nowrap;
}

.actions-cell .btn-small {
    padding: 5px 8px;
    font-size: 12px;
    margin-right: 6px;
    margin-bottom: 4px;
}
.actions-cell {
    white-space: nowrap;
    vertical-align: top;
}

.action-buttons-vertical {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.btn-small {
    font-size: 11px;
    padding: 4px 6px;
    line-height: 1.2;
}
th:nth-child(8),
td:nth-child(8) {
    width: 110px;
}
/* =====================================================
   OFFER - TOTALER
   ===================================================== */
.offer-totals,
.invoice-totals {
    margin-top: 20px;
    max-width: 320px;
    margin-left: auto;
    background: #f9fafc;
    border: 1px solid #e3e7ee;
    border-radius: 8px;
    padding: 15px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.total-final {
    font-size: 18px;
    font-weight: bold;
    border-top: 1px solid #ddd;
    padding-top: 10px;
    margin-top: 10px;
}

/* =====================================================
   OFFER - FOOTER TEXT
   ===================================================== */
.offer-footer-text {
    margin-top: 20px;
    font-size: 11px;
    color: #333;
    line-height: 1.4;
}

/* =====================================================
   OFFER - STATUSBADGES
   ===================================================== */
.status {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}

.status.offert {
    background: #6c757d;
    color: white;
}

.status.accepterad {
    background: #28a745;
    color: white;
}

.status.levererad {
    background: #17a2b8;
    color: white;
}

.status.fakturerad {
    background: #007bff;
    color: white;
}

/* =====================================================
   OFFER - UTSKRIFT
   ===================================================== */
.print-view {
    display: none;
    position: relative;
}

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

.print-logo img,
.logo-preview-print {
    max-width: 160px;
    max-height: 60px;
    object-fit: contain;
    display: block;
}

.print-title h1 {
    margin: 0;
    font-size: 28px;
    color: #2f4050;
}

.print-title .invoice-number {
    margin-top: 6px;
    font-size: 14px;
    color: #444;
}

.invoice-status-print {
    margin-top: 10px;
    font-weight: bold;
    font-size: 14px;
}

.invoice-status-print.paid {
    color: #28a745;
}

.invoice-status-print.unpaid {
    color: #dc3545;
}

.print-top-info {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
    align-items: flex-start;
}

.print-info-left,
.print-recipient-box {
    width: 48%;
    border: 1px solid #000;
    padding: 10px;
    min-height: 90px;
    box-sizing: border-box;
    font-size: 11px;
    background: #fff;
}

.print-box {
    width: 48% !important;
    box-sizing: border-box !important;
    min-height: 120px !important; /* ✅ gör dem jämna */
}

.print-box h3 {
    margin: 0 0 8px 0;
    font-size: 12px;
}

.print-info-grid {
    display: flex !important;
    gap: 18px !important;
    margin-bottom: 18px !important;
    align-items: stretch !important; /* ✅ viktigt */
}


.print-bottom-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 18px;
    align-items: start;
}

.print-payment-left,
.print-payment-right {
    border: 1px solid #000;
    padding: 12px;
    min-height: 170px;
    box-sizing: border-box;
    background: #fff;
    font-size: 11px;
}

.print-payment-left {
    display: flex;
    flex-direction: column;
}

.print-payment-left .payment-row,
.print-payment-right .total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    line-height: 1.35;
}

.print-payment-left .invoice-qr {
    margin-top: auto;
    padding-top: 10px;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
}

.print-footer {
    margin-top: 18px;
    padding-top: 8px;
    border-top: 1px solid #000;
    font-size: 10px;
    line-height: 1.4;
    color: #333;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* =====================================================
   OFFER - STÄMPLAR
   ===================================================== */
.accepted-stamp {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-20deg);
    font-size: 72px;
    font-weight: bold;
    color: rgba(40, 167, 69, 0.18);
    border: 6px solid rgba(40, 167, 69, 0.18);
    padding: 10px 30px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 6px;
    z-index: 999;
    pointer-events: none;
    white-space: nowrap;
}

/* =====================================================
   OFFER - MODAL
   ===================================================== */
.email-modal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.email-modal-content {
    background: white;
    width: 800px;
    max-width: 95%;
    margin: 60px auto;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

.email-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.email-preview-row {
    margin-bottom: 10px;
    font-size: 14px;
}

.email-preview-body {
    border: 1px solid #ddd;
    background: #fafafa;
    padding: 15px;
    min-height: 220px;
    line-height: 1.5;
    font-size: 14px;
    white-space: normal;
}

/* =====================================================
   OFFER - FORMULÄR
   ===================================================== */
.form-grid {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 10px 20px;
    max-width: 1000px;
    margin-bottom: 30px;
}

.form-grid label {
    align-self: center;
    font-weight: bold;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    width: 100%;
    box-sizing: border-box;
}

.btn-row {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* =====================================================
   OFFER - RADER I FORMULÄR
   ===================================================== */
.row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.row input {
    width: 120px;
}

.row .desc {
    width: 250px;
}

.row .sum {
    background: #eee;
}

/* =====================================================
   OFFER - KLICKBARA RUBRIKER / FILTER
   ===================================================== */
th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th.sortable:hover {
    background: #e9ecef;
}

.offer-filter-row {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.offer-filter-row input,
.offer-filter-row select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background: white;
    box-sizing: border-box;
}

.offer-filter-row input {
    width: 100%;
    max-width: 300px;
}

/* =====================================================
   OFFER - DISABLED KNAPPAR
   ===================================================== */
button:disabled,
.btn:disabled {
    background: #c7c7c7 !important;
    color: #777 !important;
    cursor: not-allowed !important;
    opacity: 0.55;
    box-shadow: none !important;
    border-color: #bdbdbd !important;
}

button:disabled:hover,
.btn:disabled:hover {
    background: #c7c7c7 !important;
}

/* =====================================================
   OFFER - SKÄRM / UTSKRIFT
   ===================================================== */
.no-print {
    display: block;
}

.print-only {
    display: none;
}

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

    .print-view,
    .print-only {
        display: block !important;
    }

    .accepted-stamp {
        display: block;
    }

    .print-view {
        position: relative;
    }

    .email-modal {
        display: none !important;
    }
    .print-view .invoice-status,
    .print-view .invoice-status-print {
        display: none !important;
    }


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

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

}
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 6px 8px;
    border-bottom: 1px solid #ddd;
    vertical-align: top;
    font-size: 13px;
}

th {
    font-size: 12px;
}

.nowrap {
    white-space: nowrap;
}

.action-buttons-vertical {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.btn-small {
    font-size: 11px;
    padding: 4px 6px;
}

.status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
}