.complaints-toolbar,
.complaints-list-header,
.complaint-email-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.complaints-toolbar {
    margin-bottom: 1rem;
}

.complaints-filter-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 180px 180px;
    gap: 0.75rem;
    flex: 1;
}

.complaints-list-header {
    margin-bottom: 0.75rem;
}

.complaints-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.complaints-list-header h3,
.complaints-list-header p {
    margin: 0;
}

.complaints-list-header p,
.complaints-muted {
    color: #64748b;
    font-size: 0.875rem;
}

.complaints-empty {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem;
    color: #64748b;
    background: #fff;
}

.complaint-row {
    cursor: pointer;
}

.complaint-row:hover {
    background: #f8fafc;
}

.complaints-table-wrap {
    overflow-x: hidden;
    width: 100%;
}

.complaints-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
}

.complaints-table th,
.complaints-table td {
    vertical-align: middle;
    min-width: 0 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: normal !important;
    overflow-wrap: normal !important;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.complaints-table th {
    overflow-wrap: normal !important;
    white-space: nowrap !important;
}

.complaints-table td {
    white-space: nowrap !important;
}

.complaints-table td:first-child,
.complaints-table td:nth-child(2),
.complaints-table td:nth-child(3),
.complaints-table td:nth-child(4) {
    white-space: normal !important;
    overflow-wrap: break-word !important;
    text-overflow: clip;
}

.complaint-title-button {
    appearance: none;
    background: none;
    border: 0;
    color: #0f172a;
    cursor: pointer;
    display: inline;
    font: inherit;
    font-weight: 700;
    padding: 0;
    text-align: left;
    white-space: normal;
}

.complaint-title-button:hover {
    color: #0f766e;
    text-decoration: underline;
}

.complaints-col-title {
    width: 29%;
}

.complaints-col-relation {
    width: 15%;
}

.complaints-col-opened {
    width: 10%;
}

.complaints-col-closed {
    width: 11%;
}

.complaints-col-state {
    width: 10%;
}

.complaints-col-assigned {
    width: 10%;
}

.complaints-col-due {
    width: 7%;
}

.complaints-col-email,
.complaints-col-actions {
    width: 4%;
}

.complaints-table--context .complaints-col-title {
    width: 29%;
}

.complaints-table--context .complaints-col-relation {
    width: 14%;
}

.complaints-table--context .complaints-col-opened,
.complaints-table--context .complaints-col-closed,
.complaints-table--context .complaints-col-assigned {
    width: 10%;
}

.complaints-table--context .complaints-col-state {
    width: 11%;
}

.complaints-table--context .complaints-col-due {
    width: 7%;
}

.complaints-table--context .complaints-col-email {
    width: 4%;
}

.complaints-table--context .complaints-col-actions {
    width: 5%;
}

.complaints-table td:nth-last-child(2),
.complaints-table th:nth-last-child(2) {
    text-align: center;
}

.complaints-table td:last-child,
.complaints-table th:last-child {
    text-align: right;
}

.complaint-open-button {
    align-items: center;
    display: inline-flex;
    height: 2rem;
    justify-content: center;
    padding: 0;
    width: 2rem;
}

.complaint-badge-stack {
    align-items: flex-start;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

@media (max-width: 1280px) {
    .complaints-actions-heading {
        color: transparent;
    }

    .complaints-table th,
    .complaints-table td {
        padding-left: 0.55rem;
        padding-right: 0.55rem;
    }
}

.complaint-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.25rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.complaint-thread-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.2rem 0.5rem;
    margin-left: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #0f766e;
    background: #ccfbf1;
    white-space: nowrap;
}

.complaint-status-nyitva {
    color: #1d4ed8;
    background: #dbeafe;
}

.complaint-status-folyamatban {
    color: #92400e;
    background: #fef3c7;
}

.complaint-status-ugyfelre_var {
    color: #7c3aed;
    background: #ede9fe;
}

.complaint-status-kesz {
    color: #166534;
    background: #dcfce7;
}

.complaint-priority-alacsony {
    color: #475569;
    background: #e2e8f0;
}

.complaint-priority-normal {
    color: #0369a1;
    background: #e0f2fe;
}

.complaint-priority-magas {
    color: #b45309;
    background: #ffedd5;
}

.complaint-priority-surgos {
    color: #b91c1c;
    background: #fee2e2;
}

.complaints-modal {
    max-width: 920px;
}

.complaint-project-source-field {
    position: relative;
}

.complaint-project-search-results {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.14);
    left: 0;
    max-height: 260px;
    overflow-y: auto;
    position: absolute;
    right: 0;
    top: calc(100% + 0.25rem);
    z-index: 30;
}

.complaint-project-search-option {
    appearance: none;
    background: #fff;
    border: 0;
    border-bottom: 1px solid #e2e8f0;
    color: #0f172a;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.7rem 0.85rem;
    text-align: left;
    width: 100%;
}

.complaint-project-search-option:hover,
.complaint-project-search-option:focus {
    background: #f8fafc;
    outline: none;
}

.complaint-project-search-option small,
.complaint-project-search-empty {
    color: #64748b;
    font-size: 0.85rem;
}

.complaint-project-search-empty {
    padding: 0.8rem 0.85rem;
}

.complaint-project-selected {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
    margin-top: 0.5rem;
}

#complaintClosureModal .complaints-modal {
    max-width: 720px;
}

.complaints-form .form-row,
.complaints-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.complaints-detail-grid {
    grid-template-columns: 120px minmax(0, 1fr) 120px minmax(0, 1fr);
    align-items: center;
}

.complaints-section {
    margin-top: 1rem;
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
}

.complaint-comment,
.complaint-email {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.complaint-email-body {
    margin-top: 0.75rem;
    white-space: pre-wrap;
    max-height: 280px;
    overflow: auto;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem;
}

@media (max-width: 820px) {
    .complaints-filter-grid,
    .complaints-form .form-row,
    .complaints-detail-grid {
        grid-template-columns: 1fr;
    }
}
