/*!
 * Soicau — chot-so.css
 * © 2026 pickles.soicau
 */

.home-chot-so,
.home-chot-so-chat {
    margin-left: -16px;
    margin-right: -16px;
}
@media (max-width: 480px) {
    .home-chot-so,
    .home-chot-so-chat {
        margin-left: -12px;
        margin-right: -12px;
    }
}

.home-chot-so,
.home-chot-so-chat { margin-top: 0; margin-bottom: 0; }

.cs-wrap {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 0;
}

.cs-card {
    background: var(--color-surface);
    overflow: hidden;
}

.cs-card .section-bar,
.cs-card .cs-header.section-bar { margin-bottom: 0; }

.cs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2, 8px);
}

.cs-header-title { letter-spacing: .3px; }

.cs-date-select {
    background: #fff;
    color: #222;
    border: 1px solid #ddd;
    padding: 3px 8px;
    font-size: 13px;
    cursor: pointer;
}

.cs-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cs-help-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: rgba(255,255,255,.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,.4);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 999px;
    transition: background .15s;
}
.cs-help-trigger:hover { background: rgba(255,255,255,.28); }
.cs-help-trigger i { font-size: 13px; }

.cs-help-content { font-size: 14px; color: #1f2937; line-height: 1.6; }
.cs-help-section {
    margin: 14px 0 6px;
    padding: 6px 10px;
    background: var(--color-bg-alt);
    color: #1f2937;
    font-size: 14px;
    font-weight: 700;
    border-left: 3px solid var(--color-primary);
}
.cs-help-section:first-child { margin-top: 0; }
.cs-help-list {
    list-style: disc;
    margin: 6px 0 6px 20px;
    padding: 0;
}
.cs-help-list li { margin: 4px 0; }
.cs-help-note {
    margin: 6px 0;
    color: #475569;
    font-size: 13px;
    font-style: italic;
}
.cs-help-pts {
    display: inline-block;
    padding: 0 6px;
    background: #fee2e2;
    color: #b91c1c;
    font-weight: 700;
    border-radius: 4px;
}
.cs-help-intro {
    margin: 0 0 14px;
    padding: 10px 12px;
    background: color-mix(in srgb, var(--color-primary) 8%, transparent);
    border-left: 3px solid var(--color-primary);
    color: #1f2937;
    font-size: 13.5px;
    line-height: 1.55;
}
.cs-help-num {
    display: inline-block;
    min-width: 28px;
    padding: 1px 6px;
    margin: 0 2px;
    background: #fff;
    border: 1px solid #d1d5db;
    color: #1f2937;
    font-weight: 700;
    text-align: center;
    border-radius: 4px;
    font-variant-numeric: tabular-nums;
}
.cs-help-list--rank li { margin: 6px 0; }
.cs-help-note i { color: var(--color-primary); margin-right: 4px; }

.cs-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2, 8px);
    padding: var(--space-3, 12px);
    border-bottom: 1px solid var(--color-border);
}

.cs-search {
    flex: 1 1 280px;
    display: flex;
    align-items: stretch;
}
.cs-search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-right: none;
    font-size: 14px;
    background: #fff;
}
.cs-search-btn {
    background: var(--color-primary);
    color: #fff;
    border: 1px solid var(--color-primary);
    padding: 0 14px;
    cursor: pointer;
    font-size: 15px;
}
.cs-search-btn:hover { background: var(--color-primary-dark); }

.cs-btn {
    border: none;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: #fff;
    transition: filter .15s;
}
.cs-btn:hover { filter: brightness(.92); }
.cs-btn--chot  { background: var(--color-primary); }
.cs-btn--chot:hover { background: var(--color-primary-dark); }
.cs-btn--reset { background: #6b7280; }
.cs-btn--reset:hover { background: #4b5563; }

.cs-actions {
    padding: 14px;
    text-align: center;
    font-size: 14px;
    color: #0f172a;
    background: #fafafa;
}
.cs-actions i {
    color: var(--color-primary);
    font-size: 16px;
}
.cs-actions .cs-btn { min-width: 110px; }
.cs-actions .cs-btn + .cs-btn { margin-left: 8px; }

/* Pagination */
.cs-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 10px;
    flex-wrap: wrap;
    border-top: 1px solid var(--color-border);
}
.cs-page {
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--color-border);
    background: #fff;
    color: #475569;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    font-variant-numeric: tabular-nums;
}
.cs-page:hover:not(:disabled):not(.active) {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.cs-page.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    cursor: default;
}
.cs-page:disabled {
    opacity: .4;
    cursor: not-allowed;
}
.cs-page--nav { padding: 0 8px; }
.cs-page-ellipsis {
    color: #94a3b8;
    padding: 0 4px;
    font-weight: 600;
}

.cs-locked-note {
    font-size: 13px;
    color: #b04a14;
    background: #fff7e6;
    border: 1px solid #ffd9a8;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ---------- List table ---------- */
.cs-list-wrap { padding: 0; }
.cs-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.cs-list-table thead th {
    background: #f3f4f6;
    text-align: center;
    padding: 8px 6px;
    border-bottom: 2px solid var(--color-border);
    font-weight: 600;
    color: #444;
}
.cs-list-table tbody td {
    padding: 6px 6px;
    border-bottom: 1px solid #eee;
    text-align: center;
    vertical-align: middle;
}

.cs-list-table tbody tr:last-child td { border-bottom: 0; }
.cs-list-table tbody tr:hover { background: #fafafa; }

.cs-td-user {
    text-align: left !important;
    white-space: nowrap;
}
.cs-td-user > * { vertical-align: middle; }

.cs-avatar {
    position: relative;
    display: inline-flex;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #eef2f3;
    flex-shrink: 0;
    margin-right: 10px;
}
.cs-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}
.cs-avatar-link {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    transition: opacity .15s;
}
.cs-avatar-link:hover { opacity: .85; }
.cs-user-name-link {
    color: inherit;
    text-decoration: none;
}
.cs-user-name-link:hover { color: var(--color-primary); text-decoration: none; }

.cs-user-info {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.cs-user-name--admin,
.cs-user-name--admin .cs-user-name-link { color: var(--color-primary); }
.cs-user-name {
    font-weight: 600;
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.3;
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
}
.cs-user-sub {
    line-height: 1;
    font-size: 12px;
    color: #6b7280;
}
.cs-user-sub b { color: #d23a3a; font-weight: 600; }
.cs-user-sub > b:first-of-type { color: #1d4ed8; }
.cs-user-time {
    color: #9ca3af;
    font-size: 11px;
    font-weight: 400;
    margin-left: 6px;
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
}
.cs-user-time i {
    font-size: 10px;
    transform: translateY(1px);
}

.cs-td-de   { white-space: nowrap; }
.cs-td-diem { white-space: nowrap; }

.cs-td-picks {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
    padding-right: 14px !important;
}
.cs-td-picks-inner {
    display: inline-block;
    vertical-align: middle;
}
.cs-td-picks .cs-pick-row {
    display: flex;
    width: 100%;
    justify-content: flex-end;
    gap: 12px;
}
.cs-td-picks .cs-pick-row--split {
    justify-content: space-between;
}
.cs-td-picks .cs-pick { gap: 6px; }
.cs-td-picks .cs-pick-label { font-weight: 700; font-size: 13px; }
.cs-td-picks .cs-pick-nums  { color: #0f172a; font-size: 13px; }
.cs-pick-num--hit  { color: #d23a3a; font-weight: 600; }
.cs-pick-num--hit sup { font-size: 9px; margin-left: 1px; }
.cs-pick-num--empty { color: #cbd5e1; font-weight: 400; }
.cs-pick-comma { color: #94a3b8; }

.cs-num {
    display: inline-block;
    min-width: 26px;
    padding: 2px 4px;
    margin: 1px;
    font-weight: 600;
    color: #222;
    background: #f3f4f6;
    border-radius: 3px;
}
.cs-num--empty { color: #bbb; background: transparent; font-weight: 400; }
.cs-num--hit   { color: #fff; background: #d23a3a; }
.cs-boi        { font-size: 10px; margin-left: 1px; }

.cs-diem {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 700;
    margin: 0 2px;
}
.cs-diem--lo { background: #fff1ea; color: #d23a3a; border: 1px solid #ffd0bf; }
.cs-diem--de { background: #eafaf1; color: #0a6b46; border: 1px solid #b3ecca; }
.cs-pending  { color: #888; font-style: italic; font-size: 12px; }

.cs-empty {
    padding: 16px;
    text-align: center;
    color: #888;
    font-size: 13px;
    margin: 0;
}

.cs-stats { padding: 0; }
.cs-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.cs-stat-col + .cs-stat-col { border-left: 1px solid var(--color-border); }
.cs-stat-col-head {
    text-align: center;
    padding: 8px 10px;
    font-weight: 700;
    color: var(--color-primary);
    font-size: 13px;
    background: #fafafa;
    border-bottom: 1px solid var(--color-border);
}
.cs-stat-col:last-child .cs-stat-col-head { color: var(--soicau-danger, #dc2626); }
.cs-stat-col-body {
    display: flex;
    flex-direction: column;
    padding: 0;
}
.cs-stat-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 8px 10px;
    border-bottom: 1px solid #f1f3f5;
}
.cs-stat-item:last-child { border-bottom: none; }
.cs-stat-ball {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 1px 2px rgba(0,0,0,.15);
    position: relative;
    z-index: 1;
}
.cs-stat-ball--lo { background: var(--color-primary); }
.cs-stat-ball--de { background: var(--soicau-danger, #dc2626); }
.cs-stat-count {
    background: #fde047;
    color: #1f2937;
    font-size: 12px;
    padding: 4px 10px 4px 14px;
    margin-left: -8px;
    border-radius: 0 14px 14px 0;
    min-width: 50px;
}
.cs-stat-empty {
    text-align: center;
    color: #9ca3af;
    font-style: italic;
    padding: 8px 0;
}

/* ---------- Top board ---------- */
.cs-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    background: #f7f7f8;
}
.cs-tab {
    background: transparent;
    border: none;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    cursor: pointer;
    border-bottom: 3px solid transparent;
}
.cs-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    background: #fff;
}

.cs-top { padding: 0; }

.cs-top-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cs-top-row {
    display: grid;
    grid-template-columns: 24px 40px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #f1f3f5;
}
.cs-top-row:last-child { border-bottom: none; }
.cs-top-row:hover { background: #fafafa; }

.cs-top-rank {
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.cs-top-row--rank1 .cs-top-rank { color: #ca8a04; }
.cs-top-row--rank2 .cs-top-rank { color: #6b7280; }
.cs-top-row--rank3 .cs-top-rank { color: #b45309; }

.cs-top-row--rank1 .cs-avatar,
.cs-avatar:has(.cs-top-badge--crown)  { box-shadow: 0 0 0 2px #fcd34d; }
.cs-top-row--rank2 .cs-avatar,
.cs-avatar:has(.cs-top-badge--silver) { box-shadow: 0 0 0 2px #cbd5e1; }
.cs-top-row--rank3 .cs-avatar,
.cs-avatar:has(.cs-top-badge--bronze) { box-shadow: 0 0 0 2px #fed7aa; }

.cs-top-badge {
    position: absolute;
    left: 50%;
    top: -11px;
    transform: translateX(-50%);
    font-size: 14px;
    line-height: 1;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,.2));
}
.cs-top-badge--crown  { color: #f5b400; }
.cs-top-badge--silver { color: #94a3b8; top: -9px; font-size: 13px; }
.cs-top-badge--bronze { color: #cd7f32; top: -9px; font-size: 13px; }

.cs-top-row--rank1 .cs-user-name { color: var(--color-text); font-weight: 700; }

.cs-top-picks {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
    min-width: 0;
    text-align: center;
}
.cs-pick-row.cs-pick-row--empty {
    display: block;
    gap: 0;
    text-align: center;
    color: #6b7280;
    font-size: 12px;
}
.cs-pick-row--empty a {
    color: var(--color-primary);
    text-decoration: none;
}
.cs-pick-row--empty a:hover { text-decoration: underline; }
.cs-pick-date {
    font-size: 11.5px;
    font-weight: 500;
}
.cs-pick-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    justify-content: center;
}
.cs-pick {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
}
.cs-pick-label {
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
}
.cs-pick-label--btl { color: #b45309; }
.cs-pick-label--stl { color: #1d4ed8; }
.cs-pick-label--de  { color: #b91c1c; }
.cs-pick-nums {
    color: #0f172a;
}

/* ---------- Modal ---------- */
.cs-modal[hidden] { display: none; }
.cs-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.cs-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
}
.cs-modal-box {
    position: relative;
    background: #fff;
    width: min(560px, 100%);
    padding: 22px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    border-radius: 4px;
    text-align: center;
}
.cs-modal-title {
    margin: 0 0 18px;
    text-align: center;
    color: #d23a3a;
    font-size: 17px;
    font-weight: 700;
}
.cs-modal-rows {
    display: inline-block;
    text-align: left;
}
.cs-modal-grid {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 26px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.cs-field {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cs-field--de {
    justify-content: center;
    margin-top: 4px;
    flex-wrap: wrap;
}
.cs-label {
    font-weight: 700;
    min-width: 36px;
}
.cs-label--blue   { color: #1e6dff; }
.cs-label--yellow { color: #e0a307; }
.cs-label--red    { color: #d23a3a; }

.cs-input {
    width: 40px;
    height: 32px;
    text-align: center;
    border: 1px solid #c8c8c8;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 600;
}
.cs-input:focus { outline: 2px solid var(--color-primary); outline-offset: -1px; }
.cs-input.is-error { border-color: #d23a3a; background: #fff3f3; }

.cs-modal-msg {
    min-height: 18px;
    margin: 10px 0;
    text-align: center;
    font-size: 13px;
}
.cs-modal-msg.is-error   { color: #d23a3a; }
.cs-modal-msg.is-success { color: #0a6b46; }

.cs-modal-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 8px;
}

/* Tablet */
@media (max-width: 900px) {
    .cs-toolbar { padding: 10px; }
    .cs-list-table { font-size: 12.5px; }
    .cs-num { min-width: 24px; padding: 2px 3px; }
    .cs-top-row { padding: 9px 12px; gap: 10px; }
}

/* Mobile */
@media (max-width: 640px) {
    .cs-wrap { gap: 10px; }

    .cs-header {
        gap: 8px;
        flex-wrap: wrap;
    }
    .cs-header-title { flex: 1 1 auto; min-width: 0; }
    .cs-header-actions { flex: 0 0 auto; gap: 6px; }
    .cs-date-select { padding: 4px 6px; max-width: none; font-size: 12px; }
    .cs-help-trigger {
        padding: 3px 8px;
        font-size: 11px;
    }
}

@media (max-width: 420px) {

    .cs-help-trigger {
        padding: 4px 8px;
        gap: 0;
    }
    .cs-help-label { display: none; }

    .cs-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .cs-search { flex: 1 1 auto; }
    .cs-btn {
        padding: 9px 14px;
        font-size: 14px;
    }
    .cs-actions { padding: 10px; gap: 10px; }
    .cs-actions .cs-btn { min-width: 100px; padding: 8px 18px; }
    .cs-locked-note { width: 100%; justify-content: center; text-align: center; }

    .cs-list-wrap { overflow-x: visible; padding: 0 10px; }
    .cs-list-table { font-size: 12px; width: 100%; }
    .cs-list-table tbody td { padding: 8px 4px; vertical-align: middle; }
    .cs-list-table tbody td:first-child { padding-left: 0; }
    .cs-list-table tbody td:last-child { padding-right: 0; }
    .cs-avatar { width: 32px; height: 32px; margin-right: 8px; }
    .cs-user-name { font-size: 13px; }
    .cs-user-sub  { font-size: 11.5px; }
    .cs-td-picks {
        text-align: right !important;
        padding-right: 0 !important;
    }
    .cs-td-picks-inner {
        display: inline-block;
        text-align: right;
    }
    .cs-td-picks .cs-pick-row {
        width: 100%;
        gap: 10px;
        justify-content: flex-end;
    }
    .cs-td-picks .cs-pick-row--split {
        justify-content: space-between;
    }
    .cs-td-picks .cs-pick-label,
    .cs-td-picks .cs-pick-nums { font-size: 11.5px; }
    .cs-td-picks .cs-pick { gap: 4px; }
    .cs-pick-date { font-size: 10.5px; }

    /* Stats */
    .cs-stat-ball { width: 32px; height: 32px; font-size: 13px; }
    .cs-stat-count { font-size: 11px; padding: 3px 8px 3px 12px; min-width: 44px; }
    .cs-stat-item  { padding: 6px 8px; }

    /* Top board */
    .cs-tabs { overflow-x: auto; }
    .cs-tab { padding: 10px 14px; font-size: 12.5px; white-space: nowrap; }
    .cs-top-row {
        grid-template-columns: 20px 32px 1fr auto;
        padding: 9px 10px;
        gap: 8px;
    }
    .cs-top-rank { font-size: 13px; }
    .cs-top-badge { font-size: 12px; top: -9px; }
    .cs-top-badge--silver,
    .cs-top-badge--bronze { font-size: 11px; top: -8px; }
    .cs-top-picks { font-size: 11.5px; gap: 2px; }
    .cs-pick-row { gap: 12px; }
    .cs-pick { gap: 6px; }

    /* Modal */
    .cs-modal { padding: 8px; align-items: flex-end; }
    .cs-modal-box {
        width: 100%;
        padding: 16px;
        border-radius: 8px 8px 0 0;
        max-height: 92vh;
        overflow-y: auto;
    }
    .cs-modal-title { font-size: 15px; margin-bottom: 14px; }
    .cs-modal-grid { gap: 14px; }
    .cs-field { gap: 6px; }
    .cs-field--de {
        display: grid;
        grid-template-columns: auto repeat(6, 1fr);
        align-items: center;
        gap: 5px;
    }
    .cs-field--de .cs-label { grid-column: 1; }
    .cs-input { width: 38px; height: 34px; font-size: 14px; }
    .cs-field--de .cs-input { width: 100%; }
    .cs-modal-actions { gap: 10px; }
    .cs-modal-actions .cs-btn { flex: 1; }
}

@media (max-width: 380px) {
    .cs-modal-grid {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    .cs-list-table th:nth-child(4),
    .cs-list-table td:nth-child(4) { display: none; }
}

.cs-chat .cs-card { padding: 0; overflow: visible; }

.cs-chat-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--color-border);
    background: #fafafa;
}
.cs-chat-textarea {
    width: 100%;
    border: 1px solid var(--color-border);
    padding: 8px 10px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 96px;
    background: #fff;
    box-sizing: border-box;
}
.cs-chat-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(5, 126, 134, .15);
}
.cs-chat-form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}
.cs-chat-msg {
    flex: 1;
    font-size: 13px;
    color: #6b7280;
}
.cs-chat-msg--error { color: #b91c1c; }

/* ----- Tìm kiếm bình luận ----- */
.cs-chat-search {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    background: #fff;
}
.cs-chat-search-box {
    position: relative;
    display: flex;
    align-items: center;
}
.cs-chat-search-icon {
    position: absolute;
    left: 12px;
    color: #9ca3af;
    font-size: 13px;
    pointer-events: none;
}
.cs-chat-search-input {
    width: 100%;
    border: 1px solid var(--color-border);
    padding: 8px 36px 8px 34px;
    font-size: 14px;
    font-family: inherit;
    background: #fafafa;
    box-sizing: border-box;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.cs-chat-search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: #fff;
    box-shadow: 0 0 0 2px rgba(5, 126, 134, .15);
}
.cs-chat-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}
.cs-chat-search-clear {
    position: absolute;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    border-radius: 50%;
    font-size: 13px;
    transition: color .15s, background .15s;
}
.cs-chat-search-clear:hover {
    color: #374151;
    background: rgba(0, 0, 0, .06);
}
.cs-chat-search-clear[hidden] { display: none; }

/* ----- Image upload (form) ----- */
.cs-chat-image-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    border-radius: 0;
    cursor: pointer;
    color: var(--color-primary);
    font-size: 18px;
    transition: color .15s;
}
.cs-chat-image-btn:hover {
    background: transparent;
    color: var(--color-primary-hover, #034a50);
}
.cs-chat-image-preview {
    position: relative;
    display: inline-block;
    align-self: flex-start;
    margin-top: 4px;
    max-width: 160px;
    width: -moz-fit-content;
    width: fit-content;
}
.cs-chat-image-preview[hidden] { display: none; }
.cs-chat-image-preview img {
    display: block;
    max-width: 160px;
    max-height: 140px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    object-fit: cover;
}
.cs-chat-image-preview.is-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .55);
    border-radius: 6px;
    background-image: linear-gradient(transparent, transparent);
}
.cs-chat-image-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: #111827;
    color: #fff;
    font-size: 11px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.cs-chat-image-remove:hover { background: #b91c1c; }

/* ----- Emoji picker (form) ----- */
.cs-chat-emoji-wrap {
    position: relative;
    display: inline-flex;
}
.cs-chat-emoji-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--color-primary);
    font-size: 18px;
    padding: 0;
    transition: color .15s;
}
.cs-chat-emoji-btn:hover { color: var(--color-primary-hover, #034a50); }

.cs-chat-emoji-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 280px;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
    padding: 6px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    z-index: 50;
}
.cs-chat-emoji-panel[hidden] { display: none; }
.cs-chat-emoji-item {
    border: none;
    background: transparent;
    padding: 3px;
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.cs-chat-emoji-item:hover { background: rgba(0, 0, 0, .06); }
.cs-chat-emoji-item img { display: block; }

/* Emoji inline trong nội dung comment */
.cs-chat-emoji {
    display: inline-block;
    vertical-align: middle;
    margin: 0 1px;
}

@media (max-width: 480px) {
    .cs-chat-emoji-panel {
        width: 252px;
        grid-template-columns: repeat(6, 1fr);
    }
}

.cs-chat-login {
    padding: 14px;
    text-align: center;
    font-size: 14px;
    color: #0f172a;
    border-bottom: 1px solid var(--color-border);
    background: #fafafa;
}
.cs-chat-login i {
    color: var(--color-primary);
    font-size: 16px;
}
.cs-chat-login a {
    color: var(--color-primary);
    text-decoration: none;
}
.cs-chat-login a:hover { text-decoration: underline; }

.cs-chat-empty {
    padding: 18px 14px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

.cs-chat-items {
    display: flex;
    flex-direction: column;
}

.cs-chat-item {
    position: relative;
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    background: #fff;
}

/* ----- 3-chấm menu trong chat item ----- */
.cs-chat-menu {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 4;
}
.cs-chat-menu-trigger {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;
    color: #6b7280;
    cursor: pointer;
    font-size: 14px;
    transition: background .15s, color .15s, border-color .15s;
}
.cs-chat-menu-trigger:hover,
.cs-chat-menu.is-open .cs-chat-menu-trigger {
    background: #f3f4f6;
    color: #111827;
    border-color: #e5e7eb;
}
.cs-chat-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    min-width: 200px;
    background: #fff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    padding: 4px 0;
    display: none;
}
.cs-chat-menu.is-open .cs-chat-menu-dropdown { display: block; }
.cs-chat-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 14px;
    background: transparent;
    border: 0;
    color: #1f2937;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background .15s;
}
.cs-chat-menu-item:hover { background: #f3f4f6; }
.cs-chat-menu-item i { width: 16px; color: #b91c1c; }
.cs-chat-menu-item--edit i { color: var(--soicau-info, #2563eb); }
.cs-chat-menu-item--delete { color: #b91c1c; }
.cs-chat-menu-item--pin i { color: #d97706; }

.cs-chat-pinned-tag {
    position: absolute;
    top: 8px;
    right: 44px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #b45309;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 999px;
    z-index: 3;
    pointer-events: none;
    line-height: 1.4;
}
.cs-chat-pinned-tag i { font-size: 10px; }
@media (max-width: 480px) {
    .cs-chat-pinned-tag { right: 40px; font-size: 10px; padding: 1px 6px; }
}

/* Inline edit form (admin) */
.cs-chat-edit-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}
.cs-chat-edit-textarea {
    min-height: 64px;
}
.cs-chat-edit-textarea.is-invalid {
    border-color: #b91c1c;
    box-shadow: 0 0 0 2px rgba(185, 28, 28, .15);
}
.cs-chat-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.cs-chat-edit-btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 0;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.cs-chat-edit-btn--cancel {
    background: #fff;
    color: #4b5563;
    border-color: #d1d5db;
}
.cs-chat-edit-btn--cancel:hover {
    background: #f3f4f6;
    color: #111827;
}
.cs-chat-edit-btn--save {
    background: var(--color-primary);
    color: #fff;
}
.cs-chat-edit-btn--save:hover { filter: brightness(.92); }
.cs-chat-edit-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.cs-chat-item:last-child { border-bottom: none; }
.cs-chat-item--reply {
    background: #f6f7f9;
    padding-left: 48px;
}

.cs-chat-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.cs-chat-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: block;
}
.cs-chat-avatar-link {
    display: inline-block;
    line-height: 0;
    transition: opacity .15s;
}
.cs-chat-avatar-link:hover { opacity: .85; }
.cs-chat-meta { flex: 1; min-width: 0; }
.cs-chat-author {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.cs-chat-name {
    color: var(--color-text);
    font-size: 14px;
    text-decoration: none;
}
a.cs-chat-name { color: var(--color-text); }
a.cs-chat-name:hover { color: var(--color-primary); text-decoration: none; }
.cs-chat-author:has(.cs-chat-badge--admin) .cs-chat-name,
.cs-chat-author:has(.cs-chat-badge--admin) a.cs-chat-name { color: var(--color-primary); }
.cs-chat-badge-wrap {
    position: relative;
    display: inline-flex;
    cursor: pointer;
    outline: none;
}
.cs-chat-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    border-radius: 20px;
    padding: 2px 6px;
    font-weight: 700;
    line-height: 1.6;
    background-color: #f2f2f2;
    color: #3b5998;
    border: 1px solid #ddd;
    white-space: nowrap;
    overflow: hidden;
}
.cs-chat-badge i { font-size: 11px; color: #e0a821; }
.cs-chat-badge::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    height: 100%;
    width: 14px;
    pointer-events: none;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 1) 40%,
        rgba(255, 255, 255, 1) 63%,
        rgba(255, 255, 255, .02) 100%
    );
    animation: cs-chat-badge-shine 2.2s ease-in-out infinite;
}
@keyframes cs-chat-badge-shine {
    0%   { transform: translateX(-30px); opacity: 0; }
    20%  { opacity: 1; }
    80%  { opacity: 1; }
    100% { transform: translateX(160px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .cs-chat-badge::after { animation: none; display: none; }
}

.cs-chat-badge--vua-lo   i.fa-crown        { color: var(--soicau-warning, #f59e0b); }
.cs-chat-badge--cao-thu  i.fa-medal        { color: #b91c1c; }
.cs-chat-badge--dang-cap i.fa-bullseye     { color: var(--soicau-danger, #dc2626); }
.cs-chat-badge--uy-tin   i.fa-sack-dollar  { color: #ca8a04; }
.cs-chat-badge--tap-chot i.fa-lightbulb    { color: #eab308; }

/* Admin */
.cs-chat-badge--admin {
    background-color: #fee2e2;
    color: #b91c1c;
    border-color: #fca5a5;
}
.cs-chat-badge--admin i.fa-user-shield { color: var(--soicau-danger, #dc2626); }

/* Tooltip */
.cs-chat-badge-tip {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 10px 12px;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .15s, transform .15s, visibility .15s;
    z-index: 50;
}
.cs-chat-badge-tip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    width: 11px;
    height: 11px;
    background: #fff;
    border-left: 1px solid #e5e7eb;
    border-top: 1px solid #e5e7eb;
    transform: translateX(-50%) rotate(45deg);
}
.cs-chat-badge-wrap.is-open .cs-chat-badge-tip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}
.cs-chat-badge-tip ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cs-chat-tier {
    display: grid;
    grid-template-columns: 70px 1fr;
    align-items: center;
    gap: 14px;
}
.cs-chat-tier-rank {
    font-size: 13px;
    color: #1f2937;
    font-weight: 600;
    white-space: nowrap;
}
.cs-chat-tier .cs-chat-badge { justify-self: start; }

.cs-chat-score {
    font-size: 12px;
    color: #4b5563;
    margin-top: 2px;
}
.cs-chat-score b { color: #b91c1c; font-weight: 700; }
.cs-chat-score > b:first-of-type { color: #1d4ed8; }
.cs-chat-score-sep { color: #cbd5e1; margin: 0 4px; }
.cs-chat-view-picks {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--soicau-success, #16a34a);
    font-size: 12px;
    margin-left: 6px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-family: inherit;
}
.cs-chat-view-picks:hover { text-decoration: none; }
.cs-chat-view-picks i { font-size: 12px; }
.cs-chat-view-picks .cs-icon-hide,
.cs-chat-view-picks .cs-text-hide { display: none; }
.cs-chat-view-picks.is-open { color: var(--soicau-danger, #dc2626); }
.cs-chat-view-picks.is-open .cs-icon-show,
.cs-chat-view-picks.is-open .cs-text-show { display: none; }
.cs-chat-view-picks.is-open .cs-icon-hide,
.cs-chat-view-picks.is-open .cs-text-hide { display: inline; }

.cs-chat-picks-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.cs-chat-picks {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 8px 12px;
    width: max-content;
    max-width: min(320px, 90vw);
    font-size: 13px;
    color: #1f2937;
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity .15s, transform .15s, visibility .15s;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.cs-chat-picks::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 18px;
    width: 11px;
    height: 11px;
    background: #fff;
    border-left: 1px solid #e5e7eb;
    border-top: 1px solid #e5e7eb;
    transform: rotate(45deg);
}
.cs-chat-picks-wrap.is-open .cs-chat-picks {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}
.cs-chat-picks-row {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-between;
}
.cs-chat-pick b { color: #b45309; margin-right: 4px; font-weight: 700; }
.cs-chat-pick--btl b { color: #b45309; }
.cs-chat-pick--lo b  { color: #1d4ed8; }
.cs-chat-pick--de b  { color: var(--soicau-danger, #dc2626); }

.cs-chat-picks-login {
    color: #4b5563;
    white-space: nowrap;
}
.cs-chat-picks-login a {
    color: var(--color-primary);
    text-decoration: none;
}
.cs-chat-picks-login a:hover { text-decoration: underline; }

@media (max-width: 480px) {
    .cs-chat-picks { left: auto; right: 0; }
    .cs-chat-picks::before { left: auto; right: 18px; }
}

.cs-chat-body {
    padding: 6px 0 4px 46px;
    font-size: 14px;
    color: #1f2937;
    line-height: 1.5;
    word-wrap: break-word;
}
.cs-chat-text + .cs-chat-img-link { margin-top: 6px; }
.cs-chat-img-link {
    display: block;
    width: -moz-fit-content;
    width: fit-content;
    max-width: 280px;
}
.cs-chat-img {
    display: block;
    max-width: 280px;
    max-height: 320px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    object-fit: contain;
    background: #f3f4f6;
}
.cs-chat-img-link:hover .cs-chat-img {
    border-color: var(--color-primary);
}
@media (max-width: 480px) {
    .cs-chat-img-link,
    .cs-chat-img { max-width: 100%; }
}

/* ----- Lightbox zoom ảnh ----- */
.cs-chat-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    cursor: zoom-out;
}
.cs-chat-lightbox.is-open { display: flex; }
.cs-chat-lightbox-img {
    max-width: 95vw;
    max-height: 92vh;
    object-fit: contain;
    box-shadow: 0 6px 32px rgba(0, 0, 0, .6);
    cursor: default;
    background: #111;
}
.cs-chat-lightbox-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, .5);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.cs-chat-lightbox-close:hover { background: rgba(0, 0, 0, .8); }
body.cs-chat-lightbox-lock { overflow: hidden; }

.cs-chat-foot {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 4px 0 0 46px;
    font-size: 12px;
    color: #6b7280;
    border-top: 1px solid #f1f1f1;
    padding-top: 6px;
    margin-top: 4px;
}
.cs-chat-like,
.cs-chat-reply-btn,
.cs-chat-msg-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 12px;
    color: #6b7280;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}
.cs-chat-like:hover,
.cs-chat-reply-btn:hover,
.cs-chat-msg-btn:hover { color: var(--color-primary); text-decoration: none; }
.cs-chat-like.is-liked { color: var(--color-primary); }
.cs-chat-like i,
.cs-chat-reply-btn i,
.cs-chat-msg-btn i { font-size: 13px; }
.cs-chat-time { margin-left: auto; font-size: 11px; color: #94a3b8; }

.cs-chat-reply-form {
    margin: 8px 0 4px 46px;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cs-chat-reply-form .cs-chat-form-actions { justify-content: flex-end; }
.cs-chat-reply-form .cs-btn { padding: 6px 14px; font-size: 13px; }

/* Load more */
.cs-chat-load-more {
    text-align: center;
    padding: 12px;
    border-top: 1px solid var(--color-border);
    background: #fafafa;
}
.cs-chat-load-more-btn {
    background: var(--color-primary);
    border: none;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background .15s;
    font-family: inherit;
}
.cs-chat-load-more-btn:hover:not(:disabled) {
    background: var(--color-primary-dark);
}
.cs-chat-load-more-btn:disabled { opacity: .65; cursor: wait; }
.cs-chat-load-more-btn i { font-size: 12px; }

@media (max-width: 480px) {
    .cs-chat-item--reply { padding-left: 28px; }
    .cs-chat-body,
    .cs-chat-foot { padding-left: 0; }
    .cs-chat-reply-form { margin-left: 0; }
    .cs-chat-foot { flex-wrap: wrap; gap: 6px 12px; }
    .cs-chat-time { margin-left: auto; font-size: 11px; flex-shrink: 0; }
}
