/* ==========================================
   LOSTVERSE
   PRIVATE CHAT & ITEM RETURN
========================================== */

/* ==========================================
   01. DESIGN SYSTEM
========================================== */

.chat-page {
    --chat-navy: #142b4b;
    --chat-blue: #2456b8;
    --chat-blue-dark: #19469f;
    --chat-muted: #64748b;
    --chat-border: #e2e8f0;
    --chat-surface: #ffffff;
    --chat-background: #f4f6fa;
    --chat-success: #15803d;
    --chat-danger: #b91c1c;
    --chat-warning: #92400e;

    margin: 0;
    min-height: 100vh;
    background: var(--chat-background);
    color: var(--chat-navy);
}

.chat-page[hidden],
.chat-page [hidden] {
    display: none !important;
}

.chat-page button,
.chat-page input,
.chat-page select,
.chat-page textarea {
    font-family: inherit;
}

.chat-page button:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.chat-page button:focus-visible,
.chat-page a:focus-visible,
.chat-page summary:focus-visible {
    outline: 3px solid #93b4ed;
    outline-offset: 3px;
}

/* ==========================================
   02. NAVIGATION
========================================== */

.chat-navbar {
    min-height: 72px;
    padding: 0 5%;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 24px;

    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

.chat-logo {
    flex-shrink: 0;

    color: #142b4b;

    font-size: 22px;
    font-weight: 800;
    letter-spacing: 1px;

    text-decoration: none;
}

.chat-navbar nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    width: auto;
    max-width: none;
    height: auto;
    min-height: 0;

    margin: 0;
    padding: 0;

    gap: 28px;
}

.chat-navbar nav a {
    color: #64748b;

    font-size: 14px;
    font-weight: 500;

    text-decoration: none;
    white-space: nowrap;
}

.chat-navbar nav a:hover {
    color: #2456b8;
}

.chat-navbar nav a.active {
    padding: 8px 12px;

    border-radius: 8px;

    background: #edf3ff;
    color: #2456b8;

    font-weight: 600;
}

/* ==========================================
   03. MAIN WORKSPACE
========================================== */

.chat-workspace {
    display: grid;

    grid-template-columns:
        320px minmax(0, 1fr);

    width: calc(100% - 64px);
    max-width: 1440px;

    height: calc(100vh - 120px);
    height: calc(100dvh - 120px);

    margin: 24px auto;

    background: #ffffff;

    border: 1px solid #e2e8f0;
    border-radius: 16px;

    overflow: hidden;

    box-shadow:
        0 4px 20px rgba(15, 23, 42, .04);
}

/* ==========================================
   04. CONVERSATION SIDEBAR
========================================== */

.conversation-sidebar {
    display: flex;
    flex-direction: column;

    min-width: 0;
    min-height: 0;

    border-right:
        1px solid #e2e8f0;

    background: #ffffff;
}

.conversation-sidebar-header {
    flex-shrink: 0;

    padding: 24px 20px 16px;
}

.conversation-sidebar-header h1 {
    margin: 0 0 6px;

    color: #142b4b;

    font-size: 24px;
    font-weight: 700;
    line-height: 1.4;
}

.conversation-sidebar-header p {
    margin: 0 0 18px;

    color: #64748b;

    font-size: 13px;
    line-height: 1.7;
}

/* ==========================================
   05. CONVERSATION SEARCH
========================================== */

#chat-search {
    width: 100%;
    min-width: 0;

    padding: 12px 14px;

    box-sizing: border-box;

    border: 1px solid #e2e8f0;
    border-radius: 9px;

    background: #f8fafc;
    color: #142b4b;

    font: inherit;
    font-size: 13px;

    outline: none;

    transition:
        border-color 180ms ease,
        box-shadow 180ms ease;
}

#chat-search::placeholder {
    color: #94a3b8;
}

#chat-search:focus {
    border-color: #2456b8;

    box-shadow:
        0 0 0 3px rgba(36, 86, 184, .08);
}

/* ==========================================
   06. CONVERSATION LIST
========================================== */

#conversation-list {
    flex: 1;

    min-width: 0;
    min-height: 0;

    padding: 8px 12px;

    overflow-y: auto;
    overscroll-behavior: contain;

    scrollbar-width: thin;
}

.conversation-item {
    display: flex;
    align-items: center;

    width: 100%;
    min-width: 0;

    gap: 12px;

    padding: 14px 12px;
    margin-bottom: 4px;

    border: 1px solid transparent;
    border-radius: 10px;

    background: transparent;
    color: #142b4b;

    text-align: left;

    cursor: pointer;

    font: inherit;

    transition:
        background 180ms ease,
        border-color 180ms ease;
}

.conversation-item:hover {
    background: #f1f5f9;
}

.conversation-item.selected {
    background: #eaf0fb;
    border-color: #dce7f9;
}

/* ==========================================
   07. AVATARS
========================================== */

.chat-avatar {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 44px;
    height: 44px;

    flex-shrink: 0;

    border-radius: 50%;

    background: #e4ebf7;
    color: #2456b8;

    font-size: 17px;
    font-weight: 600;

    overflow: hidden;
}

.chat-avatar img {
    width: 100%;
    height: 100%;

    object-fit: cover;
}

.chat-avatar.ghost {
    background: #e2e8f0;
    color: #475569;
}

.chat-avatar svg {
    width: 23px;
    height: 23px;
}

/* ==========================================
   08. CONVERSATION INFORMATION
========================================== */

.conversation-info {
    display: flex;
    flex-direction: column;

    flex: 1;
    min-width: 0;

    gap: 5px;
}

.conversation-info strong,
.conversation-info span {
    display: block;

    overflow: hidden;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.conversation-info strong {
    color: #142b4b;

    font-size: 14px;
    font-weight: 600;
}

.conversation-info span {
    color: #64748b;

    font-size: 12px;
    font-weight: 400;
}

.conversation-unread {
    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 22px;
    height: 22px;

    flex-shrink: 0;

    padding: 0 5px;

    border-radius: 20px;

    background: #2456b8;
    color: #ffffff;

    font-size: 11px;
    font-weight: 600;
}

.conversation-muted {
    display: inline-flex;
    align-items: center;

    color: #94a3b8;
}

.conversation-muted svg {
    width: 15px;
    height: 15px;
}

.chat-list-empty {
    padding: 30px 12px;

    color: #64748b;

    text-align: center;

    font-size: 13px;
    line-height: 1.8;
}

/* ==========================================
   09. CHAT PANEL
========================================== */

.chat-panel {
    min-width: 0;
    min-height: 0;

    overflow: hidden;

    background: #ffffff;
}

#chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    height: 100%;

    padding: 24px;

    text-align: center;
}

#chat-empty svg {
    width: 70px;
    height: 70px;

    margin-bottom: 15px;

    color: #94a3b8;
}

#chat-empty h2 {
    margin: 0;

    color: #142b4b;

    font-size: 23px;
    font-weight: 700;
}

#chat-empty p {
    max-width: 360px;

    color: #64748b;

    font-size: 14px;
    line-height: 1.8;
}

#chat-empty a {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 10px 18px;

    border: 1px solid #dbeafe;
    border-radius: 8px;

    background: #eff6ff;
    color: #2456b8;

    font-size: 13px;
    font-weight: 600;

    text-decoration: none;
}

#chat-empty a:hover {
    background: #dbeafe;
}

/* ==========================================
   10. CHAT ROOM
========================================== */

#chat-room {
    display: flex;
    flex-direction: column;

    height: 100%;

    min-width: 0;
    min-height: 0;
}

.chat-room-header {
    position: relative;
    z-index: 5;

    display: flex;
    align-items: center;

    flex-shrink: 0;

    gap: 12px;

    padding: 18px 24px;

    border-bottom:
        1px solid #e2e8f0;

    background: #ffffff;
}

.chat-partner {
    display: flex;
    flex-direction: column;

    flex: 1;
    min-width: 0;

    gap: 4px;
}

.chat-partner strong {
    color: #142b4b;

    font-size: 15px;
    font-weight: 600;

    overflow-wrap: anywhere;
}

.chat-partner span {
    color: #64748b;

    font-size: 12px;

    overflow-wrap: anywhere;
}

#chat-back {
    display: none;

    width: 34px;
    height: 34px;

    flex-shrink: 0;

    padding: 0;

    border: 0;
    border-radius: 8px;

    background: transparent;
    color: #142b4b;

    font-size: 22px;
}

#chat-back:hover {
    background: #f1f5f9;
}

/* ==========================================
   11. CHAT SAFETY NOTICE
========================================== */

.chat-safety {
    flex-shrink: 0;

    padding: 12px 24px;

    border-bottom:
        1px solid #eef2f7;

    background: #f8fafc;
    color: #64748b;

    font-size: 12px;
    line-height: 1.8;

    text-align: center;
}

/* ==========================================
   12. MESSAGE LIST
========================================== */

#message-list {
    display: flex;
    flex-direction: column;

    flex: 1;

    min-width: 0;
    min-height: 0;

    gap: 14px;

    padding: 24px;

    overflow-y: auto;
    overscroll-behavior: contain;

    scrollbar-width: thin;

    background: #ffffff;
}

.message-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    min-width: 0;

    gap: 5px;

    flex-shrink: 0;
}

.message-row.mine {
    align-items: flex-end;
}

.message-bubble {
    max-width: 75%;

    padding: 12px 16px;

    border-radius:
        16px 16px 16px 4px;

    background: #f1f5f9;
    color: #334155;

    font-size: 14px;
    line-height: 1.7;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.message-row.mine .message-bubble {
    border-radius:
        16px 16px 4px 16px;

    background: #2456b8;
    color: #ffffff;
}

.message-row.deleted .message-bubble {
    background: #f1f5f9;
    color: #94a3b8;

    font-style: italic;
}

.message-time {
    color: #64748b;

    font-size: 11px;
    line-height: 1.5;
}

.message-row .content-report-trigger {
    align-self: flex-start;

    margin-top: 1px;
}

.message-row.mine .content-report-trigger,
.message-row.deleted .content-report-trigger {
    display: none;
}

/* ==========================================
   13. MESSAGE ACTIONS
========================================== */

.message-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;

    gap: 8px;
}

.message-action {
    display: inline-flex;
    align-items: center;

    gap: 5px;

    padding: 4px 7px;

    border: 0;
    border-radius: 6px;

    background: transparent;
    color: #64748b;

    font-size: 11px;
    font-weight: 500;
}

.message-action:hover {
    background: #f1f5f9;
    color: #2456b8;
}

.message-action.danger:hover {
    background: #fef2f2;
    color: #b91c1c;
}

.message-action svg {
    width: 13px;
    height: 13px;
}

.message-date-divider {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 12px;

    margin: 8px 0;

    color: #94a3b8;

    font-size: 11px;
}

.message-date-divider::before,
.message-date-divider::after {
    content: '';

    flex: 1;
    height: 1px;

    background: #e2e8f0;
}

.message-system {
    align-self: center;

    max-width: 90%;

    padding: 8px 14px;

    border-radius: 8px;

    background: #f8fafc;
    color: #64748b;

    text-align: center;

    font-size: 12px;
    line-height: 1.7;
}

/* ==========================================
   14. MESSAGE COMPOSER
========================================== */

#message-form {
    display: flex;
    align-items: flex-end;
    flex-wrap: nowrap;

    flex-shrink: 0;

    gap: 12px;

    margin: 0;
    padding: 18px 24px;

    border: 0;
    border-top: 1px solid #e2e8f0;
    border-radius: 0;

    background: #ffffff;
}

#message-input {
    flex: 1;

    width: auto;
    min-width: 0;

    height: 46px;
    max-height: 140px;

    margin: 0;
    padding: 12px 18px;

    box-sizing: border-box;

    border: 1px solid #e2e8f0;
    border-radius: 24px;

    background: #f8fafc;
    color: #142b4b;

    font: inherit;
    font-size: 14px;

    resize: none;
    outline: none;

    transition:
        border-color 180ms ease,
        box-shadow 180ms ease;
}

#message-input:focus {
    border-color: #2456b8;

    box-shadow:
        0 0 0 3px rgba(36, 86, 184, .08);
}

#message-input:disabled {
    background: #f1f5f9;
    color: #94a3b8;
}

#message-input::placeholder {
    color: #94a3b8;
}

#send-message {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 46px;
    height: 46px;

    flex-shrink: 0;

    padding: 0;

    border: 0;
    border-radius: 50%;

    background: #2456b8;
    color: #ffffff;

    cursor: pointer;
}

#send-message:not(:disabled):hover {
    background: #19469f;
}

#send-message svg {
    width: 21px;
    height: 21px;
}

#send-message:disabled {
    opacity: .5;
    cursor: not-allowed;
}

#chat-error {
    flex-shrink: 0;

    margin: 0;
    padding: 8px 24px;

    color: #b91c1c;

    font-size: 12px;
    line-height: 1.7;

    overflow-wrap: anywhere;
}

#chat-error:empty {
    display: none;
}

/* ==========================================
   15. CHAT SAFETY MENU
========================================== */

#chat-safety-menu {
    margin-left: auto;

    flex-shrink: 0;
}

.chat-safety-dropdown {
    position: relative;
}

.chat-safety-dropdown summary {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 38px;
    height: 38px;

    border-radius: 9px;

    color: #64748b;

    cursor: pointer;

    list-style: none;
}

.chat-safety-dropdown summary::-webkit-details-marker {
    display: none;
}

.chat-safety-dropdown summary:hover,
.chat-safety-dropdown[open] summary {
    background: #f1f5f9;
    color: #142b4b;
}

.chat-safety-dropdown summary svg {
    width: 23px;
    height: 23px;
}

.chat-safety-options {
    position: absolute;

    top: 46px;
    right: 0;

    z-index: 100;

    width: 240px;
    max-width: calc(100vw - 32px);

    padding: 7px;

    border: 1px solid #e2e8f0;
    border-radius: 12px;

    background: #ffffff;

    box-shadow:
        0 12px 30px rgba(15, 23, 42, .12);
}

.chat-safety-options button {
    display: block;

    width: 100%;

    padding: 12px 14px;

    border: 0;
    border-radius: 7px;

    background: transparent;
    color: #334155;

    text-align: left;

    font: inherit;
    font-size: 13px;

    cursor: pointer;
}

.chat-safety-options button:not(:disabled):hover {
    background: #f1f5f9;
}

.chat-safety-options button.danger {
    color: #dc2626;
}

.chat-safety-options button.danger:not(:disabled):hover {
    background: #fef2f2;
}

.chat-safety-options button:disabled {
    color: #94a3b8;
    cursor: not-allowed;
}

.chat-safety-options hr {
    height: 1px;

    margin: 5px;

    border: 0;

    background: #e2e8f0;
}

/* ==========================================
   16. CHAT SAFETY STATUS
========================================== */

#chat-safety-status {
    flex-shrink: 0;

    padding: 13px 18px;

    border-bottom:
        1px solid #fed7aa;

    background: #fff7ed;
    color: #9a3412;

    text-align: center;

    font-size: 13px;
    line-height: 1.7;

    overflow-wrap: anywhere;
}

#chat-safety-status[hidden] {
    display: none !important;
}

/* ==========================================
   17. SHARED CHAT DIALOGS
========================================== */

.chat-safety-dialog,
.chat-dialog {
    width: min(500px, calc(100% - 32px));

    max-height: 88vh;
    max-height: 88dvh;

    padding: 24px;

    box-sizing: border-box;

    border: 1px solid #e2e8f0;
    border-radius: 16px;

    background: #ffffff;
    color: #142b4b;

    overflow-y: auto;
    overscroll-behavior: contain;

    box-shadow:
        0 24px 70px rgba(15, 23, 42, .18);
}

.chat-safety-dialog {
    max-width: 460px;
}

.chat-safety-dialog::backdrop,
.chat-dialog::backdrop {
    background: rgba(15, 23, 42, .55);

    backdrop-filter: blur(3px);
}

.safety-dialog-header,
.chat-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    margin-bottom: 14px;
}

.safety-dialog-header h2,
.chat-dialog-header h2 {
    margin: 0;

    color: #142b4b;

    font-size: 21px;
    font-weight: 700;
}

.safety-dialog-header button,
.chat-dialog-close {
    display: grid;
    place-items: center;

    width: 34px;
    height: 34px;

    flex-shrink: 0;

    padding: 0;

    border: 0;
    border-radius: 50%;

    background: #f1f5f9;
    color: #64748b;

    font-size: 23px;

    cursor: pointer;
}

.safety-dialog-header button:hover,
.chat-dialog-close:hover {
    background: #e2e8f0;
}

.safety-description,
.chat-dialog-description {
    margin: 0 0 16px;

    color: #64748b;

    font-size: 13px;
    line-height: 1.8;
}

/* ==========================================
   18. CHAT REPORT FORM
========================================== */

#chat-report-form,
.chat-dialog form {
    display: grid;

    gap: 10px;

    margin: 0;
    padding: 0;

    border: 0;
    border-radius: 0;

    background: transparent;
}

#chat-report-form label,
.chat-dialog label {
    display: block;

    margin: 6px 0 0;

    color: #142b4b;

    font-size: 13px;
    font-weight: 600;
}

#chat-report-form select,
#chat-report-form textarea,
.chat-dialog input:not([type="checkbox"]):not([type="radio"]),
.chat-dialog select,
.chat-dialog textarea {
    display: block;

    width: 100%;
    min-width: 0;

    padding: 12px;

    box-sizing: border-box;

    border: 1px solid #cbd5e1;
    border-radius: 8px;

    background: #f8fafc;
    color: #334155;

    font: inherit;
    font-size: 14px;

    outline: none;
}

#chat-report-form select:focus,
#chat-report-form textarea:focus,
.chat-dialog input:focus,
.chat-dialog select:focus,
.chat-dialog textarea:focus {
    border-color: #2456b8;

    box-shadow:
        0 0 0 3px rgba(36, 86, 184, .08);
}

#chat-report-form textarea,
.chat-dialog textarea {
    min-height: 100px;

    resize: vertical;
}

.safety-dialog-actions,
.chat-dialog-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;

    gap: 10px;

    margin-top: 20px;
}

.safety-dialog-actions button,
.chat-dialog-actions button {
    width: auto;
    min-height: 40px;

    padding: 11px 18px;

    border: 0;
    border-radius: 8px;

    font: inherit;
    font-size: 13px;
    font-weight: 600;

    cursor: pointer;
}

#cancel-chat-report {
    background: #f1f5f9;
    color: #475569;
}

#submit-chat-report {
    background: #2456b8;
    color: #ffffff;
}

#submit-chat-report:disabled {
    opacity: .6;
    cursor: wait;
}

#chat-report-error,
.chat-dialog-error {
    margin: 4px 0;

    color: #b91c1c;

    font-size: 13px;
    line-height: 1.7;

    overflow-wrap: anywhere;
}

#chat-report-error:empty,
.chat-dialog-error:empty {
    display: none;
}

/* ==========================================
   19. SHARED WORKFLOW BUTTONS
========================================== */

.chat-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 7px;

    width: auto;
    min-height: 38px;

    padding: 9px 14px;

    border: 1px solid transparent;
    border-radius: 8px;

    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;

    transition:
        background 180ms ease,
        border-color 180ms ease;
}

.chat-action-button svg {
    width: 16px;
    height: 16px;
}

.chat-action-button.primary {
    background: #2456b8;
    color: #ffffff;
}

.chat-action-button.primary:not(:disabled):hover {
    background: #19469f;
}

.chat-action-button.secondary {
    border-color: #dbe3ee;

    background: #ffffff;
    color: #334155;
}

.chat-action-button.secondary:not(:disabled):hover {
    background: #f1f5f9;
}

.chat-action-button.success {
    background: #15803d;
    color: #ffffff;
}

.chat-action-button.success:not(:disabled):hover {
    background: #166534;
}

.chat-action-button.danger {
    border-color: #fecaca;

    background: #fef2f2;
    color: #b91c1c;
}

.chat-action-button.danger:not(:disabled):hover {
    background: #fee2e2;
}

/* ==========================================
   20. ITEM RETURN WORKFLOW TOOLBAR
========================================== */

.chat-workflow-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;

    flex-shrink: 0;

    gap: 8px;

    padding: 12px 24px;

    border-bottom:
        1px solid #e2e8f0;

    background: #ffffff;
}

.chat-workflow-toolbar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 7px;

    padding: 9px 12px;

    border: 1px solid #dbe3ee;
    border-radius: 8px;

    background: #ffffff;
    color: #334155;

    font-size: 12px;
    font-weight: 600;
}

.chat-workflow-toolbar button:not(:disabled):hover,
.chat-workflow-toolbar button.active {
    border-color: #bfdbfe;

    background: #eff6ff;
    color: #2456b8;
}

.chat-workflow-toolbar svg {
    width: 17px;
    height: 17px;
}

/* ==========================================
   21. WORKFLOW PANEL
========================================== */

.chat-workflow-panel {
    flex-shrink: 0;

    min-width: 0;

    max-height: 38%;

    padding: 16px 24px;

    border-bottom:
        1px solid #e2e8f0;

    background: #f8fafc;

    overflow-y: auto;
    overscroll-behavior: contain;
}

.workflow-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;

    gap: 10px;

    margin-bottom: 14px;
}

.workflow-panel-header h3 {
    margin: 0;

    color: #142b4b;

    font-size: 15px;
    font-weight: 700;
}

.workflow-panel-header p {
    margin: 4px 0 0;

    color: #64748b;

    font-size: 12px;
}

.workflow-list {
    display: grid;

    gap: 12px;
}

.workflow-card {
    min-width: 0;

    padding: 16px;

    border: 1px solid #dbe3ee;
    border-radius: 12px;

    background: #ffffff;
}

.workflow-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;

    gap: 10px;

    margin-bottom: 10px;
}

.workflow-card-header h3,
.workflow-card-header h4 {
    margin: 0;

    color: #142b4b;

    font-size: 14px;
    font-weight: 600;
}

.workflow-card p {
    margin: 8px 0;

    color: #475569;

    font-size: 13px;
    line-height: 1.8;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.workflow-card time,
.workflow-card small {
    color: #64748b;

    font-size: 11px;
}

.workflow-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;

    gap: 8px;

    margin-top: 14px;
}

/* ==========================================
   22. WORKFLOW STATUS
========================================== */

.workflow-status {
    display: inline-flex;
    align-items: center;

    gap: 5px;

    width: fit-content;

    padding: 5px 9px;

    border-radius: 6px;

    background: #f1f5f9;
    color: #64748b;

    font-size: 11px;
    font-weight: 600;

    white-space: nowrap;
}

.workflow-status.pending {
    background: #fef3c7;
    color: #92400e;
}

.workflow-status.submitted,
.workflow-status.reviewing {
    background: #eff6ff;
    color: #1d4ed8;
}

.workflow-status.accepted,
.workflow-status.approved,
.workflow-status.confirmed,
.workflow-status.resolved {
    background: #dcfce7;
    color: #15803d;
}

.workflow-status.rejected,
.workflow-status.disputed,
.workflow-status.flagged {
    background: #fee2e2;
    color: #b91c1c;
}

.workflow-status.cancelled,
.workflow-status.dismissed {
    background: #f1f5f9;
    color: #64748b;
}

/* ==========================================
   23. SECRET PROOF
========================================== */

.secret-proof-panel {
    min-width: 0;
}

.secret-proof-card {
    padding: 16px;

    border: 1px solid #dbe3ee;
    border-radius: 12px;

    background: #ffffff;
}

.secret-proof-heading {
    display: flex;
    align-items: center;

    gap: 10px;

    margin-bottom: 12px;
}

.secret-proof-icon {
    display: grid;
    place-items: center;

    width: 38px;
    height: 38px;

    flex-shrink: 0;

    border-radius: 9px;

    background: #eff6ff;
    color: #2456b8;
}

.secret-proof-icon svg {
    width: 20px;
    height: 20px;
}

.secret-proof-heading h3 {
    margin: 0;

    color: #142b4b;

    font-size: 14px;
    font-weight: 700;
}

.secret-proof-heading small {
    color: #64748b;

    font-size: 11px;
}

.proof-question,
.proof-answer {
    padding: 14px;

    border: 1px solid #e2e8f0;
    border-radius: 9px;

    background: #f8fafc;

    color: #334155;

    font-size: 13px;
    line-height: 1.8;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.proof-answer {
    margin-top: 10px;

    border-color: #dbeafe;

    background: #f5f8ff;
}

.proof-review-note {
    margin-top: 12px;
    padding: 12px;

    border-left: 3px solid #94a3b8;
    border-radius: 0 6px 6px 0;

    background: #f8fafc;
    color: #475569;

    font-size: 12px;
    line-height: 1.8;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.proof-private-notice {
    display: flex;
    align-items: flex-start;

    gap: 9px;

    margin: 12px 0;
    padding: 12px;

    border: 1px solid #dbeafe;
    border-radius: 8px;

    background: #eff6ff;
    color: #1e40af;

    font-size: 12px;
    line-height: 1.8;
}

.proof-private-notice svg {
    width: 18px;
    height: 18px;

    flex-shrink: 0;
}

/* ==========================================
   24. PRIVATE EVIDENCE UPLOAD
========================================== */

.evidence-upload {
    display: grid;

    gap: 10px;

    padding: 16px;

    border: 1px dashed #b8c8df;
    border-radius: 10px;

    background: #f8fafc;
}

.evidence-upload label {
    margin: 0;

    color: #334155;

    font-size: 13px;
    font-weight: 600;
}

.evidence-upload input[type="file"] {
    width: 100%;
    min-width: 0;

    padding: 8px;

    border: 1px solid #dbe3ee;
    border-radius: 7px;

    background: #ffffff;

    font-size: 12px;
}

.evidence-upload input::file-selector-button {
    margin-right: 10px;
    padding: 8px 12px;

    border: 0;
    border-radius: 6px;

    background: #eaf0fb;
    color: #2456b8;

    font: inherit;
    font-weight: 600;

    cursor: pointer;
}

.evidence-upload small {
    color: #64748b;

    font-size: 11px;
    line-height: 1.8;
}

.evidence-preview,
.proof-image-preview,
.return-image-preview {
    display: block;

    width: 100%;
    max-height: 240px;

    border: 1px solid #e2e8f0;
    border-radius: 8px;

    background: #f1f5f9;

    object-fit: contain;
}

.evidence-preview[hidden],
.proof-image-preview[hidden],
.return-image-preview[hidden] {
    display: none !important;
}

.evidence-image {
    display: block;

    width: auto;
    max-width: 100%;
    max-height: 300px;

    margin-top: 10px;

    border: 1px solid #e2e8f0;
    border-radius: 9px;

    background: #f8fafc;

    object-fit: contain;
}

.evidence-remove {
    justify-self: end;

    padding: 6px 10px;

    border: 0;
    border-radius: 6px;

    background: #fef2f2;
    color: #b91c1c;

    font-size: 12px;
}

.evidence-list {
    display: grid;

    gap: 12px;
}

.evidence-card {
    padding: 14px;

    border: 1px solid #e2e8f0;
    border-radius: 9px;

    background: #ffffff;
}

.evidence-card p {
    margin: 8px 0;

    color: #334155;

    font-size: 13px;
    line-height: 1.8;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ==========================================
   25. MEETUP SAFETY
========================================== */

.meetup-safety-panel {
    display: grid;

    gap: 14px;
}

.meetup-safety-notice {
    padding: 16px;

    border: 1px solid #dbeafe;
    border-radius: 10px;

    background: #eff6ff;
    color: #1e40af;
}

.meetup-safety-notice h3 {
    margin: 0 0 8px;

    font-size: 14px;
    font-weight: 700;
}

.meetup-safety-notice p,
.meetup-safety-notice li {
    font-size: 12px;
    line-height: 1.9;
}

.meetup-safety-notice ul {
    margin: 8px 0;
    padding-left: 20px;
}

.meetup-safety-notice li + li {
    margin-top: 5px;
}

.meetup-terms {
    max-height: 260px;

    padding: 16px;

    border: 1px solid #e2e8f0;
    border-radius: 9px;

    background: #f8fafc;
    color: #475569;

    font-size: 12px;
    line-height: 1.9;

    white-space: pre-wrap;
    overflow-wrap: anywhere;

    overflow-y: auto;
    overscroll-behavior: contain;
}

.meetup-agreements {
    display: grid;

    gap: 12px;

    margin-top: 14px;
}

.chat-dialog .meetup-agreement,
.meetup-agreement {
    display: flex;
    align-items: flex-start;

    gap: 10px;

    margin: 0;

    color: #334155;

    font-size: 13px;
    font-weight: 400;
    line-height: 1.8;

    cursor: pointer;
}

.meetup-agreement input[type="checkbox"] {
    width: 17px;
    height: 17px;

    flex: 0 0 17px;

    margin: 3px 0 0;

    accent-color: #2456b8;
}

.meetup-terms-version {
    color: #64748b;

    font-size: 11px;
}

.meetup-confirmation-list {
    display: grid;

    gap: 8px;
}

.meetup-confirmation-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 10px;

    padding: 12px;

    border: 1px solid #e2e8f0;
    border-radius: 8px;

    background: #ffffff;

    font-size: 12px;
}

/* ==========================================
   26. ITEM RETURN
========================================== */

.item-return-panel {
    display: grid;

    gap: 12px;
}

.return-card {
    min-width: 0;

    padding: 18px;

    border: 1px solid #dbe3ee;
    border-radius: 12px;

    background: #ffffff;
}

.return-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;

    gap: 12px;

    margin-bottom: 16px;
}

.return-card-header h3 {
    margin: 0;

    color: #142b4b;

    font-size: 15px;
    font-weight: 700;
}

.return-card-header p {
    margin: 5px 0 0;

    color: #64748b;

    font-size: 12px;
}

.return-confirmations {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 10px;

    margin: 14px 0;
}

.return-confirmation {
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    gap: 7px;

    min-width: 0;

    padding: 14px;

    border: 1px solid #e2e8f0;
    border-radius: 9px;

    background: #f8fafc;
}

.return-confirmation strong {
    color: #334155;

    font-size: 13px;
    font-weight: 600;
}

.return-confirmation small {
    color: #64748b;

    font-size: 11px;
    line-height: 1.7;
}

.return-confirmation.confirmed {
    border-color: #bbf7d0;

    background: #f0fdf4;
}

.return-confirmation.confirmed strong {
    color: #15803d;
}

.return-confirmation-icon {
    display: grid;
    place-items: center;

    width: 32px;
    height: 32px;

    border-radius: 50%;

    background: #e2e8f0;
    color: #64748b;
}

.return-confirmation.confirmed
.return-confirmation-icon {
    background: #dcfce7;
    color: #15803d;
}

.return-confirmation-icon svg {
    width: 18px;
    height: 18px;
}

/* ==========================================
   27. RETURN PROGRESS
========================================== */

.return-progress {
    display: grid;

    gap: 0;

    margin: 16px 0;
}

.return-step {
    position: relative;

    display: flex;
    align-items: flex-start;

    gap: 12px;

    min-width: 0;

    padding-bottom: 20px;
}

.return-step:last-child {
    padding-bottom: 0;
}

.return-step:not(:last-child)::after {
    content: '';

    position: absolute;

    top: 28px;
    bottom: 0;
    left: 13px;

    width: 2px;

    background: #e2e8f0;
}

.return-step-marker {
    position: relative;
    z-index: 1;

    display: grid;
    place-items: center;

    width: 28px;
    height: 28px;

    flex-shrink: 0;

    border-radius: 50%;

    background: #e2e8f0;
    color: #64748b;

    font-size: 12px;
    font-weight: 600;
}

.return-step-marker svg {
    width: 16px;
    height: 16px;
}

.return-step.complete .return-step-marker {
    background: #dcfce7;
    color: #15803d;
}

.return-step.current .return-step-marker {
    background: #2456b8;
    color: #ffffff;
}

.return-step.complete::after {
    background: #bbf7d0;
}

.return-step-content {
    flex: 1;

    min-width: 0;

    padding-top: 3px;
}

.return-step-content strong {
    display: block;

    color: #334155;

    font-size: 13px;
    font-weight: 600;
}

.return-step-content p {
    margin: 4px 0 0;

    color: #64748b;

    font-size: 12px;
    line-height: 1.7;
}

/* ==========================================
   28. SUCCESSFUL ITEM RETURN
========================================== */

.return-success {
    display: flex;
    align-items: flex-start;

    gap: 14px;

    padding: 18px;

    border: 1px solid #bbf7d0;
    border-radius: 12px;

    background: #f0fdf4;
    color: #166534;
}

.return-success-icon {
    display: grid;
    place-items: center;

    width: 42px;
    height: 42px;

    flex-shrink: 0;

    border-radius: 50%;

    background: #dcfce7;
    color: #15803d;
}

.return-success-icon svg {
    width: 23px;
    height: 23px;
}

.return-success h3 {
    margin: 0 0 6px;

    font-size: 15px;
    font-weight: 700;
}

.return-success p {
    margin: 0;

    font-size: 12px;
    line-height: 1.8;
}

/* ==========================================
   29. RETURN VERIFICATION
========================================== */

.return-verification {
    margin: 12px 0;
    padding: 12px;

    border: 1px solid #e2e8f0;
    border-radius: 8px;

    background: #f8fafc;
    color: #475569;

    font-size: 12px;
    line-height: 1.8;
}

.return-verification.approved {
    border-color: #bbf7d0;

    background: #f0fdf4;
    color: #166534;
}

.return-verification.flagged,
.return-verification.pending {
    border-color: #fde68a;

    background: #fffbeb;
    color: #92400e;
}

.return-verification.rejected {
    border-color: #fecaca;

    background: #fef2f2;
    color: #b91c1c;
}

/* ==========================================
   30. RETURN DISPUTES
========================================== */

.return-dispute-notice {
    display: flex;
    align-items: flex-start;

    gap: 10px;

    padding: 14px;

    border: 1px solid #fecaca;
    border-radius: 9px;

    background: #fef2f2;
    color: #b91c1c;

    font-size: 12px;
    line-height: 1.8;
}

.return-dispute-notice svg {
    width: 19px;
    height: 19px;

    flex-shrink: 0;
}

.return-dispute-notice strong {
    display: block;

    margin-bottom: 4px;

    font-size: 13px;
}

.return-dispute-notice p {
    margin: 0;
}

/* ==========================================
   31. RETURN TESTIMONIAL
========================================== */

.testimonial-panel {
    display: grid;

    gap: 12px;

    padding: 16px;

    border: 1px solid #dbe3ee;
    border-radius: 10px;

    background: #ffffff;
}

.testimonial-panel h3 {
    margin: 0;

    color: #142b4b;

    font-size: 15px;
    font-weight: 700;
}

.testimonial-panel p {
    margin: 0;

    color: #64748b;

    font-size: 12px;
    line-height: 1.8;
}

.testimonial-content {
    padding: 14px;

    border-radius: 8px;

    background: #f8fafc;
    color: #334155;

    font-size: 13px;
    line-height: 1.9;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.chat-dialog .testimonial-public-option,
.testimonial-public-option {
    display: flex;
    align-items: flex-start;

    gap: 10px;

    color: #475569;

    font-size: 12px;
    font-weight: 400;
    line-height: 1.8;
}

.testimonial-public-option input {
    width: 17px;
    height: 17px;

    flex: 0 0 17px;

    margin: 3px 0 0;

    accent-color: #2456b8;
}

/* ==========================================
   32. SHARED WORKFLOW MESSAGES
========================================== */

.workflow-error {
    margin: 8px 0;

    color: #b91c1c;

    font-size: 12px;
    line-height: 1.8;

    overflow-wrap: anywhere;
}

.workflow-success {
    margin: 8px 0;

    color: #15803d;

    font-size: 12px;
    line-height: 1.8;

    overflow-wrap: anywhere;
}

.workflow-error:empty,
.workflow-success:empty {
    display: none;
}

.workflow-empty {
    padding: 24px 12px;

    color: #64748b;

    text-align: center;

    font-size: 12px;
    line-height: 1.8;
}

.workflow-loading {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 9px;

    padding: 24px;

    color: #64748b;

    font-size: 12px;
}

.chat-spinner {
    width: 18px;
    height: 18px;

    flex-shrink: 0;

    border: 2px solid #dbeafe;
    border-top-color: #2456b8;
    border-radius: 50%;

    animation:
        chat-spin .8s linear infinite;
}

@keyframes chat-spin {

    to {
        transform: rotate(360deg);
    }

}

/* ==========================================
   33. TABLET RESPONSIVE
========================================== */

@media (max-width: 1100px) {

    .chat-workspace {
        grid-template-columns:
            280px minmax(0, 1fr);

        width: calc(100% - 40px);
    }

    .chat-navbar nav {
        gap: 18px;
    }

    .chat-room-header {
        padding: 16px 20px;
    }

    #message-list {
        padding: 20px;
    }

    #message-form {
        padding: 16px 20px;
    }

    .chat-workflow-toolbar,
    .chat-workflow-panel {
        padding-left: 18px;
        padding-right: 18px;
    }

}

/* ==========================================
   34. MOBILE RESPONSIVE
========================================== */

@media (max-width: 760px) {

    .chat-page:not([hidden]) {
        display: flex;
        flex-direction: column;

        height: 100vh;
        height: 100dvh;

        min-height: 0;

        overflow: hidden;
    }

    .chat-navbar {
        min-height: 64px;

        flex-shrink: 0;

        padding: 10px 16px;

        gap: 12px;

        flex-wrap: wrap;
    }

    .chat-logo {
        font-size: 18px;
        letter-spacing: .5px;
    }

    .chat-navbar nav {
        flex-wrap: wrap;

        justify-content: flex-end;

        gap: 10px;
    }

    .chat-navbar nav a {
        font-size: 11px;
    }

    .chat-navbar nav a.active {
        padding: 6px 8px;
    }

    .chat-workspace {
        display: block;

        flex: 1;

        width: 100%;
        height: auto;
        min-height: 0;

        margin: 0;

        border: 0;
        border-radius: 0;

        box-shadow: none;
    }

    .conversation-sidebar,
    .chat-panel {
        height: 100%;

        min-height: 0;
    }

    .conversation-sidebar {
        border-right: 0;
    }

    .conversation-sidebar-header {
        padding: 20px 16px 12px;
    }

    .conversation-sidebar-header h1 {
        font-size: 22px;
    }

    #conversation-list {
        padding: 8px;
    }

    .conversation-item {
        padding: 13px 12px;
    }

    .chat-panel {
        display: none;
    }

    .chat-workspace.room-open .chat-panel {
        display: block;
    }

    .chat-workspace.room-open
    .conversation-sidebar {
        display: none;
    }

    #chat-back {
        display: grid;
        place-items: center;
    }

    .chat-room-header {
        padding: 12px 14px;

        gap: 9px;
    }

    .chat-room-header .chat-avatar {
        width: 38px;
        height: 38px;
    }

    .chat-partner strong {
        font-size: 14px;
    }

    .chat-partner span {
        font-size: 11px;
    }

    .chat-safety {
        padding: 9px 14px;

        font-size: 11px;
    }

    #chat-safety-status {
        padding: 10px 14px;

        font-size: 12px;
    }

    #message-list {
        padding: 16px;

        gap: 12px;
    }

    .message-bubble {
        max-width: 85%;

        padding: 10px 14px;

        font-size: 13px;
    }

    #message-form {
        padding: 12px;

        padding-bottom:
            max(12px, env(safe-area-inset-bottom));

        gap: 9px;
    }

    #message-input {
        font-size: 16px;
    }

    #chat-error {
        padding: 8px 14px;
    }

    .chat-workflow-toolbar {
        flex-wrap: nowrap;

        padding: 10px 12px;

        overflow-x: auto;

        scrollbar-width: thin;
    }

    .chat-workflow-toolbar button {
        flex-shrink: 0;

        white-space: nowrap;
    }

    .chat-workflow-panel {
        max-height: 32%;

        padding: 12px;
    }

    .workflow-card,
    .secret-proof-card,
    .return-card {
        padding: 14px;
    }

    .chat-safety-dialog,
    .chat-dialog {
        width: calc(100% - 24px);

        max-height: 90dvh;

        padding: 18px;
    }

    .chat-dialog input:not([type="checkbox"]):not([type="radio"]),
    .chat-dialog select,
    .chat-dialog textarea,
    #chat-report-form select,
    #chat-report-form textarea {
        font-size: 16px;
    }

}

/* ==========================================
   35. SMALL MOBILE
========================================== */

@media (max-width: 420px) {

    .chat-navbar {
        padding: 10px 12px;

        gap: 8px;
    }

    .chat-navbar nav {
        gap: 7px;
    }

    .chat-logo {
        font-size: 16px;
    }

    .chat-navbar nav a {
        font-size: 10px;
    }

    .chat-room-header {
        padding: 10px 12px;
    }

    .chat-room-header .chat-avatar {
        width: 34px;
        height: 34px;
    }

    .chat-partner strong {
        font-size: 13px;
    }

    .chat-safety-options {
        width: 220px;
    }

    .message-bubble {
        max-width: 90%;
    }

    .return-confirmations {
        grid-template-columns: 1fr;
    }

    .return-confirmation {
        padding: 12px;
    }

    .workflow-actions {
        gap: 6px;
    }

    .workflow-actions button {
        flex: 1 1 120px;
    }

    .safety-dialog-header h2,
    .chat-dialog-header h2 {
        font-size: 18px;
    }

    .safety-dialog-actions button,
    .chat-dialog-actions button {
        flex: 1;
    }

}

/* ==========================================
   36. SHORT SCREEN HEIGHT
========================================== */

@media (max-height: 650px) {

    .chat-room-header {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .chat-safety {
        padding-top: 6px;
        padding-bottom: 6px;
    }

    .chat-workflow-panel {
        max-height: 25%;
    }

    #message-form {
        padding-top: 10px;
        padding-bottom: 10px;
    }

}

/* ==========================================
   37. ACCESSIBILITY
========================================== */

@media (prefers-reduced-motion: reduce) {

    .chat-page *,
    .chat-page *::before,
    .chat-page *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }

}