/* ─── Base ─────────────────────────────────────────────── */
::selection { background: rgba(255,92,53,.18); color: #08121f; }
html { scroll-behavior: smooth; }
body { font-family: "Inter", "Manrope", sans-serif; }

/* ─── Dashboard shell ──────────────────────────────────── */
.dashboard-shell {
    background: #0f111a;
    min-height: 100vh;
}

/* ─── Sidebar ──────────────────────────────────────────── */
.dashboard-sidebar {
    background: #13151f;
    border-right: 1px solid rgba(255,255,255,.06);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    scrollbar-width: none;
}
.dashboard-sidebar::-webkit-scrollbar { display: none; }

/* ─── Nav links ────────────────────────────────────────── */
.dashboard-nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    border-radius: .85rem;
    padding: .7rem .95rem;
    color: #94a3b8;
    font-size: .88rem;
    font-weight: 600;
    transition: background 160ms, color 160ms, transform 120ms;
    text-decoration: none;
}
.dashboard-nav-link:hover {
    background: rgba(255,92,53,.1);
    color: #ff5c35;
    transform: translateX(2px);
}
.dashboard-nav-link-active {
    background: rgba(255,92,53,.15);
    color: #ff5c35;
    box-shadow: inset 3px 0 0 #ff5c35;
}
.dashboard-nav-icon {
    width: 2rem;
    height: 2rem;
    border-radius: .6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 800;
    flex-shrink: 0;
    background: rgba(255,255,255,.06);
    color: #64748b;
}
.dashboard-nav-link-active .dashboard-nav-icon {
    background: #ff5c35;
    color: #fff;
}

/* ─── Main content area ────────────────────────────────── */
.dashboard-main {
    background: #0f111a;
    flex: 1;
    overflow-y: auto;
    height: 100vh;
}

/* ─── Surface cards ────────────────────────────────────── */
.dashboard-surface {
    background: #181b27;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 1.25rem;
    box-shadow: 0 4px 24px rgba(0,0,0,.35);
}
.dashboard-surface-soft {
    background: linear-gradient(135deg, rgba(255,92,53,.08) 0%, rgba(255,92,53,.03) 100%);
    border: 1px solid rgba(255,92,53,.18);
    border-radius: 1.25rem;
}

/* ─── Pill badges ──────────────────────────────────────── */
.dashboard-pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    border-radius: 999px;
    padding: .35rem .75rem;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.dashboard-pill-muted { background: rgba(255,255,255,.06); color: #64748b; }
.dashboard-pill-brand { background: rgba(255,92,53,.15); color: #ff5c35; }
.dashboard-pill-online { background: rgba(16,185,129,.15); color: #10b981; }

/* ─── Status badges ────────────────────────────────────── */
.dashboard-status {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    border-radius: 999px;
    padding: .3rem .7rem;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.dashboard-status::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dashboard-status-open { background: rgba(16,185,129,.12); color: #10b981; }
.dashboard-status-open::before { background: #10b981; }
.dashboard-status-human { background: rgba(245,158,11,.12); color: #f59e0b; }
.dashboard-status-human::before { background: #f59e0b; }
.dashboard-status-resolved { background: rgba(100,116,139,.12); color: #64748b; }
.dashboard-status-resolved::before { background: #64748b; }

/* ─── Code blocks ──────────────────────────────────────── */
.dashboard-code-block {
    overflow-x: auto;
    border-radius: .85rem;
    background: #0a0c14;
    border: 1px solid rgba(255,255,255,.07);
    padding: .85rem 1rem;
    color: #93c5fd;
    font-size: .75rem;
    line-height: 1.7;
    font-family: "Fira Code", "Courier New", monospace;
}
.landing-code-block {
    overflow-x: auto;
    border-radius: 1.1rem;
    background: #0a0c14;
    padding: 1rem 1.1rem;
    color: #eff6ff;
    font-size: .82rem;
    line-height: 1.8;
    border: 1px solid rgba(255,255,255,.06);
}
.landing-icon-ring {
    display: inline-flex;
    height: 3rem; width: 3rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #fff1ec;
    color: #ff5c35;
    font-weight: 800;
    letter-spacing: .08em;
}

/* ─── Stat cards ───────────────────────────────────────── */
.stat-card {
    background: #181b27;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 1.1rem;
    padding: 1.4rem 1.5rem;
    transition: border-color 200ms, transform 200ms;
}
.stat-card:hover { border-color: rgba(255,92,53,.3); transform: translateY(-2px); }
.stat-card-value {
    font-size: 2.4rem;
    font-weight: 800;
    color: #f8fafc;
    line-height: 1;
    font-family: "Space Grotesk", sans-serif;
}
.stat-card-label { font-size: .78rem; color: #64748b; font-weight: 500; }
.stat-card-sub { font-size: .68rem; color: #475569; font-weight: 500; text-transform: uppercase; letter-spacing: .1em; margin-top: .5rem; }

/* ─── Table (overview recent activity) ─────────────────── */
.dash-table { width: 100%; border-collapse: collapse; }
.dash-table th {
    text-align: left;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: #475569;
    padding: .6rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.dash-table td {
    padding: .9rem 1rem;
    font-size: .85rem;
    color: #cbd5e1;
    border-bottom: 1px solid rgba(255,255,255,.04);
    vertical-align: middle;
}
.dash-table tbody tr { transition: background 150ms; }
.dash-table tbody tr:hover { background: rgba(255,255,255,.03); }
.dash-table tbody tr:last-child td { border-bottom: none; }

/* ═══════════════════════════════════════════════════════════
   MESSENGER / INBOX UI
═══════════════════════════════════════════════════════════ */

/* Thread list panel */
.inbox-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    height: calc(100vh - 0px);
    overflow: hidden;
}
@media (max-width: 900px) {
    .inbox-layout { grid-template-columns: 1fr; }
    .inbox-thread-pane { display: none; }
}

.inbox-thread-pane {
    background: #13151f;
    border-right: 1px solid rgba(255,255,255,.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.inbox-thread-header {
    padding: 1.25rem 1.1rem .85rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.inbox-search {
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: .7rem;
    padding: .5rem .85rem;
    font-size: .82rem;
    color: #cbd5e1;
    width: 100%;
    outline: none;
    transition: border-color 200ms;
}
.inbox-search::placeholder { color: #475569; }
.inbox-search:focus { border-color: rgba(255,92,53,.4); }

.inbox-thread-list {
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.08) transparent;
}
.inbox-thread-item {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .9rem 1.1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,.04);
    transition: background 150ms;
    text-decoration: none;
}
.inbox-thread-item:hover { background: rgba(255,255,255,.04); }
.inbox-thread-item.active { background: rgba(255,92,53,.1); border-left: 3px solid #ff5c35; }
.inbox-avatar {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff5c35, #e14d29);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    position: relative;
}
.inbox-avatar-online::after {
    content: '';
    position: absolute;
    bottom: 1px; right: 1px;
    width: 9px; height: 9px;
    border-radius: 50%;
    background: #10b981;
    border: 2px solid #13151f;
}
.inbox-thread-meta { flex: 1; min-width: 0; }
.inbox-thread-name {
    font-size: .84rem;
    font-weight: 700;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.inbox-thread-preview {
    font-size: .75rem;
    color: #64748b;
    margin-top: .15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.inbox-thread-time {
    font-size: .68rem;
    color: #475569;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .3rem;
}
.inbox-unread-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #ff5c35;
}

/* Chat area */
.inbox-chat-pane {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #0f111a;
}
.inbox-chat-topbar {
    padding: 1rem 1.4rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
    background: #13151f;
}
.inbox-chat-title { font-size: .95rem; font-weight: 700; color: #f1f5f9; }
.inbox-chat-subtitle { font-size: .75rem; color: #64748b; margin-top: .1rem; }

.inbox-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: .85rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.08) transparent;
}

/* ─── Chat bubbles ─────────────────────────────────────── */
.msg-row { display: flex; align-items: flex-end; gap: .6rem; }
.msg-row-right { flex-direction: row-reverse; }

.msg-bubble {
    max-width: 68%;
    padding: .65rem 1rem;
    font-size: .86rem;
    line-height: 1.6;
    border-radius: 1.1rem;
    word-break: break-word;
}
.msg-bubble-user {
    background: #1e2235;
    color: #cbd5e1;
    border-bottom-left-radius: .3rem;
}
.msg-bubble-bot {
    background: linear-gradient(135deg, #ff5c35, #e14d29);
    color: #fff;
    border-bottom-right-radius: .3rem;
}
.msg-bubble-agent {
    background: #1a2744;
    color: #93c5fd;
    border-bottom-right-radius: .3rem;
}
.msg-bubble-system {
    background: rgba(245,158,11,.1);
    color: #f59e0b;
    font-size: .75rem;
    border-radius: .7rem;
    padding: .4rem .85rem;
    text-align: center;
    align-self: center;
    max-width: 90%;
}
.msg-sender-label {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #475569;
    margin-bottom: .25rem;
}
.msg-time {
    font-size: .65rem;
    color: #475569;
    margin-top: .2rem;
    padding: 0 .25rem;
}
.msg-avatar {
    width: 1.8rem; height: 1.8rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .65rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    margin-bottom: .15rem;
}
.msg-avatar-user { background: #334155; }
.msg-avatar-bot { background: linear-gradient(135deg,#ff5c35,#e14d29); }
.msg-avatar-agent { background: #1d4ed8; }

/* Reply box */
.inbox-reply-box {
    padding: 1rem 1.4rem;
    border-top: 1px solid rgba(255,255,255,.06);
    background: #13151f;
    flex-shrink: 0;
}
.inbox-reply-inner {
    display: flex;
    align-items: flex-end;
    gap: .75rem;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 1.1rem;
    padding: .6rem .85rem;
    transition: border-color 200ms;
}
.inbox-reply-inner:focus-within { border-color: rgba(255,92,53,.4); }
.inbox-reply-textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    font-size: .86rem;
    color: #cbd5e1;
    font-family: inherit;
    line-height: 1.5;
    min-height: 2.4rem;
    max-height: 8rem;
}
.inbox-reply-textarea::placeholder { color: #475569; }
.inbox-send-btn {
    width: 2.2rem; height: 2.2rem;
    border-radius: .7rem;
    background: #ff5c35;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 160ms, transform 120ms;
}
.inbox-send-btn:hover { background: #e14d29; transform: translateY(-1px); }

/* Context sidebar inside conversation detail */
.conv-sidebar {
    width: 280px;
    flex-shrink: 0;
    border-left: 1px solid rgba(255,255,255,.06);
    background: #13151f;
    overflow-y: auto;
    padding: 1.4rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}
.conv-meta-card {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.07);
    border-radius: .9rem;
    padding: 1rem;
}
.conv-meta-card dt { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: #475569; }
.conv-meta-card dd { font-size: .82rem; color: #cbd5e1; margin-top: .3rem; font-weight: 500; }

/* ─── Buttons ──────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border-radius: .75rem;
    background: #ff5c35;
    color: #fff;
    font-size: .82rem;
    font-weight: 700;
    padding: .55rem 1.1rem;
    border: none;
    cursor: pointer;
    transition: background 160ms, transform 120ms, box-shadow 160ms;
    text-decoration: none;
}
.btn-primary:hover { background: #e14d29; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(255,92,53,.3); }
.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border-radius: .75rem;
    background: rgba(255,255,255,.06);
    color: #94a3b8;
    font-size: .82rem;
    font-weight: 600;
    padding: .55rem 1.1rem;
    border: 1px solid rgba(255,255,255,.08);
    cursor: pointer;
    transition: background 160ms, color 160ms;
    text-decoration: none;
}
.btn-ghost:hover { background: rgba(255,255,255,.1); color: #f1f5f9; }

/* ─── Form inputs (dark theme override) ────────────────── */
.dash-input,
textarea.dash-input,
select.dash-input {
    width: 100%;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: .75rem;
    color: #f1f5f9;
    font-size: .84rem;
    padding: .65rem .9rem;
    outline: none;
    transition: border-color 200ms;
    font-family: inherit;
}
.dash-input:focus { border-color: rgba(255,92,53,.5); background: rgba(255,255,255,.07); }
.dash-input::placeholder { color: #475569; }

/* Force Django form widgets dark */
input[type="text"], input[type="email"], input[type="url"],
input[type="color"], textarea, select {
    background: rgba(255,255,255,.05) !important;
    border: 1px solid rgba(255,255,255,.1) !important;
    border-radius: .75rem !important;
    color: #f1f5f9 !important;
    padding: .65rem .9rem !important;
    font-size: .84rem !important;
    outline: none !important;
    width: 100% !important;
    font-family: inherit !important;
    transition: border-color 200ms !important;
}
input[type="text"]:focus, input[type="email"]:focus, input[type="url"]:focus,
textarea:focus, select:focus {
    border-color: rgba(255,92,53,.5) !important;
    background: rgba(255,255,255,.07) !important;
}
textarea { resize: vertical; min-height: 100px; }
select option { background: #181b27; color: #f1f5f9; }
input[type="checkbox"] {
    width: 1rem !important;
    height: 1rem !important;
    accent-color: #ff5c35 !important;
    border-radius: .25rem !important;
    padding: 0 !important;
}

/* Section headings */
.section-eyebrow {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .2em;
    color: #ff5c35;
}
.section-title {
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: #f8fafc;
    margin-top: .4rem;
}
.section-sub {
    font-size: .83rem;
    color: #64748b;
    line-height: 1.7;
    margin-top: .5rem;
}

/* Scrollbar global */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.07) transparent; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }
