:root { color-scheme: light dark; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: light-dark(#1c2c35, #edf5f8); background: light-dark(#f1f6f8, #0f1a22); }
* { box-sizing: border-box; }
body { min-width: 320px; margin: 0; }
button, input { font: inherit; }
.shell { max-width: 1320px; min-height: 100vh; margin: 0 auto; background: light-dark(#fff, #152531); }
.topbar { display: flex; align-items: center; gap: 11px; min-height: 62px; padding: 10px 18px; color: #fff; background: #2aabdf; }
.menu-toggle { width: 32px; height: 32px; border: 1px solid rgba(255,255,255,.45); border-radius: 8px; color: #fff; background: rgba(0,0,0,.12); cursor: pointer; font-size: 19px; line-height: 1; }
.app-nav { position: absolute; z-index: 20; display: grid; width: 210px; gap: 5px; margin: 0 0 0 14px; padding: 9px; border: 1px solid light-dark(#d5e2e9, #3d515e); border-radius: 10px; background: light-dark(#fff, #1b2d39); box-shadow: 0 12px 28px rgba(0,0,0,.22); }
.app-nav button { padding: 10px 11px; border: 0; border-radius: 7px; color: inherit; background: transparent; text-align: left; cursor: pointer; font-size: 12px; }
.app-nav button:hover, .app-nav button.active { color: #176e95; background: light-dark(#e6f5fa, #294653); font-weight: 750; }
.view-panel[hidden], .app-nav[hidden] { display: none !important; }
.brand { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; color: #2aabdf; background: #fff; font-weight: 800; }
.topbar strong { display: block; font-size: 15px; }
.topbar small { display: block; margin-top: 2px; opacity: .9; font-size: 11px; }
.online { margin-left: auto; font-size: 11px; }
.dashboard-summary { padding: 14px 18px 16px; border-bottom: 1px solid light-dark(#d9e5eb, #334855); background: light-dark(#fff, #152531); }
.summary-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.summary-head span { color: #2aabdf; font-size: 9px; font-weight: 850; letter-spacing: .45px; }
.summary-head h1 { margin: 3px 0 0; font-size: 17px; }
.summary-head small { color: light-dark(#718791, #a7bac5); font-size: 10px; }
.report-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.report-card { padding: 10px 11px; border: 1px solid light-dark(#d5e2e9, #3d515e); border-radius: 9px; background: light-dark(#f8fbfd, #1c303c); }
.report-card strong { display: block; color: #2aabdf; font-size: 12px; }
.report-card .report-total { display: block; margin-top: 4px; font-size: 15px; font-weight: 800; }
.report-card small { display: block; margin-top: 4px; color: light-dark(#708691, #abc0ca); font-size: 9px; }
.ledger-sales { display: grid; gap: 6px; margin-top: 10px; }
.sale-row { padding: 8px 9px; border: 1px solid light-dark(#d5e2e9, #3d515e); border-radius: 7px; background: light-dark(#fff, #20333f); font-size: 10px; }
.sale-row strong { display: block; font-size: 11px; }
.sale-row span { display: block; margin-top: 3px; color: light-dark(#718791, #abc0ca); }
.history-panel { padding: 16px 18px 24px; border-top: 1px solid light-dark(#d9e5eb, #334855); background: light-dark(#fff, #152531); }
.history-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.history-head span { color: #2aabdf; font-size: 9px; font-weight: 850; letter-spacing: .45px; }
.history-head h2 { margin: 3px 0 0; font-size: 15px; }
.history-head small { color: light-dark(#718791, #a7bac5); font-size: 10px; }
.table-wrap { overflow-x: auto; border: 1px solid light-dark(#d5e2e9, #3d515e); border-radius: 9px; }
table { width: 100%; min-width: 690px; border-collapse: collapse; font-size: 11px; }
th, td { padding: 9px 10px; border-bottom: 1px solid light-dark(#e2ebef, #2b3e4a); text-align: left; white-space: nowrap; }
th { color: light-dark(#617985, #abc0ca); background: light-dark(#f8fbfd, #1b2a35); font-size: 9px; letter-spacing: .25px; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
.entry-opening_balance td:first-child, .entry-opening_payment td:first-child { color: #d47b23; }
.entry-sale td:first-child { color: #26764a; }
.entry-payment td:first-child { color: #2aabdf; }
.amount-positive { color: #26764a; font-weight: 750; }
.amount-negative { color: #2aabdf; font-weight: 750; }
.view-panel[data-view-panel="chat"] { min-height: calc(100vh - 62px); }
.layout { display: grid; grid-template-columns: 270px minmax(360px, 1fr) 230px; height: calc(100vh - 62px); min-height: 0; }
.inbox, .ledger { background: light-dark(#f8fbfd, #1b2a35); }
.inbox { display: flex; min-height: 0; flex-direction: column; overflow: hidden; border-right: 1px solid light-dark(#d9e5eb, #334855); }
.ledger { padding: 16px 13px; border-left: 1px solid light-dark(#d9e5eb, #334855); }
.section-title { padding: 15px 13px 9px; color: light-dark(#617985, #abc0ca); font-size: 10px; font-weight: 800; letter-spacing: .45px; }
.section-title span { float: right; color: #2aabdf; }
.conversation-list { display: grid; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.conversation-row { display: flex; gap: 9px; width: 100%; padding: 11px 12px; border: 0; border-bottom: 1px solid light-dark(#e2ebef, #2b3e4a); color: inherit; background: transparent; text-align: left; cursor: pointer; }
.conversation-row:hover, .conversation-row.active { background: light-dark(#e6f5fa, #223a49); }
.avatar { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border-radius: 50%; color: #fff; background: #2aabdf; font-size: 10px; font-weight: 800; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar.large { width: 42px; height: 42px; flex-basis: 42px; font-size: 11px; }
.row-copy { min-width: 0; flex: 1; }
.row-name { display: block; overflow: hidden; font-size: 12px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.channel-badge { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; vertical-align: 1px; font-weight: 700; line-height: 1; }
.channel-logo { display: inline-grid; width: 14px; height: 14px; place-items: center; border-radius: 50%; color: #fff; font-size: 9px; font-weight: 850; }
.channel-badge small { display: none; }
.channel-telegram .channel-logo { background: #2aabdf; }
.channel-telegram small { color: #2aabdf; }
.channel-facebook .channel-logo { border-radius: 4px; background: #1877f2; font-family: Arial, sans-serif; font-size: 11px; }
.channel-facebook small { color: #1877f2; }
.channel-tiktok .channel-logo { background: #111; }
.channel-tiktok small { color: #555; }
.row-preview { display: block; overflow: hidden; margin-top: 3px; color: light-dark(#6a818c, #a9bdc7); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.row-count { align-self: flex-start; color: #2aabdf; font-size: 10px; font-weight: 800; }
.chat { display: flex; min-width: 0; min-height: 0; flex-direction: column; background: light-dark(#eaf3f8, #14232e); }
.chat-head { display: flex; align-items: center; min-height: 58px; padding: 9px 16px; border-bottom: 1px solid light-dark(#d9e5eb, #334855); background: light-dark(#fff, #1d2e3a); }
.chat-head span:first-child { display: block; color: #2aabdf; font-size: 9px; font-weight: 850; letter-spacing: .35px; }
.chat-head strong { display: block; margin-top: 3px; font-size: 14px; }
.chat-head span:last-child { margin-left: auto; color: #4e9c6c; font-size: 10px; font-weight: 750; }
.messages { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 9px; overflow: auto; padding: 15px; }
.bubble { max-width: 78%; padding: 9px 10px 6px; border-radius: 10px; color: light-dark(#1c303a, #edf4f7); background: light-dark(#fff, #263b48); font-size: 12px; line-height: 1.4; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.bubble.inbound { align-self: flex-start; border-top-left-radius: 3px; }
.bubble.outbound { align-self: flex-end; border-top-right-radius: 3px; background: light-dark(#d8f5c7, #285339); }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.message-reply-preview { display: grid; gap: 1px; margin: 0 0 6px; padding: 5px 8px; border-left: 3px solid #3390ec; border-radius: 4px; background: rgba(51,144,236,.08); overflow: hidden; }
.message-reply-preview small { color: #3390ec; font-size: 10px; font-weight: 700; }
.message-reply-preview span { max-width: 100%; color: light-dark(#50636d, #c4d1d8); font-size: 11px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.message-text.muted, .media-missing { color: light-dark(#7b909c, #aabdc7); font-size: 10px; }
.message-media { display: block; max-width: 260px; margin-top: 5px; }
.message-media img { display: block; max-width: 100%; max-height: 280px; border-radius: 8px; object-fit: contain; background: rgba(0,0,0,.08); }
.message-media-video { display: block; width: min(300px, 100%); max-height: 300px; margin-top: 5px; border-radius: 8px; }
.message-media-audio { display: block; width: min(280px, 100%); margin-top: 5px; }
.message-media-file { display: block; margin-top: 5px; color: #2aabdf; font-size: 11px; overflow-wrap: anywhere; }
.time { display: block; margin-top: 3px; color: light-dark(#7b909c, #adbfca); font-size: 9px; text-align: right; }
.composer { position: relative; display: flex; gap: 7px; padding: 10px; background: light-dark(#fff, #1d2e3a); }
.composer input { min-width: 0; flex: 1; padding: 9px 12px; border: 1px solid light-dark(#cddbe3, #3d515e); border-radius: 20px; outline: 0; color: inherit; background: light-dark(#f8fbfc, #253845); font-size: 12px; }
.composer button, .ledger button { border: 0; border-radius: 8px; cursor: pointer; font-size: 11px; font-weight: 800; }
.composer button { min-width: 57px; color: #fff; background: #2aabdf; }
.attach-button { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border: 1px solid light-dark(#cddbe3, #3d515e); border-radius: 50%; color: light-dark(#617985, #c5d6dd); background: light-dark(#f8fbfc, #253845); cursor: pointer; }
.attach-button { position: relative; }
.attach-button input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; }
.attachment-preview { position: absolute; right: 74px; bottom: 54px; left: 10px; display: flex; flex-wrap: wrap; gap: 5px; }
.attachment-preview span, .attachment-preview button { padding: 4px 7px; border: 1px solid light-dark(#cddbe3, #3d515e); border-radius: 6px; color: light-dark(#526d79, #d0e0e6); background: light-dark(#fff, #243944); font-size: 10px; }
.attachment-preview button { cursor: pointer; }
.quick-replies { position: absolute; right: 72px; bottom: 54px; left: 50px; z-index: 4; max-height: 220px; overflow: auto; padding: 5px; border: 1px solid light-dark(#cddbe3, #3d515e); border-radius: 9px; background: light-dark(#fff, #1d303c); box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.quick-replies button { display: flex; width: 100%; min-height: 34px; align-items: center; gap: 9px; padding: 6px 8px; border: 0; border-radius: 6px; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.quick-replies button:hover { background: light-dark(#e6f5fa, #294653); }
.quick-replies b { min-width: 58px; color: #2aabdf; font-size: 11px; }
.quick-replies span { color: light-dark(#617985, #c2d3da); font-size: 10px; }
.ledger h2 { margin: 2px 0 13px; font-size: 13px; }
.ledger-box { padding: 11px; border: 1px solid light-dark(#d5e2e9, #3d515e); border-radius: 9px; background: light-dark(#fff, #20333f); }
.ledger-box small { display: block; color: light-dark(#758b96, #abc0ca); font-size: 10px; }
.ledger-box strong { display: block; margin: 6px 0 12px; font-size: 14px; }
.customer-profile { display: flex; align-items: center; gap: 9px; }
.customer-profile strong { margin: 3px 0 0; }
.customer-profile span { display: block; margin-top: 2px; color: light-dark(#718791, #abc0ca); font-size: 9px; }
.profile-meta { display: flex; justify-content: space-between; margin: 4px 0 11px; color: light-dark(#718791, #abc0ca); font-size: 9px; }
.profile-meta b { color: #2aabdf; }
.ledger-box div { display: flex; justify-content: space-between; margin: 7px 0; color: light-dark(#657d88, #adc0ca); font-size: 10px; }
.ledger-box b { color: light-dark(#263944, #edf5f8); }
.ledger-box b.due { color: #d47b23; }
.ledger button { width: 100%; min-height: 35px; margin-top: 9px; color: #fff; background: #26764a; }
.ledger button.secondary { color: #196d46; background: light-dark(#dcf3e6, #204a36); }
.hint { color: light-dark(#718791, #a7bac5); font-size: 10px; line-height: 1.4; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.dialog-head span { color: #2aabdf; font-size: 9px; font-weight: 850; letter-spacing: .45px; }
.dialog-head h2 { margin: 3px 0 0; font-size: 17px; }
dialog { width: min(720px, calc(100vw - 28px)); padding: 18px; border: 1px solid light-dark(#d5e2e9, #3d515e); border-radius: 13px; color: inherit; background: light-dark(#fff, #152531); box-shadow: 0 18px 50px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(9, 24, 34, .58); }
dialog label { display: grid; gap: 5px; margin: 9px 0; color: light-dark(#617985, #abc0ca); font-size: 10px; font-weight: 700; }
dialog input, dialog select, dialog textarea { width: 100%; padding: 9px 10px; border: 1px solid light-dark(#cddbe3, #3d515e); border-radius: 7px; outline: 0; color: inherit; background: light-dark(#f8fbfc, #253845); font: inherit; font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 14px; }
.dialog-actions button, .dialog-close { min-height: 34px; padding: 0 13px; border: 0; border-radius: 7px; cursor: pointer; font-size: 11px; font-weight: 800; }
.dialog-actions .primary { color: #fff; background: #26764a; }
.dialog-actions .secondary { color: #196d46; background: light-dark(#dcf3e6, #204a36); }
.dialog-close { width: 30px; color: light-dark(#617985, #abc0ca); background: transparent; font-size: 20px; line-height: 1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } dialog { padding: 14px; } }
.empty { padding: 26px 14px; color: light-dark(#768c97, #a9bdc7); font-size: 11px; text-align: center; }
@media (max-width: 850px) { .layout { grid-template-columns: 220px minmax(0, 1fr); } .ledger { grid-column: 1 / -1; border-top: 1px solid light-dark(#d9e5eb, #334855); border-left: 0; } }
@media (max-width: 700px) { .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .layout { height: auto; grid-template-columns: 1fr; } .inbox { max-height: 42vh; min-height: 0; border: 0; } .conversation-list { max-height: calc(42vh - 45px); } .chat { min-height: 70vh; } .topbar { min-height: 58px; } .online { display: none; } .app-nav { width: 180px; } }

/* Telegram-inspired inbox: full-height chat and an on-demand customer sidebar. */
:root { color-scheme: light; --surface: #fff; --ink: #17212b; --muted: #707e89; --line: #e8edf0; --accent: #3390ec; --hover: #f1f5f8; color: var(--ink); background: var(--surface); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .attach-button:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.shell { max-width: none; height: 100dvh; min-height: 0; overflow: hidden; }
.topbar { height: 60px; min-height: 60px; padding: 8px 20px; background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--line); }
.topbar small { color: var(--muted); font-size: 12px; }
.brand { background: linear-gradient(145deg, #60b5ff, #2585df); color: white; width: 36px; height: 36px; }
.menu-toggle, .icon-button { display: inline-grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border: 0; border-radius: 50%; color: var(--muted); background: transparent; cursor: pointer; font-size: 25px; }
.menu-toggle:hover, .icon-button:hover { background: var(--hover); }
.online { color: var(--muted); background: var(--hover); padding: 7px 12px; border-radius: 20px; }
.app-nav { margin: 8px 0 0 12px; padding: 8px; border-color: var(--line); background: var(--surface); }
.app-nav button { font-size: 14px; padding: 13px; }
.view-panel[data-view-panel="chat"] { min-height: 0; }
#dashboard-view { height: calc(100dvh - 60px); overflow: auto; }
.layout { position: relative; height: calc(100dvh - 60px); grid-template-columns: 340px minmax(0, 1fr); }
.layout.info-open { grid-template-columns: 340px minmax(0, 1fr) 300px; }
.inbox { background: var(--surface); border-color: var(--line); }
.inbox-heading { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 12px; }
.inbox-heading h1 { margin: 0; font-size: 22px; letter-spacing: -.5px; }
.inbox-heading > span { font-size: 12px; color: var(--muted); }
.chat-search { display: flex; align-items: center; gap: 10px; margin: 0 16px 12px; padding: 0 14px; border-radius: 24px; background: var(--hover); color: var(--muted); }
.chat-search > span { font-size: 28px; }
.chat-search input { width: 100%; min-width: 0; height: 44px; border: 0; background: transparent; color: var(--ink); font-size: 13px; outline-offset: 0; }
.chat-filters { display: flex; gap: 0; padding: 0 6px; border-bottom: 1px solid var(--line); }
.chat-filters button { position: relative; min-height: 44px; padding: 0 0 12px; border: 0; background: none; color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; }
.chat-filters button.active { color: var(--accent); }
.chat-filters button.active::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
#unread-count { padding: 2px 6px; margin-left: 4px; border-radius: 10px; background: var(--hover); font-size: 11px; }
.conversation-list { display: block; flex: 1; padding: 7px; max-height: none; }
.conversation-row { align-items: center; gap: 12px; padding: 12px 10px; min-height: 78px; border: 0; border-radius: 10px; }
.conversation-row:hover { background: var(--hover); }
.conversation-row.active { color: white; background: var(--accent); }
.avatar { width: 50px; height: 50px; flex-basis: 50px; background: linear-gradient(145deg, #79c4ed, #4399d5); font-size: 17px; font-weight: 600; }
.conversation-row:nth-child(3n+2) .avatar { background: linear-gradient(145deg, #bba1ee, #8a6bce); }
.conversation-row:nth-child(3n+3) .avatar { background: linear-gradient(145deg, #f3b98b, #d78661); }
.row-name { font-size: 14px; font-weight: 650; }
.row-preview { margin-top: 6px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.row-meta { display: flex; align-self: stretch; align-items: end; flex-direction: column; justify-content: space-between; gap: 6px; padding: 3px 0; }
.row-time { color: var(--muted); font-size: 10px; white-space: nowrap; }
.row-count { align-self: auto; display: grid; min-width: 21px; height: 21px; padding: 0 5px; place-items: center; border-radius: 12px; color: white; background: var(--accent); font-size: 11px; }
.conversation-row.active .row-preview, .conversation-row.active .row-time { color: #e8f4ff; }
.conversation-row.active .row-count { background: white; color: var(--accent); }
.chat { position: relative; background-color: #dce6d4; background-image: radial-gradient(ellipse at 25% 80%, #cbdcc780, transparent 60%), radial-gradient(ellipse at 90% 20%, #eee7c980, transparent 65%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill='none' stroke='%23759479' stroke-opacity='.10' stroke-width='1.3'%3E%3Cpath d='m16 13 15 6-15 6 4-6Zm50 47 5-8 5 8 9 2-7 6 1 9-8-5-8 5 1-9-7-6Z'/%3E%3Ccircle cx='75' cy='20' r='7'/%3E%3Cpath d='M14 71q8-12 16 0t16 0M40 39l5 5-5 5-5-5Z'/%3E%3C/g%3E%3C/svg%3E"); }
.chat-head { flex-shrink: 0; min-height: 72px; gap: 12px; padding: 10px 24px; border-color: var(--line); background: var(--surface); }
.chat-head .avatar { width: 44px; height: 44px; flex-basis: 44px; font-size: 14px; }
.chat-heading { display: flex; flex-direction: column-reverse; gap: 4px; min-width: 0; }
.chat-head .chat-heading strong { margin: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .chat-heading span { color: var(--muted); font-size: 11px; font-weight: 400; letter-spacing: .4px; }
#assigned { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.messages { gap: 7px; padding: 22px max(24px, calc((100% - 780px) / 2)); overscroll-behavior: contain; }
.messages-date-badge { position: absolute; top: 78px; left: 50%; z-index: 3; transform: translateX(-50%); padding: 4px 11px; border-radius: 12px; color: #fff; background: #6b846bbd; box-shadow: 0 1px 3px #17212b22; font-size: 10px; line-height: 1.2; pointer-events: none; }
.messages-date-badge[hidden] { display: none; }
.bubble { max-width: min(82%, 520px); padding: 10px 12px 7px; font-size: 14px; line-height: 1.7; border-radius: 14px; background: #fff; color: #17212b; }
.message-reactions { position: relative; display: flex; min-height: 0; align-items: center; flex-wrap: wrap; gap: 3px; margin: 0; line-height: 1; }
.message-reactions.empty-reactions { height: 0; pointer-events: none; }
.message-reactions.empty-reactions .reaction-add { position: absolute; right: 0; bottom: -5px; opacity: 0; pointer-events: auto; }
.bubble:hover .message-reactions.empty-reactions .reaction-add, .message-reactions.empty-reactions:focus-within .reaction-add { opacity: .72; }
.message-reactions.has-reactions { min-height: 21px; height: 21px; margin: 2px 0 -12px; }
.reaction-chip, .reaction-add { display: inline-flex; min-width: 26px; height: 22px; align-items: center; justify-content: center; gap: 3px; padding: 0 6px; border: 1px solid #d4e0e6; border-radius: 12px; color: #526d79; background: #fff; box-shadow: 0 1px 2px #0000000d; cursor: pointer; line-height: 1; }
.reaction-chip b { font-size: 10px; font-weight: 700; }
.reaction-chip.chosen { border-color: #56a8dc; color: #1879b8; background: #e8f6ff; }
.reaction-add { width: 28px; padding: 0; opacity: .72; }
.reaction-add i { font-size: 12px; }
.reaction-add-plus { margin-left: -3px; font-size: 10px; font-weight: 800; }
.reaction-chip:disabled, .reaction-add:disabled { opacity: .45; cursor: wait; }
.reaction-picker { position: absolute; z-index: 12; bottom: 31px; left: 0; display: grid; grid-template-columns: repeat(5, 34px); gap: 3px; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 8px 28px #17212b33; }
.reaction-picker[hidden] { display: none; }
.reaction-picker button { display: grid; width: 34px; height: 34px; place-items: center; padding: 0; border: 0; border-radius: 9px; background: transparent; cursor: pointer; font-size: 20px; }
.reaction-picker button:hover, .reaction-picker button[data-chosen="true"] { background: #e7f4fb; }
.bubble.outbound .message-reactions { justify-content: flex-end; }
.sticker-bubble .message-reactions { margin-top: 1px; }
.bubble.inbound { border-top-left-radius: 14px; border-bottom-left-radius: 4px; }
.bubble.outbound { border-top-right-radius: 14px; border-bottom-right-radius: 4px; background: #eeffde; }
.time { margin-top: 4px; font-size: 10px; color: #7b8a81; line-height: 1.3; }
.date-divider { align-self: center; margin: 5px 0 12px; }
.date-divider span, .chat-empty { padding: 5px 12px; border-radius: 20px; background: #6b846b80; color: white; font-size: 11px; }
.composer { flex-shrink: 0; align-items: center; gap: 10px; margin: 6px max(20px, calc((100% - 800px) / 2)) 20px; padding: 8px 10px; border-radius: 16px; background: var(--surface); box-shadow: 0 2px 6px #00000008; }
.topup-bar { flex-shrink: 0; margin: 8px max(20px, calc((100% - 800px) / 2)) 0; padding: 10px 12px; border: 1px solid #d6e7d1; border-radius: 12px; background: #f8fff5; box-shadow: 0 1px 4px #17212b0c; }
.chat-tools { display: flex; flex-shrink: 0; gap: 6px; margin: 8px max(20px, calc((100% - 800px) / 2)) 0; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.chat-tool { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 11px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; font-size: 10px; font-weight: 700; }
.chat-tool i { font-size: 11px; }
.chat-tool.active { color: var(--accent); background: #e6f4ea; }
.chat-tool:hover { background: #edf4ef; }
.topup-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; color: #26764a; font-size: 11px; }
.topup-head strong { display: inline-flex; align-items: center; gap: 6px; }
.topup-head strong i { font-size: 12px; }
.topup-head-meta { display: inline-flex; align-items: center; gap: 7px; }
.topup-close { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; color: var(--muted); background: transparent; cursor: pointer; }
.topup-close:hover { color: #a23a36; background: #fde9e7; }
.topup-head span { color: var(--muted); font-size: 10px; font-weight: 500; }
.topup-games, .topup-regions { display: flex; gap: 5px; margin-bottom: 7px; }
.topup-variant { width: 100%; height: 34px; margin-bottom: 7px; padding: 0 9px; border: 1px solid #cbdcc6; border-radius: 8px; outline: 0; color: var(--ink); background: #fff; font-size: 11px; }
.topup-games button, .topup-regions button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 28px; padding: 0 10px; border: 1px solid #cbdcc6; border-radius: 7px; color: #5f7666; background: #fff; cursor: pointer; font-size: 10px; font-weight: 750; }
.topup-games button i { font-size: 11px; }
.topup-games button.active, .topup-regions button.active { color: #fff; border-color: #26764a; background: #26764a; }
.topup-controls { display: flex; gap: 8px; }
.topup-controls input { min-width: 0; flex: 1; height: 34px; padding: 7px 10px; border: 1px solid #cbdcc6; border-radius: 8px; outline: 0; color: var(--ink); background: #fff; font-size: 12px; }
.topup-controls button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 75px; padding: 0 12px; border: 0; border-radius: 8px; color: #fff; background: #26764a; cursor: pointer; font-size: 11px; font-weight: 800; }
.topup-controls button:disabled { cursor: wait; opacity: .6; }
.topup-status { margin-top: 7px; padding: 6px 8px; border-radius: 7px; font-size: 10px; line-height: 1.4; }
.topup-status.pending { color: #765a13; background: #fff7d6; }
.topup-status.success { color: #26764a; background: #e5f6e8; }
.topup-status.failed { color: #a23a36; background: #fde9e7; }
.topup-history { display: grid; gap: 3px; margin-top: 6px; }
.topup-history-row { display: grid; grid-template-columns: 7px auto auto minmax(0, 1fr); align-items: center; gap: 5px; color: var(--muted); font-size: 9px; }
.topup-history-row b { color: #26764a; font-size: 8px; }
.topup-history-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topup-dot { width: 6px; height: 6px; border-radius: 50%; background: #9ca9af; }
.topup-dot.success { background: #3b9b5d; }
.topup-dot.failed { background: #d4524b; }
.topup-dot.pending { background: #c59d24; }
.composer input { height: 42px; padding: 8px 2px; background: transparent; border: 0; border-radius: 0; font-size: 14px; }
.attach-button { width: 40px; height: 40px; flex-basis: 40px; border: 0; background: transparent; font-size: 21px; }
.composer .send-button { display: grid; place-items: center; min-width: 44px; height: 44px; border-radius: 50%; background: var(--accent); }
.attachment-preview { bottom: 66px; }
.quick-replies { bottom: 66px; }
.ledger { overflow: auto; min-height: 0; padding: 16px; background: var(--surface); border-color: var(--line); }
.ledger-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.ledger-heading h2 { margin: 0; font-size: 17px; }
.ledger-box { padding: 14px; border-color: var(--line); background: var(--surface); }
.ledger-box div { font-size: 12px; }
.ledger-box .customer-profile { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 24px; }
.ledger-box .customer-profile > div:last-child { display: block; }
.customer-profile .avatar.large { width: 80px; height: 80px; flex-basis: 80px; font-size: 25px; }
.ledger-box .customer-profile strong { color: var(--ink); font-size: 18px; }
.customer-profile span { font-size: 12px; }
.ledger-box .profile-meta { flex-wrap: wrap; gap: 8px; font-size: 10px; margin-bottom: 20px; }
.ledger button.primary { min-height: 43px; background: var(--accent); font-size: 13px; }
.ledger button.secondary { min-height: 42px; background: var(--hover); color: var(--accent); font-size: 12px; }
.ledger .icon-button { width: 40px; margin: 0; background: transparent; color: var(--muted); font-size: 25px; }
.sale-row { padding: 12px; border-color: var(--line); }
.sale-row strong { font-size: 12px; }
.hint { font-size: 11px; line-height: 1.8; }
.mobile-back { display: none; }
@media (max-width: 1100px) {
  .layout, .layout.info-open { grid-template-columns: 310px minmax(0, 1fr); }
  .ledger { position: absolute; z-index: 10; inset: 0 0 0 auto; width: 320px; grid-column: auto; border-top: 0; border-left: 1px solid var(--line); box-shadow: -12px 0 35px #17212b20; }
  #assigned { display: none; }
  #ledger-toggle { margin-left: auto; }
}
@media (max-width: 700px) {
  .topbar { padding: 8px 12px; }
  .online { display: none; }
  .layout, .layout.info-open { display: block; height: calc(100dvh - 60px); }
  .inbox { height: 100%; max-height: none; }
  .conversation-list { max-height: none; }
  .chat { display: none; height: 100%; min-height: 0; }
  .chat-open .inbox { display: none; }
  .chat-open .chat { display: flex; }
  .mobile-back { display: inline-grid; }
  .chat-head { gap: 8px; padding: 8px 12px; min-height: 66px; }
  .messages { padding: 16px 12px; }
  .messages-date-badge { top: 70px; }
  .composer { margin: 4px 10px max(10px, env(safe-area-inset-bottom)); gap: 5px; padding: 6px; }
  .topup-bar { margin: 6px 10px 0; }
  .chat-tools { margin: 6px 10px 0; }
  .composer input { font-size: 16px; }
  .bubble { max-width: 88%; }
  .ledger { width: min(100%, 360px); }
  .summary-head, .history-head { align-items: start; flex-direction: column; }
}

/* Shared interface helpers. */
.ui-icon { display: inline-block; width: 20px; height: 20px; flex: 0 0 20px; vertical-align: middle; }
.app-nav button { display: flex; align-items: center; gap: 10px; }
.ledger > button { display: flex; align-items: center; justify-content: center; gap: 8px; }
.chat-search > span { display: inline-flex; }
.region-flag { width: 20px; height: 14px; object-fit: cover; flex: 0 0 20px; border-radius: 2px; box-shadow: 0 0 0 1px #00000012; }
.check-form { background: #f6fbff; border-color: #d5e4f0; }
.check-form .topup-head { color: #2b6c91; }
.check-form .topup-controls button { background: #347fa9; }
.server-check-fields { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.server-check-fields input { width: 100%; min-width: 0; height: 38px; padding: 8px 11px; border: 1px solid #d8e1ec; border-radius: 10px; outline: 0; color: #26364d; background: #fff; font-size: 12px; font-weight: 650; }
.server-check-fields input:focus { border-color: #42a5e8; box-shadow: 0 0 0 3px #42a5e81a; }
.server-check-fields button, .server-check-send { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 15px; border: 0; border-radius: 10px; color: #fff; background: #1498e5; cursor: pointer; font-size: 11px; font-weight: 800; }
.server-check-fields button:disabled, .server-check-send:disabled { cursor: wait; opacity: .65; }
.server-check-result { display: grid; gap: 9px; margin-top: 10px; }
.server-check-card { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); align-items: stretch; gap: 10px; }
.server-check-panel { min-width: 0; padding: 14px 16px; border: 1px solid #d8e1ec; border-radius: 14px; background: #fbfcfe; box-shadow: inset 0 0 0 1px #f1f4f8; }
.server-check-panel h3 { margin: 0 0 8px; color: #94a3ba; font-size: 9px; font-weight: 850; letter-spacing: .55px; }
.server-check-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 12px; min-height: 34px; border-bottom: 1px solid #eef2f6; }
.server-check-row:last-child { border-bottom: 0; }
.server-check-row span { color: #94a3ba; font-size: 11px; font-weight: 750; }
.server-check-row strong { min-width: 0; overflow-wrap: anywhere; color: #26364d; font-size: 13px; font-weight: 850; text-align: right; }
.server-check-row:first-child strong { color: #1498e5; }
.server-check-tier-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; border-bottom: 1px solid #eef2f6; }
.server-check-tier-row:last-child { border-bottom: 0; }
.server-check-tier-row > strong { color: #26364d; font-size: 11px; font-weight: 800; }
.server-check-badge { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 82px; padding: 5px 9px; border-radius: 999px; font-size: 9px; font-weight: 850; }
.server-check-badge.available { color: #217346; background: #dcf5e5; }
.server-check-badge.used { color: #bf3838; background: #ffe1e1; }
.server-check-empty { display: grid; min-height: 126px; place-items: center; color: #94a3ba; font-size: 11px; }
.server-check-send { justify-self: end; background: #26764a; }
.server-check-send.sent { background: #e5f6e8; color: #26764a; cursor: default; }

/* Server check uses the same compact controls and quiet typography as Auto Top-up. */
.check-form { border-color: #d6e7d1; background: #f8fff5; }
.check-form .topup-head { color: #26764a; }
.server-check-fields label { color: var(--muted); font-weight: 500; letter-spacing: 0; }
.server-check-fields input { height: 34px; padding: 7px 10px; border-color: #cbdcc6; border-radius: 8px; font-size: 12px; font-weight: 400; }
.server-check-fields input:focus { border-color: #74a66f; box-shadow: 0 0 0 3px #74a66f1a; }
.server-check-fields button { min-height: 34px; padding: 0 12px; border-radius: 8px; background: #26764a; font-size: 11px; font-weight: 500; }
.server-check-panel { padding: 12px 14px; border-color: #d6e7d1; border-radius: 12px; background: #f8fff5; box-shadow: none; }
.server-check-panel h3 { color: var(--muted); font-size: 9px; font-weight: 500; letter-spacing: .3px; }
.server-check-row span, .server-check-row strong, .server-check-tier-row > strong { color: var(--ink); font-size: 11px; font-weight: 400; }
.server-check-row:first-child strong { color: var(--ink); }
.server-check-badge { font-size: 9px; font-weight: 500; }

/* Chat folders stay in one scrollable row on narrow screens. */
.chat-filters { flex-shrink: 0; justify-content: flex-start; gap: 0; padding: 0 6px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
.chat-filters button { display: inline-flex; align-items: center; justify-content: center; gap: 2px; flex: 0 0 auto; min-height: 44px; padding: 10px 6px 12px; font-size: 11px; white-space: nowrap; }
.chat-filters .filter-icon { display: block; width: 14px; height: 14px; flex: 0 0 14px; }
.chat-filters [data-filter="fb"] .filter-icon { width: 8px; flex-basis: 8px; }
.chat-filters button.active::after { left: 5px; right: 5px; }
#unread-count { margin-left: 0; padding: 2px 4px; font-size: 10px; }
.composer #reply-input { display: block; min-width: 0; flex: 1; min-height: 42px; max-height: 180px; margin: 0; padding: 9px 2px; border: 0; border-radius: 0; resize: none; color: inherit; background: transparent; font: inherit; font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-y: auto; }
.composer { align-items: flex-end; flex-wrap: wrap; }
.selected-quick-reply { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 8px; padding: 6px 10px; border-left: 3px solid var(--accent); background: var(--hover); color: var(--muted); font-size: 12px; }
.selected-quick-reply button { min-width: 28px; min-height: 28px; background: transparent; color: var(--muted); font-size: 20px; }
.quick-replies { bottom: calc(100% + 8px); }
.quick-option { display: flex; align-items: center; }
.quick-option > button:first-child { flex: 1; min-width: 0; }
.quick-option > button:first-child span { white-space: pre-wrap; overflow: hidden; max-height: 70px; line-height: 1.5; }
.quick-option .quick-edit { width: auto; min-width: 42px; color: var(--accent); }
#quick-create { color: var(--accent); border-top: 1px solid var(--line); margin-top: 5px; border-radius: 0; }
.bubble.sticker-bubble { background: transparent; box-shadow: none; padding: 0; }
.message-sticker, .message-sticker img { background: transparent; border-radius: 0; max-width: 220px; max-height: 220px; object-fit: contain; }
.sticker-bubble .time { display: table; margin-left: auto; padding: 3px 7px; border-radius: 10px; background: #ffffffb3; color: #526354; }
@media (max-width: 700px) {
  .composer #reply-input { font-size: 16px; }
  .server-check-fields { grid-template-columns: minmax(0, 1fr) auto; }
  .server-check-row { grid-template-columns: 76px minmax(0, 1fr); }
  .server-check-send { width: 100%; justify-self: stretch; }
  .reaction-picker { position: fixed; right: 12px; bottom: 76px; left: 12px; grid-template-columns: repeat(5, minmax(34px, 1fr)); justify-items: center; padding: 9px; }
}

@media (max-width: 520px) {
  .server-check-card { grid-template-columns: 1fr; }
}

.animated-sticker { width: 220px; height: 220px; background: transparent; }
.animated-sticker svg { display: block; width: 100%; height: 100%; }

/* Keep the composer compact and give its actions a consistent Telegram-like treatment. */
.composer #reply-input {
  font-size: 13px;
  line-height: 1.45;
  padding: 7px 2px;
}
.attach-button {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  border-radius: 10px;
  color: #7a8792;
  background: transparent;
}
.attach-button:hover {
  color: #3390ec;
  background: #f1f5f8;
}
.attach-button .ui-icon {
  width: 19px;
  height: 19px;
  stroke-width: 1.8;
  transform: rotate(-8deg);
}
.composer .send-button {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  color: #fff;
  background: #3390ec;
}
.composer .send-button:hover {
  background: #2782dc;
  transform: translateY(-1px);
}
.composer .send-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sticker-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  color: #7a8792;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
}
.sticker-toggle:hover, .sticker-toggle[aria-expanded="true"] { color: #3390ec; background: #f1f5f8; }
.sticker-picker {
  position: absolute;
  right: 54px;
  bottom: 54px;
  z-index: 6;
  width: min(340px, calc(100% - 20px));
  max-height: 290px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 10px 30px #17212b22;
}
.sticker-picker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; color: var(--ink); font-size: 12px; }
.sticker-picker-head small { color: var(--muted); font-size: 9px; }
.sticker-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.sticker-option { display: grid; place-items: center; aspect-ratio: 1; padding: 4px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; }
.sticker-option:hover { background: var(--hover); }
.sticker-option img { width: 100%; height: 100%; object-fit: contain; }
.sticker-empty { padding: 24px 10px; color: var(--muted); font-size: 11px; text-align: center; }
@media (max-width: 700px) {
  .composer #reply-input { font-size: 14px; }
  .sticker-picker { right: 48px; bottom: 52px; width: min(320px, calc(100% - 16px)); }
}
