/* DCLM Connect — User chat page */
.dcc-wrap {
    max-width: 680px;
    margin: 24px auto;
    border-radius: 16px;
    border: 1px solid #E0E3E8;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #fff;
    box-shadow: 0 2px 16px rgba(0,0,0,0.07);
}

/* Header */
.dcc-header {
    background: #0D1B2A;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.dcc-org-name {
    font-size: 13px;
    font-weight: 700;
    color: #C9A84C;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 2px;
}
.dcc-subject {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}
.dcc-active-badge {
    background: #16A34A;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
}
.dcc-closed-badge {
    background: #6B7280;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

/* Messages */
.dcc-messages {
    padding: 20px 20px 8px;
    min-height: 200px;
    max-height: 480px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #F8F9FB;
}

.dcc-msg { display: flex; }
.dcc-msg--team { justify-content: flex-start; }
.dcc-msg--you  { justify-content: flex-end; }

.dcc-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 15px;
    line-height: 1.55;
}

.dcc-msg--team .dcc-bubble {
    background: #fff;
    border: 1px solid #E0E3E8;
    border-bottom-left-radius: 4px;
}
.dcc-msg--you .dcc-bubble {
    background: #0D1B2A;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.dcc-body { margin-bottom: 5px; }

.dcc-meta {
    display: flex;
    gap: 8px;
    font-size: 11px;
}
.dcc-msg--team .dcc-meta { color: #9CA3AF; }
.dcc-msg--you  .dcc-meta { color: rgba(255,255,255,0.55); justify-content: flex-end; }

.dcc-empty {
    text-align: center;
    color: #9CA3AF;
    font-size: 14px;
    padding: 24px 0;
    align-self: center;
}

/* Reply box */
.dcc-reply-box {
    padding: 12px 16px 16px;
    background: #fff;
    border-top: 1px solid #E0E3E8;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.dcc-reply-box textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #E0E3E8;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    outline: none;
    line-height: 1.5;
    transition: border-color 0.15s;
}
.dcc-reply-box textarea:focus { border-color: #C9A84C; }

.dcc-send-btn {
    background: #0D1B2A;
    color: #C9A84C;
    border: none;
    padding: 10px 22px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.dcc-send-btn:hover { background: #1A3050; }
.dcc-send-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Closed state */
.dcc-closed-msg {
    padding: 16px 20px;
    background: #F8F9FB;
    border-top: 1px solid #E0E3E8;
    font-size: 13px;
    color: #6B7280;
    text-align: center;
}

/* Footer */
.dcc-footer {
    padding: 12px 20px;
    background: #F8F9FB;
    border-top: 1px solid #E0E3E8;
    font-size: 12px;
    color: #9CA3AF;
    text-align: center;
    line-height: 1.5;
}
.dcc-footer p { margin: 0 0 2px; }

/* Responsive */
@media ( max-width: 720px ) {
    .dcc-wrap { margin: 0; border-radius: 0; border-left: none; border-right: none; }
    .dcc-bubble { max-width: 85%; }
}

/* ---- Password form ---- */
.dcc-wrap--narrow {
    max-width: 480px;
}
.dcc-locked-badge {
    background: #6B7280;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}
.dcc-password-body {
    padding: 36px 28px;
    text-align: center;
    background: #fff;
}
.dcc-password-icon {
    font-size: 40px;
    margin-bottom: 12px;
    line-height: 1;
}
.dcc-password-body h2 {
    font-size: 18px;
    font-weight: 700;
    color: #0D1B2A;
    margin: 0 0 10px;
}
.dcc-password-body p {
    font-size: 14px;
    color: #6B7280;
    line-height: 1.6;
    margin: 0 0 20px;
}
.dcc-password-form {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 24px 0 12px;
}
.dcc-pass-input {
    flex: 1;
    max-width: 180px;
    padding: 12px 16px;
    border: 2px solid #E0E3E8;
    border-radius: 10px;
    font-size: 22px;
    font-weight: 700;
    font-family: monospace;
    letter-spacing: 6px;
    text-align: center;
    text-transform: uppercase;
    outline: none;
    transition: border-color 0.15s;
    color: #0D1B2A;
}
.dcc-pass-input:focus { border-color: #C9A84C; }
.dcc-pass-error {
    color: #DC2626;
    font-size: 13px;
    font-weight: 500;
    margin: 4px 0 0;
}
.dcc-pass-hint {
    font-size: 12px !important;
    color: #9CA3AF !important;
    margin-top: 20px !important;
}

/* ---- Admin bar on chat page ---- */
.dcc-admin-badge {
    background: #C9A84C;
    color: #0D1B2A;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.dcc-admin-bar {
    background: #F8F9FB;
    border-bottom: 1px solid #E0E3E8;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: #6B7280;
    flex-wrap: wrap;
}
.dcc-admin-link {
    margin-left: auto;
    color: #0D1B2A;
    font-weight: 600;
    text-decoration: none;
    font-size: 12px;
}
.dcc-admin-link:hover { color: #C9A84C; }

/* ---- Session expired ---- */
.dcc-session-expired {
    text-align: center;
    padding: 40px 24px;
    color: #6B7280;
    font-size: 14px;
    line-height: 1.6;
}
.dcc-session-expired p { margin: 0 0 8px; }

/* ---- Generic notice ---- */
.dcc-wrap .dcc-notice {
    padding: 32px 24px;
    text-align: center;
    color: #6B7280;
    font-size: 15px;
    background: #fff;
}

/* ================================================================
   FRONT-END ADMIN INBOX
   ================================================================ */
:root {
    --dcc-navy:   #0D1B2A;
    --dcc-gold:   #C9A84C;
    --dcc-border: #E0E3E8;
    --dcc-bg:     #F4F5F7;
    --dcc-muted:  #6B7280;
    --dcc-text:   #1A1A2E;
    --dcc-sidebar-w: 300px;
}

.dcc-admin-inbox {
    display: flex;
    height: 88vh;
    max-height: 900px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--dcc-border);
    box-shadow: 0 4px 24px rgba(0,0,0,0.10);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #fff;
}

/* ── Sidebar ── */
.dcc-ai-sidebar {
    width: var(--dcc-sidebar-w);
    min-width: var(--dcc-sidebar-w);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--dcc-border);
    background: #fff;
}

.dcc-ai-sidebar-header {
    background: var(--dcc-navy);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.dcc-ai-logo {
    font-size: 13px;
    font-weight: 700;
    color: var(--dcc-gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dcc-ai-badge {
    background: rgba(201,168,76,0.2);
    color: var(--dcc-gold);
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dcc-ai-filters {
    padding: 10px 12px;
    background: #f8f9fb;
    border-bottom: 1px solid var(--dcc-border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dcc-ai-filters input,
.dcc-ai-filters select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--dcc-border);
    border-radius: 7px;
    font-size: 12px;
    outline: none;
    background: #fff;
    box-sizing: border-box;
    color: var(--dcc-text);
}
.dcc-ai-filters input:focus,
.dcc-ai-filters select:focus { border-color: var(--dcc-gold); }

.dcc-ai-thread-list {
    flex: 1;
    overflow-y: auto;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dcc-ai-thread {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--dcc-border);
    cursor: pointer;
    transition: background 0.12s;
}
.dcc-ai-thread:hover      { background: #f8f9fb; }
.dcc-ai-thread.active     { background: #EEF2FF; border-left: 3px solid var(--dcc-gold); }
.dcc-ai-thread.unread .dcc-ai-name { font-weight: 700; }

.dcc-ai-avatar {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    background: var(--dcc-navy);
    color: var(--dcc-gold);
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dcc-ai-avatar.medium { width: 44px; height: 44px; font-size: 17px; }

.dcc-ai-meta { flex: 1; min-width: 0; }
.dcc-ai-row1, .dcc-ai-row2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
}
.dcc-ai-name    { font-size: 13px; font-weight: 500; color: var(--dcc-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dcc-ai-time    { font-size: 11px; color: var(--dcc-muted); white-space: nowrap; }
.dcc-ai-subject { font-size: 12px; color: var(--dcc-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dcc-ai-badge-count {
    background: var(--dcc-gold);
    color: var(--dcc-navy);
    font-size: 10px;
    font-weight: 700;
    min-width: 17px;
    height: 17px;
    border-radius: 9px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dcc-ai-status {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.dcc-ai-status--open        { background: #DCFCE7; color: #166534; }
.dcc-ai-status--in_progress { background: #FEF9C3; color: #854D0E; }
.dcc-ai-status--closed      { background: #F1F5F9; color: #64748B; }

.dcc-ai-empty { padding: 32px 16px; text-align: center; color: var(--dcc-muted); font-size: 13px; }

/* ── Chat panel ── */
.dcc-ai-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--dcc-bg);
}

.dcc-ai-no-thread {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dcc-muted);
    font-size: 14px;
    text-align: center;
}
.dcc-ai-no-thread-inner p { margin: 0; }

/* Panel header */
.dcc-ai-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--dcc-navy);
    flex-wrap: wrap;
}

.dcc-ai-panel-info { flex: 1; min-width: 0; }
.dcc-ai-panel-info strong { display: block; color: #fff; font-size: 14px; }
.dcc-ai-panel-info span   { font-size: 12px; color: rgba(255,255,255,0.6); }

.dcc-ai-panel-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dcc-ai-select {
    font-size: 12px;
    padding: 5px 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    outline: none;
}
.dcc-ai-select option { background: var(--dcc-navy); }

.dcc-ai-expiry {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    white-space: nowrap;
}

/* Form summary */
.dcc-ai-form-summary {
    background: #fff;
    border-bottom: 1px solid var(--dcc-border);
    font-size: 13px;
}
.dcc-ai-form-summary summary {
    padding: 9px 16px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: var(--dcc-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    user-select: none;
}
.dcc-ai-form-grid {
    display: grid;
    grid-template-columns: minmax(110px, auto) 1fr;
    padding: 4px 16px 12px;
    gap: 0;
}
.dcc-ai-form-label { padding: 4px 12px 4px 0; font-weight: 600; color: var(--dcc-muted); font-size: 12px; }
.dcc-ai-form-value { padding: 4px 0; font-size: 13px; color: var(--dcc-text); }

/* Messages */
.dcc-ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dcc-ai-msg { display: flex; max-width: 72%; }
.dcc-ai-msg.mine   { align-self: flex-end; }
.dcc-ai-msg.theirs { align-self: flex-start; }
.dcc-ai-msg.internal { align-self: center; max-width: 85%; }

.dcc-ai-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}
.dcc-ai-msg.mine .dcc-ai-bubble {
    background: var(--dcc-navy);
    color: #fff;
    border-bottom-right-radius: 3px;
}
.dcc-ai-msg.theirs .dcc-ai-bubble {
    background: #fff;
    border: 1px solid var(--dcc-border);
    color: var(--dcc-text);
    border-bottom-left-radius: 3px;
}
.dcc-ai-msg.internal .dcc-ai-bubble {
    background: #FFFBEA;
    border: 1px dashed #F0D060;
    color: #7A5E00;
    border-radius: 8px;
    font-size: 13px;
}
.dcc-ai-internal-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
    color: #9A7500;
}
.dcc-ai-body { margin-bottom: 4px; }
.dcc-ai-msg-meta { display: flex; gap: 8px; font-size: 11px; margin-top: 3px; }
.dcc-ai-msg.mine .dcc-ai-msg-meta   { color: rgba(255,255,255,0.5); justify-content: flex-end; }
.dcc-ai-msg.theirs .dcc-ai-msg-meta { color: var(--dcc-muted); }
.dcc-ai-empty-chat { text-align: center; color: var(--dcc-muted); font-size: 13px; padding: 32px; align-self: center; }

/* Reply box */
.dcc-ai-reply {
    background: #fff;
    border-top: 1px solid var(--dcc-border);
    padding: 10px 14px 14px;
}
.dcc-ai-reply-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.dcc-ai-tab {
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid var(--dcc-border);
    background: none;
    font-size: 12px;
    cursor: pointer;
    color: var(--dcc-muted);
    transition: all 0.12s;
}
.dcc-ai-tab.active { background: var(--dcc-navy); color: var(--dcc-gold); border-color: var(--dcc-navy); }

.dcc-ai-reply-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.dcc-ai-reply-row textarea {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid var(--dcc-border);
    border-radius: 10px;
    font-size: 14px;
    resize: none;
    font-family: inherit;
    outline: none;
    line-height: 1.5;
    transition: border-color 0.12s;
}
.dcc-ai-reply-row textarea:focus { border-color: var(--dcc-gold); }
.dcc-ai-send-btn {
    background: var(--dcc-navy);
    color: var(--dcc-gold);
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s;
}
.dcc-ai-send-btn:hover { background: #1A3050; }
.dcc-ai-send-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.dcc-ai-closed-bar { padding: 14px; text-align: center; font-size: 13px; color: var(--dcc-muted); background: #fff; border-top: 1px solid var(--dcc-border); }

/* Toast (admin inbox) */
#dccToast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--dcc-navy);
    color: #fff;
    padding: 11px 18px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 9999;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}
#dccToast.show { opacity: 1; transform: translateY(0); }

/* ── Sign-in form ── */
.dcc-wrap--signin { max-width: 440px; }
.dcc-signin-body { padding: 36px 28px; background: #fff; }
.dcc-signin-icon { font-size: 40px; text-align: center; margin-bottom: 12px; }
.dcc-signin-body h2 { font-size: 19px; font-weight: 700; color: #0D1B2A; margin: 0 0 8px; text-align: center; }
.dcc-signin-body > p { font-size: 14px; color: #6B7280; line-height: 1.6; text-align: center; margin: 0 0 24px; }

.dcc-signin-form { display: flex; flex-direction: column; gap: 16px; }
.dcc-signin-label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: #374151; }
.dcc-signin-input {
    padding: 11px 14px;
    border: 1.5px solid #E0E3E8;
    border-radius: 9px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.15s;
    color: #0D1B2A;
    width: 100%;
    box-sizing: border-box;
}
.dcc-signin-input:focus { border-color: #C9A84C; }
.dcc-pass-field { font-family: monospace; font-size: 20px; letter-spacing: 4px; text-transform: uppercase; }

.dcc-pass-row { display: flex; gap: 8px; align-items: center; }
.dcc-pass-row .dcc-signin-input { flex: 1; }
.dcc-toggle-pass {
    background: none;
    border: 1.5px solid #E0E3E8;
    border-radius: 9px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 16px;
    transition: border-color 0.15s;
    flex-shrink: 0;
}
.dcc-toggle-pass:hover { border-color: #C9A84C; }

.dcc-signin-btn {
    background: #0D1B2A;
    color: #C9A84C;
    border: none;
    padding: 13px;
    border-radius: 9px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 4px;
}
.dcc-signin-btn:hover { background: #1A3050; }
.dcc-signin-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.dcc-signin-help {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #F0F2F5;
    font-size: 12px;
    color: #9CA3AF;
    line-height: 1.6;
    text-align: center;
}
.dcc-signin-help p { margin: 0 0 4px; }

/* Mobile */
@media (max-width: 640px) {
    .dcc-admin-inbox { height: 92vh; border-radius: 0; border: none; }
    .dcc-ai-sidebar  { width: 100%; display: none; }
    .dcc-admin-inbox.show-sidebar .dcc-ai-sidebar { display: flex; }
    .dcc-admin-inbox.show-sidebar .dcc-ai-panel   { display: none; }
}

/* Notice bar (shown above sign-in when link is invalid) */
.dcc-notice-bar {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #991B1B;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 12px;
    text-align: center;
}
