:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #101828;
  --muted: #475467;
  --line: #eaecf0;
  --brand: #0f5c4d;
  --brand-soft: #e3f1ed;
  --in: #ffffff;
  --out: #e2f4ed;
  --ai: #eff4ff;
  --note: #fef08a;
  --warn: #fffaeb;
  --warn-ink: #b54708;
  --danger: #b42318;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1110; --panel: #131b18; --ink: #eaecf0; --muted: #98a2b3; --line: #1d2926;
    --brand: #3fb594; --brand-soft: #162a24; --in: #1a2622; --out: #16382e; --ai: #1d2939;
    --note: #3a3211; --warn: #3a2511; --warn-ink: #fedf89;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--danger); min-height: 1.2em; margin: 0; font-size: 14px; }
button { font: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 92, 77, 0.12); }

.btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 9px 16px; font-weight: 500; min-height: 40px; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:hover { opacity: 0.92; }
.btn.danger { color: var(--danger); border-color: var(--line); }
.icon-btn { border: 0; background: transparent; color: var(--muted); font-size: 18px; width: 38px; height: 38px; border-radius: 8px; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--brand-soft); color: var(--brand); }
.chip { border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 500; transition: all .15s; }
.chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.chip.active { background: var(--note); border-color: #facc15; color: #713f12; font-weight: 600; }

.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -0.01em; }
.logo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: #e04f16; color: #fff; font-weight: 800; font-size: 15px; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.logo.has-img { background: #fff; overflow: hidden; border: 1px solid var(--line); }
.logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo-row { display: flex; gap: 14px; align-items: center; margin: 4px 0 14px; }
.logo-row .logo.big { margin: 0; flex: none; }
.logo-row p { margin: 2px 0 8px; }
.logo.big { width: 64px; height: 64px; font-size: 30px; border-radius: 16px; margin: 0 auto 12px; background: #e04f16; }

/* Login */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; display: grid; gap: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.04); }
.login-card label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }

/* Layout */
.app { display: grid; grid-template-columns: 360px 1fr; height: 100dvh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.top-actions { display: flex; gap: 4px; }
.mode-bar { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 16px 0; }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 500; }
.pill.off { background: var(--warn); color: var(--warn-ink); }
.filters { padding: 12px 16px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 3px; border-radius: 8px; }
.tab { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 6px; border-radius: 6px; font-size: 13px; font-weight: 500; transition: all .15s; }
.tab.active { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filter-row > * { min-width: 0; font-size: 13px; padding: 8px 10px; }

.conv-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.conv { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: center; transition: background .12s; }
.conv:hover { background: var(--bg); }
.conv.active { background: var(--brand-soft); border-left: 3px solid var(--brand); }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 600; font-size: 15px; }
.conv-main { min-width: 0; }
.conv-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.conv-last { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.conv-meta { display: grid; justify-items: end; gap: 4px; font-size: 11px; color: var(--muted); }
.badge { background: #e04f16; color: #fff; border-radius: 999px; min-width: 18px; height: 18px; padding: 0 5px; text-align: center; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--bg); color: var(--muted); font-weight: 500; display: inline-flex; align-items: center; gap: 3px; }
.tag.human { background: var(--warn); color: var(--warn-ink); }
.empty-list { padding: 32px 16px; text-align: center; color: var(--muted); }

/* Chat */
.chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
.chat .chat-inner { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat.empty .chat-inner { display: none; }
.chat:not(.empty) .empty-state { display: none; }
.empty-state { margin: auto; text-align: center; color: var(--muted); padding: 24px; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); box-shadow: 0 1px 2px rgba(0,0,0,0.02); z-index: 2; }
.chat-head .back { display: none; }
.who { flex: 1; min-width: 0; }
.who-name { font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-name:hover { color: var(--brand); }
.who-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.details { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); align-items: end; z-index: 1; }
.details label { display: grid; gap: 4px; font-size: 12px; font-weight: 500; color: var(--muted); }

.switch { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; padding: 4px 8px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); }
.switch input { display: none; }
.slider { width: 34px; height: 18px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; }
.slider::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::after { transform: translateX(16px); }
.switch-label { font-size: 13px; font-weight: 600; color: var(--ink); }

.banner { margin: 10px 16px 0; padding: 10px 14px; border-radius: 10px; background: var(--warn); color: var(--warn-ink); font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border: 1px solid rgba(181, 71, 8, 0.15); }
.banner input { flex: 1; min-width: 140px; padding: 5px 10px; background: var(--panel); }

.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 72%; padding: 10px 14px 8px; border-radius: var(--radius); white-space: pre-wrap; word-wrap: break-word; box-shadow: 0 1px 2px rgba(0,0,0,0.04); font-size: 14.5px; line-height: 1.5; }
.msg.in { align-self: flex-start; background: var(--in); border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg.out { align-self: flex-end; background: var(--out); border-top-right-radius: 4px; border: 1px solid rgba(15, 92, 77, 0.15); }
.msg.out.ai { background: var(--ai); border-color: rgba(30, 80, 160, 0.15); }
.msg.note { align-self: center; background: var(--note); color: #713f12; max-width: 85%; font-size: 13.5px; border: 1px solid #fde047; border-radius: 8px; box-shadow: none; }
.msg.system { background: transparent; box-shadow: none; color: var(--muted); font-size: 12px; text-align: center; padding: 4px 12px; }
.msg-meta { font-size: 11px; color: var(--muted); margin-top: 4px; text-align: right; }
.msg.failed .msg-meta { color: var(--danger); font-weight: 500; }
.day-sep { align-self: center; font-size: 12px; color: var(--muted); background: var(--panel); padding: 4px 12px; border-radius: 999px; margin: 8px 0; border: 1px solid var(--line); font-weight: 500; box-shadow: 0 1px 2px rgba(0,0,0,0.02); }
.typing { padding: 4px 16px 8px; font-size: 13px; color: var(--muted); font-style: italic; }

.composer { background: var(--panel); border-top: 1px solid var(--line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); display: grid; gap: 8px; box-shadow: 0 -2px 6px rgba(0,0,0,0.02); }
.composer-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; max-height: 160px; padding: 10px 14px; border-radius: 10px; font-size: 14.5px; }
.composer.note-mode textarea { background: var(--note); border-color: #fde047; color: #713f12; }
.composer .send { height: 44px; width: 44px; padding: 0; border-radius: 10px; display: grid; place-items: center; flex: none; }

/* Modal & toast */
.modal { position: fixed; inset: 0; background: rgba(16, 24, 40, 0.5); backdrop-filter: blur(2px); display: grid; place-items: center; padding: 16px; z-index: 100; animation: fadeIn .15s ease-out; }
.modal-card { background: var(--panel); border-radius: 16px; padding: 24px; width: 100%; max-width: 560px; max-height: 90dvh; overflow: auto; display: grid; gap: 16px; box-shadow: 0 20px 24px -4px rgba(16, 24, 40, 0.1), 0 8px 8px -4px rgba(16, 24, 40, 0.04); border: 1px solid var(--line); }
.modal-card h3 { margin: 0; font-size: 18px; font-weight: 600; }
.modal-card label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.modal-card textarea.kb { min-height: 50dvh; font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.menu-list { display: grid; gap: 6px; }
.menu-list .btn { text-align: left; justify-content: flex-start; }
.team-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #101828; color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 200; max-width: calc(100% - 32px); font-size: 14px; font-weight: 500; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); animation: slideUp .15s ease-out; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translate(-50%, 10px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* Mobile: show list OR chat */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .app.show-chat .sidebar { display: none; }
  .app:not(.show-chat) .chat { display: none; }
  .chat-head .back { display: inline-flex; }
  .details { grid-template-columns: 1fr 1fr; }
  .details .btn { grid-column: span 2; }
  .msg { max-width: 85%; }
}

/* Sales stages */
.tag.stage { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.tag.stage-lost { background: var(--bg); color: var(--muted); text-decoration: line-through; }
/* Usage page */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.stat { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--panel); }
.stat .v { font-size: 24px; font-weight: 700; color: var(--ink); }
.stat .k { font-size: 12px; color: var(--muted); margin-top: 2px; }
.meter { height: 8px; border-radius: 999px; background: var(--bg); overflow: hidden; border: 1px solid var(--line); }
.meter > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.meter.warn > span { background: #d97706; } .meter.over > span { background: var(--danger); }
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.set-grid label.wide { grid-column: span 2; }
.keybox { font: 12px ui-monospace, Menlo, Consolas, monospace; word-break: break-all; background: var(--bg); padding: 10px; border-radius: 8px; border: 1px solid var(--line); }
.modal-card.wide { max-width: 760px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table td, .mini-table th { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
@media (max-width: 760px) { .set-grid { grid-template-columns: 1fr; } .set-grid label.wide { grid-column: auto; } }

.details input, .details select { width: 100%; min-width: 0; }

.steps { margin: 6px 0 8px 18px; padding: 0; line-height: 1.6; }
.modal-card h4 { margin: 14px 0 4px; font-weight: 600; }
#pMode { width: 100%; margin-top: 4px; }
.tag.line { background: #eff4ff; color: #1d4ed8; font-weight: 500; }
/* Quick replies */
.qlist { display: flex; flex-direction: column; gap: 6px; max-height: 55dvh; overflow-y: auto; }
.qitem { display: block; flex: none; width: 100%; text-align: left; white-space: normal; height: auto; padding: 10px 14px; line-height: 1.4; }
.qitem .muted { display: block; margin-top: 2px; }

/* Photos & files in chat */
.msg.has-media { display: flex; flex-direction: column; gap: 6px; }
.msg-img { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 10px; overflow: hidden; max-width: 280px; }
.msg-img img { display: block; width: 100%; max-height: 320px; object-fit: cover; border-radius: 10px; background: var(--line); min-height: 80px; }
.msg-img.sticker { max-width: 140px; }
.msg-img.sticker img { background: none; object-fit: contain; }
.msg-video { display: block; width: 280px; max-width: 100%; max-height: 320px; border-radius: 10px; background: #000; }
.msg-audio { display: block; width: 260px; max-width: 100%; height: 40px; }
.msg-file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,0.04); border: 1px solid var(--line); color: inherit; text-decoration: none; min-width: 200px; white-space: normal; }
.msg-file span { flex: 1; overflow-wrap: anywhere; font-weight: 500; }
.msg-file b { font-size: 12px; color: var(--brand); font-weight: 600; white-space: nowrap; }
.msg-file.pending { color: var(--muted); font-size: 13px; min-width: 0; }
a.msg-file:hover { background: rgba(0,0,0,0.07); }
.viewer-img { display: block; max-width: 100%; max-height: 70dvh; margin: 0 auto; border-radius: 10px; object-fit: contain; }
@media (max-width: 760px) { .msg-img, .msg-video { max-width: 100%; } }
.tag.shopee { background: #fff1ec; color: #c2410c; font-weight: 500; }

/* Daily learning */
.learn-controls { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.modal-card label.inline { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
.learn-list { display: flex; flex-direction: column; gap: 10px; max-height: 55dvh; overflow-y: auto; }
.learn-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 6px; font-size: 14px; background: var(--panel); }
.learn-item.pending { border-color: #93c5fd; }
.learn-item.conflict { border-color: #fca5a5; background: rgba(239, 68, 68, 0.04); }
.learn-meta { font-size: 12px; color: var(--muted); }
.learn-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* iPhone fixes */
@media (max-width: 760px) {
  /* iOS zooms the page when a box under 16px is tapped — keep all typing boxes at 16px */
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px !important; }
  /* Tool buttons in one swipeable row so the chat keeps its space */
  .composer-tools { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .composer-tools::-webkit-scrollbar { display: none; }
  .composer-tools .chip { flex: none; white-space: nowrap; }
  .composer { padding-top: 8px; gap: 6px; }
  /* Keep toasts above the reply box and the iPhone home bar */
  .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
}
/* Landscape iPhones: keep content clear of the notch */
.app { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.login-card input { width: 100%; min-width: 0; box-sizing: border-box; }
.login-card label { min-width: 0; }

/* Invoices tab */
.tab .badge { margin-left: 4px; font-size: 11px; min-width: 18px; height: 18px; padding: 0 5px; }
.inv-head { padding: 10px 16px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; list-style: none; }
.inv-tabs .tab { font-size: 12px; }
.inv-scan { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.inv-scan .btn { padding: 6px 12px; font-size: 13px; }
.inv { list-style: none; padding: 12px 16px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; cursor: pointer; font-size: 14px; }
.inv:hover { background: var(--bg); }
.inv-top { display: flex; justify-content: space-between; gap: 8px; }
.inv-amt { font-weight: 700; color: var(--brand); }
.inv-line { font-size: 13px; overflow-wrap: anywhere; }
.inv-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.inv-actions .btn { padding: 6px 10px; font-size: 13px; }
.inv-scan .btn { white-space: nowrap; flex: none; }

/* Photo library */
.lib-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; max-height: 60dvh; overflow-y: auto; }
.lib-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: grid; gap: 8px; background: var(--panel); }
.lib-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--line); }
.lib-card input, .lib-card textarea { width: 100%; box-sizing: border-box; font-size: 13px; }
.lib-actions { display: flex; gap: 6px; }
.lib-actions .btn { padding: 6px 10px; font-size: 13px; }

/* WhatsApp-style replies */
.msg.can-reply { position: relative; cursor: pointer; }
.reply-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--muted); display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .15s; padding: 0; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.msg.in .reply-btn { right: -36px; }
.msg.out .reply-btn { left: -36px; }
.msg.can-reply:hover .reply-btn, .reply-btn:focus-visible { opacity: 1; }
.reply-btn:hover { color: var(--brand); }
@media (hover: none) { .reply-btn { display: none; } }
.msg.replying { outline: 2px solid var(--brand); outline-offset: 2px; }
.msg.flash { animation: msgflash 1.2s ease-out; }
@keyframes msgflash { 0%, 40% { box-shadow: 0 0 0 4px rgba(63, 181, 148, 0.45); } 100% { box-shadow: 0 1px 2px rgba(0,0,0,0.04); } }
.msg-quote { display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; margin: 0 0 6px; padding: 5px 10px; border: 0; border-left: 3px solid var(--brand); border-radius: 6px; background: rgba(0,0,0,0.05); white-space: normal; }
.msg-quote b { display: block; font-size: 12px; color: var(--brand); font-weight: 600; }
.msg-quote span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; color: var(--muted); }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-left: 3px solid var(--brand); border-radius: 8px; background: var(--brand-soft, rgba(15, 92, 77, 0.06)); }
.reply-bar-text { flex: 1; min-width: 0; }
.reply-bar-text b { display: block; font-size: 12px; color: var(--brand); }
.reply-bar-text span { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-bar .icon-btn { flex: none; width: 30px; height: 30px; }
.reply-bar.hidden { display: none; }

/* Easier-to-scan chat list */
.avatar { background: hsl(var(--h, 165) 45% 91%); color: hsl(var(--h, 165) 50% 28%); }
@media (prefers-color-scheme: dark) { .avatar { background: hsl(var(--h, 165) 30% 20%); color: hsl(var(--h, 165) 55% 75%); } }
.conv.unread .conv-name { font-weight: 700; }
.conv.unread .conv-last { color: var(--ink); font-weight: 500; }
.conv.unread .conv-meta > span:first-child { color: var(--brand); font-weight: 600; }
.conv-last .draft { color: #c2410c; font-weight: 600; }

/* Composer buttons: full labels on wide screens, short ones on phones so all fit */
.lbl-short { display: none; }
@media (max-width: 760px) {
  .lbl-long { display: none; }
  .lbl-short { display: inline; }
  .composer-tools .chip { padding: 6px 12px; }
  .composer-tools .chip svg { display: none; }
}

/* "New message" button while reading older messages */
.chat-inner { position: relative; }
.newer { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--composer-h, 120px) + 12px); z-index: 5; border: 1px solid var(--line); background: var(--panel); color: var(--brand); font-weight: 600; font-size: 13px; padding: 7px 14px; border-radius: 999px; box-shadow: 0 4px 12px rgba(0,0,0,0.12); cursor: pointer; }

/* Slim 24-hour banner */
.banner.compact { flex-wrap: nowrap; }
.banner.compact span { flex: 1; min-width: 0; }
.banner.compact .btn { flex: none; white-space: nowrap; }
@media (max-width: 760px) { .banner.compact { font-size: 12.5px; padding: 8px 10px; } }

/* Daily report */
#btnMenu { position: relative; }
#btnMenu.has-dot::after { content: ''; position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: #e04f16; border: 2px solid var(--panel); }
.rep-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rep-bar select { flex: 1; min-width: 160px; }
.rep-counts { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.rep-owner-c b { color: #c2410c; }
.rep-reply-c b { color: var(--brand); }
.rep-help { margin: 0; font-size: 13px; }
.rep-list { display: flex; flex-direction: column; gap: 10px; }
.rep-item { border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 6px; font-size: 14px; background: var(--panel); }
.rep-item.rep-owner { border-left-color: #ea580c; }
.rep-item.rep-reply { border-left-color: var(--brand); }
.rep-item.is-done { opacity: .65; }
.rep-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.rep-tag { font-size: 12px; font-weight: 600; }
.rep-owner .rep-tag { color: #c2410c; }
.rep-reply .rep-tag { color: var(--brand); }
.rep-handled .rep-tag { color: var(--muted); }
.rep-topic { font-weight: 600; }
.rep-reason { font-size: 13px; color: #9a3412; background: rgba(234, 88, 12, 0.07); padding: 4px 8px; border-radius: 6px; }
.rep-draft { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.rep-draft textarea { width: 100%; font-size: 14px; color: var(--ink); resize: vertical; }
.rep-state { font-size: 13px; color: var(--brand); font-weight: 600; }
.rep-note { font-size: 12.5px; }
.rep-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rep-handled-list summary { cursor: pointer; font-size: 14px; color: var(--muted); padding: 6px 0; }
.rep-handled-list .rep-item { margin-top: 8px; }
