.mobile-incidents-list {
    display: none;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}
.mobile-incident-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #f0f0f0;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
}
.mobile-incident-card:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.mobile-incident-card.status-active {
    border-left: 4px solid #27ae60;
}
.mobile-incident-card.status-closed {
    border-left: 4px solid #bdbdbd;
    opacity: 0.9;
}
.mobile-incident-card.status-reopened {
    border-left: 4px solid #f0a020;
}
.mobile-incident-card.inc-new { background: #e9f7ec; }
.mobile-incident-card.inc-closed { background: #f5f5f5; }
.mobile-incident-card.inc-reopened { background: #fff6e8; }
.mic-card-top {
    padding: 14px 16px 10px;
}
.mic-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.mic-id {
    background: #e8f4fc;
    color: #1a73e8;
    font-weight: 700;
    font-size: 13px;
    padding: 3px 10px;
    border-radius: 8px;
}
.mic-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.mic-status-badge.status-active {
    background: #e8f8ef;
    color: #27ae60;
}
.mic-status-badge.status-closed {
    background: #f0f0f0;
    color: #888;
}
.mic-status-badge.status-reopened {
    background: #fff3e0;
    color: #e65100;
}
.mic-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.mic-status-badge.status-active .mic-status-dot {
    background: #27ae60;
}
.mic-status-badge.status-closed .mic-status-dot {
    background: #888;
}
.mic-status-badge.status-reopened .mic-status-dot {
    background: #e65100;
}
.mic-department {
    font-weight: 600;
    color: #2c3e50;
    font-size: 15px;
    line-height: 1.3;
}
.mic-card-body {
    padding: 0 16px 12px;
}
.mic-field {
    margin-bottom: 0;
    overflow: hidden;
}
.mic-field .mic-value {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
    color: #555;
    line-height: 1.4;
}
.mic-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f5f5f5;
    flex-wrap: wrap;
}
.mic-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #999;
}
.mic-meta-item svg {
    flex-shrink: 0;
}
.mic-action-bar {
    display: flex;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
}
.mic-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 8px;
    background: transparent;
    border: none;
    border-right: 1px solid #f0f0f0;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}
.mic-action-btn:last-child {
    border-right: none;
}
.mic-action-btn:active {
    background: #f0f0f0;
}
.mic-action-btn svg {
    flex-shrink: 0;
}
.mic-action-btn.btn-view {
    color: #1a73e8;
}
.mic-action-btn.btn-view:active {
    background: #e8f4fc;
}
.mic-action-btn.btn-close {
    color: #c0392b;
}
.mic-action-btn.btn-close:active {
    background: #fdecea;
}
.mic-action-btn.btn-reopen {
    color: #27ae60;
}
.mic-action-btn.btn-reopen:active {
    background: #e8f8ef;
}
.mic-action-btn.btn-delete {
    color: #c0392b;
}
.mic-action-btn.btn-delete:active {
    background: #fdecea;
}
.mic-delete-btn {
    background: #fdecea;
    color: #c0392b;
    border: none;
    border-top: 1px solid #f5f5f5;
    border-radius: 0;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
    transition: background 0.15s;
}
.mic-delete-btn:active {
    background: #f5c6cb;
}
.mobile-users-list {
    display: none;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}
.mobile-user-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    padding: 14px;
}
.mobile-user-card.inactive {
    opacity: 0.6;
    background: #f9f9f9;
}
@media (max-width: 768px) {
    .modal-overlay#incidentDetailModal.open {
        display: flex;
        overflow: hidden;
        align-items: flex-end;
        justify-content: center;
    }
    .modal-overlay#incidentDetailModal.open .modal {
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-y;
        scrollbar-width: none;
        -ms-overflow-style: none;
        border-radius: 20px 20px 0 0;
        margin: 0;
        width: 100%;
        max-height: 92vh;
        flex-shrink: 0;
        animation: slideUpModal 0.3s ease-out;
    }
    @keyframes slideUpModal {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
    .modal-overlay#incidentDetailModal.open .modal::-webkit-scrollbar {
        display: none;
    }
    .modal-overlay#incidentDetailModal.open .modal .detail-body {
        overflow: visible;
    }
    .modal-overlay#incidentDetailModal.open .modal .detail-scroll {
        overflow: visible;
        flex: none;
        padding-bottom: 20px;
    }
    .incident-detail-modal.detail-body-expanded .detail-body {
        overflow: hidden;
    }
}
@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;
    }
    .chat-section {
        padding: 12px 16px;
    }
    .chat-section .detail-label {
        min-width: auto;
        padding-top: 0;
        margin-bottom: 8px;
    }
    .chat-wrapper {
        border-radius: 12px;
        overflow: hidden;
        min-height: 200px;
        max-height: 280px;
    }
    .chat-messages {
        height: 180px;
    }
    .chat-input {
        font-size: 16px;
    }
    .chat-expand-modal {
        width: 100%;
        max-width: 100%;
        height: 85vh;
        max-height: 85vh;
        border-radius: 20px 20px 0 0;
        margin: 0;
        animation: slideUpChat 0.3s ease-out;
    }
    @keyframes slideUpChat {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
    .chat-expand-header {
        position: relative;
        padding: 16px 20px;
        border-bottom: 1px solid #eee;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .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;
        flex-wrap: wrap;
    }
    .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;
    }
    .chat-expand-body .chat-participants-header {
        padding: 6px 12px;
        border-bottom: 1px solid #f0f0f0;
        background: #fafafa;
    }
    .chat-photo-modal {
        width: 90%;
        max-width: 90%;
        max-height: 70vh;
        border-radius: 16px;
        animation: scaleInPhoto 0.25s ease-out;
    }
    @keyframes scaleInPhoto {
        from {
            transform: scale(0.8);
            opacity: 0;
        }
        to {
            transform: scale(1);
            opacity: 1;
        }
    }
    .chat-photo-modal.expanded {
        width: 100%;
        max-width: 100%;
        height: 95vh;
        max-height: 95vh;
        border-radius: 0;
    }
}
@media (max-width: 768px) {
    .mobile-incidents-list { display: flex; }
    .mobile-users-list { display: flex; }
    .incidents-table { display: none; }
    .users-table { display: none; }
    .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;
    }
    .mobile-users-list {
        display: flex;
    }
    .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;
    }
}
@media (max-width: 480px) {
    .mic-card-top {
        padding: 12px 14px 8px;
    }
    .mic-card-body {
        padding: 0 14px 10px;
    }
    .mic-action-btn {
        padding: 10px 6px;
        font-size: 11px;
    }
    .mic-action-btn span {
        display: none;
    }
    .mic-action-btn svg {
        width: 20px;
        height: 20px;
    }
}
.mobile-detail-modal {
    display: none;
}
.mobile-detail-modal.open {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeInOverlay 0.2s ease-out;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}
.mobile-detail-content {
    width: 100%;
    height: 92vh;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    animation: slideUpMobileDetail 0.3s ease-out;
    overflow: hidden;
}
@keyframes slideUpMobileDetail {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.mobile-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    padding-top: max(16px, env(safe-area-inset-top));
    border-bottom: 1px solid #eee;
    background: #fff;
    flex-shrink: 0;
}
.mobile-detail-header-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}
.mobile-detail-title {
    margin: 0;
    font-size: 18px;
    color: #2c3e50;
    font-weight: 700;
}
.mobile-detail-statuses {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.mobile-detail-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}
.mobile-detail-close:active {
    color: #333;
}
.mobile-detail-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    min-height: 0;
}
.md-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #f0f0f0;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.md-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}
.md-card-header svg {
    flex-shrink: 0;
}
.md-card-ic {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.md-card-ic svg {
    width: 16px;
    height: 16px;
}
.md-ic-blue { color: #1a73e8; }
.md-ic-orange { color: #ff9800; }
.md-ic-red { color: #c0392b; }
.md-ic-green { color: #27ae60; }
.md-ic-purple { color: #9b59b6; }
.md-ic-teal { color: #00bcd4; }
.md-card-body {
    padding: 12px 16px;
    font-size: 14px;
    color: #555;
    line-height: 1.5;
}
.md-card-body.empty {
    color: #999;
    font-style: italic;
}
.md-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    gap: 12px;
}
.md-row:not(:last-child) {
    border-bottom: 1px solid #f5f5f5;
}
.md-label {
    font-size: 12px;
    color: #999;
    flex-shrink: 0;
    min-width: 100px;
}
.md-value {
    font-size: 14px;
    color: #333;
    text-align: right;
    word-break: break-word;
}
.md-value.empty {
    color: #999;
    font-style: italic;
}
.md-action-bar {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}
.md-action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.md-action-btn:active {
    transform: scale(0.95);
}
.md-action-btn svg {
    width: 24px;
    height: 24px;
}
.md-action-btn.btn-chat {
    background: #e8f4fc;
    border-color: #1a73e8;
    color: #1a73e8;
}
.md-action-btn.btn-reopen {
    background: #e8f8ef;
    border-color: #27ae60;
    color: #27ae60;
}
.md-action-btn.btn-close {
    background: #fff3e0;
    border-color: #ff9800;
    color: #ff9800;
}
.md-action-btn.btn-delete {
    background: #fdecea;
    border-color: #c0392b;
    color: #c0392b;
}
.mobile-chat-modal {
    display: none;
}
.mobile-chat-modal.open {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeInOverlay 0.2s ease-out;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.mobile-chat-content {
    width: 100%;
    height: 85vh;
    max-height: 85vh;
    border-radius: 20px 20px 0 0;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    animation: slideUpMobileChat 0.3s ease-out;
    overflow: hidden;
}
@keyframes slideUpMobileChat {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.mobile-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    border-bottom: 1px solid #eee;
    background: #fff;
    flex-shrink: 0;
}
.mobile-chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}
.mobile-chat-back-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #1a73e8;
    display: flex;
    align-items: center;
}
.mobile-chat-back-btn:active {
    color: #0d47a1;
}
.mobile-chat-title {
    margin: 0;
    font-size: 16px;
    color: #2c3e50;
    font-weight: 700;
}
.mobile-chat-subtitle {
    font-size: 12px;
    color: #999;
}
.mobile-chat-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
}
.mobile-chat-format-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: #fafafa;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.mobile-fmt-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: all 0.15s;
}
.mobile-fmt-btn:active {
    background: #e8f0fe;
    border-color: #1a73e8;
}
.mobile-fmt-btn b,
.mobile-fmt-btn i,
.mobile-fmt-btn u,
.mobile-fmt-btn s {
    pointer-events: none;
}
.mobile-fmt-sep {
    width: 1px;
    height: 20px;
    background: #e0e0e0;
    margin: 0 4px;
}
.mobile-fmt-colors {
    display: flex;
    gap: 3px;
    align-items: center;
}
.mobile-fmt-color-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #e0e0e0;
    cursor: pointer;
    transition: transform 0.15s;
}
.mobile-fmt-color-btn:active {
    transform: scale(1.2);
}
.mobile-fmt-spacer {
    flex: 1;
}
.mobile-fmt-actions {
    display: flex;
    gap: 4px;
}
.mobile-fmt-select-btn {
    font-weight: 700;
    font-size: 12px;
}
.mobile-chat-messages {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f5f5f5;
}
.mobile-msg {
    display: flex;
    width: 100%;
}
.mobile-msg.own {
    justify-content: flex-end;
}
.mobile-msg.other {
    justify-content: flex-start;
}
.mobile-msg-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    position: relative;
    word-wrap: break-word;
}
.mobile-msg.own .mobile-msg-bubble {
    background: #1a73e8;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.mobile-msg.other .mobile-msg-bubble {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.mobile-msg-text {
    font-size: 14px;
    line-height: 1.4;
}
.mobile-msg-images {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.mobile-msg-image {
    max-width: min(150px, 100%);
    max-height: 150px;
    border-radius: 8px;
    cursor: pointer;
}
.mobile-msg-time {
    font-size: 10px;
    opacity: 0.7;
    text-align: right;
    margin-top: 4px;
}
.mobile-msg.own .mobile-msg-time {
    color: rgba(255,255,255,0.7);
}
.mobile-msg.other .mobile-msg-time {
    color: #999;
}
.mobile-msg-error {
    text-align: center;
    color: #c0392b;
    padding: 20px;
    font-size: 14px;
}
.mobile-chat-input-area {
    background: #fff;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
}
.mobile-chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 12px;
}
.mobile-chat-attach-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.mobile-chat-attach-btn:active {
    color: #1a73e8;
}
.mobile-chat-input {
    flex: 1;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 16px;
    line-height: 1.4;
    max-height: 100px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.mobile-chat-input::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}
.mobile-chat-input:focus {
    outline: none;
    border-color: #1a73e8;
}
.mobile-chat-input:empty:before {
    content: attr(data-placeholder);
    color: #999;
}
.mobile-chat-send {
    background: #1a73e8;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    font-size: 18px;
    flex-shrink: 0;
}
.mobile-chat-send:active {
    background: #0d47a1;
}
.mobile-chat-attach-preview {
    padding: 4px 12px 8px;
    background: #fafafa;
    border-top: 1px solid #eee;
    display: none;
}
.mobile-chat-attach-preview.has-files {
    display: block;
}
.mobile-chat-file-input {
    display: none;
}
@media (max-width: 768px) {
    #incidentForm .form-actions {
        flex-direction: column;
    }
    #incidentForm .form-actions .btn-primary {
        order: 1;
    }
    #incidentForm .form-actions .btn-secondary {
        order: 2;
    }
}
