﻿:root{
    --brand-red: #B40002;
    --brand-red-dark: #8A0001;
    --brand-bg: #FFF5F6;
    --brand-bg-strong: #FCF2F3;
    --brand-bg-soft: #FFFAFB;
    --brand-ink: #1F1F1F;
    --brand-muted: #6B5B5C;
    --brand-sidebar: #2B0B0C;
    --brand-sidebar-border: #3A0F10;
}

body{margin:0;font-family:'Montserrat',Arial,Helvetica,sans-serif;background:var(--brand-bg);display:flex;flex-direction:column;color:var(--brand-ink)}
h1,h2,h3{letter-spacing:.2px}
h2{font-size:22px;margin:0 0 18px 0}

#sidebar .logo-row{
    display:flex;
    align-items:center;
    justify-content:center;
    padding: 0 15px;
    flex: 0 0 auto;
}
#sidebar .logo-row img{
    width:140px;
    height:auto;
    display:block;
}
.login-logo{
    width:240px;
    height:auto;
    margin: 0 auto 12px auto;
    display:block;
}

#sidebar.crm-sidebar-shell{
    width:100%;
    background:var(--brand-sidebar);
    color:white;
    position:fixed;
    top:0;left:0;
    padding:10px 14px;
    z-index:1000;
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:10px 12px;
    flex-wrap:wrap;
    overflow-x:visible;
    white-space:normal;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    border-bottom: 1px solid #3d1416;
    box-sizing:border-box;
}
.crm-sidebar-shell__lead{
    display:flex;
    flex-direction:column;
    gap:6px;
    flex:0 1 auto;
    min-width:140px;
}
.crm-sidebar-shell__lead .logo-row{
    padding:0;
    justify-content:flex-start;
}
.crm-sidebar-shell__nav{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:8px;
    flex:1 1 280px;
    justify-content:center;
}
.crm-sidebar-shell__actions{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:8px;
    margin-left:auto;
}
.crm-sidebar-shell__actions .btn-icon-toolbar{
    width:32px;
    height:32px;
    min-width:32px;
    min-height:32px;
}
#sidebar h2{
    margin:0 0 20px 20px;
}

#content{
    margin-left:0;
    margin-top:92px;
    padding:24px;
    width:100%;
    background: transparent;
    min-height: calc(100vh - 60px);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}


label{font-weight:bold}
input, select, textarea{
    padding:9px 10px;
    border:1px solid #d9d9d9;
    border-radius:10px;
    width:100%;
    box-sizing:border-box;
    background:#fff;
}
button{
    padding:10px 18px;
    background:var(--brand-red);
    color:white;
    border:none;
    border-radius:10px;
    cursor:pointer;
    transition: background .2s, box-shadow .2s, transform .1s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
button:hover{background:var(--brand-red-dark)}
button:active{transform: translateY(1px)}
.button-row{
    display:flex;
    gap:10px;
    align-items:center;
    flex-wrap:nowrap;
    overflow-x:auto;
}
.button-row button{flex:0 0 auto;}
.button-row select{
    flex: 0 0 auto;
    max-width: 220px;
}
.tab-toggle{
    background: var(--brand-red);
}
.tab-toggle.active{
    background: var(--brand-red-dark);
}

.action-button {
    width: 30px;
    height: 30px;
    padding: 0;
    margin: 0;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    color: var(--brand-ink);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: transform .1s ease, box-shadow .2s ease, filter .2s ease;
}
.action-button:hover { filter: brightness(0.97); }
.action-button:active { transform: translateY(1px); }
.action-button.details,
.action-button.edit,
.action-button.delete { border-color: #d9d9d9; }
.actions-inline{
    display:inline-flex;
    align-items:center;
    gap:6px;
    white-space:nowrap;
}

.priority-flag{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width: 38px;
    height: 28px;
    border-radius: 8px;
    font-size: 18px;
    line-height: 1;
    user-select: none;
}
.priority-flag.on{
    background: #E8F6EE;
    border: 1px solid #28a745;
}
.priority-flag.off{
    background: #FDECEC;
    border: 1px solid #d9534f;
}
.priority-flag.editable{
    cursor: pointer;
}
.priority-flag.disabled{
    opacity: 0.65;
    cursor: not-allowed;
}

.tab-hint {
    font-size: 0.82rem;
    color: #6b6366;
    margin: -0.35rem 0 0.85rem;
    line-height: 1.45;
    max-width: 52rem;
}

.copy-status-hint {
    font-size: 0.8rem;
    color: #047857;
    font-weight: 600;
    margin-left: 0.35rem;
}

.discount-sent-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.discount-sent-badge__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    font-size: 0.72rem;
    line-height: 1;
}

.discount-sent-badge--yes {
    color: #047857;
}

.discount-sent-badge--yes .discount-sent-badge__icon {
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
}

.discount-sent-badge--sms {
    color: #1d4ed8;
}

.discount-sent-badge--sms .discount-sent-badge__icon {
    background: #eff6ff;
    border: 1px solid #93c5fd;
}

.discount-sent-badge--no {
    color: #9ca3af;
    font-weight: 500;
}

.discount-sent-badge__date {
    font-size: 0.72rem;
    font-weight: 500;
    color: #6b7280;
}

.wysylka-cell{
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.wysylka-date{
    font-size: 14px;
    color: #6B5B5C;
    line-height: 1.3;
}


input:focus, select:focus, textarea:focus {
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px rgba(180, 0, 2, 0.2);
    outline: none;
}

#progress-container{
    width:100%;height:14px;background:var(--brand-bg-strong);margin-top:15px;
    border-radius:8px;overflow:hidden;display:none;transition:opacity .4s;
}
#progress-bar{
    width:0%;height:100%;background:var(--brand-red);transition:width .2s;
}
#progress-text{
    font-weight:bold;margin-top:4px;display:none;
}
.success-message {
    font-weight: bold;
    margin-top: 15px;
}

.tab { display:none; }
.tab.active {
    display:block;
    background:#fff;
    border-radius:14px;
    padding:22px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}

table.dataTable{width:100%!important;background:white;border-radius:12px;overflow:hidden}
table.dataTable tbody tr{
    border-bottom:1px solid #efefef;
}
table.dataTable tbody tr:hover{
    background:#faf7f7;
}
table.dataTable thead th{
    background:var(--brand-bg-strong);
    border-bottom:2px solid var(--brand-red);
    font-weight:600;
}
.filters th input{
    width:100%;padding:6px 8px;font-size:12px;margin-top:6px;border-radius:8px
}

/* Bardziej skondensowany widok wszystkich tabel */
table.dataTable thead th,
table.dataTable tbody td {
    padding: 8px 10px !important;
    font-size: 12px;
    line-height: 1.2;
}
table.dataTable tbody tr {
    height: 32px;
}
.filters th input{
    padding:4px 6px;
    font-size:11px;
    margin-top:4px;
}
.my-contacts-tabs{
    display:flex;
    gap:10px;
    margin: -6px 0 12px 0;
}
.dataTables_processing {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    background: white;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    z-index: 10000;
}


.modal-overlay{
    display:none; position:fixed; top:0; left:0; width:100%; height:100%;
    background:rgba(0,0,0,0.6); justify-content:center; align-items:center; z-index:9999;
}
.modal-overlay .box{
    background:white; width:650px; max-height:90vh; overflow-y:auto;
    border-radius:10px; padding:20px; position:relative;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}
.sales-report{
    display:flex;
    flex-direction:column;
    gap:12px;
    font-size:14px;
}
.sales-report .meta{
    background: var(--brand-bg-strong);
    border: 1px solid #e6dcdc;
    border-radius: 8px;
    padding: 10px 12px;
    line-height: 1.4;
}
.sales-report .meta .title{
    font-weight: 700;
    font-size: 16px;
}
.sales-report .meta .subtitle{
    color: #555;
    margin-top: 2px;
}
.sales-report .lines{
    margin: 0;
    padding-left: 18px;
}
.sales-report .lines li{
    margin: 4px 0;
}
.sales-report .value{
    font-weight: 700;
    color: var(--brand-red);
}
.sales-tooltip{
    position: fixed;
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    color: #1F1F1F;
    max-width: 380px;
    z-index: 100000;
    display: none;
}
.sales-tooltip.show{ display: block; }
.sales-tooltip .title{ font-weight: 700; margin-bottom: 4px; }
.sales-tooltip .subtitle{ color: #666; margin-bottom: 6px; }
.sales-tooltip ul{ margin: 0; padding-left: 16px; }
.sales-tooltip li{ margin: 2px 0; }
.modal-overlay .close{
    position:absolute; top:10px; right:15px; cursor:pointer; font-size:22px;
}

#detailsModal{ display:none; }
#detailsModal .box{ width: 650px; }

#addContactModal .box, #editContactModal .box {
    width: 700px;
}

#offer.tab.active {
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: stretch;
    min-height: calc(100vh - 210px);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

#offer-sms.tab.active{
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: stretch;
    min-height: calc(100vh - 210px);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}


.controls-panel {
    flex: 1 1 0;
    min-width: 0;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #e6d8d8;
    background: linear-gradient(180deg, #f6f7f8 0%, #eef1f3 100%);
    overflow-y: auto;
    max-height: none;
    min-height: calc(100vh - 260px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 22px rgba(0,0,0,0.06);
}

.email-preview-panel {
    flex: 1 1 0;
    min-width: 0;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #e7d9da;
    background: linear-gradient(180deg, #fbfcfd 0%, #f6f8fa 100%);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    align-items: stretch;
    min-height: calc(100vh - 260px);
    box-shadow: 0 8px 22px rgba(0,0,0,0.06);
}
.sms-preview-panel{
    flex: 0 0 50%;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #ccc;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.phone-mock{
    width: 272px;
    height: 548px;
    border-radius: 44px;
    border: 7px solid #111111;
    background: #0f0f10;
    box-shadow:
        0 24px 48px rgba(0,0,0,0.28),
        inset 0 1px 0 rgba(255,255,255,0.08);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.phone-mock::before{
    content: "";
    position: absolute;
    inset: 7px;
    border-radius: 36px;
    pointer-events: none;
    background: linear-gradient(165deg, rgba(255,255,255,0.14) 0%, rgba(255,255,255,0.03) 22%, rgba(255,255,255,0) 40%);
}
.phone-notch{
    position: absolute;
    top: 12px;
    width: 116px;
    height: 26px;
    background: #0c0c0d;
    border-radius: 14px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.phone-notch::before{
    content: "";
    position: absolute;
    left: 50%;
    top: 9px;
    transform: translateX(-50%);
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: #1d1d1f;
}
.phone-screen{
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    background: #f5f5f7;
    border-radius: 36px;
    padding: 16px;
    box-sizing: border-box;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}
.sms-bubble{
    background: #ffffff;
    border-radius: 20px;
    padding: 12px 14px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-wrap;
    color: #1F1F1F;
    height: 100%;
    overflow: hidden;
}
.sms-counter-panel{
    width: 100%;
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f8f8f8 100%);
    border: 1px solid #ececec;
    display:flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    padding: 22px 16px;
}
.sms-counter{
    width: 100%;
    height: 100%;
    display:flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
}
.sms-counter-value{
    font-size: 54px;
    font-weight: 700;
    color: var(--brand-red);
    line-height: 1;
}
.sms-counter-label{
    margin-top: 6px;
    font-size: 13px;
    color: #666;
    letter-spacing: 0.2px;
}
.sms-counter-logo{
    width: 120px;
    height: auto;
    margin-bottom: 16px;
}
.sms-counter-divider{
    width: 60%;
    height: 1px;
    background: #e8e8e8;
    margin: 12px 0;
}
.sms-counter-pill{
    margin-top: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid #f0d7d7;
    background: #fff5f6;
    color: #8A0001;
    font-size: 12px;
    font-weight: 600;
}

.input-group-highlight {
    border: 1px solid #d8b6b8;
    border-radius: 12px;
    padding: 15px;
    background: #ffffff;
    margin-bottom: 20px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}

#message-text, #footer-text, #sent-message-text, #sent-footer-text {
    width: calc(100% - 20px);
    min-height: 100px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 0;
    font-family: 'Montserrat', 'Century Gothic', 'Segoe UI', 'Arial', sans-serif;
    font-size: 14px;
    resize: vertical;
}

#footer-text.drag-over, #sent-footer-text.drag-over {
    border: 2px dashed var(--brand-red);
    background-color: #ffebeb;
}

.discount-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 0;
    align-items: center;
}

.discount-controls div {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.discount-controls label {
    font-weight: bold;
    font-size: 14px;
}

.discount-controls input[type="text"],
.discount-controls input[type="number"] {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.discount-controls input[type="text"]::placeholder,
.discount-controls input[type="number"]::placeholder{
    color: #b6b6b6;
    font-weight: 500;
}

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}
.offer-filter-toggle{
    display:flex;
    justify-content:flex-end;
    margin: 4px 0 10px 0;
}
.offer-filters.collapsed{
    display:none;
}
.brand-checkbox{
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--brand-red);
    border-radius: 4px;
    background: #fff;
    display: inline-grid;
    place-content: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.brand-checkbox:checked{
    background: var(--brand-red);
    border-color: var(--brand-red);
}
.brand-checkbox:checked::after{
    content: "";
    width: 5px;
    height: 10px;
    border: 2px solid #fff;
    border-top: 0;
    border-left: 0;
    transform: rotate(45deg);
}
.brand-checkbox:focus-visible{
    outline: 3px solid rgba(180, 0, 2, 0.25);
    outline-offset: 2px;
}
.brand-checkbox:disabled{
    opacity: 0.6;
    cursor: not-allowed;
}

.filter-buttons {
    margin-bottom: 15px;
    display:flex;
    gap:10px;
    flex-wrap:nowrap;
    align-items:center;
}
.tag-filter{
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
}
.tag-filter-toggle{
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: var(--brand-red);
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    text-align: left;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.tag-filter-toggle:hover{
    background: var(--brand-red-dark);
}
.tag-filter-panel{
    position: absolute;
    top: calc(100% + 6px);
    left: auto;
    right: 0;
    z-index: 9999;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    padding: 8px;
    min-width: 220px;
    max-height: 220px;
    overflow: auto;
    display: none;
    text-align: left;
    align-items: flex-start;
    flex-direction: column;
}
.tag-filter-panel.open{
    display: flex;
}
.tag-filter-item{
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 4px 2px;
    text-align: left;
    justify-content: flex-start;
    width: 100%;
}
.tag-filter-item input[type="checkbox"]{
    margin: 0;
}
.tag-filter-item span{
    text-align: left;
    flex: 1;
}
#myClientsTable_wrapper,
#myClientsTable_wrapper .dataTables_scroll,
#myClientsTable_wrapper .dataTables_scrollHead,
#myClientsTable_wrapper .dataTables_scrollBody{
    overflow: visible !important;
}
#myClientsTable thead th{
    position: relative;
}

.filter-controls label {
    font-weight: bold;
    white-space: nowrap;
}

.filter-controls input[type="text"],
.filter-controls input[type="date"] {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    flex-grow: 1;
    min-width: 100px;
}

.filter-buttons button {
    padding: 8px 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background-color: #5cb85c;
    color: white;
    font-weight: bold;
    transition: background-color 0.2s, transform 0.1s;
}

.filter-buttons button:hover {
    background-color: #4cae4c;
}
.filter-buttons button:active {
    transform: translateY(1px);
}

.table-container {
    border: 1px solid #e1e1e1;
    border-radius: 12px;
    background-color: #fff;
    flex-grow: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.4);
}

.scrollable-body {
    max-height: calc(20 * 40px + 12px);
    overflow-y: auto;
    overflow-x: hidden;
    display: block;
    width: 100%;
}

#events-table, #events-body-table, #sent-events-table, #sent-events-body-table,
#sms-events-table, #sms-events-body-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

#events-table thead th, #sent-events-table thead th, #sms-events-table thead th {
    background-color: #f4f5f6;
    padding: 10px 8px;
    text-align: left;
    border-bottom: 2px solid var(--brand-red);
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: 12px;
    letter-spacing: 0.2px;
    text-transform: uppercase;
}

#events-body-table tbody td, #sent-events-body-table tbody td, #sms-events-body-table tbody td {
    padding: 8px;
    border: 1px solid #e0e0e0;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    background-color: #fff;
    font-size: 13px;
    height: 40px;
    line-height: 1.3;
}

#events-table tbody tr:hover, #events-body-table tbody tr:hover,
#sent-events-table tbody tr:hover, #sent-events-body-table tbody tr:hover,
#sms-events-table tbody tr:hover, #sms-events-body-table tbody tr:hover {
    background-color: #f5f5f5;
}

#events-table th:nth-child(1), #events-body-table td:nth-child(1),
#sent-events-table th:nth-child(1), #sent-events-body-table td:nth-child(1),
#sms-events-table th:nth-child(1), #sms-events-body-table td:nth-child(1) {
    width: 25px;
    text-align: center;
}

#events-body-table td:nth-child(1) input[type="checkbox"],
#sent-events-body-table td:nth-child(1) input[type="checkbox"],
#sms-events-body-table td:nth-child(1) input[type="checkbox"] {
    margin: 0 !important;
    padding: 0 !important;
    vertical-align: middle;
}

#events-table th:nth-child(2), #events-body-table td:nth-child(2),
#sent-events-table th:nth-child(2), #sent-events-body-table td:nth-child(2),
#sms-events-table th:nth-child(2), #sms-events-body-table td:nth-child(2) {
    display: none;
}

#events-table th:nth-child(3), #events-body-table td:nth-child(3),
#sent-events-table th:nth-child(3), #sent-events-body-table td:nth-child(3),
#sms-events-table th:nth-child(3), #sms-events-body-table td:nth-child(3) {
    width: 40%;
    white-space: normal;
    overflow: visible;
}

#events-table th:nth-child(4), #events-body-table td:nth-child(4),
#sent-events-table th:nth-child(4), #sent-events-body-table td:nth-child(4),
#sms-events-table th:nth-child(4), #sms-events-body-table td:nth-child(4) {
    width: 18%;
}

#events-table th:nth-child(5), #events-body-table td:nth-child(5),
#sent-events-table th:nth-child(5), #sent-events-body-table td:nth-child(5),
#sms-events-table th:nth-child(5), #sms-events-body-table td:nth-child(5) {
    width: 14%;
}

#events-table th:nth-child(6), #events-body-table td:nth-child(6),
#sent-events-table th:nth-child(6), #sent-events-body-table td:nth-child(6) {
    width: 10%;
}

#events-table th:nth-child(7), #events-body-table td:nth-child(7),
#sent-events-table th:nth-child(7), #sent-events-body-table td:nth-child(7),
#sms-events-table th:nth-child(6), #sms-events-body-table td:nth-child(6) {
    width: 20%;
    white-space: normal;
    overflow: visible;
}

#events-body-table td:nth-child(6) input.offer-discount-input,
#sent-events-body-table td:nth-child(6) input.offer-discount-input {
    width: 64px !important;
    max-width: 100%;
}

.offer-status-col {
    vertical-align: middle;
}

.offer-status-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.28rem;
    min-width: 0;
}

.offer-status-cell__rabat,
.offer-status-cell__sent-rabat {
    font-size: 0.72rem;
    font-weight: 600;
    color: #4b5563;
    line-height: 1.2;
}

.offer-status-cell__sent-rabat--unknown {
    font-weight: 500;
    color: #9ca3af;
}

.wysylka-cell__rabat {
    font-size: 0.72rem;
    font-weight: 600;
    color: #4b5563;
    margin-top: 0.15rem;
}

.loading, .error {
    text-align: center;
    padding: 15px;
}

.error {
    color: var(--brand-red);
    font-weight: bold;
}

.event-label {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.3;
}
.event-label > span{
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
}
.sales-info-icon{
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    color: var(--brand-red);
    padding: 0;
    margin-left: auto;
}
.sales-info-icon:focus-visible{
    outline: 2px solid rgba(180, 0, 2, 0.25);
    outline-offset: 2px;
}
.sales-info-icon:hover{
    filter: brightness(0.9);
}
.sales-info-icon:focus-visible{
    outline: 2px solid rgba(180, 0, 2, 0.25);
    outline-offset: 2px;
}

#email-preview-wrapper, #sent-email-preview-wrapper {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    border: 1px solid #dfd3d4;
    border-radius: 12px;
    padding: 10px;
    max-width: none;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    background: #fff;
}

.email-preview,
.sent-email-preview,
#email-preview,
#sent-email-preview {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.email-preview table,
.sent-email-preview table {
    max-width: 100% !important;
}

.email-preview img,
.sent-email-preview img {
    max-width: 100% !important;
    height: auto !important;
}

.email-preview table[width="640"], .sent-email-preview table[width="640"] {
    width: 100% !important;
}

.copy-button {
    padding: 10px 25px;
    background-color: var(--brand-red);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
    font-weight: bold;
    display: block;
    margin: 16px auto 0 auto;
}

#offer .controls-panel > div:first-child,
#offer .email-preview-panel > h2 {
    padding-bottom: 8px;
    border-bottom: 1px solid #ead9da;
}

#offer #copy-message {
    min-height: 20px;
}

.copy-button:hover {
    background-color: var(--brand-red-dark);
}

.copy-button.saved-feedback {
    background-color: #1a7f37;
}

.copy-button.saved-feedback:hover {
    background-color: #1a7f37;
}

#copy-message, #sent-copy-message {
    margin-top: 10px;
    text-align: left;
    padding-left: 5px;
}

#emailPreview {
    border: 1px solid #ccc;
    min-height: 400px;
    overflow-y: auto;
    background-color: #f7f7f7;
    margin-top: 10px;
}

#emailHtmlOutput {
    width: 100%;
    height: 100px;
    margin-top: 10px;
    font-family: monospace;
    font-size: 12px;
    display: none;
}

@media (max-width: 1200px) {
    #offer.tab.active {
        flex-direction: column;
    }
    #offer-sms.tab.active{
        flex-direction: column;
    }
    .controls-panel {
        flex: auto;
        border-right: none;
        padding-right: 0;
        max-height: none;
    }
    .email-preview-panel {
        margin-top: 20px;
    }
}

@media (max-width: 900px) {
    #sidebar {
        flex-wrap: wrap;
        padding: 8px 0;
    }
    .side-item {
        display: inline-block;
        padding: 10px 12px;
        border-right: 1px solid var(--brand-sidebar-border);
    }
    #content {
        margin-left: 0;
        margin-top: 100px;
        width: 100%;
        padding: 15px;
        box-shadow: none;
    }
    #crm > div:first-of-type {
        flex-direction: column;
        gap: 10px !important;
    }
    #crm > div:first-of-type > div:last-child {
        display: block !important;
        align-items: stretch !important;
    }
    #crm > div:first-of-type > div:last-child button {
        width: 100%;
    }
    .modal-overlay .box {
        width: 95%;
        margin: 20px 0;
    }
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.dashboard-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    border-top: 4px solid var(--brand-red);
}

.dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.dashboard-card h3 {
    margin: 0 0 10px 0;
    color: #1F1F1F;
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dashboard-card .stat-value {
    font-size: 48px;
    font-weight: bold;
    color: var(--brand-red);
    margin: 15px 0;
}

.dashboard-card .stat-label {
    font-size: 14px;
    color: #666;
}

.dashboard-tables{
    display:flex;
    gap: 20px;
    align-items: flex-start;
}
.dashboard-tables .top-events-table{
    flex: 1 1 0;
}
@media (max-width: 1200px){
    .dashboard-tables{ flex-direction: column; }
}
.top-events-table {
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.top-events-table h3 {
    margin: 0;
    padding: 20px 25px;
    background: var(--brand-bg-strong);
    color: var(--brand-ink);
    font-size: 18px;
    border-bottom: 3px solid var(--brand-red);
}

.top-events-table table {
    width: 100%;
    border-collapse: collapse;
}

.top-events-table thead {
    background: #F8F8F8;
}

.top-events-table th {
    padding: 15px;
    text-align: left;
    font-weight: bold;
    color: var(--brand-ink);
    border-bottom: 2px solid var(--brand-red);
}

.top-events-table td {
    padding: 15px;
    border-bottom: 1px solid #E8E8E8;
}

.top-events-table tbody tr:hover {
    background: var(--brand-bg-strong);
}

.top-events-table .position {
    font-weight: bold;
    color: var(--brand-red);
    font-size: 18px;
    width: 50px;
    text-align: center;
}

.top-events-table .discount-value {
    font-weight: bold;
    color: #5cb85c;
    font-size: 18px;
}

.dashboard-loading {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}
#login-overlay {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2B0B0C 0%, #B40002 100%);
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

#login-overlay.hidden {
    display: none;
}

.login-box {
    background: white;
    width: 420px;
    padding: 50px 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    text-align: center;
}
.login-progress{
    margin: 12px 0 18px 0;
    text-align: left;
    display: none;
}
.login-progress .label{
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
}
.login-progress .bar{
    width: 100%;
    height: 8px;
    background: #f0f0f0;
    border-radius: 999px;
    overflow: hidden;
}
.login-progress .bar > span{
    display: block;
    height: 100%;
    width: 0%;
    background: var(--brand-red);
    transition: width 0.2s ease;
}

.login-box h1 {
    margin: 0 0 10px 0;
    color: var(--brand-ink);
    font-size: 32px;
    font-weight: bold;
}

.login-box .subtitle {
    color: #666;
    margin-bottom: 35px;
    font-size: 14px;
}

.login-box .input-group {
    margin-bottom: 20px;
    text-align: left;
}

.login-box .input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--brand-ink);
    font-size: 14px;
}

.login-box .input-group input {
    width: 100%;
    padding: 14px;
    border: 2px solid #E0E0E0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.login-box .input-group input:focus {
    border-color: var(--brand-red);
    outline: none;
}

.login-box button {
    width: 100%;
    padding: 14px;
    background: var(--brand-red);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 10px;
}

.login-box button:hover {
    background: var(--brand-red-dark);
}

.login-error {
    color: var(--brand-red);
    font-size: 14px;
    margin-top: 15px;
    display: none;
}

.login-error.show {
    display: block;
}

#toast-container{
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
    pointer-events: none;
    display: none;
}
.status-bar{
    position: fixed;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    background: #ffffff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    color: #1F1F1F;
    line-height: 1.35;
    min-width: 260px;
    max-width: 760px;
    display: none;
    z-index: 100000;
}
.status-bar.show{
    display: flex;
    align-items: center;
    gap: 10px;
}
.status-bar.success{border-left: 5px solid #28a745;}
.status-bar.error{border-left: 5px solid #d9534f;}
.status-bar.info{border-left: 5px solid #5bc0de;}
.status-bar.warn{border-left: 5px solid #f0ad4e;}
.status-bar .status-bar-title{
    font-weight: 700;
    margin: 0 0 2px 0;
}
.status-bar .status-bar-msg{
    margin: 0;
    color: #333;
    word-break: break-word;
}
.status-bar .status-bar-close{
    margin-left: auto;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #777;
    font-size: 16px;
    line-height: 1;
    padding: 2px 4px;
}
.toast{
    pointer-events: auto;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    color: #1F1F1F;
    line-height: 1.35;
}
.toast .toast-row{
    display:flex;
    align-items:flex-start;
    gap:10px;
}
.toast .toast-icon{
    font-size: 18px;
    line-height: 1;
    margin-top: 1px;
}
.toast .toast-title{
    font-weight: 700;
    margin: 0 0 2px 0;
}
.toast .toast-msg{
    margin: 0;
    color: #333;
    word-break: break-word;
}
.toast .toast-close{
    margin-left: auto;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #777;
    font-size: 16px;
    line-height: 1;
    padding: 2px 4px;
}
.toast.success{border-left: 5px solid #28a745;}
.toast.error{border-left: 5px solid #d9534f;}
.toast.info{border-left: 5px solid #5bc0de;}
.toast.warn{border-left: 5px solid #f0ad4e;}

/* Osadzenie w panelu Symulatora (iframe ?embedded=1) — kolory jak w index.html */
html.crm-embedded{
    --brand-red:#cc0000;
    --brand-red-dark:#a50000;
    --brand-bg:#f6f0f2;
    --brand-bg-strong:#fcf2f3;
    --brand-bg-soft:#fff8f8;
    --brand-ink:#1b1b1b;
    --brand-muted:#6b6366;
}
html.crm-embedded #sidebar{display:none !important;}
html.crm-embedded #content{
    margin-top:0 !important;
    padding:10px 12px 12px;
    min-height:auto;
    width:100%;
}
html.crm-embedded body{overflow-x:auto;overflow-y:auto;-webkit-overflow-scrolling:touch;}
html.crm-embedded .tab:not(#crm){display:none !important;}
html.crm-embedded #crm h2{
    font-size:16px;
    margin:0 0 10px 0;
    font-family:inherit;
    font-weight:700;
}
html.crm-embedded #crm > div:first-of-type{
    display:flex !important;
    flex-wrap:wrap !important;
    gap:10px !important;
    max-width:100% !important;
}
html.crm-embedded #crm > div:first-of-type > div{
    flex:1 1 118px !important;
    min-width:0;
}
html.crm-embedded #crm #csv-btn{margin-top:12px !important;}
html.crm-embedded table.dataTable{font-size:11px;}
html.crm-embedded #login-overlay .login-box{max-width:min(360px,94vw);padding:20px;}
html.crm-embedded .login-logo{max-width:180px;}

/* Radio Switch (toggle) */
.radio-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.radio-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.radio-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 24px;
}
.radio-switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
.radio-switch input:checked + .radio-switch-slider {
    background-color: var(--brand-red);
}
.radio-switch input:checked + .radio-switch-slider:before {
    transform: translateX(20px);
}
.radio-switch input:focus + .radio-switch-slider {
    box-shadow: 0 0 1px var(--brand-red);
}

/* Discount generator filter table styles extracted from crm.html. */
#discount-gen-table tr.filter-row th { text-align: left !important; padding: 2px 4px !important; }
#discount-gen-table th, #discount-gen-table td { text-align: left !important; padding: 4px 6px !important; font-size: 12px; }
#discount-gen-table td { vertical-align: top; }
.excel-filter { position: relative; display: block; }
.filter-btn { 
    background: #f0f0f0; 
    border: 1px solid #ccc; 
    padding: 1px 6px; 
    cursor: pointer; 
    font-size: 10px;
    margin: 0;
    line-height: 1;
}
.filter-btn:hover { background: #e0e0e0; }
.filter-dropdown {
    position: fixed;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 10000;
    min-width: 250px;
    max-height: 350px;
    overflow-y: auto;
    display: none;
    padding: 0;
    margin: 0;
}
.filter-items {
    padding: 0;
    margin: 0;
}
.filter-dropdown.active { display: block; }
.filter-dropdown-item {
    padding: 1px 4px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 3px;
    cursor: pointer;
    font-size: 12px;
    margin: 0;
}
.filter-dropdown-item:hover { background: #f5f5f5; }
.filter-dropdown-item input[type="checkbox"] { 
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}
.filter-dropdown-item span {
    text-align: left;
    flex: 1;
}
.filter-dropdown-header {
    padding: 6px 8px;
    border-bottom: 1px solid #eee;
    background: #f9f9f9;
    font-size: 11px;
}
.filter-dropdown-header button {
    font-size: 10px;
    padding: 2px 6px;
    margin-right: 4px;
    cursor: pointer;
}
.filter-dropdown-footer {
    padding: 6px 8px;
    border-top: 1px solid #eee;
    background: #f9f9f9;
    text-align: center;
}
.filter-dropdown-footer button {
    font-size: 11px;
    padding: 4px 12px;
    cursor: pointer;
    background: #c41230;
    color: white;
    border: none;
    border-radius: 3px;
}

.crm-marketing-consent {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    white-space: nowrap;
}

.crm-marketing-consent-led {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.crm-marketing-consent-label {
    font-size: 12px;
    letter-spacing: 0.02em;
}

.crm-marketing-consent-filter {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 12px;
    padding: 4px 6px;
}

#crmTable.dataTable.compact-crm tbody td,
#crmTable.dataTable.compact-crm thead th {
    padding: 4px 8px;
    font-size: 12px;
    line-height: 1.35;
    vertical-align: middle;
}

#crmTable.dataTable.compact-crm thead tr.filters th {
    padding: 3px 4px;
}

#crmTable.dataTable.compact-crm thead tr.filters input,
#crmTable.dataTable.compact-crm thead tr.filters select {
    font-size: 11px;
    padding: 3px 5px;
}
