* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.5;
    padding: 10px;
}
.top-bar {
    margin: 0 0 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.top-bar .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.top-bar .user-menu {
    margin-left: 0;
}
.nav-buttons {
    display: flex;
    gap: 8px;
}
.user-menu {
    position: relative;
}
html:not(.auth-ready) .user-menu .user-btn {
    visibility: hidden;
}
.user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    transition: border-color 0.2s;
    font-family: inherit;
}
.user-btn:hover {
    border-color: #3498db;
}
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #3498db;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}
.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    min-width: 220px;
    z-index: 1000;
    overflow: hidden;
}
.user-dropdown.open {
    display: block;
}
.dropdown-header {
    padding: 14px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}
.dropdown-header .user-name {
    font-weight: 700;
    font-size: 14px;
    color: #2c3e50;
}
.dropdown-header .user-role {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}
.dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    background: none;
    border: none;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
    text-decoration: none;
}
.dropdown-item:hover {
    background: #f0f7ff;
    text-decoration: none;
}
.dropdown-item.danger {
    color: #e74c3c;
}
.dropdown-item.danger:hover {
    background: #fdf0f0;
}
.dropdown-item.active {
    color: #1a73e8;
    background: #f0f7ff;
    font-weight: 600;
    cursor: default;
}
.dropdown-item.active:hover {
    background: #f0f7ff;
}
.dropdown-divider {
    height: 1px;
    background: #eee;
}
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    overscroll-behavior: contain;
}
.modal-overlay.open {
    display: flex;
}
.modal-overlay#confirmModal {
    z-index: 10050 !important;
}
.modal {
    background: #fff;
    border-radius: 10px;
    padding: 28px;
    width: 400px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    border: 1px solid #eee;
}
.modal h2 {
    font-size: 20px;
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
}
.modal .form-group {
    margin-bottom: 16px;
}
.modal label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}
.modal input,
.modal textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: #333;
    box-sizing: border-box;
}
.modal input:focus,
.modal textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.15);
}
.modal > .btn,
.modal .form-row > .btn {
    width: 100%;
}
.modal .error-msg {
    color: #e74c3c;
    font-size: 13px;
    margin-bottom: 12px;
    display: none;
    text-align: center;
    transition: opacity 0.5s ease;
}
.modal .error-msg.fade-out {
    opacity: 0;
}
.modal .error-msg.show {
    display: block;
}
.modal .error-msg.frozen {
    background: #fdf0f0;
    border: 1px solid #f5c6c6;
    border-radius: 6px;
    padding: 12px 16px;
    color: #c0392b;
    font-weight: 600;
    font-size: 14px;
}
.container {
    margin: 0;
    padding: 0 10px;
}
h1 {
    text-align: center;
    margin-bottom: 24px;
    color: #2c3e50;
    font-size: 26px;
}
.page-title {
    margin: 0 0 20px 0;
    font-size: 22px;
    color: #2c3e50;
}
.page-title--center {
    text-align: center;
}
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    padding: 20px;
    overflow: hidden;
}
.card h2 {
    font-size: 20px;
    margin-bottom: 16px;
    color: #34495e;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}
.table-wrapper {
    width: 100%;
    overflow-x: auto;
}
table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 14px;
}
th {
    background: #34495e;
    color: #fff;
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    position: sticky;
    top: 0;
    border: 1px solid #2c3e50;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
}
td {
    padding: 10px 8px;
    border: 1px solid #e0e0e0;
    vertical-align: middle;
    text-align: center;
    overflow: hidden;
    font-size: 13px;
}
tr:hover {
    background: #f8f9fa;
}
th:nth-child(1), td:nth-child(1) { width: 35px; }
th:nth-child(2), td:nth-child(2) { width: 110px; }
th:nth-child(3), td:nth-child(3) { width: 100px; }
th:nth-child(4), td:nth-child(4) { width: 90px; }
th:nth-child(5), td:nth-child(5) { width: 90px; }
th:nth-child(6), td:nth-child(6) { width: 90px; }
th:nth-child(7), td:nth-child(7) { width: 55px; }
th:nth-child(8), td:nth-child(8) { width: 90px; }
th:nth-child(9), td:nth-child(9) { width: 80px; }
th:nth-child(10), td:nth-child(10) { width: 90px; }
th:nth-child(11), td:nth-child(11) { width: 60px; }
.actions-cell {
    text-align: center;
    white-space: nowrap;
}
.empty-row td {
    color: #999;
    text-align: center;
    font-style: italic;
    padding: 30px;
}
.btn-danger {
    background: #e74c3c;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
}
.btn-danger:hover {
    background: #c0392b;
}
.btn {
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}
.btn-primary {
    background: #3498db;
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
    display: inline-block;
    text-align: center;
}
.btn-primary:hover {
    background: #2980b9;
}
.btn-outline-danger {
    background: transparent;
    color: #e74c3c;
    border: 1px solid #e74c3c;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    display: inline-block;
    text-align: center;
    line-height: normal;
}
.btn-outline-danger:hover {
    background: #e74c3c;
    color: #fff;
}
.btn-secondary {
    background: #ecf0f1;
    color: #333;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}
.btn-secondary:hover {
    background: #d5dbdb;
}
.btn-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    color: #333;
    border-radius: 4px;
    transition: background 0.2s;
}
.btn-close:hover {
    background: #f0f0f0;
}
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}
.form-label--center {
    text-align: center;
}
.form-input,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: #333;
    box-sizing: border-box;
}
textarea {
    resize: none;
    min-height: 60px;
    max-height: 120px;
    overflow-y: auto;
}
.form-input:focus,
textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.15);
}
.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: #333;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 36px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.15);
}
.form-select:hover {
    border-color: #3498db;
}
.user-select {
    position: relative;
    width: 100%;
    min-width: 0;
}
.user-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    text-align: left;
    overflow: hidden;
    cursor: pointer;
}
.user-select-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-select-value.placeholder {
    color: #8a94a6;
}
.user-select-menu {
    position: fixed;
    z-index: 10050;
    display: none;
    box-sizing: border-box;
    width: 320px;
    max-width: calc(100vw - 16px);
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding: 4px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.user-select-menu.open {
    display: block;
}
.user-select-option {
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.3;
    color: #333;
    cursor: pointer;
    white-space: normal;
    word-break: break-word;
}
.user-select-option:hover,
.user-select-option.active {
    background: #f0f4ff;
    color: #1a73e8;
}
.user-select-option--empty {
    color: #8a94a6;
}
.user-select-menu-empty {
    padding: 10px;
    text-align: center;
    color: #999;
    font-size: 13px;
}
[data-theme="dark"] .user-select-menu {
    background: var(--bg-2);
    border-color: var(--border);
}
[data-theme="dark"] .user-select-option {
    color: var(--text);
}
[data-theme="dark"] .user-select-option:hover,
[data-theme="dark"] .user-select-option.active {
    background: var(--bg-4);
    color: var(--accent);
}
[data-theme="dark"] .user-select-option--empty,
[data-theme="dark"] .user-select-value.placeholder {
    color: var(--text-3);
}
.role-select-wrap {
    display: flex;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
}
.role-select-item {
    flex: 1;
    position: relative;
    display: flex;
    align-items: stretch;
}
.role-select-item input[type="radio"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    margin: 0;
    z-index: 1;
}
.role-select-item label {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 12px 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
    border-right: 1px solid #e0e0e0;
    height: 100%;
    box-sizing: border-box;
}
.role-select-item:last-child label {
    border-right: none;
}
.role-select-item label:hover {
    background: #e8f4fc;
    color: #3498db;
}
.role-select-item input:checked + label {
    background: #3498db !important;
    color: #fff !important;
    font-weight: 700;
}
.role-select-item input:checked + label:hover {
    background: #2980b9 !important;
}
.date-trigger,
.datetime-trigger {
    cursor: pointer;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") no-repeat right 10px center;
    background-size: 18px;
    padding-right: 36px;
}
.date-trigger:hover,
.datetime-trigger:hover {
    border-color: #3498db;
}
#incDatetime {
    text-align: center;
}
#incDatetime::placeholder {
    text-align: center;
}
.incident-form {
    max-width: 580px;
    margin: 0 auto;
}
.form-row {
    display: flex;
    gap: 16px;
}
.form-row .form-group.half {
    flex: 1;
}
.form-row .form-actions {
    display: flex;
    gap: 10px;
}
.form-actions .btn {
    flex: 1;
}
.inline-btn-row {
    display: flex;
    gap: 8px;
}
.inline-btn-row > input {
    flex: 1;
    min-width: 0;
}
.inline-add-btn {
    width: auto;
    white-space: nowrap;
    flex-shrink: 0;
}
.photo-attach-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}
.photo-attached-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    padding: 4px 6px 4px 10px;
    font-size: 12px;
    color: #155724;
}
.photo-remove-btn {
    background: none;
    border: none;
    color: #155724;
    font-size: 16px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}
.photo-remove-btn:hover {
    color: #c0392b;
}
.photos-upload-area {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 12px;
    background: #fafafa;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.photos-upload-area:hover {
    border-color: #3498db;
    background: #f0f7fc;
}
.photos-upload-area.has-photos {
    border-style: solid;
    border-color: #e0e0e0;
    background: #fff;
    cursor: pointer;
}
.photos-upload-area.has-photos:hover {
    border-color: #3498db;
}
.photos-drop-text {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    color: #aaa;
    font-size: 13px;
    text-align: center;
}
.photos-upload-area.has-photos .photos-drop-text {
    display: none;
}
.photos-gallery-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: fit-content;
    margin: 10px auto 0;
    padding: 8px 14px;
    border: 1px solid #d6dee8;
    border-radius: 10px;
    background: #fff;
    color: #1570ef;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.15s;
}
.photos-gallery-btn:hover {
    border-color: #1570ef;
    background: #eff6ff;
}
.photos-gallery-btn:active {
    transform: scale(0.98);
}
.photos-gallery-btn svg {
    flex-shrink: 0;
}
.photos-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}
.photo-thumb-wrap {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e0e0e0;
    background: #fff;
}
.photo-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.photo-thumb-wrap--new {
    animation: photoPopIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.photo-thumb-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    border: none;
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.photo-thumb-remove:hover {
    background: rgba(0,0,0,0.8);
}
.photo-add-tile {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 2px dashed #cfd8e3;
    border-radius: 8px;
    background: #f7f9fc;
    color: #94a3b8;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.photo-add-tile:hover {
    border-color: #3498db;
    color: #3498db;
    background: #f0f7fc;
}
.photo-add-plus {
    font-size: 26px;
    line-height: 1;
    font-weight: 600;
}
.photo-add-caption {
    font-size: 11px;
    font-weight: 600;
}
.modal-overlay#photoModal {
    background: rgba(0,0,0,0.85);
}
.photo-modal {
    background: #fff;
    border-radius: 10px;
    padding: 0;
    width: auto;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.photo-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}
.photo-modal-title {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}
.photo-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #888;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.photo-modal-close:hover {
    color: #333;
}
.photo-modal img {
    max-width: 100%;
    max-height: calc(90vh - 50px);
    display: block;
    border-radius: 0 0 10px 10px;
}
.btn-photo {
    background: #3498db;
    color: #fff;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}
.btn-photo:hover {
    background: #2980b9;
}
.photo-badge {
    background: #e8f4fc;
    color: #3498db;
    border: 1px solid #3498db;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
}
.measures-indicator {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    vertical-align: middle;
    flex-shrink: 0;
}
.measures-indicator.measures-empty {
    background: #bbb;
}
.measures-indicator.measures-filled {
    background: #27ae60;
    box-shadow: 0 0 4px rgba(39,174,96,0.5);
}
.btn-sm {
    padding: 3px 8px;
    font-size: 11px;
}
.incident-detail-modal {
    width: 900px;
    max-width: 95vw;
    max-height: 90vh;
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.incident-detail-modal.detail-body-expanded {
    overflow: visible;
}
.incident-detail-modal.detail-body-expanded .detail-body {
    overflow: hidden;
}
.incident-detail-modal .detail-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: #f5f7fa;
}
.incident-detail-modal .detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid #e8e8e8;
    background: #fff;
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
}
.detail-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.incident-detail-modal .detail-title {
    margin: 0;
    font-size: 18px;
    color: #2c3e50;
    font-weight: 700;
}
.detail-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.detail-status-badge.status-active {
    background: #e8f8ef;
    color: #27ae60;
}
.detail-status-badge.status-closed {
    background: #f0f0f0;
    color: #888;
}
.detail-status-badge.status-reopened {
    background: #fff3e0;
    color: #e65100;
}
.detail-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}
.detail-status-badge.status-active .detail-status-dot {
    background: #27ae60;
    animation: pulse-dot 2s infinite;
}
.detail-status-badge.status-closed .detail-status-dot {
    background: #888;
}
.detail-status-badge.status-reopened .detail-status-dot {
    background: #e65100;
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.incident-status-history-popover {
    position: fixed;
    z-index: 10060;
    display: none;
    min-width: 230px;
    max-width: min(340px, calc(100vw - 16px));
    padding: 10px 12px;
    border: 1px solid var(--border, #e3e7ee);
    border-radius: 10px;
    background: var(--bg-2, #fff);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    color: var(--text, #333);
    font-size: 12px;
    pointer-events: none;
}
.incident-status-history-title {
    margin-bottom: 7px;
    font-weight: 700;
    font-size: 12px;
}
.incident-status-history-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 3px 0;
    line-height: 1.35;
}
.incident-status-history-dot {
    flex: none;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #8a94a6;
}
.incident-status-history-dot.opened,
.incident-status-history-dot.reopened {
    background: #27ae60;
}
.incident-status-history-dot.closed {
    background: #e74c3c;
}
.incident-status-history-status {
    font-weight: 600;
    white-space: nowrap;
}
.incident-status-history-time {
    margin-left: auto;
    color: var(--text-3, #8a94a6);
    white-space: nowrap;
}
.incident-status-history-empty {
    color: var(--text-3, #8a94a6);
}
.incident-status-history-note {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border, #e3e7ee);
    color: var(--text-3, #8a94a6);
    line-height: 1.35;
}
.detail-close-btn {
    background: none;
    border: none;
    border-radius: 0;
    width: 32px;
    height: 32px;
    color: #999;
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.detail-close-btn:hover {
    color: #e74c3c;
}
.incident-detail-modal .detail-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}
.detail-card {
    background: #fff;
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid #f0f0f0;
}
.detail-card:last-child {
    margin-bottom: 0;
}
.detail-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f5f5f5;
}
.detail-card-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.detail-card-icon svg {
    width: 16px;
    height: 16px;
}
.detail-card-icon.icon-blue {
    background: #e8f4fc;
    color: #3498db;
}
.detail-card-icon.icon-green {
    background: #e8f8ef;
    color: #27ae60;
}
.detail-card-icon.icon-orange {
    background: #fff3e0;
    color: #f39c12;
}
.detail-card-icon.icon-purple {
    background: #f3e8fc;
    color: #9b59b6;
}
.detail-card-icon.icon-red {
    background: #fdecea;
    color: #e74c3c;
}
.detail-card-icon.icon-teal {
    background: #e0f7fa;
    color: #00838f;
}
.detail-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.detail-card-body {
    font-size: 14px;
    color: #2c3e50;
    line-height: 1.6;
    word-break: break-word;
}
.detail-card-body.empty {
    color: #ccc;
    font-style: italic;
}
.detail-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.detail-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.detail-info-label {
    font-size: 11px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.detail-info-value {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 500;
}
.detail-info-value.empty {
    color: #ccc;
    font-style: italic;
}
.detail-info-item .btn {
    align-self: flex-start;
}
.assignee-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e8f0fe;
    border: 1px solid #c5d9f7;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 13px;
    color: #1a56db;
    white-space: nowrap;
}
.assignee-badge-name {
    font-weight: 500;
}
.assignee-badge.empty {
    background: #f5f5f5;
    border-color: #e0e0e0;
}
.assignee-badge.empty .assignee-badge-name {
    color: #999;
    font-weight: 400;
}
.field-tiles {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.field-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    background: #f7f9fc;
    border: 1px solid #eceff4;
    border-radius: 12px;
    text-align: left;
    font-family: inherit;
    transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}
button.field-tile {
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}
button.field-tile:hover {
    background: #eef4fb;
    border-color: #cfe1f5;
    box-shadow: 0 2px 10px rgba(52, 152, 219, 0.08);
}
button.field-tile:active {
    transform: translateY(1px);
}
.field-tile--add {
    cursor: pointer;
}
.field-tile--add:hover {
    background: #eef4fb;
    border-color: #cfe1f5;
    box-shadow: 0 2px 10px rgba(52, 152, 219, 0.08);
}
.field-tile--clickable {
    cursor: pointer;
}
.field-tile--clickable:hover {
    background: #eef4fb;
    border-color: #cfe1f5;
    box-shadow: 0 2px 10px rgba(52, 152, 219, 0.08);
}
.field-tile-input {
    width: 100%;
    box-sizing: border-box;
    padding: 4px 6px;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    font-family: inherit;
    border: 1px solid #3498db;
    border-radius: 6px;
    outline: none;
    background: #fff;
}
.field-tile-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e8f0fe;
    color: #3498db;
}
.field-tile-icon svg {
    display: block;
}
.field-tile.empty .field-tile-icon {
    background: #eef1f5;
    color: #b6bec9;
}
.field-tile-avatar {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3498db, #5b8def);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    text-transform: uppercase;
}
.field-tile-avatar svg {
    display: block;
}
.field-tile-avatar.empty {
    background: #eef1f5;
    color: #b6bec9;
}
.field-tile-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.field-tile-label {
    font-size: 11px;
    font-weight: 600;
    color: #98a2b3;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-align: center;
}
.field-tile-value {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    overflow-wrap: anywhere;
    text-align: center;
}
.field-tile-value.empty,
.field-tile.empty .field-tile-value {
    color: #a9b2bf;
    font-weight: 500;
}
.field-tile-chevron {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    color: #c3cbd6;
    transition: transform 0.18s, color 0.18s;
}
button.field-tile:hover .field-tile-chevron {
    color: #3498db;
    transform: translateX(2px);
}
.field-tile-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.icon-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    transition: border-color 0.18s, color 0.18s, background 0.18s;
}
.icon-btn:hover {
    border-color: #3498db;
    color: #3498db;
    background: #f4f9ff;
}
.icon-btn.danger:hover {
    border-color: #e74c3c;
    color: #e74c3c;
    background: #fdf3f3;
}
.field-tiles--grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
}
.field-tiles--grid .field-tile {
    position: relative;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 18px 14px;
    text-align: center;
}
.field-tiles--grid .field-tile-body {
    flex: none;
    width: 100%;
    align-items: center;
}
.field-tiles--grid .field-tile-actions {
    position: absolute;
    top: 50%;
    right: 7px;
    transform: translateY(-50%);
}
.field-tiles--grid .field-tile-chevron {
    position: absolute;
    top: 50%;
    right: 9px;
    bottom: auto;
    transform: translateY(-50%);
}
.field-tiles--grid button.field-tile:hover .field-tile-chevron {
    transform: translateY(-50%) translateX(2px);
}
.field-tiles--grid .field-tile-icon {
    display: none;
}
.field-tiles--grid .field-tile-avatar {
    display: none;
}
.field-tiles--grid.field-tiles--compact .field-tile {
    padding: 11px 12px;
    gap: 4px;
}
.field-tiles--grid.field-tiles--compact .field-tile-label {
    font-size: 10px;
}
.field-tiles--grid.field-tiles--compact .field-tile-value {
    font-size: 13px;
}
.field-tiles--grid.field-tiles--compact .field-tile-actions {
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
}
.field-tiles--grid.field-tiles--compact .field-tile-chevron {
    top: 50%;
    right: 6px;
    bottom: auto;
    transform: translateY(-50%);
}
.detail-text {
    white-space: pre-wrap;
}
.detail-textarea {
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    min-height: 90px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    color: #2c3e50;
    background: #f7f9fc;
    border: 1px solid #eceff4;
    border-radius: 12px;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.detail-textarea:focus {
    border-color: #3498db;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.12);
}
.contact-card {
    position: relative;
    padding: 12px 14px;
    padding-right: 54px;
    background: #f7f9fc;
    border: 1px solid #eceff4;
    border-radius: 12px;
}
.contact-head {
    display: flex;
    align-items: center;
    gap: 10px;
}
.contact-head .icon-btn {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
}
.contact-avatar {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3498db, #5b8def);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
}
.contact-name {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    overflow-wrap: anywhere;
}
.contact-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px 14px;
    margin-top: 10px;
    padding-left: 44px;
}
.contact-field-label {
    font-size: 11px;
    font-weight: 600;
    color: #98a2b3;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.contact-field-value {
    font-size: 13px;
    color: #2c3e50;
    overflow-wrap: anywhere;
}
.contact-empty {
    text-align: center;
    padding: 10px;
    color: #98a2b3;
    font-size: 13px;
}
.detail-assignee-name {
    font-size: 15px;
    font-weight: 600;
    color: #2c3e50;
    padding: 6px 12px;
    background: #eef2f7;
    border-radius: 6px;
    display: inline-block;
}
.detail-assignee-name.empty {
    color: #aaa;
    font-style: italic;
    background: transparent;
    padding: 6px 0;
}
.detail-photos-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.detail-photo-thumb {
    width: 90px;
    height: 90px;
    border-radius: 10px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid #f0f0f0;
    transition: all 0.2s;
}
.detail-photo-thumb:hover {
    border-color: #3498db;
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(52,152,219,0.2);
}
.detail-photo-add {
    width: 104px;
    height: 104px;
    padding: 0;
    border-radius: 12px;
    border: 1.5px dashed #cbd5e1;
    background: #f8fafc;
    color: #98a2b3;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.18s, color 0.18s, background 0.18s;
}
.detail-photo-add:hover {
    border-color: #1570ef;
    color: #1570ef;
    background: #eff6ff;
}
@keyframes photoPopIn {
    from {
        opacity: 0;
        transform: scale(0.75);
    }
}
.detail-photo-thumb--new {
    animation: photoPopIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.detail-photo-item {
    position: relative;
    display: inline-flex;
    line-height: 0;
}
.detail-photo-item .detail-photo-thumb {
    display: block;
    margin: 0;
}
.detail-photo-del {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.96);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.15s, transform 0.15s, background 0.15s;
    z-index: 2;
}
.detail-photo-item:hover .detail-photo-del {
    opacity: 1;
    transform: scale(1);
}
.detail-photo-del:hover {
    background: #dc2626;
}
.detail-photo-del svg {
    display: block;
    pointer-events: none;
}
@media (hover: none) {
    .detail-photo-del { opacity: 1; transform: scale(1); }
}
.incident-detail-modal .detail-section {
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    gap: 20px;
    align-items: flex-start;
    overflow: hidden;
    word-break: break-word;
}
.incident-detail-modal .detail-section:last-child {
    border-bottom: none;
}
.incident-detail-modal .detail-section:hover {
    background: #fafafa;
}
.incident-detail-modal .detail-label {
    font-size: 12px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 140px;
    padding-top: 2px;
}
.incident-detail-modal .detail-value {
    font-size: 15px;
    color: #2c3e50;
    word-wrap: break-word;
    flex: 1;
    line-height: 1.6;
}
.incident-detail-modal .detail-value.empty {
    color: #ccc;
    font-style: italic;
}
.incident-detail-modal .detail-photo-wrap {
    margin-top: 4px;
}
.incident-detail-modal .detail-thumb {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid #e0e0e0;
    object-fit: cover;
    transition: transform 0.2s, box-shadow 0.2s;
    display: block;
}
.incident-detail-modal .detail-thumb:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.incident-detail-modal .detail-photos-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.incident-detail-modal .detail-photos-grid .detail-thumb {
    width: 80px;
    height: 80px;
}
.photo-viewer-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.92);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.photo-viewer-modal.open {
    display: flex;
    opacity: 1;
}
.photo-viewer-modal .viewer-close {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    transition: background 0.2s;
    z-index: 10001;
}
.photo-viewer-modal .viewer-close:hover {
    background: rgba(255,255,255,0.3);
}
.photo-viewer-modal img {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
    position: relative;
    z-index: 10002;
}
.photo-file-name {
    font-size: 12px;
    color: #27ae60;
}
.action-menu-wrap {
    position: relative;
    display: inline-block;
}
.action-menu-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: all 0.2s;
}
.action-menu-btn:hover {
    background: #f0f0f0;
    border-color: #bbb;
}
.action-dropdown {
    display: none;
    position: fixed;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    min-width: 150px;
    max-width: 280px;
    z-index: 9999;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: visible;
}
.action-dropdown.open {
    display: block;
}
.action-item {
    padding: 10px 14px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
    border-bottom: 1px solid #f0f0f0;
}
.action-item:last-child {
    border-bottom: none;
}
.action-item:hover {
    background: #f5f5f5;
}
.action-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.action-item.disabled:hover {
    background: transparent;
}
.action-icon {
    font-size: 14px;
    width: 20px;
    text-align: center;
}
.danger-text {
    color: #e74c3c;
}
.danger-text:hover {
    color: #c0392b;
}
.success-text {
    color: #27ae60;
}
.success-text:hover {
    color: #1e8449;
}
.modal-notify {
    text-align: center;
    padding: 32px 28px;
}
.modal-notify--center {
    min-width: 320px;
}
.notify-icon {
    font-size: 48px;
    margin-bottom: 16px;
    line-height: 1;
}
.notify-title {
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 8px;
}
.notify-message {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}
.modal-notify.success .notify-icon { color: #27ae60; }
.modal-notify.error .notify-icon { color: #e74c3c; }
.modal-notify.success .notify-title { color: #27ae60; }
.modal-notify.error .notify-title { color: #e74c3c; }
.notify-ok-btn {
    margin-top: 16px;
    width: 100%;
}
.modal-notify .form-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
}
.modal-notify .form-actions .btn {
    flex: 1;
}
.notify-icon--warn {
    color: #e74c3c;
}
.modal-reg-token-row {
    display: flex;
    gap: 8px;
}
.modal-reg-token-row input {
    flex: 1;
}
.modal-reg-btn {
    width: auto;
    padding: 10px 12px;
}
.modal-reg-row {
    display: flex;
    gap: 10px;
}
.modal-reg-row .btn {
    flex: 1;
}
.calendar-modal {
    width: 320px;
    padding: 0;
    text-align: center;
}
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #eee;
}
.calendar-nav-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 16px;
    color: #333;
    transition: background 0.2s;
}
.calendar-nav-btn:hover {
    background: #f0f0f0;
}
.calendar-title {
    font-weight: 600;
    font-size: 16px;
    color: #2c3e50;
}
.calendar-grid {
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.calendar-day-name {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-align: center;
    padding: 4px;
}
.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: all 0.15s;
}
.calendar-day:hover {
    background: #f0f0f0;
}
.calendar-day.other-month {
    color: #ccc;
}
.calendar-day.today {
    background: #e8f4fc;
    font-weight: 600;
    color: #3498db;
}
.calendar-day.selected {
    background: #3498db;
    color: #fff;
    font-weight: 600;
}
.calendar-day.selected:hover {
    background: #2980b9;
}
.calendar-time {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #eee;
}
.calendar-time label {
    font-size: 14px;
    color: #555;
}
.cal-time-input {
    width: 60px;
    text-align: center;
    padding: 6px 8px;
}
.cal-time-input::-webkit-inner-spin-button,
.cal-time-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.field-error {
    border-color: #e74c3c !important;
    animation: blink-error 0.6s ease-in-out 3;
}
@keyframes blink-error {
    0%, 100% { background-color: #fff; }
    50% { background-color: #fdeaea; }
}
.cal-time-input[type="number"] {
    -moz-appearance: textfield;
}
.calendar-actions {
    display: flex;
    gap: 10px;
    padding: 12px 16px 16px;
}
.calendar-actions .btn {
    flex: 1;
}
.nav-buttons a {
    text-decoration: none;
}
.users-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.users-table th {
    background: #34495e;
    color: #fff;
    padding: 10px 6px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    border: 1px solid #2c3e50;
}
.users-table th:nth-child(1) { width: 180px; }
.users-table th:nth-child(2) { width: 130px; }
.users-table th:nth-child(3) { width: 120px; }
.users-table th:nth-child(4) { width: 150px; }
.users-table th:nth-child(5) { width: 140px; }
.users-table th:nth-child(6) { width: 130px; }
.users-table th:nth-child(7) { width: 70px; }
.users-table td {
    padding: 10px 6px;
    border: 1px solid #e0e0e0;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}
.user-name-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-dot.active {
    background: #27ae60;
    box-shadow: 0 0 0 2px #e8f8ef;
}
.status-dot.inactive,
.status-dot.frozen {
    background: #e74c3c;
    box-shadow: 0 0 0 2px #fdeaea;
}
.token-cell {
    font-family: monospace;
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 13px;
}
.mobile-incidents-list,
.mobile-users-list { display: none; }
.incidents-table { display: table; width: 100%; table-layout: fixed; }
.actions-cell {
    text-align: center;
    width: 1%;
    white-space: nowrap;
}
#incidentsBody tr.inc-new { background: #e9f7ec; }
#incidentsBody tr.inc-new:hover { background: #ddf0e2; }
#incidentsBody tr.inc-closed { background: #f5f5f5; }
#incidentsBody tr.inc-closed:hover { background: #ededed; }
#incidentsBody tr.inc-closed td { color: #9aa0a6; }
#incidentsBody tr.inc-closed td:first-child {
    border-left: 4px solid #bdbdbd;
}
#incidentsBody tr.inc-reopened { background: #fff6e8; }
#incidentsBody tr.inc-reopened:hover { background: #fdeed7; }
#incidentsBody tr.inc-reopened td:first-child {
    border-left: 4px solid #f0a020;
}
#incidentsBody tr.inc-reopen-requested { background: #f6ecff; }
#incidentsBody tr.inc-reopen-requested:hover { background: #eedcff; }
#incidentsBody tr.inc-reopen-requested td:first-child {
    border-left: 4px solid #9b59b6;
}
.mobile-incident-card.inc-reopen-requested { background: #f6ecff; }
.incident-context-menu {
    position: fixed;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    z-index: 9999;
    overflow: hidden;
    min-width: 160px;
}
.ctx-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    transition: background 0.1s;
}
.ctx-item:hover {
    background: #f0f0f0;
}
.ctx-close {
    color: #c0392b;
    font-weight: 600;
}
.ctx-close:hover { background: #fdecea !important; }
.ctx-open {
    color: #27ae60;
    font-weight: 600;
}
.ctx-open:hover { background: #e8f5e9 !important; }
@media (max-width: 768px) {
    .incident-context-menu,
    .action-dropdown {
        position: fixed;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        bottom: 0;
        border-radius: 16px 16px 0 0;
        border-bottom: none;
        max-height: 70vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .ctx-item {
        padding: 14px 20px;
        font-size: 15px;
        text-align: center;
    }
    .action-dropdown {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .action-dropdown::-webkit-scrollbar {
        display: none;
    }
    .action-dropdown .action-item {
        padding: 14px 20px;
        font-size: 15px;
        justify-content: center;
    }
    .action-dropdown .action-icon {
        display: none;
    }
    .modal-overlay#confirmModal {
        align-items: center;
    }
    .modal-overlay#confirmModal .modal {
        margin: 10px;
        width: auto;
        max-width: 100%;
        border-radius: 12px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
}
.incidents-header-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.incidents-header-row h2 {
    margin-bottom: 0;
    white-space: nowrap;
}
.period-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}
.period-btns {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.period-btn {
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    color: #555;
    transition: all 0.15s;
    font-family: inherit;
}
.period-btn:hover {
    background: #e0e0e0;
}
.period-btn.active {
    background: #3498db;
    border-color: #3498db;
    color: #fff;
    font-weight: 600;
}
.period-custom {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 4px;
}
.period-input {
    width: 110px !important;
    padding: 4px 8px !important;
    font-size: 12px !important;
}
.incidents-filters {
    margin-bottom: 16px;
}
.incidents-filters .status-filter {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}
.incidents-list-title {
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
    margin-bottom: 0;
}
.status-btn {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 16px;
    font-size: 13px;
    cursor: pointer;
    color: #555;
    transition: all 0.15s;
    font-family: inherit;
}
.status-btn:hover {
    background: #e0e0e0;
}
.status-btn.active {
    background: #3498db;
    border-color: #3498db;
    color: #fff;
    font-weight: 600;
}
.status-btn[data-status="active"].active {
    background: #27ae60;
    border-color: #27ae60;
}
.status-btn[data-status="closed"].active {
    background: #95a5a6;
    border-color: #95a5a6;
}
.status-btn[data-status="reopened"].active {
    background: #ff9800;
    border-color: #ff9800;
}
@media (max-width: 768px) {
    body { padding: 8px; }
    h1 { font-size: 18px; }
    .page-title { margin: 0 0 12px 0; font-size: 18px; }
    .card {
        padding: 12px;
        overflow-x: auto;
    }
    .card[style*="max-width"] {
        max-width: 100% !important;
    }
    .form-select {
        padding: 12px;
        font-size: 15px;
    }
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    table {
        font-size: 11px;
        white-space: nowrap;
    }
    th, td {
        padding: 6px 4px;
    }
    .form-row {
        flex-direction: column;
        align-items: stretch;
    }
    .inline-btn-row {
        flex-direction: column;
    }
    .inline-btn-row > input {
        width: 100%;
    }
    .inline-add-btn {
        width: 100%;
    }
    .form-row .form-input,
    .form-row input[type="text"],
    #incidentSearchInput,
    #userSearchInput {
        width: 100% !important;
        max-width: 100%;
    }
    .form-row > div,
    .form-row > button {
        width: 100%;
    }
    .form-row .btn {
        width: 100%;
    }
    .modal {
        margin: 0;
        max-height: calc(100vh - 20px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        width: calc(100% - 20px);
        max-width: calc(100% - 20px);
        border-radius: 12px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .modal::-webkit-scrollbar {
        display: none;
    }
    .modal::-webkit-scrollbar {
        display: none;
    }
    .modal-overlay {
        padding: 10px;
        padding-bottom: 0;
        overflow-y: visible;
        align-items: flex-end;
    }
    .modal-overlay#chatNotifModal,
    .modal-overlay#chatExpandModal,
    .modal-overlay#loginModal,
    .modal-overlay#addParticipantModal,
    .modal-overlay#removeParticipantModal,
    .modal-overlay#notifyModal,
    .modal-overlay#confirmModal,
    .modal-overlay#messageErrorModal,
    .modal-overlay#photoModal,
    .modal-overlay#calendarModal,
    .modal-overlay#incidentDetailModal {
        align-items: center;
        justify-content: center;
    }
    .modal-overlay#chatNotifModal .chat-notif-modal,
    .modal-overlay#chatExpandModal .chat-expand-modal {
        margin: 0;
        width: 100%;
        max-height: 85vh;
        border-radius: 16px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .modal-overlay#chatNotifModal .chat-notif-modal::-webkit-scrollbar,
    .modal-overlay#chatExpandModal .chat-expand-modal::-webkit-scrollbar {
        display: none;
    }
    .modal-overlay#chatNotifModal .chat-notif-modal .modal-header {
        padding: 14px 16px;
    }
    .modal-overlay#chatNotifModal .chat-notif-modal .chat-notif-list {
        max-height: calc(85vh - 60px);
    }
    .modal-overlay#addParticipantModal .modal,
    .modal-overlay#removeParticipantModal .modal,
    .modal-overlay#loginModal .modal,
    .modal-overlay#notifyModal .modal,
    .modal-overlay#confirmModal .modal,
    .modal-overlay#messageErrorModal .modal,
    .modal-overlay#photoModal .modal,
    .modal-overlay#calendarModal .modal {
        margin: 10px;
        width: auto;
        max-width: calc(100% - 20px);
        border-radius: 12px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
    .modal-overlay#incidentDetailModal {
        padding: 0;
        align-items: center;
        justify-content: center;
    }
    .modal-overlay#incidentDetailModal .modal {
        margin: 10px;
        width: calc(100% - 20px);
        max-height: calc(100vh - 20px);
    }
    .modal-reg-row {
        flex-direction: column;
    }
    .modal-reg-row .btn {
        width: 100%;
    }
    .user-btn span {
        display: none;
    }
    .user-dropdown {
        right: 0;
        left: auto;
        min-width: 160px;
    }
    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    .btn-primary,
    .btn-secondary {
        padding: 10px 16px;
        font-size: 14px;
    }
    .modal-notify .form-actions {
        flex-direction: column;
    }
    .modal-notify .form-actions .btn {
        width: 100%;
    }
    .incident-detail-modal {
        width: calc(100% - 20px);
        max-width: 100%;
        max-height: calc(100vh - 20px);
        overflow: visible;
        border-radius: 16px;
        display: flex;
        flex-direction: column;
    }
    .incident-detail-modal .detail-body {
        overflow: visible;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        background: #f5f7fa;
        padding: 0;
    }
    .incident-detail-modal .detail-body::-webkit-scrollbar {
        display: none;
    }
    .incident-detail-modal::-webkit-scrollbar {
        display: none;
    }
    .incident-detail-modal .detail-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 14px 16px;
        background: #fff;
        border-bottom: 1px solid #e8e8e8;
    }
    .incident-detail-modal .detail-title {
        font-size: 15px;
        margin: 0;
    }
    .detail-status-badge {
        font-size: 11px;
        padding: 3px 10px;
    }
    .detail-close-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    .incident-detail-modal .detail-scroll {
        flex: none;
        overflow: visible;
        padding: 12px 16px;
    }
    .detail-card {
        padding: 14px 16px;
        margin-bottom: 10px;
        border-radius: 10px;
    }
    .detail-card-header {
        margin-bottom: 10px;
        padding-bottom: 8px;
    }
    .detail-card-icon {
        width: 28px;
        height: 28px;
        border-radius: 7px;
        font-size: 14px;
    }
    .detail-card-title {
        font-size: 12px;
    }
    .detail-info-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .detail-photo-thumb {
        width: 70px;
        height: 70px;
    }
    .incident-detail-modal .detail-section {
        padding: 12px 16px;
        flex-direction: column;
        gap: 6px;
        overflow: visible;
        word-break: break-word;
    }
    .incident-detail-modal .detail-label {
        font-size: 11px;
        min-width: auto;
        padding-top: 0;
        flex: none;
    }
    .incident-detail-modal .detail-value {
        font-size: 14px;
        flex: none;
        width: 100%;
    }
    .incident-detail-modal .detail-thumb {
        max-width: 120px;
        max-height: 100px;
    }
    .incidents-table { display: none; }
    .mobile-incidents-list { display: flex; }
    .incidents-filters .status-filter {
        grid-template-columns: 1fr 1fr 1fr 1fr;
    }
    .status-btn {
        padding: 6px 4px;
        font-size: 11px;
    }
    .period-filter {
        flex-direction: column;
        align-items: stretch;
    }
    .period-btns {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 4px;
    }
    .period-btn {
        text-align: center;
    }
    .period-custom {
        margin-top: 8px;
    }
    .period-custom input {
        flex: 1;
    }
    .incidents-list-title {
        text-align: center;
    }
}
@media (max-width: 768px) {
    .chat-open-btn-wrap {
        display: flex !important;
        justify-content: center;
        align-items: center;
    }
    .chat-open-btn {
        min-width: 220px;
        height: 46px;
        padding: 0 24px;
        border-radius: 12px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        font-size: 15px;
        font-weight: 600;
        background: linear-gradient(135deg, #3498db, #1f7fc4);
        box-shadow: 0 6px 18px rgba(52, 152, 219, 0.28);
        transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
    }
    .chat-open-btn:hover {
        background: linear-gradient(135deg, #3aa5e8, #268fd6);
        box-shadow: 0 8px 22px rgba(52, 152, 219, 0.38);
        transform: translateY(-1px);
    }
    .chat-wrapper {
        display: none !important;
    }
    .chat-input-area {
        display: none;
    }
    .chat-wrapper:not(.expanded) .chat-format-bar {
        justify-content: center;
    }
    .chat-wrapper:not(.expanded) .chat-format-bar .fmt-btn:not(#chatExpandBtn),
    .chat-wrapper:not(.expanded) .chat-format-bar .fmt-sep,
    .chat-wrapper:not(.expanded) .chat-format-bar .fmt-colors,
    .chat-wrapper:not(.expanded) .chat-format-bar .fmt-zoom-btn {
        display: none !important;
    }
    .chat-wrapper:not(.expanded) .chat-format-bar #chatExpandBtn {
        display: flex !important;
    }
}
@media (min-width: 769px) {
    .chat-open-btn-wrap {
        display: none !important;
    }
}
.mic-header {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 4px;
        flex-wrap: wrap;
    }
    .mic-id {
        background: #e8f0fe;
        color: #1a73e8;
        font-weight: 700;
        font-size: 13px;
        padding: 2px 6px;
        border-radius: 4px;
    }
    .mic-date {
        color: #666;
        font-size: 12px;
    }
    .mic-department {
        font-weight: 600;
        color: #333;
        font-size: 14px;
        margin-bottom: 8px;
    }
    .mic-field {
        margin-bottom: 8px;
        overflow: hidden;
    }
    .mic-field .mic-value {
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .mic-label {
        color: #888;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        display: block;
        margin-bottom: 2px;
    }
    .mic-value {
        color: #333;
        font-size: 13px;
        word-break: break-word;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
    }
    .mic-empty { color: #ccc; }
    .mic-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px 12px;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid #f0f0f0;
    }
    .mic-grid-item {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    .mic-grid-item .mic-label {
        font-size: 10px;
        color: #888;
        text-transform: uppercase;
    }
    .mic-grid-item .mic-text {
        font-size: 12px;
        color: #333;
        word-break: break-word;
    }
    .mobile-users-list {
        display: none;
        flex-direction: column;
        gap: 12px;
        margin-top: 12px;
    }
    .mobile-user-card {
        background: #fff;
        border-radius: 8px;
        border: 1px solid #e0e0e0;
        padding: 12px;
    }
    .mobile-user-card.inactive {
        opacity: 0.7;
        background: #f5f5f5;
    }
    .muc-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;
        gap: 10px;
    }
    .muc-name {
        display: flex;
        align-items: center;
        gap: 8px;
        font-weight: 600;
        font-size: 15px;
        color: #333;
    }
    .muc-role {
        font-size: 12px;
        color: #666;
        background: #f0f0f0;
        padding: 3px 8px;
        border-radius: 4px;
    }
    .muc-fields {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }
    .muc-field {
        display: flex;
        gap: 8px;
        font-size: 13px;
    }
    .muc-label {
        color: #888;
        min-width: 60px;
    }
    .muc-value {
        color: #333;
        word-break: break-all;
    }
    .muc-token {
        font-family: monospace;
        background: #f5f5f5;
        padding: 2px 6px;
        border-radius: 3px;
        font-size: 12px;
    }
    .muc-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid #f0f0f0;
    }
    .muc-btn {
        padding: 8px 12px;
        border-radius: 6px;
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        border: none;
        font-family: inherit;
    }
    .muc-btn--edit {
        background: #e8f0fe;
        color: #1a73e8;
    }
    .muc-btn--warning {
        background: #fff3e0;
        color: #e65100;
    }
    .muc-btn--success {
        background: #e8f5e9;
        color: #2e7d32;
    }
    .muc-btn--danger {
        background: #fdecea;
        color: #c62828;
    }
    .muc-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }
    .mobile-users-list { display: flex; }
    .users-table { display: none; }
    .users-card .search-row {
        flex-direction: column;
    }
    .users-card .search-row .form-input {
        width: 100% !important;
    }
    .users-card .search-row > div {
        width: 100%;
        flex-direction: column;
    }
    .users-card .search-row .btn {
        width: 100%;
    }
    .users-card .add-btn {
        width: 100%;
        margin-top: 8px;
    }
    .chat-section {
        padding: 12px 16px;
    }
    .chat-section .detail-label {
        min-width: auto;
        padding-top: 0;
        margin-bottom: 8px;
    }
    .chat-wrapper {
        border-radius: 8px;
        overflow: hidden;
        min-height: 200px;
        max-height: 280px;
    }
    .chat-messages {
        height: 180px;
    }
    .chat-input {
        font-size: 16px;
    }
}
.add-btn {
    background: #27ae60;
    color: #fff;
}
.add-btn:hover {
    background: #219a52;
}
.modal-overlay#registerModal {
    align-items: center;
}
.modal-overlay#registerModal .modal {
    margin: 10px;
    width: 400px;
    max-width: calc(100vw - 20px);
    box-sizing: border-box;
    max-height: calc(100vh - 20px);
    border-radius: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.modal-overlay#registerModal .modal::-webkit-scrollbar {
    display: none;
}
.add-btn {
    background: #27ae60;
    color: #fff;
}
.add-btn:hover {
    background: #219a52;
}
.table-wrapper::-webkit-scrollbar,
.modal-overlay::-webkit-scrollbar {
    display: none;
}
.table-wrapper,
.modal-overlay {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
@media (min-width: 769px) {
    .incident-detail-modal:not(.detail-body-expanded) {
        overflow-y: auto;
    }
}
.chat-section {
    padding: 16px 24px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
    overflow: visible;
    background: transparent !important;
    position: relative;
    min-height: 0;
    flex-shrink: 0;
}
.chat-section.expanded {
    flex: 50;
    padding: 0;
    width: 100%;
    min-height: 0;
    overflow: visible;
}
.chat-section.expanded .detail-label {
    display: none;
}
.chat-section.expanded .detail-value {
    flex: 50;
    min-height: 0;
    overflow: visible;
}
.chat-section:hover {
    background: transparent !important;
}
.incident-detail-modal .detail-section:hover {
    background: #fafafa;
}
.incident-detail-modal .detail-section.chat-section:hover {
    background: transparent !important;
}
.chat-section .detail-label {
    font-size: 12px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 140px;
    padding-top: 6px;
    flex-shrink: 0;
}
.chat-section .detail-value {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.chat-wrapper {
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    background: #fff;
    flex-shrink: 0;
    min-height: 0;
    height: 280px;
    max-height: 350px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    transition: all 0.5s ease;
}
.chat-wrapper.expanded {
    flex: 1;
    min-height: 0;
    border-radius: 0;
    border: none;
    margin: 0;
}
.chat-wrapper.expanded .chat-messages {
    flex: 1;
    height: auto;
    overflow-y: auto;
    scrollbar-width: thin;
}
#chatParticipantsHeader,
#chatParticipantsHeaderExpanded,
#chatExpandModal .chat-participants-header,
.chat-expand-body .chat-participants-header {
    min-height: 30px !important;
    visibility: visible !important;
    display: flex !important;
}
.chat-participants-header {
    padding: 6px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-size: 12px;
    color: #6c757d;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    flex-shrink: 0;
    min-height: 30px;
}
.chat-participants-header .participants-label {
    font-weight: 600;
    margin-right: 4px;
}
.chat-participant-badge {
    display: inline-flex;
    align-items: center;
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    color: #495057;
}
.chat-participant-badge.is-admin {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}
.chat-participant-badge.is-head {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffe082;
}
.chat-wrapper .chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    padding: 16px 12px;
    background: #eef2f5;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
    font-size: 14px;
}
.chat-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 12px;
    background: #dde3e8;
    border-top: 1px solid #c8d0d6;
}
.chat-page-info {
    font-size: 13px;
    color: #555;
    min-width: 40px;
    text-align: center;
}
.chat-page-btn {
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s;
}
.chat-page-btn:hover:not(:disabled) {
    background: #2980b9;
}
.chat-page-btn:disabled {
    background: #b0bec5;
    cursor: not-allowed;
}
@keyframes slideInMessage {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.chat-msg {
    animation: slideInMessage 0.3s ease-out;
}
.chat-date-sep {
    text-align: center;
    margin: 12px 0;
}
.chat-date-sep span {
    background: rgba(255,255,255,0.8);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    color: #8899a6;
    font-weight: 500;
}
.chat-msg {
    display: flex;
    margin-bottom: 4px;
}
.chat-msg.mine {
    justify-content: flex-end;
}
.chat-msg.other {
    justify-content: flex-start;
}
.chat-msg.system-msg {
    justify-content: center !important;
    display: flex !important;
    width: 100%;
}
.chat-msg.system-msg .system-msg-content {
    background: transparent;
    padding: 6px 12px;
    font-size: 13px;
    color: #27ae60;
    text-align: center;
    font-weight: 700;
}
.chat-msg.system-msg--removal {
    justify-content: center !important;
    display: flex !important;
    width: 100%;
}
.chat-msg.system-msg--removal .system-msg-content {
    background: transparent;
    padding: 6px 12px;
    font-size: 13px;
    color: #e74c3c;
    text-align: center;
    font-weight: 700;
}
.chat-msg .msg-meta {
    max-width: 75%;
    display: flex;
    flex-direction: column;
    min-width: 0;
    text-align: left;
}
.chat-msg .msg-sender,
.chat-msg .msg-sender-other,
.chat-msg .msg-bubble-with-time,
.chat-msg .msg-time-side,
.chat-msg .msg-sender-badge,
.chat-msg .msg-sender-time,
.chat-msg.other .msg-other-block > .msg-sender {
    display: none !important;
}
.chat-msg .msg-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
    font-weight: 400;
    color: #495057;
    background: #f0f4f8;
    padding: 2px 7px;
    border-radius: 10px;
    border: 1px solid #d0d8de;
    white-space: nowrap;
}
.chat-msg .msg-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: inherit;
    line-height: 1.45;
    word-break: break-word;
    position: relative;
    background: #fff;
    color: #1a1a1a;
    border: 1px solid #e1e8ed;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.chat-msg .msg-bubble b, .chat-msg .msg-bubble strong { font-weight: 700; }
.chat-msg .msg-bubble i, .chat-msg .msg-bubble em { font-style: italic; }
.chat-msg .msg-bubble s, .chat-msg .msg-bubble strike { text-decoration: line-through; color: #888; }
.chat-msg .msg-bubble code { background: #f0f0f0; padding: 1px 4px; border-radius: 3px; font-family: monospace; }
.chat-msg .msg-bubble font { font-weight: 400; }
.chat-msg .msg-bubble span { font-weight: 400; }
.chat-msg.mine .msg-bubble {
    border-bottom-left-radius: 4px;
}
.chat-msg.other .msg-bubble {
    border-bottom-right-radius: 4px;
}
.chat-msg .msg-footer {
    display: flex;
    align-items: center;
    margin-top: 4px;
    padding: 0 4px;
    gap: 8px;
}
.chat-msg .msg-footer-mine {
    justify-content: flex-end;
}
.chat-msg .msg-footer-other {
    justify-content: flex-start;
}
.chat-msg .msg-time-left {
    font-size: 11px;
    font-weight: 400;
    color: #495057;
    background: #f0f4f8;
    padding: 2px 7px;
    border-radius: 10px;
    border: 1px solid #d0d8de;
    white-space: nowrap;
}
.chat-msg .msg-time {
    font-size: 12px;
    font-weight: 500;
    color: #546e7a;
}
.chat-msg .msg-status {
    font-size: 11px;
}
.chat-msg .msg-status.read {
    color: #3498db;
}
.read-status-name.is-admin {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
}
.read-status-name.is-head {
    background: #fff3cd;
    color: #495057;
    border: 1px solid #ffe082;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
}
.chat-msg .msg-read-label {
    font-size: 11px;
    color: #8899a6;
    font-style: italic;
}
.chat-empty {
    text-align: center;
    color: #999;
    padding: 8px 12px;
    font-size: 13px;
}
.chat-input-area {
    display: flex;
    gap: 10px;
    padding: 12px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
}
.chat-format-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
}
.chat-readonly .chat-input-area,
.chat-readonly .chat-attach-preview {
    display: none !important;
}
.chat-readonly .chat-format-bar {
    justify-content: flex-end;
}
.chat-readonly .chat-format-bar > :not(.fmt-chat-actions) {
    display: none !important;
}
.chat-readonly .mobile-chat-input-row,
.chat-readonly .mobile-chat-attach-preview {
    display: none !important;
}
.chat-readonly .mobile-chat-format-bar {
    justify-content: flex-end;
}
.chat-readonly .mobile-chat-format-bar > :not(.mobile-fmt-actions) {
    display: none !important;
}
@media (min-width: 769px) {
    .chat-wrapper:not(.expanded) .chat-format-bar .fmt-zoom-btn {
        display: none !important;
    }
}
.fmt-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: all 0.15s;
    margin-right: 4px;
}
.fmt-btn:hover {
    background: #f0f0f0;
    border-color: #3498db;
    color: #3498db;
}
.fmt-btn.active {
    background: #3498db;
    border-color: #3498db;
    color: #fff;
}
.fmt-sep {
    width: 1px;
    height: 20px;
    background: #e0e0e0;
    margin: 0 4px;
}
.fmt-chat-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}
.fmt-chat-actions .fmt-btn {
    margin-right: 0;
}
.fmt-colors {
    display: flex;
    gap: 4px;
}
.fmt-color-btn {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}
.fmt-color-btn:hover {
    transform: scale(1.15);
}
.fmt-color-btn.active {
    border-color: #fff;
    box-shadow: 0 0 0 2px #333;
    transform: scale(1.1);
}
.fmt-spacer {
    flex: 1;
}
.chat-input {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    border-radius: 18px;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, min-height 0.15s;
    overflow-y: auto;
    word-wrap: break-word;
    box-sizing: border-box;
    background: #fff;
    white-space: pre-wrap;
}
.chat-input:empty:before {
    content: attr(data-placeholder);
    color: #999;
    pointer-events: none;
}
.chat-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}
.chat-input-area .btn {
    align-self: center;
    height: 44px;
    padding: 0 18px;
    border-radius: 18px;
}
.chat-file-input {
    display: none;
}
.btn-attach {
    align-self: center;
    height: 44px;
    min-width: 52px;
    padding: 0 12px;
    border-radius: 12px;
    background: #f0f7ff;
    border: 1px solid #3498db;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #3498db;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
}
.chat-input-area .btn-attach { display: none !important; }
.chat-attach-btn svg { display: block; }
.chat-readonly .chat-attach-btn { display: none !important; }
.btn-attach:hover {
    background: #3498db;
    color: #fff;
}
.btn-attach.active {
    background: #27ae60;
    border-color: #27ae60;
    color: #fff;
}
.btn-attach svg {
    flex-shrink: 0;
}
.chat-attach-preview {
    display: none;
    padding: 8px 12px;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
    gap: 8px;
    flex-wrap: wrap;
}
.chat-attach-preview.has-files {
    display: flex;
}
.chat-attach-thumb {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    background: #fff;
}
.chat-attach-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.chat-attach-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    border: none;
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.chat-attach-remove:hover {
    background: rgba(231, 76, 60, 0.9);
}
.modal-overlay#chatPhotoModal {
    background: rgba(0,0,0,0.7);
    z-index: 5000;
    transition: background 0.35s ease;
}
.modal-overlay#chatPhotoModal.chat-photo-expanded {
    background: rgba(0,0,0,0.92);
}
.chat-photo-modal {
    background: #fff;
    border-radius: 12px;
    padding: 0;
    width: 55vw;
    max-width: 500px;
    max-height: 60vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
    overflow: hidden;
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease, border-radius 0.35s ease;
}
.modal-overlay#chatPhotoModal.open .chat-photo-modal {
    transform: scale(1);
    opacity: 1;
}
.chat-photo-modal.expanded {
    border-radius: 16px;
}
.chat-photo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
    flex-shrink: 0;
}
.chat-photo-title {
    font-weight: 600;
    color: #2c3e50;
    font-size: 13px;
}
.chat-photo-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.chat-photo-expand-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
    padding: 0;
}
.chat-photo-expand-btn:hover {
    background: #3498db;
    border-color: #3498db;
    color: #fff;
}
.chat-photo-expand-btn svg {
    transition: transform 0.3s ease;
}
.chat-photo-close {
    background: none;
    border: none;
    font-size: 22px;
    color: #888;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}
.chat-photo-close:hover {
    background: #f0f0f0;
    color: #333;
}
.chat-photo-modal img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    cursor: pointer;
}
.chat-empty {
    margin: auto;
    text-align: center;
    color: #94a3b8;
    padding: 24px 16px;
    font-size: 14px;
    background: transparent;
}
.mobile-chat-empty {
    margin: auto;
    text-align: center;
    color: #94a3b8;
    padding: 24px 16px;
    font-size: 14px;
}
.chat-wrapper::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
    width: 6px;
}
.chat-wrapper::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chat-wrapper::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}
.chat-wrapper::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}
.chat-notif-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 40px;
    height: 38px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
    padding: 0 10px;
}
.chat-notif-btn:hover {
    background: #f8f9fa;
    border-color: #3498db;
    color: #3498db;
}
.chat-notif-btn.has-messages {
    color: #3498db;
    border-color: #3498db;
    animation: pulse-notif 2s infinite;
}
@keyframes pulse-notif {
    0%, 100% { box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(52, 152, 219, 0); }
}
.notif-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}
.chat-notif-modal {
    width: 420px;
    max-width: calc(100% - 40px);
    max-height: 80vh;
    border-radius: 12px;
}
.chat-notif-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}
.chat-notif-modal .modal-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: #2c3e50;
}
.chat-notif-modal .chat-notif-list {
    max-height: 60vh;
    overflow-y: auto;
}
.chat-notif-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    border-top: 1px solid #eee;
}
.chat-notif-page-btn {
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.chat-notif-page-btn:hover {
    background: #2980b9;
}
.chat-notif-page-info {
    font-size: 13px;
    color: #888;
    min-width: 50px;
    text-align: center;
}
.chat-notif-icon.new {
    background: #e3f2fd;
    color: #3498db;
}
.chat-notif-icon.history-icon {
    background: #f5f5f5;
    color: #888;
}
.chat-notif-item.history {
    opacity: 0.8;
}
.chat-notif-item.history:hover {
    opacity: 1;
}
.modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}
.modal-close-btn:hover {
    color: #333;
}
.chat-notif-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px 0;
}
.chat-notif-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.15s;
}
.chat-notif-item:hover {
    background: #f8f9fa;
}
.chat-notif-icon {
    width: 36px;
    height: 36px;
    background: #e3f2fd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3498db;
    flex-shrink: 0;
}
.chat-notif-info {
    flex: 1;
    min-width: 0;
}
.chat-notif-section-title {
    font-size: 11px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px 6px;
    background: #fafafa;
}
.chat-notif-title {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-notif-meta {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}
.chat-notif-meta font {
    font-weight: 600;
}
.chat-notif-meta span[style*="color"] {
    font-weight: 600;
}
.chat-notif-badge {
    min-width: 22px;
    height: 22px;
    background: #e74c3c;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    flex-shrink: 0;
}
.chat-notif-empty {
    text-align: center;
    color: #aaa;
    padding: 40px 20px;
    font-size: 14px;
}
.modal-overlay#chatExpandModal {
    z-index: 3000;
}
.chat-expand-modal {
    width: 900px;
    max-width: 95vw;
    height: 85vh;
    max-height: 85vh;
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    background: #fff;
}
.chat-expand-header {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e8e8e8;
    background: #fff;
    flex-shrink: 0;
}
.chat-expand-header .detail-close-btn {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
}
.chat-expand-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.chat-expand-title {
    margin: 0;
    font-size: 17px;
    color: #2c3e50;
    font-weight: 700;
}
.chat-expand-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.chat-expand-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: #eef2f5;
}
.chat-expand-body .chat-participants-header {
    padding: 6px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-size: 12px;
    color: #6c757d;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    flex-shrink: 0;
    min-height: 30px;
}
.chat-expand-body .chat-messages {
    flex: 1;
    height: auto;
    overflow-y: auto;
    scrollbar-width: thin;
    padding: 16px 12px;
    background: #eef2f5;
}
.chat-expand-body .chat-format-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}
.chat-expand-body .chat-input-area {
    display: flex;
    gap: 10px;
    padding: 12px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}
.chat-expand-body .chat-attach-preview {
    display: none;
    padding: 8px 12px;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.chat-expand-body .chat-attach-preview.has-files {
    display: flex;
}
.chat-expand-body .chat-input {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    border-radius: 18px;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    outline: none;
    overflow-y: auto;
    word-wrap: break-word;
    box-sizing: border-box;
    background: #fff;
    white-space: pre-wrap;
}
.chat-expand-body .chat-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}
@media (max-width: 768px) {
    .modal-overlay#chatExpandModal {
        padding: 0;
        align-items: flex-end;
        justify-content: center;
    }
    .modal-overlay#chatExpandModal.open {
        display: flex;
        overflow: hidden;
    }
    .modal-overlay#chatExpandModal.open .chat-expand-modal {
        margin: 0;
        width: 100%;
        height: 85vh;
        max-height: 85vh;
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        animation: slideUpChat 0.3s ease-out;
    }
    @keyframes slideUpChat {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    .modal-overlay#chatExpandModal .chat-expand-body {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .modal-overlay#chatExpandModal .chat-messages {
        flex: 1;
        height: auto;
        overflow-y: auto;
        scrollbar-width: thin;
    }
    .modal-overlay#chatExpandModal .chat-format-bar {
        flex-wrap: wrap;
        gap: 4px;
        padding: 8px;
        justify-content: flex-start;
        background: #fafafa;
        border-top: 1px solid #eee;
        flex-shrink: 0;
    }
    .modal-overlay#chatExpandModal .chat-format-bar .fmt-btn,
    .modal-overlay#chatExpandModal .chat-format-bar .fmt-sep,
    .modal-overlay#chatExpandModal .chat-format-bar .fmt-colors,
    .modal-overlay#chatExpandModal .chat-format-bar .fmt-zoom-btn,
    .modal-overlay#chatExpandModal .chat-format-bar .fmt-chat-actions {
        display: flex !important;
    }
    .modal-overlay#chatExpandModal #chatExpandBtn {
        display: none !important;
    }
    .chat-readonly .modal-overlay#chatExpandModal .chat-format-bar {
        display: none !important;
    }
    .chat-readonly .mobile-chat-format-bar {
        display: none !important;
    }
    .modal-overlay#chatExpandModal .chat-input-area {
        flex-shrink: 0;
        padding: 8px;
        background: #fff;
        border-top: 1px solid #eee;
    }
    .modal-overlay#chatExpandModal .chat-input {
        font-size: 16px;
    }
    .modal-overlay#chatPhotoModal {
        padding: 16px;
        align-items: center;
        justify-content: center;
    }
    .chat-photo-modal {
        width: 90vw;
        max-width: 400px;
        max-height: 70vh;
        border-radius: 16px;
        animation: scaleInPhoto 0.25s ease-out;
    }
    @keyframes scaleInPhoto {
        from { transform: scale(0.85); opacity: 0; }
        to { transform: scale(1); opacity: 1; }
    }
    .chat-photo-modal.expanded {
        width: 100%;
        max-width: 100%;
        max-height: 95vh;
        border-radius: 0;
        animation: none;
    }
    .chat-photo-modal img {
        max-height: calc(70vh - 50px);
    }
    .chat-photo-modal.expanded img {
        max-height: calc(95vh - 50px);
    }
}
#chatAddParticipantBtnExpanded,
#chatRemoveParticipantBtnExpanded {
    display: none;
}
.modal-overlay#addParticipantModal {
    align-items: flex-start;
    padding-top: 8vh;
}
#addParticipantModal .form-actions {
    margin-top: 24px;
    display: flex;
    gap: 10px;
    justify-content: center;
}
#addParticipantModal .form-actions .btn {
    flex: 1;
    min-width: 120px;
}
#removeParticipantModal .form-actions {
    margin-top: 24px;
    display: flex;
    gap: 10px;
    justify-content: center;
}
#removeParticipantModal .form-actions .btn {
    flex: 1;
    min-width: 120px;
}
#personNameModal .form-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
}
#personNameModal .form-actions .btn {
    flex: 1;
}
.btn-danger {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 10px 20px;
}
.btn-danger:hover {
    background-color: #c0392b;
}
.btn-danger:disabled {
    background-color: #f5b7b1;
    cursor: not-allowed;
}
#participantSearchInput {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}
#participantSearchInput:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}
.participant-search-results {
    display: none;
    overflow-y: visible;
    margin-top: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: white;
}
.participant-search-result {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f5f5f5;
    gap: 10px;
}
.participant-search-result:last-child {
    border-bottom: none;
}
.participant-search-result:hover,
.participant-search-result.selected {
    background: #f0f8ff;
}
.participant-search-result.already-added,
.participant-search-result.already-added:hover {
    background: #fdecec;
    box-shadow: inset 3px 0 0 #e74c3c;
    cursor: not-allowed;
    user-select: none;
}
.participant-search-result .participant-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #3498db;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 12px;
    flex-shrink: 0;
}
.participant-search-result .participant-info {
    flex: 1;
}
.participant-search-result .participant-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
}
.participant-search-result .participant-role {
    font-size: 12px;
    color: #666;
}
.participant-not-found {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
    background: #f9f9f9;
    border-radius: 6px;
    margin-top: 10px;
}
#pcAddContactModal .participant-search-results {
    max-height: 300px;
    overflow-y: auto;
}
.participant-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
}
.participant-pagination .page-btn {
    min-width: 32px;
    height: 32px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: all 0.2s;
}
.participant-pagination .page-btn:hover:not(.disabled) {
    background: #f0f0f0;
    border-color: #ccc;
}
.participant-pagination .page-btn.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}
.participant-pagination .page-btn.disabled {
    opacity: 0.4;
    cursor: default;
}
.participant-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f5f5f5;
    gap: 10px;
}
.participant-item:last-child {
    border-bottom: none;
}
.participant-item:hover {
    background: #f0f8ff;
}
.participant-item-added {
    background: #e8f5e9;
}
.participant-item-added:hover {
    background: #c8e6c9;
}
.participant-item .participant-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
}
.participant-item .participant-info {
    font-size: 12px;
    color: #888;
}
#contactSearchModal .modal {
    width: 560px;
    max-width: calc(100vw - 20px);
    box-sizing: border-box;
}
#contactSearchModal .participant-search-results {
    max-height: 320px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
#contactSearchModal .participant-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}
#contactSearchModal .participant-name,
#contactSearchModal .participant-info {
    line-height: 1.35;
}
.chat-msg .msg-tg-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.chat-msg .msg-tg-name {
    font-weight: 600;
    font-size: 13px;
}
.chat-msg .msg-tg-name.role-admin {
    color: #c62828 !important;
}
.chat-msg .msg-tg-name.role-head {
    color: #856404 !important;
}
.chat-msg .msg-tg-name.role-user {
    color: #444 !important;
}
.chat-msg .msg-tg-time {
    font-size: 11px;
    color: #999;
    margin-left: auto;
}
.chat-msg .msg-footer {
    margin-top: 4px;
}
.chat-msg .read-check {
    font-size: 11px;
    color: #4caf50;
    margin-right: 2px;
}
.chat-msg .read-person {
    font-size: 12px;
    font-weight: 500;
}
.chat-msg .read-person.role-admin {
    color: #c62828 !important;
}
.chat-msg .read-person.role-head {
    color: #856404 !important;
}
.chat-msg .read-person.role-user {
    color: #555 !important;
}
.chat-msg .read-time {
    font-size: 11px;
    color: #888;
}
.chat-msg .read-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #e8e8e8;
    border: 1px solid #ccc;
    padding: 3px 10px;
    border-radius: 12px;
    margin: 2px 6px 2px 0;
}
.chat-msg .read-tag-single {
    padding: 3px 8px;
}
.msg-context-menu {
    position: fixed;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    z-index: 10000;
    overflow: hidden;
    min-width: 140px;
}
.msg-menu-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    transition: background 0.1s;
}
.msg-menu-item:hover {
    background: #f0f0f0;
}
.msg-menu-item-danger {
    color: #e74c3c;
}
.msg-menu-item-danger:hover {
    background: #fdecea;
}
.msg-deleted-text {
    color: #999;
    font-style: italic;
    font-size: 13px;
}
.mobile-msg-del {
    background: none;
    border: none;
    cursor: pointer;
    color: #e74c3c;
    font-size: 12px;
    padding: 0 2px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}
.mobile-msg:hover .mobile-msg-del {
    opacity: 1;
}
.mobile-msg-del:hover {
    color: #c0392b;
}
.msg-del-btn {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #e74c3c;
    cursor: pointer;
    border-radius: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s, background 0.15s;
}
.chat-msg:hover .msg-del-btn {
    opacity: 1;
    pointer-events: auto;
}
.msg-del-btn:hover {
    background: rgba(231, 76, 60, 0.12);
}
.msg-del-btn svg {
    display: block;
}
.reply-quote {
    background: #f5f5f5;
    border-left: 3px solid #4caf50;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 0 8px 8px 0;
    width: 100%;
    box-sizing: border-box;
}
.reply-quote-header {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    flex-wrap: wrap;
    text-align: left;
}
.reply-quote-author {
    font-weight: 600;
    font-size: 12px;
    color: #4caf50;
    flex-shrink: 0;
}
.reply-quote-text {
    font-size: 12px;
    color: #666;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.reply-quote-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}
.reply-quote-close:hover {
    color: #333;
}
.chat-msg .msg-reply-block {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    background: rgba(76, 175, 80, 0.08);
    border-left: 2px solid #4caf50;
    padding: 4px 8px;
    margin-bottom: 6px;
    border-radius: 0 4px 4px 0;
    font-size: 12px;
}
.chat-msg .msg-reply-arrow {
    color: #4caf50;
    font-weight: 600;
    flex-shrink: 0;
}
.chat-msg .msg-reply-author {
    font-weight: 600;
    color: #555;
    flex-shrink: 0;
}
.chat-msg .msg-reply-text {
    color: #777;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-msg .msg-header-divider {
    height: 1px;
    background: rgba(0,0,0,0.08);
    margin-bottom: 8px;
}
.chat-msg .msg-body-text {
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    color: #222;
    text-align: left;
}
.chat-msg .msg-image {
    max-width: min(240px, 100%);
    max-height: 240px;
    width: auto;
    height: auto;
    border-radius: 12px;
    cursor: pointer;
    display: block;
    margin-top: 6px;
    transition: transform 0.15s;
}
.chat-msg .msg-image:hover {
    transform: scale(1.02);
}
.chat-msg .msg-image-wrap {
    margin-top: 6px;
    max-width: 100%;
}
.chat-msg .msg-bubble {
    background: #fff !important;
    border: 1px solid #d8dfe5 !important;
    padding: 12px 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.chat-msg.other {
    justify-content: flex-start;
}
.chat-msg.other .msg-other-block {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}
.chat-msg.other .msg-bubble {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 16px;
    background: #ddf7fa !important;
    border-color: #b2ebf2 !important;
}
.chat-msg.other .msg-tg-name {
    color: #00838f;
}
.chat-msg.mine {
    justify-content: flex-end;
}
.chat-msg.mine .msg-bubble {
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 4px;
    background: #fff !important;
    border-color: #d8dfe5 !important;
}
.chat-msg.mine .msg-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}
.chat-msg .msg-sender-badge,
.chat-msg .msg-sender,
.chat-msg .msg-sender-time,
.chat-msg .msg-time-side,
.chat-msg .msg-bubble-with-time,
.chat-msg.other .msg-other-block > .msg-sender {
    display: none !important;
}
@media (min-width: 769px) {
    .mobile-incidents-list {
        display: none !important;
    }
    .mobile-users-list {
        display: none !important;
    }
    .incidents-table {
        display: table !important;
        width: 100%;
    }
    .users-table {
        display: table !important;
        width: 100%;
    }
    .users-card .search-row {
        flex-direction: row !important;
        align-items: center !important;
    }
    .users-card .search-row .form-input,
    #userSearchInput {
        width: 280px !important;
        min-width: 0;
        max-width: 280px;
        flex: 0 0 280px;
    }
    .users-card .search-row > div {
        width: auto !important;
        flex-direction: row !important;
    }
    .users-card .search-row .btn {
        width: auto !important;
    }
    .users-card .add-btn {
        width: auto !important;
        margin-top: 0 !important;
        margin-left: auto !important;
    }
}
.btn-outline {
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
}
.btn-outline:hover {
    border-color: #3498db;
    color: #3498db;
}
.btn-reopen-request {
    background: #fff;
    border: 1px solid #ddd;
    color: #333;
    cursor: pointer;
}
.btn-reopen-request:hover,
.btn-reopen-request:focus,
.btn-reopen-request:active {
    background: #f5f7fa;
    border-color: #cfd6df;
    color: #333;
}
[data-theme="dark"] .btn-reopen-request {
    background: var(--bg-2);
    border-color: var(--border);
    color: var(--text);
}
[data-theme="dark"] .btn-reopen-request:hover,
[data-theme="dark"] .btn-reopen-request:focus,
[data-theme="dark"] .btn-reopen-request:active {
    background: var(--bg-4);
    border-color: var(--border-2);
    color: var(--text);
}
.btn-reopen-request-sent,
.btn-reopen-request-sent:hover,
.btn-reopen-request-sent:focus,
.btn-reopen-request-sent:active {
    background: #eefaf2;
    border: 1px solid #b7e4c7;
    color: #2e7d32;
    cursor: default;
    opacity: 1;
}
[data-theme="dark"] .btn-reopen-request-sent,
[data-theme="dark"] .btn-reopen-request-sent:hover,
[data-theme="dark"] .btn-reopen-request-sent:focus,
[data-theme="dark"] .btn-reopen-request-sent:active {
    background: rgba(46, 204, 113, 0.12);
    border-color: rgba(46, 204, 113, 0.38);
    color: #9fe7b4;
}
.required {
    color: #e74c3c;
}
.modal-department {
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}
.modal-department .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    position: relative;
}
.modal-department .modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: #2c3e50;
    flex: 1;
    text-align: center;
}
.modal-department .modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    line-height: 1;
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
}
.modal-department .modal-close:hover {
    color: #333;
}
.modal-department .modal-search {
    padding: 16px 24px;
    border-bottom: 1px solid #eee;
}
.modal-department .modal-search .form-input {
    margin: 0;
}
.modal-department .modal-list {
    flex: 1;
    overflow-y: auto;
    min-height: 200px;
    max-height: 350px;
    padding: 8px 0;
}
.modal-department .modal-list-item {
    padding: 12px 24px;
    cursor: pointer;
    transition: background-color 0.15s;
    position: relative;
    padding-right: 50px;
}
.modal-department .modal-list-item:hover {
    background-color: #f5f5f5;
}
.modal-department .modal-list-item:active {
    background-color: #e8e8e8;
}
.modal-department .modal-list-item--selected {
    background-color: #e8f4fc;
    color: #2980b9;
    font-weight: 500;
}
.modal-department .modal-list-item--selected:hover {
    background-color: #d4ebf7;
}
.modal-department .modal-list-item .dept-name {
    font-weight: 500;
}
.modal-department .modal-list-item .dept-address {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}
.modal-department .modal-list-item .dept-check {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    color: #2980b9;
    font-weight: bold;
}
.modal-department .modal-list-empty {
    padding: 20px 24px;
    text-align: center;
    color: #999;
}
.modal-department .modal-footer {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid #eee;
}
.modal-department .modal-footer .btn {
    flex: 1;
}
.dept-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.dept-controls .btn-outline {
    flex-shrink: 0;
    padding: 10px 14px;
    font-size: 14px;
}
.dept-controls .btn-secondary {
    padding: 10px 14px;
    font-size: 14px;
    flex-shrink: 0;
}
.dept-controls.dept-controls--single .btn-outline {
    flex: 1 1 auto;
    width: 100%;
    padding-left: 12px;
    padding-right: 12px;
}
#incidentForm .form-row .form-input,
#incidentForm .dept-controls .btn-outline,
#incidentForm .dept-controls .btn-secondary {
    line-height: 20px;
}
#incidentForm .dept-controls .btn-secondary {
    border: 1px solid transparent;
}
@media (max-width: 768px) {
    .dept-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .modal-department {
        max-width: 95%;
    }
}
.private-chat-modal {
    width: 900px;
    max-width: 95vw;
    height: 80vh;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border-radius: 16px;
}
.pc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e8e8e8;
    flex-shrink: 0;
}
.pc-title {
    margin: 0;
    font-size: 17px;
    color: #2c3e50;
    font-weight: 700;
}
.pc-body {
    flex: 1;
    display: flex;
    min-height: 0;
}
.pc-left-panel {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e8e8e8;
    background: #fafafa;
}
.pc-left-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e8e8e8;
    flex-shrink: 0;
}
.pc-left-title {
    font-weight: 600;
    font-size: 14px;
    color: #2c3e50;
}
.pc-contacts-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
}
.pc-contacts-list::-webkit-scrollbar {
    width: 4px;
}
.pc-contacts-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}
.pc-contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f0f0f0;
}
.pc-contact-item:hover {
    background: #eef2f5;
}
.pc-contact-item.active {
    background: #e3f0ff;
}
.pc-contact-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #3498db;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}
.pc-contact-info {
    flex: 1;
    min-width: 0;
}
.pc-contact-name {
    font-size: 13px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pc-unread-badge {
    background: #e74c3c;
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
    line-height: 1.5;
}
.pc-right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.pc-right-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 10px 16px;
    border-bottom: 1px solid #e8e8e8;
    background: #fff;
}
.pc-right-title {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}
.pc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #eef2f5;
    scrollbar-width: thin;
}
.pc-messages::-webkit-scrollbar {
    width: 6px;
}
.pc-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}
.pm-message {
    display: flex;
    flex-direction: column;
    max-width: 75%;
}
.pm-mine {
    align-self: flex-end;
    align-items: flex-end;
}
.pm-theirs {
    align-self: flex-start;
    align-items: flex-start;
}
.pm-message-bubble {
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 100%;
    word-break: break-word;
}
.pm-mine .pm-message-bubble {
    background: linear-gradient(135deg, #4c9aff, #2f7fe0);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.pm-theirs .pm-message-bubble {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.pm-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
    padding: 0 4px;
}
.pm-mine .pm-message-time {
    color: rgba(255,255,255,0.7);
}
.pm-read-status {
    margin-left: 6px;
    font-style: italic;
}
.pc-messages .chat-msg {
    animation: none;
}
.pc-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e8e8e8;
    background: #fff;
    align-items: center;
}
.pc-input-area .form-input {
    flex: 1;
}
.pc-input-area .pc-send-btn {
    height: 42px;
    min-width: 88px;
    padding: 0 20px;
    font-size: 14px;
    font-weight: 600;
}
.pc-delete-chat-modal {
    width: 380px;
}
.pc-delete-chat-text {
    padding: 20px 28px;
    text-align: center;
    font-size: 14px;
    color: #555;
}
.pc-delete-chat-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 28px 20px;
}
.pc-delete-chat-self {
    border: 1px solid #3498db;
    color: #3498db;
    background: #fff;
}
.totp-hint {
    font-size: 13px;
    line-height: 1.5;
    color: #666;
    margin: 0 0 12px;
}
.totp-qr-wrap {
    display: flex;
    justify-content: center;
    margin: 4px 0 10px;
}
.totp-qr-wrap img {
    width: 200px;
    height: 200px;
    padding: 6px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    image-rendering: pixelated;
}
.totp-link {
    display: block;
    margin-bottom: 12px;
    text-align: center;
    font-size: 12px;
    color: #3498db;
    word-break: break-all;
}
#loginModal .btn {
    display: block;
    width: 100%;
    max-width: 220px;
    margin: 12px auto 0;
}
#loginModal .login-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
}
#loginModal .login-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    max-width: 180px;
    margin: 0;
}
#loginModal .form-group {
    text-align: center;
}
#loginModal .form-group label {
    display: block;
    text-align: center;
}
#loginModal .form-input {
    display: block;
    max-width: 260px;
    margin: 0 auto;
    text-align: center;
    caret-color: transparent;
}
#loginModal .totp-hint,
#loginModal .error-msg {
    text-align: center;
}
.otp-input {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 6px 0 4px;
}
.otp-input .otp-cell {
    width: 44px;
    height: 52px;
    padding: 0;
    margin: 0;
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    font-family: inherit;
    color: #2c3e50;
    background: #fff;
    border: 1.5px solid #d5dbe3;
    border-radius: 10px;
    outline: none;
    caret-color: transparent;
    transition: border-color 0.22s ease, background-color 0.22s ease,
                box-shadow 0.22s ease, color 0.22s ease, transform 0.15s ease;
}
.otp-input .otp-cell:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}
.otp-input .otp-cell.filled {
    animation: otp-pop 0.15s ease;
}
.otp-input.success .otp-cell {
    animation: otp-green-wave 0.5s ease both;
}
.otp-input.success .otp-cell:nth-child(2) { animation-delay: 0.06s; }
.otp-input.success .otp-cell:nth-child(3) { animation-delay: 0.12s; }
.otp-input.success .otp-cell:nth-child(4) { animation-delay: 0.18s; }
.otp-input.success .otp-cell:nth-child(5) { animation-delay: 0.24s; }
.otp-input.success .otp-cell:nth-child(6) { animation-delay: 0.30s; }
.otp-input .otp-cell.error {
    border-color: #e74c3c;
    color: #e74c3c;
}
@keyframes otp-pop {
    0% { transform: scale(0.88); }
    100% { transform: scale(1); }
}
@keyframes otp-green-wave {
    0% {
        transform: scale(1);
        border-color: #d5dbe3;
        background: #fff;
        color: #2c3e50;
        box-shadow: none;
    }
    45% {
        transform: scale(1.08);
        border-color: #2ecc71;
        background: #d7f5e3;
        color: #1e8449;
        box-shadow: 0 0 0 7px rgba(46, 204, 113, 0.20);
    }
    100% {
        transform: scale(1);
        border-color: #2ecc71;
        background: #eafaf1;
        color: #1e8449;
        box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.15);
    }
}
@keyframes otp-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}
.otp-input.shake {
    animation: otp-shake 0.4s ease;
}
@media (max-width: 480px) {
    .otp-input { gap: 6px; }
    .otp-input .otp-cell { width: 38px; height: 46px; font-size: 18px; }
}
#loginModal .modal {
    width: 440px;
    max-height: calc(100vh - 12px);
    overflow-y: auto;
}
.login-step {
    animation: loginStepIn 0.26s ease both;
}
.login-step-enter {
    animation: loginStepIn 0.26s ease both;
}
@keyframes loginStepIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
#loginModal .login-register-link {
    display: block;
    width: auto !important;
    max-width: none !important;
    margin: 14px auto 0 !important;
    padding: 4px 8px;
    background: none;
    border: none;
    color: #3498db;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
#loginModal .login-register-link:hover {
    text-decoration: underline;
}
.login-step-hint {
    text-align: left;
}
#loginModal .login-reg-step .form-group,
#loginModal .login-profile-step .form-group {
    margin-bottom: 12px;
    text-align: left;
}
#loginModal .login-reg-step .form-group label,
#loginModal .login-profile-step .form-group label {
    text-align: left;
}
#loginModal .login-reg-step .form-input,
#loginModal .login-profile-step .form-input {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
    text-align: left;
    caret-color: auto;
    transition: border-color 0.4s ease, background-color 0.4s ease, box-shadow 0.4s ease;
}
#loginModal .login-reg-step .form-select,
#loginModal .login-profile-step .form-select {
    cursor: pointer;
}
.login-reg-warning {
    margin: 0 0 12px;
    padding: 11px 13px;
    border: 1px solid #b7e4c7;
    border-radius: 8px;
    background: #eefaf2;
    color: #2e7d32;
    font-size: 13px;
    line-height: 1.45;
    text-align: left;
}
.modal .login-reg-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 6px 0 16px;
    padding: 13px 15px;
    border: 1px solid #e1e7ef;
    border-radius: 10px;
    background: #f7f9fc;
    color: #3d4a5c;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.35;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}
.modal .login-reg-checkbox:hover {
    background: #f1f6fc;
    border-color: #cfe0f2;
}
.modal .login-reg-checkbox:has(input:checked) {
    background: #eaf4ff;
    border-color: #accff0;
    box-shadow: 0 1px 4px rgba(52, 152, 219, 0.1);
}
.modal .login-reg-checkbox span {
    position: relative;
    top: 0;
}
.modal .login-reg-checkbox input {
    -webkit-appearance: none;
    appearance: none;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin: 0 9px 0 0;
    padding: 0;
    border: 1.5px solid #b9c3d0;
    border-radius: 4px;
    background-color: #fff;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 11px 11px;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.modal .login-reg-checkbox input:checked {
    border-color: #3498db;
    background-color: #3498db;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M2 6.5 4.7 9 10 3.5'/%3E%3C/svg%3E");
}
.modal .login-reg-checkbox input:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.25);
}
@keyframes fieldInvalidPulse {
    0% { box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.18); }
    50% { box-shadow: 0 0 0 5px rgba(231, 76, 60, 0.05); }
    100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}
.modal .login-reg-step .form-input.field-invalid,
.modal .login-profile-step .form-input.field-invalid {
    border-color: #e74c3c;
    background-color: #fff7f7;
    animation: fieldInvalidPulse 0.6s ease-in-out 5 forwards;
}
.modal .login-reg-checkbox.field-invalid {
    border-color: #e74c3c;
    background: #fff5f5;
    animation: fieldInvalidPulse 0.6s ease-in-out 5 forwards;
}
.modal .login-reg-checkbox.field-invalid input {
    border-color: #e74c3c;
}
.login-token-highlight {
    margin: 14px 0 4px;
    padding: 14px;
    border: 1px solid #b7e4c7;
    border-radius: 10px;
    background: #eefaf2;
    text-align: center;
}
.login-token-highlight-title {
    font-size: 13px;
    font-weight: 700;
    color: #2e7d32;
}
.login-token-value {
    display: block;
    margin: 6px 0;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #1b5e20;
    word-break: break-all;
}
.login-token-copy {
    padding: 5px 12px;
    border: 1px solid #9ed3ad;
    border-radius: 6px;
    background: #fff;
    color: #2e7d32;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.login-token-copy:hover {
    background: #f1fbf4;
}
.login-token-highlight-note {
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.4;
    color: #2e7d32;
}
.login-status-badge {
    display: block;
    margin: 0 auto 12px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    background: #f1f3f5;
    color: #495057;
}
.login-status-badge.pending {
    background: #fff4e5;
    color: #b36b00;
}
.login-status-badge.clarification {
    background: #fff8e1;
    color: #8a6d12;
}
.login-status-badge.approved {
    background: #e8f5e9;
    color: #2e7d32;
}
.login-status-badge.rejected {
    background: #fdecea;
    color: #c0392b;
}
.login-status-meta {
    margin: -6px 0 10px;
    text-align: center;
    font-size: 12px;
    color: #8a94a6;
}
[data-theme="dark"] .login-status-meta {
    color: var(--text-2);
}
.login-status-details {
    margin: 12px 0;
    padding: 4px 14px;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    background: #fafbfc;
    text-align: left;
}
.login-status-row {
    display: grid;
    gap: 2px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(138, 148, 166, 0.22);
    font-size: 13px;
    line-height: 1.4;
}
.login-status-row:last-child {
    border-bottom: none;
}
.login-status-label {
    color: #8a94a6;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.login-status-value {
    color: #333;
    font-size: 14px;
    word-break: break-word;
}
.login-status-comment-label {
    margin: 12px 0 5px;
    font-size: 12px;
    font-weight: 600;
    color: #8a94a6;
}
[data-theme="dark"] .login-status-comment-label {
    color: var(--text-2);
}
.login-status-comment {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid #f0c36d;
    border-radius: 8px;
    background: #fff8e1;
    color: #7a5b12;
    font-size: 13px;
    line-height: 1.45;
    text-align: left;
}
#loginModal .login-reg-result-step .btn,
#loginModal .login-reg-status-step .btn {
    white-space: nowrap;
}
@media (max-width: 768px) {
    #loginModal .modal {
        width: calc(100% - 20px);
        max-width: calc(100% - 20px);
        max-height: calc(100vh - 20px);
    }
    #loginModal .login-actions {
        flex-wrap: wrap;
    }
    #loginModal .login-actions .btn {
        min-width: 0;
        flex: 1 1 0;
        max-width: none;
    }
}
