/* ===== Artemis Brand Guidelines — Mockfol.io ===== */

/* Typography: Inter (brand secondary — optimized for digital interfaces) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ===== Brand Tokens ===== */
:root {
    /* Primary palette */
    --artemis-primary: #684FF8;
    --artemis-primary-hover: #5a3ee0;
    --artemis-primary-light: #E9E6FD;
    --artemis-primary-muted: #59557B;
    --artemis-blue: #4B93FF;
    --artemis-teal: #26A17B;

    /* Gradient stops */
    --artemis-grad-start: #9988FF;
    --artemis-grad-end: #684FF8;

    /* Functional colors */
    --green: #26A17B;
    --red: #E43E34;
    --gold: #F5AC37;
    --silver: #9B9BA8;
    --bronze: #E84142;

    /* Leaderboard rank colors */
    --rank-gold: #F5AC37;
    --rank-silver: #72748E;
    --rank-bronze: #FB7C6D;

    /* Light-theme specifics */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8F7FC;
    --bg-card: #FFFFFF;
    --text-primary: #13141B;
    --text-secondary: #59557B;
    --text-muted: #72748E;
    --border-color: #E9E6FD;
    --border-subtle: #F0EEF8;
}

[data-theme="dark"] {
    --bg-primary: #070611;
    --bg-secondary: #13141B;
    --bg-card: #191A22;
    --text-primary: #FFFFFF;
    --text-secondary: #9B9BA8;
    --text-muted: #72748E;
    --border-color: #2B2C3B;
    --border-subtle: #1E1F2B;
}

/* ===== Base ===== */
html,
body,
input,
select,
textarea,
button,
a,
th,
td,
label,
legend {
    font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
}

body {
    background: var(--bg-primary) !important;
    color: var(--text-primary);
}

main.container {
    background: var(--bg-primary);
}

[data-theme="dark"] nav.container-fluid {
    background: var(--bg-primary);
}

/* ===== Pico overrides ===== */
:root {
    --pico-primary: #684FF8;
    --pico-primary-hover: #5a3ee0;
    --pico-primary-focus: rgba(104, 79, 248, 0.12);
}

[data-theme="dark"] {
    --pico-primary: #9988FF;
    --pico-primary-hover: #684FF8;
    --pico-primary-focus: rgba(104, 79, 248, 0.2);
    --pico-background-color: #070611;
    --pico-card-background-color: #191A22;
    --pico-card-sectioning-background-color: #191A22;
    --pico-dropdown-background-color: #191A22;
    --pico-modal-overlay-background-color: rgba(7, 6, 17, 0.8);
    --pico-color: #FFFFFF;
    --pico-h1-color: #FFFFFF;
    --pico-h2-color: #FFFFFF;
    --pico-h3-color: #FFFFFF;
    --pico-h4-color: #FFFFFF;
    --pico-muted-color: #72748E;
    --pico-muted-border-color: #2B2C3B;
    --pico-table-border-color: #2B2C3B;
    --pico-border-color: #2B2C3B;
    --pico-secondary: #9B9BA8;
    --pico-form-element-background-color: #13141B;
    --pico-form-element-border-color: #2B2C3B;
    --pico-form-element-focus-color: #9988FF;
}

/* ===== Nav ===== */
nav {
    border-bottom: 1px solid var(--border-color);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

nav .brand {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    text-decoration: none;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

nav .brand .brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--artemis-grad-start), var(--artemis-grad-end));
    border-radius: 6px;
    color: #fff;
    font-weight: 800;
    font-size: 0.85rem;
    line-height: 1;
}

nav .brand:hover {
    color: var(--artemis-primary);
}

[data-theme="dark"] nav .brand:hover {
    color: var(--artemis-grad-start);
}

nav a {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.15s ease;
}

nav a:hover {
    color: var(--artemis-primary);
}

[data-theme="dark"] nav a:hover {
    color: var(--artemis-grad-start);
}

nav li a[aria-current="page"],
nav li a.active {
    color: var(--artemis-primary);
    font-weight: 600;
}

/* ===== Page headers ===== */
.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.page-header h2 {
    margin-bottom: 0.25rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    font-size: 1.75rem;
}

.page-header p {
    margin-bottom: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== Eyebrow / Capitals (brand: uppercase, wide spacing) ===== */
.eyebrow,
.stat-label,
.stat-card h3,
.order-form legend,
.data-table thead th,
.section-title-label {
    font-family: 'Inter', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

/* ===== P&L colors ===== */
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }

/* ===== Stat cards ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    text-align: center;
    padding: 1.5rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--artemis-primary);
    box-shadow: 0 4px 20px rgba(104, 79, 248, 0.1);
}

[data-theme="dark"] .stat-card:hover {
    box-shadow: 0 4px 20px rgba(104, 79, 248, 0.15);
}

.stat-card .stat-label {
    margin-bottom: 0.5rem;
}

.stat-card h3 {
    margin-bottom: 0.5rem;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

/* ===== Tables ===== */
.data-table {
    font-size: 0.875rem;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.data-table thead th {
    padding: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.data-table tbody td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.data-table tbody tr {
    transition: background 0.1s ease;
}

.data-table tbody tr:hover {
    background: var(--artemis-primary-light);
}

[data-theme="dark"] .data-table tbody tr:hover {
    background: rgba(104, 79, 248, 0.08);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ===== Auth pages ===== */
.auth-container {
    max-width: 420px;
    margin: 4rem auto;
}

.auth-container article {
    border-radius: 16px;
    padding: 2.5rem 2rem;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

.auth-container h2 {
    text-align: center;
    font-weight: 700;
    margin-bottom: 0.25rem;
    letter-spacing: -0.03em;
}

.auth-container .auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.auth-container .auth-links {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.875rem;
}

.auth-container .auth-links a {
    font-weight: 500;
    color: var(--artemis-primary);
}

/* Google sign-in button */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--artemis-grad-start), var(--artemis-grad-end)) !important;
    color: #FFFFFF !important;
    border: none !important;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none !important;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    line-height: 1.4;
}

.btn-google:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(104, 79, 248, 0.4);
    color: #FFFFFF !important;
    text-decoration: none !important;
}

.btn-google:visited,
.btn-google:active,
.btn-google:focus {
    color: #FFFFFF !important;
    text-decoration: none !important;
}

.btn-google svg {
    flex-shrink: 0;
}

/* ===== Trade page ===== */
.trade-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 768px) {
    .trade-grid {
        grid-template-columns: 1fr;
    }
}

.trade-grid article {
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.order-form fieldset {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.order-form legend {
    padding: 0 0.25rem;
}

.market-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.market-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.market-status.open .dot { background: var(--green); box-shadow: 0 0 6px var(--green); }
.market-status.closed .dot { background: var(--red); box-shadow: 0 0 6px var(--red); }
.market-status.open { color: var(--green); }
.market-status.closed { color: var(--red); }

/* ===== Client-side ticker dropdown ===== */
#ticker-dropdown {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(104, 79, 248, 0.1);
}

[data-theme="dark"] #ticker-dropdown {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

#ticker-dropdown > div {
    padding: 0.625rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.9rem;
    transition: background 0.1s ease;
}

#ticker-dropdown > div:last-child {
    border-bottom: none;
}

#ticker-dropdown > div:hover {
    background: var(--artemis-primary-light);
}

[data-theme="dark"] #ticker-dropdown > div:hover {
    background: rgba(104, 79, 248, 0.1);
}

/* ===== Validation messages ===== */
.validation-msg {
    font-size: 0.85rem;
    padding: 0.625rem 0.75rem;
    border-radius: 8px;
    margin-top: 0.75rem;
    font-weight: 500;
}

.validation-error {
    background: rgba(228, 62, 52, 0.08);
    color: #E43E34;
    border: 1px solid rgba(228, 62, 52, 0.2);
}

[data-theme="dark"] .validation-error {
    background: rgba(228, 62, 52, 0.12);
    color: #FB7C6D;
    border: 1px solid rgba(228, 62, 52, 0.25);
}

.validation-ok {
    background: rgba(38, 161, 123, 0.08);
    color: var(--green);
    border: 1px solid rgba(38, 161, 123, 0.2);
}

[data-theme="dark"] .validation-ok {
    background: rgba(38, 161, 123, 0.12);
    color: #45CD85;
    border: 1px solid rgba(38, 161, 123, 0.25);
}

/* ===== Leaderboard ===== */
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
    background: var(--text-muted);
}

.rank-1 .rank-badge { background: var(--rank-gold); }
.rank-2 .rank-badge { background: var(--rank-silver); }
.rank-3 .rank-badge { background: var(--rank-bronze); }

/* ===== Chart ===== */
.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid var(--border-color);
}

/* ===== Flash messages ===== */
.flash-msg {
    transition: opacity 0.5s ease;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.875rem 1.25rem;
}

.flash-msg.fade-out {
    opacity: 0;
}

.flash-error {
    border-left: 4px solid var(--red);
    background: rgba(228, 62, 52, 0.06);
}

[data-theme="dark"] .flash-error {
    background: rgba(228, 62, 52, 0.1);
}

.flash-success {
    border-left: 4px solid var(--green);
    background: rgba(38, 161, 123, 0.06);
}

[data-theme="dark"] .flash-success {
    background: rgba(38, 161, 123, 0.1);
}

/* ===== Section headers ===== */
.section-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* ===== Holding period notice ===== */
.holding-period-notice {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

.caveats {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.caveats ul {
    margin: 0;
    padding-left: 1.25rem;
}
.caveats li {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    line-height: 1.5;
}

/* ===== Empty state ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state p {
    font-size: 1rem;
    color: var(--text-muted);
}

.empty-state a {
    color: var(--artemis-primary);
    font-weight: 500;
}

/* ===== Price display ===== */
.price-display {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--artemis-primary);
}

[data-theme="dark"] .price-display {
    color: var(--artemis-grad-start);
}

/* ===== Buttons ===== */
button[type="submit"],
.btn-primary {
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: 8px;
    background: var(--artemis-primary);
    border-color: var(--artemis-primary);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

button[type="submit"]:hover,
.btn-primary:hover {
    background: var(--artemis-primary-hover);
    border-color: var(--artemis-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(104, 79, 248, 0.3);
}

/* Outline / secondary button */
.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    font-weight: 500;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.btn-outline:hover {
    border-color: var(--artemis-primary);
    color: var(--artemis-primary);
}

/* ===== Nav buttons (Login, Theme toggle) ===== */
.nav-btn {
    display: inline-block;
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none !important;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    line-height: 1.4;
    white-space: nowrap;
}

/* Primary nav button (Login) */
.nav-btn-primary {
    background: var(--artemis-primary) !important;
    color: #FFFFFF !important;
    border: 1px solid var(--artemis-primary) !important;
}

.nav-btn-primary:hover {
    background: var(--artemis-primary-hover) !important;
    border-color: var(--artemis-primary-hover) !important;
    color: #FFFFFF !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(104, 79, 248, 0.3);
}

/* Outline nav button (Theme toggle) */
.theme-btn {
    display: inline-block;
    padding: 0.4rem 0.85rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
    line-height: 1.4;
    white-space: nowrap;
    background: transparent !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-secondary) !important;
    text-decoration: none !important;
}

.theme-btn:hover {
    border-color: var(--artemis-primary) !important;
    color: var(--artemis-primary) !important;
    background: rgba(104, 79, 248, 0.06) !important;
}

[data-theme="dark"] .theme-btn:hover {
    color: var(--artemis-grad-start) !important;
    border-color: var(--artemis-grad-start) !important;
    background: rgba(104, 79, 248, 0.1) !important;
}

/* ===== Links ===== */
a {
    color: var(--artemis-primary);
}

a:hover {
    color: var(--artemis-primary-hover);
}

[data-theme="dark"] a {
    color: var(--artemis-grad-start);
}

[data-theme="dark"] a:hover {
    color: #FFFFFF;
}

/* ===== Focus ring override ===== */
:focus-visible {
    outline: 2px solid var(--artemis-primary);
    outline-offset: 2px;
}

/* ===== Inputs ===== */
input:not([type="radio"]):not([type="checkbox"]):focus,
select:focus,
textarea:focus {
    border-color: var(--artemis-primary);
    box-shadow: 0 0 0 3px rgba(104, 79, 248, 0.12);
}

/* ===== Scrollbar (dark theme) ===== */
[data-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== Chat ===== */
.chat-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 0;
    height: calc(100vh - 80px);
    margin: -1rem -1rem 0;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-card);
}

.chat-sidebar {
    border-right: 1px solid var(--border-color);
    padding: 1rem;
    overflow-y: auto;
    background: var(--bg-secondary);
}

.chat-sidebar-close {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    float: right;
    padding: 0 0.25rem;
    margin: 0;
    line-height: 1;
}

.chat-sidebar-section {
    margin-bottom: 1.5rem;
}

.chat-sidebar-section h4 {
    margin-bottom: 0.75rem;
}

.chat-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.chat-back-link {
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none !important;
    color: var(--artemis-primary) !important;
    white-space: nowrap;
}

.chat-sidebar-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    font-size: 1rem;
    color: var(--text-primary);
    cursor: pointer;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-message {
    display: flex;
    gap: 0.5rem;
    max-width: 75%;
    align-self: flex-start;
}

.chat-message-self {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--artemis-grad-start), var(--artemis-grad-end));
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    line-height: 1;
    flex-shrink: 0;
}

.chat-avatar-sm {
    width: 24px;
    height: 24px;
    min-width: 24px;
    font-size: 0.65rem;
}

.chat-bubble {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
    min-width: 0;
    word-break: break-word;
}

.chat-message-self .chat-bubble {
    background: rgba(104, 79, 248, 0.08);
    border-color: rgba(104, 79, 248, 0.2);
}

[data-theme="dark"] .chat-message-self .chat-bubble {
    background: rgba(104, 79, 248, 0.15);
    border-color: rgba(104, 79, 248, 0.25);
}

.chat-meta {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.15rem;
}

.chat-username {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--artemis-primary);
}

[data-theme="dark"] .chat-username {
    color: var(--artemis-grad-start);
}

.chat-pnl {
    font-size: 0.65rem;
    font-weight: 600;
}

.chat-time {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.chat-body {
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--text-primary);
}

.chat-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.35rem;
}

.chat-footer {
    border-top: 1px solid var(--border-color);
    padding: 0.5rem 1rem 0.75rem;
}

.chat-input-form {
    display: flex !important;
    flex-direction: row !important;
    gap: 0.5rem;
    align-items: center;
}

.chat-input {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    margin-bottom: 0 !important;
    padding: 0.6rem 0.85rem !important;
    font-size: 0.875rem !important;
    border-radius: 8px !important;
}

.chat-send-btn {
    flex: 0 0 auto !important;
    width: auto !important;
    padding: 0.6rem 1.25rem !important;
    font-size: 0.85rem !important;
    font-weight: 600;
    border-radius: 8px !important;
    background: var(--artemis-primary) !important;
    color: #fff !important;
    border: none !important;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, transform 0.15s ease;
    margin: 0 !important;
    margin-bottom: 0 !important;
}

.chat-send-btn:hover {
    background: var(--artemis-primary-hover) !important;
    transform: translateY(-1px);
}

/* Online users */
.online-user {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0;
    font-size: 0.825rem;
}

.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
    flex-shrink: 0;
}

.online-username {
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dm-link {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--artemis-primary) !important;
    text-decoration: none;
    padding: 0.1rem 0.4rem;
    border: 1px solid var(--artemis-primary);
    border-radius: 4px;
    transition: background 0.15s ease;
}

.dm-link:hover {
    background: rgba(104, 79, 248, 0.1);
}

/* DM conversation links */
.dm-conversation-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 8px;
    text-decoration: none !important;
    color: var(--text-primary) !important;
    font-size: 0.825rem;
    font-weight: 500;
    transition: background 0.15s ease;
    margin-bottom: 0.25rem;
}

.dm-conversation-link:hover {
    background: rgba(104, 79, 248, 0.08);
}

.dm-active {
    background: rgba(104, 79, 248, 0.12);
    font-weight: 600;
}

.unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--artemis-primary);
    margin-left: auto;
    flex-shrink: 0;
}

[data-theme="dark"] .dm-active {
    background: rgba(104, 79, 248, 0.2);
}

/* Typing indicator */
.typing-text {
    font-size: 0.75rem;
    font-style: italic;
    color: var(--text-muted);
    padding: 0.15rem 0;
    display: block;
    min-height: 1.2em;
}

/* Reaction buttons */
.reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.15rem 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
    font-size: 0.75rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    color: var(--text-primary);
}

.reaction-btn:hover {
    border-color: var(--artemis-primary);
    background: rgba(104, 79, 248, 0.06);
}

.reaction-active {
    border-color: var(--artemis-primary);
    background: rgba(104, 79, 248, 0.1);
}

[data-theme="dark"] .reaction-active {
    background: rgba(104, 79, 248, 0.2);
}

.reaction-count {
    font-size: 0.7rem;
    font-weight: 600;
}

.reaction-add {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    border-style: dashed;
}

/* Emoji picker popover */
.emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    display: flex;
    gap: 0.15rem;
    padding: 0.35rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

[data-theme="dark"] .emoji-picker {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.emoji-pick-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    padding: 0.2rem 0.35rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s ease;
    line-height: 1;
}

.emoji-pick-btn:hover {
    background: rgba(104, 79, 248, 0.1);
}

.chat-muted {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0.25rem 0;
}

/* Relative position on reaction containers for picker placement */
.chat-reactions {
    position: relative;
}

/* Mobile: collapse sidebar */
@media (max-width: 768px) {
    .chat-layout {
        grid-template-columns: 1fr;
    }

    .chat-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 270px;
        height: 100vh;
        z-index: 200;
        transition: left 0.25s ease;
        border-right: 1px solid var(--border-color);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
    }

    .chat-sidebar-open {
        left: 0;
    }

    .chat-sidebar-close {
        display: block;
    }

    .chat-sidebar-toggle {
        display: inline-block;
    }

    .chat-message {
        max-width: 90%;
    }
}
