/* ==========================================================================
   Modern UI layer — loads after app.css. Same palette (purple #680A83,
   pink #EE00AB, Poppins); refreshed surfaces, spacing, motion, focus states.
   ========================================================================== */
:root {
    --brand: #680A83;
    --brand-600: #5a078b;
    --brand-800: #420ba1;
    --brand-50: #f6effa;
    --brand-100: #eadcf2;
    --accent: #EE00AB;
    --accent-2: #fd6286;
    --ok: #49e073;
    --ink: #36404a;
    --ink-2: #4d5a66;
    --muted: #7a8494;
    --bg: #f7f3fa;
    --card: #ffffff;
    --line: #eee6f3;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(66, 11, 90, .06), 0 1px 3px rgba(66, 11, 90, .05);
    --shadow: 0 6px 20px rgba(66, 11, 90, .08);
    --shadow-lg: 0 18px 50px rgba(66, 11, 90, .18);
    --ring: 0 0 0 3px rgba(104, 10, 131, .22);
    --ease: cubic-bezier(.2, .7, .2, 1);
}

html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { background: var(--brand-100); color: var(--brand); }
a { transition: color .15s var(--ease), background-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
h1, h2, h3, h4, h5, h6 { color: var(--brand-600); letter-spacing: -.01em; }

/* thin, quiet scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--brand-100) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--brand-100); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #d7bfe6; }

/* ---------- Icon rail (left menu) ---------- */
.sidebar-menu { background: var(--card); border-right: 1px solid var(--line); box-shadow: none; }
.sidebar-menu .logo-col { padding-bottom: 6px; }
.sidebar-menu .chat-menus ul li a,
.sidebar-menu .bottom-menus ul li a {
    position: relative; width: 46px; height: 46px; border-radius: 14px; background: transparent; color: var(--brand-600);
    display: flex; align-items: center; justify-content: center; transition: background-color .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.sidebar-menu .chat-menus ul li a:hover,
.sidebar-menu .bottom-menus ul li a:hover { background: var(--brand-50); transform: translateY(-1px); }
.sidebar-menu .chat-menus ul li a.active,
.sidebar-menu .chat-menus ul li a[aria-current="page"] { background: linear-gradient(135deg, var(--brand), var(--brand-600)); color: #fff; box-shadow: 0 6px 14px rgba(104, 10, 131, .3); }
.sidebar-menu .chat-menus ul li a > span:not(.material-icons) {
    position: absolute; left: calc(100% + 12px); top: 50%; transform: translate(-6px, -50%); white-space: nowrap; pointer-events: none;
    background: var(--ink); color: #fff; font-size: 12px; padding: 5px 10px; border-radius: 8px; opacity: 0; visibility: hidden;
    transition: opacity .15s var(--ease), transform .15s var(--ease); z-index: 50; display: block;
}
.sidebar-menu .chat-menus ul li a:hover > span:not(.material-icons),
.sidebar-menu .chat-menus ul li a:focus-visible > span:not(.material-icons) { opacity: 1; visibility: visible; transform: translate(0, -50%); }
.sidebar-menu .bottom-menus ul li a > span:not(.material-icons) { display: none; }

/* ---------- Left panel: title, search, online strip ---------- */
.left-sidebar { background: var(--bg); border-right: 1px solid var(--line); }
.left-chat-title .chat-title h4 { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-600); }
.btn.logout-btn, .logout-btn {
    background: linear-gradient(135deg, var(--accent), #c9008f); color: #fff; border: 0; border-radius: 999px; padding: 8px 16px;
    font-size: 12px; font-weight: 600; box-shadow: 0 4px 12px rgba(238, 0, 171, .28); transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.btn.logout-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(238, 0, 171, .34); color: #fff; }
.btn.logout-btn.info { background: var(--brand-50); color: var(--brand); box-shadow: none; }
.btn.logout-btn.info:hover { background: var(--brand-100); box-shadow: none; }

.search_chat .form-control, .chat_input {
    height: 46px; border-radius: 999px !important; border: 1px solid var(--line); background: var(--card); padding-left: 44px;
    box-shadow: var(--shadow-sm); transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.search_chat .form-control:focus, .chat_input:focus { border-color: var(--brand); box-shadow: var(--ring); outline: 0; }
.search_chat .form-control-feedback { color: var(--brand); left: 16px; }

.top-online-contacts .top-contacts-box {
    background: var(--card); border-radius: var(--radius); padding: 14px 8px 12px; box-shadow: var(--shadow-sm); border: 1px solid transparent;
    transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.top-online-contacts .top-contacts-box:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand-100); }
.top-contacts-box .profile-img img { border-radius: 14px; object-fit: cover; }
.top-contacts-box .profile-name span { font-weight: 600; color: var(--ink-2); font-size: 12px; }
.profile-img.online::after, .avatar-online::before, .avatar.avatar-online:before { box-shadow: 0 0 0 2px #fff; }

/* ---------- Lists (recent calls, contacts, phonebook) ---------- */
.user-list { display: grid; gap: 10px; padding: 0; }
.user-list-item {
    background: var(--card); border: 1px solid transparent; border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: 14px 16px; transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.user-list-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--brand-100); }
.user-list-item .avatar img { border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px var(--brand-50); }
.users-list-body h5 { font-size: 15px; font-weight: 600; color: var(--brand-600); margin-bottom: 2px; }
.users-list-body p { color: var(--muted); margin-bottom: 0; line-height: 1.5; }
.users-list-body p b { color: var(--ink); font-weight: 600; }
.last-chat-time a {
    width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-50); transition: background-color .15s var(--ease), transform .15s var(--ease);
}
.last-chat-time a:hover { background: var(--brand); transform: scale(1.06); }
.last-chat-time a:hover .material-icons { color: #fff !important; }
.last-chat-time .material-icons, .calling-icon { color: var(--brand); font-size: 20px; }

/* ---------- Conversation column ---------- */
.chat { background: var(--bg); }
.chat .chat-header { background: rgba(255, 255, 255, .86); -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.chat .chat-header .user-details h5 { font-weight: 600; color: var(--brand-600); }
.chat .chat-header small.online { color: #1a9c48; font-weight: 500; }
.chat .chat-header small.online::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 6px; box-shadow: 0 0 0 3px rgba(73, 224, 115, .25); }
.chat-options .btn, .chat-options .btn-outline-light {
    width: 42px; height: 42px; border-radius: 50%; padding: 0; display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-50); border: 0; color: var(--brand);
}
.chat-options .btn:hover { background: var(--brand); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 14px rgba(104, 10, 131, .28); }

.chat .chat-body .messages .chats .message-content {
    background: var(--card); border: 1px solid var(--line); border-radius: 18px 18px 18px 6px; box-shadow: var(--shadow-sm); padding: 12px 16px; color: var(--ink);
}
.chat .chat-body .messages .chats.chats-right .message-content {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-600) 55%, #7a1aa0 100%); border: 0; border-radius: 18px 18px 6px 18px; color: #fff;
    box-shadow: 0 8px 20px rgba(104, 10, 131, .25);
}
.chat .chat-body .messages .chats .chat-time { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; font-size: 11px; }
.chat .chat-body .messages .chats .chat-time .time a {
    display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-weight: 600; letter-spacing: .03em; text-decoration: none;
    background: var(--brand-50); color: var(--brand);
}
.chat .chat-body .messages .chats.chats-right .chat-time .time a { background: rgba(255, 255, 255, .18); color: #fff; }
.chat .chat-body .messages .chats .chat-time .time a:hover { filter: brightness(.96); transform: translateY(-1px); }
.chat .chat-body .messages .chats .chat-avatar img { border: 2px solid #fff; box-shadow: var(--shadow-sm); object-fit: cover; }
.chat-profile-name h6 { color: var(--muted); font-size: 11px; font-weight: 500; margin-top: 4px; }

.chat .chat-footer { background: transparent; border: 0; padding: 12px 18px 18px; }
.chat .chat-footer form { background: var(--card); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); padding: 6px 8px; align-items: center; transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.chat .chat-footer form:focus-within { border-color: var(--brand); box-shadow: var(--ring), var(--shadow); }
.chat .chat-footer .chat_form { border: 0 !important; box-shadow: none !important; background: transparent; }
.chat .chat-footer .smile-col a, .chat .chat-footer .attach-col a, .chat .chat-footer .specker-col a { color: var(--brand); opacity: .8; }
.chat .chat-footer .smile-col a:hover, .chat .chat-footer .attach-col a:hover, .chat .chat-footer .specker-col a:hover { opacity: 1; }
.chat .chat-footer .send-btn { width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #c9008f); border: 0; box-shadow: 0 6px 14px rgba(238, 0, 171, .32); transition: transform .15s var(--ease); }
.chat .chat-footer .send-btn:hover { transform: scale(1.06); }

/* ---------- Wallet / profile column ---------- */
.right-sidebar, .sidebar-group.right-sidebar { background: var(--bg); border-left: 1px solid var(--line); }
.right-sidebar .card, .right-sidebar .profile-card, .right-sidebar .right-sidebar-wrap { border-radius: var(--radius); }

/* ---------- Buttons, forms ---------- */
.btn { border-radius: 12px; font-weight: 600; transition: transform .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease); }
.btn:active { transform: scale(.98); }
.newgroup_create, .btn.newgroup_create {
    background: linear-gradient(135deg, var(--brand), var(--brand-600)); border: 0; border-radius: 12px; padding: 11px 22px; color: #fff; font-weight: 600;
    box-shadow: 0 8px 18px rgba(104, 10, 131, .28); transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.newgroup_create:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(104, 10, 131, .34); background: linear-gradient(135deg, #7a0d99, var(--brand)); }
.cancel-btn a { color: var(--muted); font-weight: 500; text-decoration: none; }
.cancel-btn a:hover { color: var(--brand); }
.form-control, .group_formcontrol, select.form-control {
    border: 1px solid var(--line); border-radius: 12px; background: #fdfbfe; transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease);
}
.form-control:focus { border-color: var(--brand); box-shadow: var(--ring); background: #fff; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: .02em; margin-bottom: 6px; }

/* ---------- Modals ---------- */
.modal-backdrop.show { opacity: 1; background: rgba(38, 10, 54, .5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal.fade .modal-dialog { transform: translateY(18px) scale(.98); transition: transform .28s var(--ease), opacity .28s var(--ease); }
.modal.show .modal-dialog { transform: none; }
.modal-content { border: 0; border-radius: 20px; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-header { border-bottom: 1px solid var(--line); padding: 18px 22px; background: linear-gradient(180deg, var(--brand-50), #fff); }
.modal-title { font-size: 16px; font-weight: 700; color: var(--brand-600); display: flex; align-items: center; gap: 10px; }
.modal-header .close { width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.modal-header .close:hover { background: var(--brand-50); color: var(--brand); }
.modal-body { padding: 22px; }

/* ---------- Tables, dropdowns, alerts, pagination ---------- */
.table { border-collapse: separate; border-spacing: 0 8px; }
.table thead th { border: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.table tbody tr { background: var(--card); box-shadow: var(--shadow-sm); }
.table tbody td { border: 0; vertical-align: middle; }
.table tbody td:first-child { border-radius: 12px 0 0 12px; }
.table tbody td:last-child { border-radius: 0 12px 12px 0; }
.dropdown-menu { border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; }
.dropdown-item { border-radius: 10px; padding: 8px 12px; }
.dropdown-item:hover { background: var(--brand-50); color: var(--brand); }
.alert { border: 0; border-radius: 14px; box-shadow: var(--shadow-sm); padding: 12px 16px; }
.alert-success { background: #e7f9ee; color: #14783a; }
.alert-danger { background: #fdecef; color: #b4234b; }
.alert h5 { margin: 0; font-size: 14px; font-weight: 600; color: inherit; }
.pagination .page-link { border: 0; border-radius: 10px; margin: 0 3px; color: var(--brand); }
.pagination .active .page-link, .pagination .page-link:hover { background: var(--brand); color: #fff; }
.custom-check .checkmark { border-radius: 6px; }

/* ---------- Login (split layout kept, refined) ---------- */
.account-page { background: #fff; padding-left: 0; }
.account-page .login-left { display: flex; align-items: center; justify-content: center; background: #fff; padding: 24px; }
.account-page .account-content { display: block; height: auto; max-width: 380px; padding: 0; animation: rise .5s var(--ease) both; }
.account-page .login-header { padding-bottom: 28px; }
.account-page .login-header img { height: 48px; width: auto; }
.account-page .login-text-details { padding-bottom: 20px; }
.account-page .login-text-details h3 { font-size: 26px; font-weight: 700; color: var(--brand-600); margin-bottom: 6px; }
.account-page .login-text-details p { color: var(--muted); margin: 0; }
.account-page .form-control { height: 50px; padding: 0 16px; }
.account-page .newgroup_create { height: 50px; border-radius: 14px; }
.account-page .newgroup_create.btn-danger { background: var(--brand-50); color: var(--brand); box-shadow: none; }
.account-page .newgroup_create.btn-danger:hover { background: var(--brand-100); }
.account-page .forgot-link a { color: var(--accent); font-weight: 600; text-decoration: none; }
.account-page .forgot-link a:hover { text-decoration: underline; }
.account-page hr { border-color: var(--line); opacity: 1; }
.account-page .login-right { position: relative; }
.account-page .login-right::after { content: ""; position: absolute; inset: 0; background: radial-gradient(700px 400px at 100% 100%, rgba(238, 0, 171, .28), transparent 60%), linear-gradient(135deg, rgba(66, 11, 161, .35), rgba(104, 10, 131, .15)); pointer-events: none; }
@media (max-width: 991px) { .account-page .login-left { width: 100%; float: none; min-height: 100vh; background: linear-gradient(180deg, var(--brand-50), #fff 40%); } .account-page .login-right { display: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Page entrance + empty/loading polish ---------- */
.left-sidebar-wrap .sidebar-body, .chat .chat-body, .settings-main .settings-tab { animation: rise .35s var(--ease) both; }
.user-list-item:nth-child(-n+8) { animation: rise .35s var(--ease) both; }
.user-list-item:nth-child(2) { animation-delay: .03s; } .user-list-item:nth-child(3) { animation-delay: .06s; }
.user-list-item:nth-child(4) { animation-delay: .09s; } .user-list-item:nth-child(5) { animation-delay: .12s; }
.user-list-item:nth-child(6) { animation-delay: .15s; } .user-list-item:nth-child(7) { animation-delay: .18s; }
.user-list-item:nth-child(8) { animation-delay: .21s; }

/* ---------- Mobile bottom nav ---------- */
@media (max-width: 991px) {
    .sidebar-menu { background: rgba(255, 255, 255, .92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(66, 11, 90, .08); }
    .sidebar-menu .chat-menus ul li a > span:not(.material-icons) { display: none; }
    .user-list-item { padding: 12px 14px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Online strip: compact round avatars */
.top-online-contacts .swiper-slide { height: auto; }
.top-contacts-box .profile-img { width: 64px; height: 64px; margin: 0 auto 8px; position: relative; }
.top-contacts-box .profile-img img { width: 64px; height: 64px; border-radius: 50% !important; object-fit: cover; box-shadow: 0 0 0 3px var(--brand-50); }
.top-contacts-box .profile-img.online::after { right: 2px; bottom: 2px; }

/* Header action buttons: always legible */
.chat-options .btn i, .chat-options .btn .fas { color: var(--brand) !important; font-size: 15px; }
.chat-options .btn:hover i { color: #fff !important; }

/* Empty state */
.empty-state { max-width: 340px; margin: 12vh auto 0; text-align: center; padding: 0 16px; animation: rise .4s var(--ease) both; }
.empty-state .empty-icon { width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 50%; background: linear-gradient(135deg, var(--brand-50), var(--brand-100)); display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 28px rgba(104, 10, 131, .14); }
.empty-state .empty-icon .material-icons { font-size: 38px; color: var(--brand); }
.empty-state h5 { font-weight: 700; margin-bottom: 6px; }
.empty-state p { color: var(--muted); margin-bottom: 18px; line-height: 1.6; }

/* ==========================================================================
   Contacts & Phonebook
   ========================================================================== */
.settings-main .page-header { padding: 6px 4px 0; }
.settings-main .page-header h5 { font-size: 22px; font-weight: 700; margin-bottom: 2px; }
.settings-main .page-header p { color: var(--muted); margin: 0; }
.settings-tab { margin-top: 18px !important; }
.settings-form { background: transparent; box-shadow: none; padding: 0; border: 0; }

/* toolbar */
.list-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin: 0 0 16px; }
.list-count { display: flex; align-items: baseline; gap: 8px; margin-right: auto; }
.list-count .count-num { font-size: 28px; font-weight: 700; color: var(--brand-600); line-height: 1; font-variant-numeric: tabular-nums; }
.list-count .count-label { color: var(--muted); font-size: 13px; }
.toolbar-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); background: var(--brand-50); padding: 6px 12px; border-radius: 999px; }
.toolbar-note .material-icons { font-size: 16px; color: var(--brand); }
.toolbar-add.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; margin: 0; font-size: 13px; }
.toolbar-add .material-icons { font-size: 18px; }
.segmented { display: inline-flex; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-sm); }
.segmented .seg { padding: 7px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-2); text-decoration: none; transition: background-color .18s var(--ease), color .18s var(--ease), box-shadow .18s var(--ease); }
.segmented .seg:hover { color: var(--brand); }
.segmented .seg.active { background: linear-gradient(135deg, var(--brand), var(--brand-600)); color: #fff; box-shadow: 0 4px 12px rgba(104, 10, 131, .28); }

/* list + rows */
.contact-list { display: grid; gap: 10px; transition: opacity .15s var(--ease); }
.contact-list.is-loading { opacity: .5; pointer-events: none; }
.contact-list [hidden] { display: none !important; }
.result-note { font-size: 12px; color: var(--muted); padding: 0 4px; }
.contact-row {
    display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.5fr) minmax(0, 1.1fr) auto; align-items: center; gap: 12px 20px;
    background: var(--card); border: 1px solid transparent; border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow-sm);
    transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.contact-row:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--brand-100); }
.contact-main { display: flex; align-items: center; gap: 14px; min-width: 0; color: inherit; text-decoration: none; border-radius: 12px; }
.contact-avatar { flex: none; width: 52px; height: 52px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 3px var(--brand-50); background: var(--brand-50); }
.contact-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.contact-id { display: flex; flex-direction: column; min-width: 0; gap: 3px; }
.contact-name { font-weight: 600; font-size: 15px; color: var(--brand-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-main:hover .contact-name { color: var(--accent); }
.contact-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 12px; color: var(--muted); }
.contact-meta span { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.contact-meta i { font-size: 11px; color: var(--brand); opacity: .75; }
.contact-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.contact-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--brand-50); color: var(--brand); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-soft { background: #f3f5f8; color: var(--ink-2); }
.chip i { font-size: 10px; opacity: .8; }
.contact-agent { display: flex; flex-direction: column; min-width: 0; font-size: 12px; line-height: 1.4; }
.agent-label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.agent-name { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-team { color: var(--muted); }
.status-pill { align-self: flex-start; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.status-pill.unassigned { background: #fff4e5; color: #b26a00; }
.contact-actions { display: flex; gap: 8px; justify-content: flex-end; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--brand-50); color: var(--brand); text-decoration: none; transition: background-color .15s var(--ease), color .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease); }
.icon-btn .material-icons { font-size: 20px; }
.icon-btn:hover { background: var(--brand); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 14px rgba(104, 10, 131, .28); }
.icon-btn.primary { background: linear-gradient(135deg, #1fb76a, #179e59); color: #fff; }
.icon-btn.primary:hover { box-shadow: 0 6px 14px rgba(31, 183, 106, .35); background: linear-gradient(135deg, #22c273, #179e59); }

.list-empty { margin: 5vh auto; }

/* pager */
.pager { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px; margin: 18px 0 8px; }
.pager-btn { min-width: 38px; height: 38px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--card); color: var(--ink-2); font-weight: 600; font-size: 13px; text-decoration: none; border: 1px solid var(--line); }
.pager-btn:hover { border-color: var(--brand); color: var(--brand); }
.pager-btn.active { background: linear-gradient(135deg, var(--brand), var(--brand-600)); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(104, 10, 131, .28); }
.pager-btn.disabled { opacity: .4; pointer-events: none; }
.pager-btn .material-icons { font-size: 20px; }
.pager-gap { color: var(--muted); padding: 0 4px; }

/* left profile card (settings pages) */
.settings-page .profile-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px 16px; margin-top: 14px; }
.settings-page .profile-cover-avatar img { width: 84px; height: 84px; object-fit: cover; box-shadow: 0 0 0 4px var(--brand-50), var(--shadow); }
.settings-page .profile-name { font-weight: 700; color: var(--brand-600); }
.settings-page .profile-country { font-size: 12px; color: var(--muted); font-weight: 500; }
.settings-page .info-title { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.settings-page .info-text, .settings-page .info-text a { color: var(--ink); font-size: 13px; word-break: break-word; text-decoration: none; }
.settings-page .settings-option .user-list-item { display: block; text-align: center; font-weight: 600; color: var(--brand); }

/* responsive */
@media (max-width: 1399px) {
    .contact-row { grid-template-columns: minmax(0, 1fr) auto; }
    .contact-tags { grid-column: 1; grid-row: 2; }
    .contact-agent { grid-column: 1; grid-row: 3; flex-direction: row; align-items: baseline; gap: 8px; }
    .contact-actions { grid-column: 2; grid-row: 1 / span 3; align-self: center; flex-direction: column; }
}
@media (max-width: 575px) {
    .contact-row { padding: 12px 14px; gap: 10px 12px; }
    .contact-avatar { width: 46px; height: 46px; }
    .list-toolbar { gap: 10px; }
    .list-count { width: 100%; }
    .segmented { flex: 1; }
    .segmented .seg { flex: 1; text-align: center; }
    .toolbar-add.btn { flex: none; }
}

/* active rail icon must stay visible */
.sidebar-menu .chat-menus ul li a.active .material-icons, .sidebar-menu .chat-menus ul li a.active i { color: #fff !important; }

/* ==========================================================================
   Groups & Group View
   ========================================================================== */
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.group-grid [hidden] { display: none !important; }
.group-grid .empty-state { grid-column: 1 / -1; }
.group-card {
    display: flex; flex-direction: column; gap: 16px; background: var(--card); border: 1px solid transparent; border-radius: var(--radius);
    padding: 18px; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.group-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand-100); }
.group-main { display: flex; align-items: center; gap: 14px; min-width: 0; color: inherit; text-decoration: none; border-radius: 12px; }
.group-badge {
    flex: none; width: 54px; height: 54px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 18px; letter-spacing: .02em; color: #fff; box-shadow: 0 8px 18px rgba(104, 10, 131, .22);
}
.group-badge.tone-0 { background: linear-gradient(135deg, var(--brand), var(--brand-600)); }
.group-badge.tone-1 { background: linear-gradient(135deg, var(--accent), #c9008f); box-shadow: 0 8px 18px rgba(238, 0, 171, .24); }
.group-badge.tone-2 { background: linear-gradient(135deg, var(--brand-800), #6a3fd0); box-shadow: 0 8px 18px rgba(66, 11, 161, .24); }
.group-badge.tone-3 { background: linear-gradient(135deg, var(--accent-2), #ffa977); box-shadow: 0 8px 18px rgba(253, 98, 134, .26); }
.group-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.group-name { font-weight: 600; font-size: 16px; color: var(--brand-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-main:hover .group-name { color: var(--accent); }
.group-count { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.group-count i { font-size: 11px; color: var(--brand); opacity: .75; }
.group-actions { display: flex; gap: 8px; margin-top: auto; }
.btn-ghost {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; border-radius: 12px; font-size: 13px; font-weight: 600;
    background: var(--brand-50); color: var(--brand); text-decoration: none; transition: background-color .15s var(--ease), color .15s var(--ease), transform .15s var(--ease);
}
.btn-ghost .material-icons { font-size: 18px; }
.btn-ghost:hover { background: var(--brand); color: #fff; transform: translateY(-1px); }
.btn-ghost.accent { background: #fdeaf7; color: #c9008f; }
.btn-ghost.accent:hover { background: var(--accent); color: #fff; }

/* group view */
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--brand); text-decoration: none; padding: 7px 14px 7px 8px; border-radius: 999px; background: var(--brand-50); }
.back-link .material-icons { font-size: 18px; }
.back-link:hover { background: var(--brand-100); }
.list-toolbar .back-link + .list-count { margin-left: 4px; }
.icon-btn.danger { background: #fdecef; color: #c0264c; }
.icon-btn.danger:hover { background: #e5484d; color: #fff; box-shadow: 0 6px 14px rgba(229, 72, 77, .32); }
.contact-row:not(:has(.contact-agent)) { grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.6fr) auto; }
@media (max-width: 1399px) {
    .contact-row:not(:has(.contact-agent)) { grid-template-columns: minmax(0, 1fr) auto; }
    .contact-row:not(:has(.contact-agent)) .contact-actions { grid-row: 1 / span 2; }
}
.form-hint { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }

/* ==========================================================================
   Send SMS composer + history, Text-to-Voice
   ========================================================================== */
.settings-main .alert h5 { text-align: center; }

.composer { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 20px; align-items: start; margin-top: 18px; padding-bottom: 24px; }
.composer.flash .composer-main { animation: flash-ring 1.1s var(--ease); }
@keyframes flash-ring { 0% { box-shadow: 0 0 0 0 rgba(104, 10, 131, .45); } 100% { box-shadow: 0 0 0 16px rgba(104, 10, 131, 0); } }
.composer-main, .send-summary, .phone-frame { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.composer-main { padding: 22px; display: grid; gap: 18px; }
.composer .field { display: grid; gap: 8px; margin: 0; }
.composer .field[hidden] { display: none; }
.composer label, .field-label { font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: .02em; margin: 0; }
.composer textarea.form-control { resize: vertical; min-height: 130px; line-height: 1.55; }
.segmented-full { display: flex; width: 100%; }
.segmented-full .seg { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: transparent; cursor: pointer; }
.segmented-full .seg .material-icons { font-size: 18px; }
.form-hint.bad { color: #b4234b; }
.inline-note { padding: 12px 14px; border-radius: 12px; background: var(--brand-50); color: var(--ink-2); font-size: 13px; }
.inline-note a { color: var(--brand); font-weight: 600; }
.group-preview { display: flex; flex-wrap: wrap; gap: 6px; }
.counter { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.counter .dot { opacity: .6; }
.counter b { color: var(--ink); }
.counter-note { color: var(--muted); }

.composer-side { display: grid; gap: 14px; position: sticky; top: 8px; }
.phone-frame { padding: 10px; border-radius: 28px; background: linear-gradient(180deg, #fff, var(--brand-50)); }
.phone-top { text-align: center; padding: 10px 8px 12px; }
.phone-to { display: inline-block; max-width: 100%; font-size: 12px; font-weight: 600; color: var(--brand-600); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone-screen { min-height: 190px; background: #fff; border-radius: 20px; padding: 16px 14px; border: 1px solid var(--line); }
.bubble { max-width: 88%; margin-left: auto; padding: 10px 14px; border-radius: 18px 18px 4px 18px; background: linear-gradient(135deg, var(--brand), var(--brand-600)); color: #fff; font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; box-shadow: 0 6px 16px rgba(104, 10, 131, .22); }
.bubble-empty { opacity: .75; font-style: italic; }
.phone-meta { text-align: right; font-size: 11px; color: var(--muted); margin-top: 6px; min-height: 16px; }
.send-summary { padding: 16px; display: grid; gap: 10px; }
.sum-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.sum-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.send-cta.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px; margin: 6px 0 0; }
.send-cta.btn:disabled { opacity: .45; box-shadow: none; transform: none; cursor: not-allowed; background: linear-gradient(135deg, var(--brand), var(--brand-600)); }
.send-cta .material-icons { font-size: 20px; }
.material-icons.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.send-error { margin: 0; font-size: 12px; color: #b4234b; background: #fdecef; padding: 8px 12px; border-radius: 10px; }

/* history (left column) */
.sms-history { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.history-item {
    display: flex; gap: 12px; padding: 14px; background: var(--card); border: 1px solid transparent; border-radius: var(--radius); box-shadow: var(--shadow-sm);
    cursor: pointer; transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.history-item:hover, .history-item:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--brand-100); }
.history-item[hidden], .history-empty[hidden] { display: none !important; }
.history-icon { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--brand-50); display: inline-flex; align-items: center; justify-content: center; }
.history-icon .material-icons { color: var(--brand); font-size: 20px; }
.history-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.history-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.history-top b { font-size: 14px; color: var(--brand-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-top time { flex: none; font-size: 11px; color: var(--muted); }
.history-text { font-size: 12px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5; }
.history-reuse { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--accent); opacity: 0; transform: translateY(2px); transition: opacity .15s var(--ease), transform .15s var(--ease); margin-top: 2px; }
.history-reuse .material-icons { font-size: 14px; }
.history-item:hover .history-reuse, .history-item:focus-visible .history-reuse { opacity: 1; transform: none; }
.history-empty { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 28px 16px; color: var(--muted); font-size: 12px; background: var(--card); border-radius: var(--radius); }
.history-empty .material-icons { font-size: 34px; color: var(--brand); opacity: .7; }
.history-empty b { color: var(--brand-600); font-size: 14px; }

@media (max-width: 1199px) {
    .composer { grid-template-columns: 1fr; }
    .composer-side { position: static; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}
@media (max-width: 575px) {
    .composer-main { padding: 16px; }
    .composer-side { grid-template-columns: 1fr; }
    .segmented-full .seg { padding: 8px 6px; font-size: 12px; }
    .segmented-full .seg .material-icons { display: none; }
}

/* Text to voice */
.voice-composer .composer-main { gap: 20px; }
.recipient-card { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; background: var(--brand-50); border: 1px solid var(--brand-100); }
.recipient-card[hidden], #phoneField[hidden] { display: none; }
.recipient-card img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px #fff; }
.rc-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.rc-text b { color: var(--brand-600); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-text span { font-size: 12px; color: var(--muted); }
.rc-change { border: 0; background: #fff; color: var(--brand); font-weight: 600; font-size: 12px; padding: 7px 14px; border-radius: 999px; box-shadow: var(--shadow-sm); transition: background-color .15s var(--ease), color .15s var(--ease); }
.rc-change:hover { background: var(--brand); color: #fff; }
.say-intro { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: #fdeaf7; color: #8a0068; font-size: 12px; }
.say-intro .material-icons { font-size: 20px; color: var(--accent); flex: none; }
.voice-composer { grid-template-columns: minmax(0, 1fr) 260px; }
.note-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.note-meta .chip { padding: 2px 9px; }
.chip.play-chip { background: linear-gradient(135deg, #1fb76a, #179e59); color: #fff; text-decoration: none; }
.chip.play-chip .material-icons { font-size: 14px; }
.chip.play-chip:hover { filter: brightness(1.06); }
@media (max-width: 1199px) { .voice-composer { grid-template-columns: 1fr; } }

/* ==========================================================================
   Dashboard + wallet panel
   ========================================================================== */
.dash-hero { padding: 6px 4px 0; }
.dash-hero h5 { font-size: 24px; font-weight: 700; margin: 0 0 2px; }
.dash-hero p { color: var(--muted); margin: 0; }

.quick-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 18px 0 14px; }
.qa { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--card); border: 1px solid transparent; border-radius: var(--radius); box-shadow: var(--shadow-sm); text-decoration: none; color: inherit; transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease); min-width: 0; }
.qa:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand-100); }
.qa-icon { flex: none; width: 44px; height: 44px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.qa-icon .material-icons { font-size: 22px; }
.qa-icon.tone-0 { background: linear-gradient(135deg, #1fb76a, #179e59); box-shadow: 0 8px 16px rgba(31, 183, 106, .25); }
.qa-icon.tone-1 { background: linear-gradient(135deg, var(--accent), #c9008f); box-shadow: 0 8px 16px rgba(238, 0, 171, .22); }
.qa-icon.tone-2 { background: linear-gradient(135deg, var(--brand), var(--brand-600)); box-shadow: 0 8px 16px rgba(104, 10, 131, .25); }
.qa-icon.tone-3 { background: linear-gradient(135deg, var(--accent-2), #ffa977); box-shadow: 0 8px 16px rgba(253, 98, 134, .25); }
.qa-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.qa-text b { font-size: 14px; color: var(--brand-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qa-text small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat-card { display: flex; flex-direction: column; gap: 2px; padding: 16px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--line); position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; right: -24px; top: -24px; width: 84px; height: 84px; border-radius: 50%; background: var(--brand-50); }
.stat-icon { position: relative; z-index: 1; width: 34px; height: 34px; border-radius: 10px; background: var(--brand-50); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.stat-icon .material-icons { font-size: 18px; color: var(--brand); }
.stat-num { position: relative; z-index: 1; font-size: 26px; font-weight: 700; color: var(--brand-600); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { position: relative; z-index: 1; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.stat-sub { position: relative; z-index: 1; font-size: 11px; color: var(--muted); }
.stat-sub a { color: var(--accent); font-weight: 600; text-decoration: none; }

.dash-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px 20px; margin-bottom: 14px; }
.dash-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.dash-card-head h6 { margin: 0; font-size: 14px; font-weight: 700; }
.dash-card-sub { font-size: 12px; color: var(--muted); }
.dash-link { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; color: var(--brand); text-decoration: none; }
.dash-link .material-icons { font-size: 18px; }
.dash-link:hover { color: var(--accent); }

.bars { display: flex; align-items: flex-end; gap: 14px; height: 170px; padding-top: 6px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; gap: 6px; }
.bar { display: block; width: 100%; max-width: 54px; border-radius: 10px 10px 4px 4px; background: linear-gradient(180deg, var(--accent), var(--brand)); transform-origin: bottom; animation: bar-grow .6s var(--ease) both; min-height: 6px; }
.bar-col:hover .bar { filter: brightness(1.1); }
.bar-val { font-size: 12px; font-weight: 700; color: var(--brand-600); font-variant-numeric: tabular-nums; }
.bar-label { font-size: 11px; color: var(--muted); white-space: nowrap; }
@keyframes bar-grow { from { transform: scaleY(.05); opacity: .4; } to { transform: none; opacity: 1; } }
.wallet-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 24px 12px; color: var(--muted); font-size: 13px; text-align: center; }
.wallet-empty .material-icons { font-size: 32px; color: var(--brand); opacity: .6; }

.activity-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.activity-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 12px 16px; padding: 10px; border-radius: 14px; transition: background-color .15s var(--ease); }
.activity-row:hover { background: var(--brand-50); }
.activity-main { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; }
.contact-avatar.sm { width: 42px; height: 42px; }
.activity-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.activity-text b { font-size: 14px; color: var(--brand-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-text small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-tags { display: flex; gap: 6px; }
.activity-cost { font-size: 13px; font-weight: 600; color: var(--ink-2); min-width: 56px; text-align: right; font-variant-numeric: tabular-nums; }
.activity-row .icon-btn { width: 36px; height: 36px; }

/* team list (left panel) */
.team-list { margin-top: 4px; }
.team-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid transparent; transition: transform .2s var(--ease), border-color .2s var(--ease); }
.team-item:hover { transform: translateY(-2px); border-color: var(--brand-100); }
.team-item[hidden] { display: none !important; }
.team-avatar { position: relative; flex: none; width: 42px; height: 42px; }
.team-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px var(--brand-50); }
.online-dot { position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px #fff; }
.team-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.team-text b { font-size: 14px; color: var(--brand-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-text small { font-size: 12px; color: var(--muted); }

/* wallet panel (right column) */
.wallet-panel .right-sidebar-wrap { overflow: hidden; }
.wallet-body { padding: 4px 18px 20px !important; display: grid; gap: 16px; align-content: start; }
.wallet-user { display: flex; align-items: center; gap: 12px; }
.wallet-user img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px var(--brand-50); }
.wallet-user div { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.wallet-user b { font-size: 14px; color: var(--brand-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wallet-user span { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.wallet-user .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(73, 224, 115, .25); }
.balance-card { position: relative; overflow: hidden; padding: 20px; border-radius: 20px; color: #fff; background: linear-gradient(135deg, var(--brand) 0%, var(--brand-600) 55%, #7a1aa0 100%); box-shadow: 0 16px 32px rgba(104, 10, 131, .32); }
.balance-card::before { content: ""; position: absolute; right: -40px; top: -40px; width: 150px; height: 150px; border-radius: 50%; background: radial-gradient(circle, rgba(238, 0, 171, .55), transparent 70%); }
.balance-card.state-low { background: linear-gradient(135deg, #b25a00, #e08600 60%, #f3a638); box-shadow: 0 16px 32px rgba(224, 134, 0, .3); }
.balance-card.state-empty { background: linear-gradient(135deg, #8c1c3b, #c0264c 60%, #e5484d); box-shadow: 0 16px 32px rgba(192, 38, 76, .32); }
.balance-label { position: relative; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.balance-amount { position: relative; font-size: 38px; font-weight: 700; line-height: 1.15; margin: 4px 0 14px; font-variant-numeric: tabular-nums; }
.balance-bar { position: relative; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.balance-bar span { display: block; height: 100%; border-radius: inherit; background: #fff; transition: width .6s var(--ease); }
.balance-split { position: relative; display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: 12px; }
.balance-split span { display: inline-flex; align-items: center; gap: 4px; opacity: .95; }
.balance-split i { font-size: 16px; }
.balance-split b { font-weight: 700; }
.wallet-alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; font-size: 12px; line-height: 1.5; }
.wallet-alert .material-icons { font-size: 18px; flex: none; }
.wallet-alert.low { background: #fff4e5; color: #8a5200; }
.wallet-alert.empty { background: #fdecef; color: #b4234b; }
.wallet-topup.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin: 0; height: 46px; }
.wallet-topup .material-icons { font-size: 20px; }
.wallet-section h6 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 4px 0 10px; }
.tx-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tx-item { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-radius: 12px; }
.tx-icon { flex: none; width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.tx-icon .material-icons { font-size: 18px; }
.tx-icon.credit { background: #e7f9ee; color: #14783a; }
.tx-icon.call { background: var(--brand-50); color: var(--brand); }
.tx-icon.note { background: #fdeaf7; color: #c9008f; }
.tx-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.35; }
.tx-text b { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-text small { font-size: 11px; color: var(--muted); }
.tx-amount { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx-amount.plus { color: #14783a; }
.tx-amount.minus { color: var(--ink-2); }

@media (max-width: 1399px) {
    .quick-actions, .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .activity-row { grid-template-columns: minmax(0, 1fr) auto auto; }
    .activity-tags { display: none; }
}
@media (max-width: 991px) {
    /* on phones/tablets the dashboard itself is the landing view, not the team panel */
    body.dashboard-page .left-sidebar { display: none !important; }
    body.dashboard-page .chat { display: flex !important; width: 100% !important; margin-left: 0 !important; transform: none !important; }
}
@media (max-width: 575px) {
    .quick-actions { gap: 10px; }
    .qa { padding: 12px; gap: 10px; }
    .qa-icon { width: 38px; height: 38px; border-radius: 12px; }
    .stat-num { font-size: 22px; }
    .dash-card { padding: 14px; }
    .bars { gap: 8px; }
    .activity-cost { display: none; }
    .activity-row { grid-template-columns: minmax(0, 1fr) auto; }
}

/* wallet: keep grid children inside the 320px panel */
.wallet-body { grid-template-columns: minmax(0, 1fr); }
.wallet-body > * { min-width: 0; }
.balance-split { flex-wrap: wrap; }
.balance-amount { overflow-wrap: anywhere; }
.tx-list { grid-template-columns: minmax(0, 1fr); }
.tx-item { min-width: 0; }

@media (max-width: 991px) { .settings-main .slimscroll { padding-bottom: 96px; } }

/* ==========================================================================
   Composer layout follows the width of its own column (not the screen):
   the left panel + rail + wallet can leave the middle column as narrow as ~500px even on a 1300px screen.
   ========================================================================== */
.settings-main { container-type: inline-size; container-name: main; }
@container main (max-width: 819px) {
    .composer, .voice-composer { grid-template-columns: minmax(0, 1fr); }
    .composer-side { position: static; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}
@container main (max-width: 559px) {
    .composer-side { grid-template-columns: minmax(0, 1fr); }
    .segmented-full .seg { padding: 8px 6px; font-size: 12px; }
}
@container main (max-width: 419px) {
    .segmented-full .seg .material-icons { display: none; }
}

/* Phones/tablets: on the message pages the composer IS the page, so it comes first and the history list follows below
   (the app's default is to show only the left list until something is tapped). */
@media (max-width: 991px) {
    body.compose-page .main_content { flex-direction: column; }
    body.compose-page .chat { display: flex !important; margin-left: 0 !important; order: 1; width: 100% !important; height: auto !important; }
    body.compose-page .left-sidebar { display: flex !important; margin-left: 0 !important; order: 2; width: 100% !important; height: auto !important; }
    body.compose-page .left-sidebar .slimscroll { height: auto !important; overflow: visible !important; }
    body.compose-page .chat .slimscroll { height: auto !important; overflow: visible !important; }
}
@media (max-width: 991px) {
    body.compose-page .slimScrollDiv { height: auto !important; overflow: visible !important; }
    body.compose-page .slimScrollBar, body.compose-page .slimScrollRail { display: none !important; }
    body.compose-page .main-wrapper, body.compose-page .main-wrapper .content.main_content { height: auto !important; min-height: 100vh; }
    body.compose-page .main-wrapper { padding-bottom: 96px; }   /* room above the bottom nav bar */
}

/* ---- account security, sign-in step two, POST logout/switch buttons ---- */
.logout-form, .dropdown-logout { margin: 0; display: inline; }
.dropdown-logout .dropdown-item { width: 100%; background: none; border: 0; text-align: left; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.segmented button.seg { border: 0; background: transparent; cursor: pointer; font-family: inherit; }
.link-button { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: underline; }
.link-button:hover { color: var(--brand-600); }
.code-input { letter-spacing: .28em; font-size: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.form-hint { display: block; margin-top: 6px; color: var(--ink-2); }
.sec-status { text-align: center; margin-top: 6px; }
.chip.chip-soft { background: var(--card); color: var(--ink-2); border: 1px solid var(--line); }
.sec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; align-items: start; }
.sec-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); padding: 20px; margin-bottom: 16px; }
.sec-grid .sec-card { margin-bottom: 0; }
.sec-card h6 { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 6px; }
.sec-card h6 i { color: var(--brand); }
.sec-help { color: var(--ink-2); font-size: 13px; line-height: 1.5; margin-bottom: 12px; }
.secret-box { background: var(--brand-50); border: 1px dashed var(--brand); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; word-break: break-all; }
.secret-box code { font-size: 16px; letter-spacing: .08em; color: var(--brand); }
.recovery-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.recovery-list code { display: block; text-align: center; padding: 8px; border-radius: 10px; background: var(--brand-50); color: var(--brand); font-size: 15px; }
.btn-ghost-sm, .btn-danger-sm { border-radius: 999px; padding: 8px 16px; font-weight: 600; font-size: 13px; border: 1px solid var(--line); background: var(--card); color: var(--brand); }
.btn-danger-sm { color: #c0262d; border-color: #f0c4c6; }
.event-list { list-style: none; padding: 0; margin: 0; }
.event-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.event-row:first-child { border-top: 0; }
.event-dot { width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: var(--brand); flex: none; }
.event-row.bad .event-dot { background: #c0262d; }
.event-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.event-text small, .event-meta small { color: var(--ink-2); font-size: 12px; }
.event-meta { display: flex; flex-direction: column; text-align: right; font-size: 12px; }
@media (max-width: 575px) { .event-row { flex-wrap: wrap; } .event-meta { text-align: left; margin-left: 21px; } }

/* ---- app dialog: result messages and the recording player (assets/js/modern.js: AppDialog) ---- */
.ad-backdrop { position: fixed; inset: 0; z-index: 2000; background: rgba(36, 14, 48, .45); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; transition: opacity .18s var(--ease); }
.ad-backdrop.open { opacity: 1; }
.ad-box { position: relative; width: 100%; max-width: 380px; background: linear-gradient(180deg, #f6eefa 0%, #fff 55%); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 30px 24px 22px; text-align: center; transform: translateY(12px) scale(.98); transition: transform .22s var(--ease); }
.ad-backdrop.open .ad-box { transform: none; }
.ad-close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: #6b6b7b; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.ad-close:hover { background: rgba(104, 10, 131, .08); }
.ad-icon { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--brand-50); color: var(--brand); box-shadow: 0 0 0 8px rgba(104, 10, 131, .06); }
.ad-icon .material-icons { font-size: 36px; }
.ad-box[data-tone="success"] .ad-icon { background: #e7f9ee; color: #14783a; box-shadow: 0 0 0 8px rgba(31, 183, 106, .10); }
.ad-box[data-tone="error"] .ad-icon { background: #fdecec; color: #c0262d; box-shadow: 0 0 0 8px rgba(229, 72, 77, .10); }
.ad-box[data-tone="info"] .ad-icon { background: #fff4e0; color: #b26a00; box-shadow: 0 0 0 8px rgba(245, 166, 35, .12); }
.ad-title { margin: 0; font-size: 19px; font-weight: 600; color: var(--brand-600); }
.ad-text { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); line-height: 1.5; word-break: break-word; }
.ad-audio { width: 100%; margin-top: 18px; }
.ad-note { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.ad-note.err { color: #c0262d; }
.ad-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.ad-btn { min-width: 120px; border: 0; border-radius: 999px; padding: 10px 22px; font-weight: 600; font-size: 14px; cursor: pointer; background: linear-gradient(135deg, var(--brand), var(--brand-800)); color: #fff; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.ad-btn:hover { filter: brightness(1.08); color: #fff; }
.ad-btn.ghost { background: var(--card); color: var(--brand); border: 1px solid var(--line); }
.ad-btn.ghost:hover { background: var(--brand-50); color: var(--brand); }
.ad-btn .material-icons { font-size: 18px; }
body.ad-lock { overflow: hidden; }
button.chip.play-chip { border: 0; cursor: pointer; font-family: inherit; }
/* Texts page on phones: the recent calls list sits below the composer, so a button at the top jumps to it */
.recent-jump { display: none; flex: none; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--brand-50); color: var(--brand); font-size: 12px; font-weight: 600; text-decoration: none; border: 1px solid var(--brand-100); }
.recent-jump .material-icons { font-size: 16px; }
.recent-jump b { background: var(--brand); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 11px; line-height: 18px; }
.recent-jump:hover { background: var(--brand-100); color: var(--brand); }
@media (max-width: 991px) { .recent-jump { display: inline-flex; } #chats { scroll-margin-top: 12px; } }

/* ---- Navigation rail: every item stays on screen, on short laptop screens and on phones ---- */
@media (min-width: 992px) {
    .sidebar-menu { height: 100vh; height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 16px 0 14px; }
    .sidebar-menu .logo-col { flex: none; padding-bottom: 0; }
    .sidebar-menu .menus-col { flex: 1 1 auto; min-height: 0; height: auto; width: 100%; flex-wrap: nowrap; flex-direction: column; align-items: center; justify-content: space-between; }
    .sidebar-menu .chat-menus { margin-top: clamp(10px, 5vh, 50px); }
    .sidebar-menu .chat-menus ul li + li, .sidebar-menu .bottom-menus ul li + li { margin-top: clamp(2px, calc((100vh - 600px) / 8), 30px); }
    .sidebar-menu .bottom-menus { flex: none; align-self: center; padding-top: 8px; }
}
@media (min-width: 992px) and (max-height: 640px) {
    .sidebar-menu .chat-menus ul li a, .sidebar-menu .bottom-menus ul li a { width: 40px; height: 40px; border-radius: 12px; }
}
@media (min-width: 992px) and (max-height: 540px) {
    .sidebar-menu .chat-menus ul li a, .sidebar-menu .bottom-menus ul li a { width: 34px; height: 34px; border-radius: 10px; }
    .sidebar-menu .chat-menus ul li a span.material-icons, .sidebar-menu .bottom-menus ul li a span.material-icons { font-size: 20px; }
    .sidebar-menu .bottom-menus .chat-profile-icon, .sidebar-menu .bottom-menus .chat-profile-icon img { width: 32px; height: 32px; }
}
@media (max-width: 991px) {
    .sidebar-menu { height: auto; min-height: 58px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); }
    .sidebar-menu .menus-col { flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 4px; }
    .sidebar-menu .chat-menus { flex: 1 1 auto; min-width: 0; }
    .sidebar-menu .chat-menus ul { display: flex; justify-content: space-around; }
    .sidebar-menu .chat-menus ul li + li, .sidebar-menu .bottom-menus ul li + li { margin-left: 0; }
    .sidebar-menu .chat-menus ul li a { width: 40px; height: 40px; }
    .sidebar-menu .bottom-menus { flex: none; width: auto; }
    .sidebar-menu .bottom-menus .chat-profile-icon { width: 40px; height: 40px; }
    .sidebar-menu .bottom-menus .chat-profile-icon img { width: 34px; height: 34px; object-fit: cover; }
}
@media (max-width: 359px) { .sidebar-menu .chat-menus ul li a { width: 34px; height: 34px; } }
/* profile menu (rail avatar): wide enough for its labels, icon on the right */
.bottom-menus .dropdown-menu { min-width: 220px; padding: 6px; border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.bottom-menus .dropdown-menu .dropdown-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 10px; font-size: 14px; white-space: nowrap; color: var(--ink); }
.bottom-menus .dropdown-menu .dropdown-item:hover { background: var(--brand-50); color: var(--brand); }
.bottom-menus .dropdown-menu .dropdown-item .material-icons, .bottom-menus .dropdown-menu .dropdown-item i { font-size: 18px; color: var(--brand); margin: 0; position: static; }
.bottom-menus .dropdown-menu .dropdown-logout { display: block; }
.bottom-menus .dropdown-menu .dropdown-item { width: 100%; }
.tx-icon.sms { background: #e8f1fe; color: #1d5fc4; }

/* ---- send later + "Scheduled & sending" panel (Send SMS, Text to voice) ---- */
.when-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.when-row .segmented { flex: none; }
.when-row input[type="datetime-local"] { flex: 1 1 220px; min-width: 0; max-width: 320px; }
.when-row input[hidden] { display: none; }
.jobs-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px; margin-top: 18px; }
.jobs-card[hidden] { display: none; }
.jobs-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.jobs-head h6 { margin: 0; display: flex; align-items: center; gap: 8px; font-weight: 700; }
.jobs-head h6 .material-icons { color: var(--brand); font-size: 20px; }
.jobs-head .chip .material-icons { font-size: 14px; }
.jobs-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.job { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--bg); }
.job-icon { flex: none; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--brand-50); color: var(--brand); }
.job-icon .material-icons { font-size: 18px; }
.job-done .job-icon { background: #e7f9ee; color: #14783a; }
.job-failed .job-icon { background: #fdecec; color: #c0262d; }
.job-cancelled .job-icon { background: #f1f1f4; color: #8a8a99; }
.job-running .job-icon { background: #fff4e0; color: #b26a00; }
.job-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.job-body b { font-size: 13px; color: var(--brand-600); }
.job-text { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-status { font-size: 12px; font-weight: 600; color: var(--ink); }
.job-failed .job-status { color: #c0262d; }
.job-bar { display: block; height: 6px; border-radius: 6px; background: var(--brand-100); overflow: hidden; margin-top: 4px; }
.job-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: 6px; transition: width .4s var(--ease); }
.job-cancel { flex: none; border: 1px solid #f0c4c6; background: var(--card); color: #c0262d; border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer; }
.job-cancel:hover { background: #fdecec; }
.job-cancel:disabled { opacity: .5; cursor: default; }
.sum-row.sum-when b { color: var(--brand); }
.chip.chip-cost { background: #e8f1fe; color: #1d5fc4; }
.chip.chip-bad { background: #fdecec; color: #c0262d; }

/* ---- AppDialog form (top-up request) ---- */
.ad-box.ad-wide { max-width: 440px; max-height: calc(100dvh - 32px); overflow-y: auto; }
.ad-form { text-align: left; margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.ad-field { display: flex; flex-direction: column; gap: 5px; margin: 0; }
.ad-field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.ad-field input, .ad-field select, .ad-field textarea { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 15px; background: #fff; color: var(--ink); }
.ad-field input:focus, .ad-field select:focus, .ad-field textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.ad-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.ad-chip { border: 1px solid var(--line); background: var(--card); color: var(--brand); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.ad-chip:hover, .ad-chip.on { background: var(--brand-50); border-color: var(--brand-100); }
.ad-btn:disabled { opacity: .6; cursor: wait; }

/* ---- Wallet: pending top-up requests ---- */
.topup-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.topup-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px dashed var(--brand-100); border-radius: var(--radius-sm); background: var(--brand-50); }
.topup-item .material-icons { color: var(--brand); }
.topup-item .tu-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topup-item .tu-text b { font-size: 14px; color: var(--ink); }
.topup-item .tu-text small { color: var(--muted); font-size: 12px; }
.topup-item .tu-cancel { border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.topup-item .tu-cancel:hover { color: #c0262d; background: #fdecec; }

/* ---- History page ---- */
.history-page .settings-main { flex: 1; }
.hist-export { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--brand); border-radius: 999px; padding: 8px 16px; font-weight: 600; font-size: 14px; }
.hist-export:hover { background: var(--brand-50); color: var(--brand); }
.hist-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 4px 0 18px; }
.hist-stat { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-sm); min-width: 0; }
.hist-stat > .material-icons { width: 40px; height: 40px; flex: none; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--brand-50); color: var(--brand); font-size: 22px; }
.hist-stat div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hist-stat b { font-size: 20px; color: var(--ink); line-height: 1.2; }
.hist-stat small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-stat em { font-style: normal; font-weight: 600; color: var(--ink-2); font-size: 13px; }
.hist-stat.total { background: linear-gradient(135deg, var(--brand), var(--brand-800)); border: 0; }
.hist-stat.total > .material-icons { background: rgba(255,255,255,.16); color: #fff; }
.hist-stat.total b, .hist-stat.total small { color: #fff; }
.hist-filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.hist-filters .segmented { align-self: flex-start; max-width: 100%; overflow-x: auto; }
.hist-filters .seg { text-decoration: none; white-space: nowrap; }
.hist-filter-row { display: flex; gap: 10px; flex-wrap: wrap; }
.hist-filter-row select { width: auto; min-width: 150px; }
.hist-search { position: relative; flex: 1; min-width: 200px; }
.hist-search .material-icons { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 20px; pointer-events: none; }
.hist-search input { padding-left: 40px; }
.hist-count { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.hist-list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.hist-item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.hist-item:last-child { border-bottom: 0; }
.hist-item > .tx-icon { flex: none; }
.hist-main { flex: 1; min-width: 0; }
.hist-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.hist-top b { color: var(--ink); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-cost { font-weight: 600; color: var(--ink-2); font-size: 14px; flex: none; }
.hist-body { margin: 3px 0 0; color: var(--ink-2); font-size: 14px; line-height: 1.45; white-space: pre-line; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hist-body.hist-sub { color: var(--muted); font-size: 13px; }
.hist-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.hist-meta time { color: var(--muted); font-size: 12px; margin-right: 4px; }
.hist-meta .chip { font-size: 11px; padding: 3px 9px; text-decoration: none; }
.hist-meta .chip .material-icons { font-size: 14px; }
.chip.chip-ok { background: #e7f9ee; color: #14783a; }
.chip.chip-warn { background: #fff4e0; color: #9a5b00; }
.chip.chip-muted { background: #f3f5f8; color: var(--muted); }
.chip.chip-bad { background: #fdecec; color: #c0262d; }
.play-chip { border: 0; cursor: pointer; }
.hist-again:hover { background: var(--brand-50); color: var(--brand); }
.hist-details { margin-top: 8px; font-size: 13px; }
.hist-details summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.hist-details ul { list-style: none; padding: 8px 0 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.hist-details li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hist-details li small { color: var(--muted); flex-basis: 100%; }
.hist-empty { margin-top: 10px; }
.hist-pager { display: flex; justify-content: space-between; align-items: center; margin: 14px 0 30px; color: var(--muted); font-size: 13px; }
.hist-pager .btn { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: var(--card); color: var(--brand); border-radius: 999px; padding: 6px 14px; font-weight: 600; }
.wallet-all { float: right; font-size: 12px; font-weight: 600; color: var(--brand); text-transform: none; letter-spacing: 0; }
@media (max-width: 991.98px) { .hist-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) {
    .hist-stats { gap: 8px; }
    .hist-stat { padding: 10px; }
    .hist-stat > .material-icons { width: 34px; height: 34px; font-size: 19px; }
    .hist-stat b { font-size: 17px; }
    .hist-item { padding: 12px; }
    .hist-filter-row select { flex: 1; }
}
