/* USB Bali Care — tampilan ala Cekat.AI */
:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --border: #e5e8ef;
  --border-strong: #d5dae4;
  --text: #1f2937;
  --muted: #6b7280;
  --faint: #9ca3af;
  --primary: #2f6fed;
  --primary-600: #2459c9;
  --primary-50: #eef3ff;
  --primary-100: #dde7ff;
  --green: #16a34a;
  --green-50: #e8f7ee;
  --orange: #d97706;
  --orange-50: #fff4e1;
  --red: #dc2626;
  --red-50: #fdecec;
  --purple: #7c3aed;
  --purple-50: #f3edff;
  --yellow-50: #fffbe6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.07);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.14);
  --sidebar-w: 238px;
  --topbar-h: 58px;
  font-family: "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }
.app.collapsed { grid-template-columns: 68px 1fr; }
.sidebar {
  background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
.brand { display: flex; align-items: center; gap: 10px; height: var(--topbar-h); padding: 0 16px; border-bottom: 1px solid var(--border); }
.brand img { width: 30px; height: 30px; }
.brand b { font-size: 16px; letter-spacing: 0.2px; }
.brand span { display: block; font-size: 11px; color: var(--muted); margin-top: -2px; }
.nav { flex: 1; overflow-y: auto; padding: 10px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--faint); padding: 12px 10px 4px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px;
  color: #3f4756; font-weight: 600; position: relative;
}
.nav a:hover { background: var(--panel-2); }
.nav a.active { background: var(--primary-50); color: var(--primary); }
.nav a .badge-count { margin-left: auto; }
.nav a svg { flex: none; }
.app.collapsed .nav a span, .app.collapsed .nav-section, .app.collapsed .brand-text { display: none; }
.app.collapsed .nav a { justify-content: center; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-foot.nav { flex: none; overflow: visible; }
.nav a span:not(.badge-count):not(.status-dot) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bubble b { font-weight: 800; }
.chat-head .head-sub { display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.chat-head .head-sub span { overflow: hidden; text-overflow: ellipsis; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  height: var(--topbar-h); background: var(--panel); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; padding: 0 18px; flex: none;
}
.pill-info {
  display: inline-flex; align-items: center; gap: 6px; background: var(--primary); color: #fff;
  padding: 6px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
}
.pill-outline {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--primary-100); color: var(--primary);
  padding: 5px 11px; border-radius: 8px; font-size: 12.5px; font-weight: 600; background: #fff; cursor: pointer;
}
.content { flex: 1; min-height: 0; overflow: auto; }
.page { padding: 22px 26px; max-width: 1280px; }
.page-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---------- komponen umum ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--border-strong);
  background: #fff; padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 600; white-space: nowrap;
}
.btn:hover { background: var(--panel-2); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-green:hover { filter: brightness(0.95); background: var(--green); }
.btn-danger { color: var(--red); border-color: #f3c4c4; }
.btn-danger:hover { background: var(--red-50); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.icon-btn { border: 0; background: transparent; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--muted); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

.input, .select, .textarea {
  width: 100%; border: 1px solid var(--border-strong); border-radius: 9px; padding: 9px 12px; background: #fff; outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 700; font-size: 13px; }
.field .hint { color: var(--muted); font-size: 12.5px; margin-top: -2px; }
.field .counter { align-self: flex-end; color: var(--faint); font-size: 11.5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge-open { background: #eef2f7; color: #475569; }
.badge-pending { background: var(--orange-50); color: var(--orange); }
.badge-assigned { background: var(--primary-50); color: var(--primary); }
.badge-resolved { background: var(--green-50); color: var(--green); }
.badge-soon { background: var(--purple-50); color: var(--purple); }
.badge-role { background: #f1f5f9; color: #334155; }
.badge-count { background: var(--red); color: #fff; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; }

.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; font-size: 14px; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }

.toggle { position: relative; width: 40px; height: 22px; flex: none; cursor: pointer; }
.toggle input { display: none; }
.toggle i { position: absolute; inset: 0; background: #cbd2dd; border-radius: 999px; transition: 0.15s; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: 0.15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked + i { background: var(--primary); }
.toggle input:checked + i::after { left: 21px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; cursor: pointer; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 7px; align-items: center; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--panel-2); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--panel-2); }

.empty { display: grid; place-items: center; text-align: center; color: var(--muted); padding: 40px 20px; gap: 6px; }
.empty .empty-icon { width: 64px; height: 64px; border-radius: 18px; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; margin-bottom: 6px; }
.empty h3 { color: var(--text); margin: 0; font-size: 17px; }
.empty p { margin: 0; max-width: 420px; }

.modal-back { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.42); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); width: min(520px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 17px; flex: 1; }
.modal-body { padding: 20px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }

.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #1f2937; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); max-width: 360px; font-weight: 600; }
.toast.ok { background: #14532d; }
.toast.err { background: #7f1d1d; }
.toast.warn { background: #7c2d12; }

.alert { padding: 10px 14px; border-radius: 10px; display: flex; gap: 9px; align-items: flex-start; font-size: 13px; }
.alert-warn { background: var(--orange-50); color: #92400e; }
.alert-info { background: var(--primary-50); color: #1e40af; }
.alert-ok { background: var(--green-50); color: #166534; }
.alert-err { background: var(--red-50); color: #991b1b; }

/* ---------- login ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, #eef3ff 0%, #f8fafc 60%); }
.auth-card { width: min(420px, 100%); padding: 30px; }
.auth-card .brand-big { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 20px; text-align: center; }
.auth-card .brand-big img { width: 56px; height: 56px; }
.auth-card h2 { margin: 0; }

/* ---------- chat (3 kolom) ---------- */
.chat { display: grid; grid-template-columns: 318px 1fr 296px; height: 100%; min-height: 0; }
.chat.no-detail { grid-template-columns: 318px 1fr; }
.chat-list { background: var(--panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.chat-list-head { padding: 12px 12px 0; border-bottom: 1px solid var(--border); }
.chat-tabs { display: flex; gap: 2px; overflow-x: auto; margin: 10px -12px 0; padding: 0 8px; }
.chat-tabs button { border: 0; background: transparent; padding: 9px 9px; font-weight: 700; font-size: 12.5px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; gap: 5px; align-items: center; }
.chat-tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.chat-tabs .n { background: #eef2f7; color: #475569; border-radius: 999px; padding: 0 6px; font-size: 11px; }
.chat-tabs button.active .n { background: var(--primary-50); color: var(--primary); }
.conv-items { flex: 1; overflow-y: auto; }
.conv-item { display: flex; gap: 10px; padding: 12px; border-bottom: 1px solid #f0f2f6; cursor: pointer; }
.conv-item:hover { background: var(--panel-2); }
.conv-item.active { background: var(--primary-50); box-shadow: inset 3px 0 0 var(--primary); }
.conv-item .top { display: flex; gap: 6px; align-items: baseline; }
.conv-item .name { font-weight: 800; flex: 1; min-width: 0; }
.conv-item .time { font-size: 11.5px; color: var(--faint); flex: none; }
.conv-item .preview { color: var(--muted); font-size: 13px; }
.conv-item .meta { display: flex; gap: 6px; align-items: center; margin-top: 5px; font-size: 11.5px; color: var(--muted); }
.conv-item.unread .name, .conv-item.unread .preview { color: var(--text); }

.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #f6f8fc; }
.chat-head { background: var(--panel); border-bottom: 1px solid var(--border); padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex: none; }
.chat-head h3 { margin: 0; font-size: 15.5px; }
.messages { flex: 1; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 6px; }
.day-sep { align-self: center; background: #e9edf5; color: #64748b; font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; margin: 8px 0; }
.msg { max-width: 68%; display: flex; flex-direction: column; }
.msg.in { align-self: flex-start; }
.msg.out, .msg.note { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; box-shadow: 0 1px 1px rgba(16,24,40,.06); }
.msg.in .bubble { background: #fff; border-top-left-radius: 4px; }
.msg.out .bubble { background: var(--primary); color: #fff; border-top-right-radius: 4px; }
.msg.out.ai .bubble { background: #e6eeff; color: #1e3a8a; }
.msg.out.notif .bubble { background: #ecfdf3; color: #14532d; }
.msg.note .bubble { background: var(--yellow-50); color: #713f12; border: 1px dashed #f3d77a; border-top-right-radius: 4px; }
.msg .who { font-size: 11px; color: var(--faint); margin: 0 4px 2px; font-weight: 700; }
.msg .stamp { font-size: 10.5px; color: var(--faint); margin: 2px 4px 0; }
.msg img.media { max-width: 260px; max-height: 260px; border-radius: 10px; display: block; margin-bottom: 4px; cursor: zoom-in; }
.event { align-self: center; background: #eef1f6; color: #556070; font-size: 12px; padding: 5px 12px; border-radius: 10px; max-width: 80%; text-align: center; white-space: pre-wrap; }
.event.summary { background: var(--purple-50); color: #4c1d95; text-align: left; border: 1px solid #e4d8ff; }

.ai-banner { background: var(--primary-50); color: #1e40af; padding: 8px 16px; font-size: 12.5px; display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--primary-100); }
.assigned-bar { background: #e9f9ef; color: #166534; padding: 7px 16px; font-size: 12.5px; font-weight: 700; display: flex; gap: 8px; align-items: center; border-top: 1px solid #c7efd5; }
.composer { background: var(--panel); border-top: 1px solid var(--border); padding: 8px 14px 12px; flex: none; position: relative; }
.composer-tabs { display: flex; gap: 14px; margin-bottom: 6px; }
.composer-tabs button { border: 0; background: transparent; padding: 4px 0; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.composer-tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.composer-tabs button.note.active { color: #a16207; border-bottom-color: #eab308; }
.composer-box { display: flex; gap: 8px; align-items: flex-end; }
.composer.dragging { outline: 2px dashed var(--primary); outline-offset: -4px; background: var(--primary-50, #eff6ff); }
.attach-btn { width: 40px; height: 44px; }
.attach-preview { display: flex; align-items: center; gap: 10px; padding: 8px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
.attach-preview img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }

/* Gambar yang bisa dikirim AI (tab Knowledge Sources) */
.ai-images { border-top: 1px solid var(--border); margin-top: 22px; padding-top: 18px; }
.img-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-bottom: 14px; }
.img-card { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.img-card img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; display: block; }
.img-add { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px dashed var(--border-strong); border-radius: 12px; background: var(--panel-2); }
.img-drop { width: 96px; height: 96px; flex: none; border: 1px dashed var(--border-strong); border-radius: 10px; background: var(--panel); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); padding: 0; overflow: hidden; }
.img-drop:hover { border-color: var(--primary); color: var(--primary); }
.img-drop img { width: 100%; height: 100%; object-fit: cover; }
.composer textarea { flex: 1; border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 12px; resize: none; min-height: 44px; max-height: 160px; outline: none; }
.composer textarea:focus { border-color: var(--primary); }
.composer.note-mode textarea { background: var(--yellow-50); border-color: #f3d77a; }
.qr-pop { position: absolute; bottom: calc(100% - 4px); left: 14px; right: 14px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 260px; overflow-y: auto; z-index: 5; }
.qr-pop div { padding: 9px 14px; cursor: pointer; border-bottom: 1px solid #f1f3f7; }
.qr-pop div:hover, .qr-pop div.sel { background: var(--primary-50); }
.qr-pop b { color: var(--primary); }

.chat-detail { background: var(--panel); border-left: 1px solid var(--border); overflow-y: auto; min-height: 0; }
.detail-sec { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.detail-sec h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; }
.chip button { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0; line-height: 1; opacity: 0.85; }
.order-card { border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; margin-bottom: 8px; background: var(--panel-2); }
.order-card .on { font-weight: 800; font-size: 12.5px; }
.progress { height: 6px; background: #e6eaf2; border-radius: 999px; overflow: hidden; margin-top: 6px; }
.progress i { display: block; height: 100%; background: var(--primary); }

/* ---------- connected platforms ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 20px; align-items: start; }
.inbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.inbox-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 18px 14px; text-align: center; cursor: pointer; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 160px; justify-content: center; }
.inbox-card:hover { border-color: var(--primary-100); }
.inbox-card.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.inbox-card.create { background: var(--primary); color: #fff; border-color: var(--primary); }
.inbox-card.create:hover { background: var(--primary-600); }
.inbox-card .ib-name { font-weight: 800; }
.platform-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 170px)); gap: 16px; justify-content: center; }
.platform-card { border: 1px solid var(--border); border-radius: 16px; padding: 22px 10px; text-align: center; cursor: pointer; background: #fff; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 10px; position: relative; }
.platform-card:hover { border-color: var(--primary); }
.platform-card.disabled { cursor: not-allowed; opacity: 0.6; }
.platform-card .badge { position: absolute; top: 8px; right: 8px; }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.qr-box img { width: 260px; height: 260px; border: 1px solid var(--border); border-radius: 12px; padding: 8px; background: #fff; }
.steps { text-align: left; margin: 0; padding-left: 20px; color: var(--muted); }
.steps li { margin: 3px 0; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ---------- AI agent ---------- */
.ai-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.test-chat { position: sticky; top: 0; display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - 130px); min-height: 420px; }
.test-chat .messages { background: #f6f8fc; padding: 14px; }
.test-chat .msg { max-width: 88%; }
.tool-card { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: #fff; margin-bottom: 12px; }
.tool-card .tool-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex: none; }

/* ---------- settings grid ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.setting-card { display: flex; gap: 14px; align-items: center; padding: 16px; cursor: pointer; }
.setting-card:hover { border-color: var(--primary-100); }
.setting-card .s-icon { width: 42px; height: 42px; border-radius: 11px; background: var(--panel-2); border: 1px solid var(--border); display: grid; place-items: center; color: #475569; flex: none; }
.setting-card h4 { margin: 0; font-size: 14.5px; }
.setting-card p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.section-title { font-size: 15px; margin: 22px 0 10px; }

.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; }
.swatches button.sel { box-shadow: 0 0 0 2px var(--text); }

@media (max-width: 1180px) {
  .chat { grid-template-columns: 300px 1fr; }
  .chat .chat-detail { display: none; }
  .split, .ai-layout { grid-template-columns: 1fr; }
  .test-chat { position: static; height: 520px; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .chat { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ---------- CSAT, angka ringkasan (stat tile), meter ---------- */
.csat-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.wa-preview { background: #efeae2; border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.wa-bubble { max-width: 85%; padding: 7px 10px; border-radius: 8px; font-size: 13px; white-space: pre-wrap; box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13); }
.wa-bubble.out { align-self: flex-end; background: #d9fdd3; }
.wa-bubble.in { align-self: flex-start; background: #fff; }
.section-bar { display: flex; align-items: center; gap: 10px; margin: 24px 0 12px; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; cursor: pointer; font-weight: 700; color: var(--muted); font-size: 12.5px; }
.seg button.active { background: var(--primary-50); color: var(--primary); }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-tile { padding: 14px 16px; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 28px; font-weight: 800; margin-top: 2px; line-height: 1.2; }
.stat-unit { font-size: 14px; font-weight: 600; color: var(--muted); }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.csat-results { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.meter-list { display: flex; flex-direction: column; gap: 10px; }
.meter-row { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; }
.meter-name { font-weight: 700; white-space: nowrap; }
.meter-track { height: 8px; border-radius: 999px; background: var(--primary-50); overflow: hidden; display: block; }
.meter-fill { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.meter-fig { font-size: 12.5px; white-space: nowrap; min-width: 64px; text-align: right; }
.stars-on { color: #f59e0b; letter-spacing: 1px; }
@media (max-width: 1100px) {
  .csat-layout, .csat-results { grid-template-columns: 1fr; }
}

/* ---------- Tickets (papan Kanban) ---------- */
.avatar.xs { width: 22px; height: 22px; font-size: 9.5px; }
.tk-page { max-width: none; }
.tk-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tk-search { display: flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--border-strong); border-radius: 9px; padding: 0 10px; color: var(--muted); min-width: 260px; }
.tk-search input { border: 0; outline: none; padding: 8px 0; background: transparent; flex: 1; min-width: 0; color: var(--text); }
.tk-search:focus-within { border-color: var(--primary); }
.tk-filter { width: auto; min-width: 140px; }
.select-sm { padding: 4px 8px; font-size: 12.5px; width: auto; }
.tk-board { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; padding-bottom: 10px; }
.tk-col { flex: 0 0 280px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column;
  max-height: calc(100vh - var(--topbar-h) - 190px); transition: border-color 0.15s; }
.tk-col.over { border-color: var(--stage); }
.tk-col-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 11px 11px 0 0;
  background: color-mix(in srgb, var(--stage) 16%, #fff); border-bottom: 2px solid var(--stage); }
.tk-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--stage); flex: none; }
.tk-count { background: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 800; color: var(--muted); }
.tk-col-sub { font-size: 12px; color: var(--muted); padding: 6px 12px 0; font-weight: 700; }
.tk-col-body { overflow-y: auto; padding: 8px 10px 12px; display: flex; flex-direction: column; gap: 8px; min-height: 90px; }
.tk-empty { border: 1px dashed var(--border-strong); border-radius: 10px; padding: 18px 8px; text-align: center; color: var(--faint); font-size: 12.5px; }
.tk-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 11px; cursor: grab; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 5px; }
.tk-card:hover { border-color: var(--primary-100); }
.tk-card.dragging { opacity: 0.4; }
.tk-title { font-weight: 800; line-height: 1.3; word-break: break-word; }
.tk-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.tk-meta b { color: var(--text); }
.tk-meta span { display: inline-flex; align-items: center; gap: 3px; }
.overdue, .tk-meta .overdue { color: var(--red); font-weight: 700; }
.tk-drop-line { height: 3px; border-radius: 3px; background: var(--primary); margin: -2px 0; }
.prio-low { background: #f1f5f9; color: #475569; }
.prio-medium { background: var(--primary-50); color: var(--primary); }
.prio-high { background: var(--orange-50); color: var(--orange); }
.prio-urgent { background: var(--red-50); color: var(--red); }
.badge-type { background: #f1f5f9; color: #334155; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tk-form { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; }
.tk-side { background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 12px 2px; align-self: start; }
.tk-meta-info { border-top: 1px solid var(--border); padding: 10px 0 12px; display: grid; gap: 2px; }
.contact-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px; }
.picker { position: relative; }
.picker-pop { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); z-index: 20; max-height: 260px; overflow-y: auto; }
.picker-pop > div { padding: 8px 12px; cursor: pointer; }
.picker-pop > div:hover { background: var(--panel-2); }
.tk-activity { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.tk-activity h4 { margin: 0 0 8px; font-size: 13.5px; }
.tk-act { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.tk-act:last-child { border-bottom: 0; }
.tk-comment { white-space: pre-wrap; margin: 4px 0 0 28px; background: var(--yellow-50); border-radius: 8px; padding: 6px 9px; }
.stage-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.stage-row .input { flex: 1; min-width: 140px; }
.stage-colors { display: flex; gap: 3px; }
.stage-colors button { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; padding: 0; }
.stage-colors button.sel { box-shadow: 0 0 0 2px var(--text); }
.ticket-mini { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; margin-bottom: 6px; }
.ticket-mini:hover { background: var(--panel-2); }
.ticket-mini .tk-dot { background: var(--stage); }
@media (max-width: 900px) {
  .tk-form { grid-template-columns: 1fr; }
}

/* ---------- Siapa yang dibalas AI ---------- */
.audience { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 18px; background: var(--panel-2); }
.blocked-list { display: flex; flex-wrap: wrap; gap: 6px; }
.blocked-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--border-strong); border-radius: 999px; padding: 3px 6px 3px 10px; font-size: 12.5px; }
.blocked-chip button { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 2px; }
.blocked-chip button:hover { color: var(--red); }
.qr-thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); flex: none; }

/* ---------- Analytics (grafik HTML/CSS) ---------- */
.an-page .kpi-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.an-page.refetch .kpi-row, .an-page.refetch .an-grid, .an-page.refetch .table { opacity: 0.55; transition: opacity 0.2s; }
.an-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.an-title { margin: 0 0 12px; font-size: 14.5px; }
.delta-up { color: #006300; font-weight: 700; }
.delta-down { color: #d03b3b; font-weight: 700; }
.cc { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: var(--plot-h) auto; column-gap: 8px; margin-top: 18px; }
.cc-y { position: relative; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.cc-y span { position: absolute; right: 0; transform: translateY(50%); line-height: 1; }
.cc-plot { position: relative; }
.cc-grid { position: absolute; left: 0; right: 0; height: 1px; background: #eceef3; }
.cc-grid.base { background: #c9ced8; }
.cc-bands { position: absolute; inset: 0; display: flex; }
.cc-band { flex: 1 1 0; min-width: 0; display: flex; align-items: flex-end; justify-content: center; position: relative; outline: none; border-radius: 4px 4px 0 0; }
.cc-band.on { background: rgba(47, 111, 237, 0.07); }
.cc-band:focus-visible { box-shadow: inset 0 0 0 2px var(--primary-100); }
.cc-bar { width: min(24px, 72%); background: var(--primary); border-radius: 4px 4px 0 0; }
.cc-band.on .cc-bar { background: var(--primary-600); }
.cc-tip { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 6px; background: #111827; color: #fff; padding: 6px 9px;
  border-radius: 8px; font-size: 12px; white-space: nowrap; z-index: 5; pointer-events: none; box-shadow: var(--shadow-lg); font-weight: 400; }
.cc-tip b { font-size: 13px; }
.cc-tip.left { left: 0; transform: none; }
.cc-tip.right { left: auto; right: 0; transform: none; }
.cc-tip-sub { opacity: 0.75; font-size: 11px; margin-top: 1px; }
.cc-x { display: flex; margin-top: 6px; }
.cc-x span { flex: 1 1 0; width: 0; min-width: 0; display: flex; justify-content: center; white-space: nowrap; font-size: 11px; color: var(--faint); }
.link-btn { border: 0; background: transparent; color: var(--primary); font-size: 12px; padding: 0; margin-top: 10px; cursor: pointer; font-weight: 700; }
.table-sm th, .table-sm td { padding: 6px 10px; }
.an-table-wrap { max-height: 230px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; margin-top: 8px; }
.segbar { display: flex; gap: 2px; height: 28px; }
.segbar-part { height: 100%; border-radius: 4px; display: flex; align-items: center; padding-left: 8px; font-size: 12px; font-weight: 800; min-width: 3px;
  position: relative; outline: none; box-sizing: border-box; }
.segbar-part:hover, .segbar-part:focus-visible { filter: brightness(1.08); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend b { color: var(--text); margin-left: 3px; }
.an-tickets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.an-tickets div { display: flex; flex-direction: column; gap: 2px; }
.an-tickets b { font-size: 16px; }
.rank-list { display: flex; flex-direction: column; gap: 10px; }
.rank-row { display: grid; grid-template-columns: minmax(90px, 170px) 1fr auto; gap: 10px; align-items: center; }
.rank-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; font-size: 13px; }
.rank-name i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.rank-track { height: 10px; display: block; }
.rank-fill { display: block; height: 100%; background: var(--primary); border-radius: 0 4px 4px 0; min-width: 2px; }
.rank-fig { font-size: 12.5px; font-variant-numeric: tabular-nums; min-width: 28px; text-align: right; }
@media (max-width: 1100px) {
  .an-grid { grid-template-columns: 1fr; }
}
.bh-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.bh-days { display: inline-flex; gap: 4px; }
.bh-days button { border: 1px solid var(--border-strong); background: var(--panel); border-radius: 8px; padding: 5px 9px; font-weight: 700; font-size: 12.5px; cursor: pointer; color: var(--muted); }
.bh-days button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.bh-time { width: auto; display: inline-block; padding: 5px 8px; margin-left: 4px; }

/* ---------- Broadcast ---------- */
.bc-progress { height: 8px; border-radius: 999px; background: var(--primary-50); overflow: hidden; margin-bottom: 4px; }
.bc-progress span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.bc-form { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; }
.bc-h { margin: 6px 0 8px; font-size: 13.5px; }
.bc-aud { display: flex; flex-direction: column; gap: 8px; }
.bc-aud label { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.bc-days { width: 80px; padding: 4px 8px; display: inline-block; }
.bc-labels { display: flex; flex-wrap: wrap; gap: 6px; margin-left: 22px; }
.bc-label { border: 1px solid var(--border-strong); background: var(--panel); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; font-weight: 700; cursor: pointer; color: var(--muted); }
.bc-label.on { color: #fff; }
.bc-count { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--primary-50); color: #1e3a8a; }
.bc-test { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
@media (max-width: 900px) { .bc-form { grid-template-columns: 1fr; } }

/* ---------- Iklan & sumber chat ---------- */
.src-badge { background: #fff4e5; color: #9a3412; border-radius: 999px; padding: 0 7px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.ads-filter { font-size: 15px; filter: grayscale(1); opacity: 0.6; }
.ads-filter.on { filter: none; opacity: 1; background: var(--orange-50); }
.ads-how { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; }
.ads-steps { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.ads-link { display: block; margin-top: 4px; word-break: break-all; background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; font-size: 11.5px; }
.ads-spend { width: 120px; display: inline-block; padding: 4px 8px; text-align: right; }
@media (max-width: 900px) { .ads-how { grid-template-columns: 1fr; } }

/* ---------- Notifikasi tim ---------- */
.tn-rule { margin-bottom: 12px; }
.tn-to { display: flex; flex-wrap: wrap; gap: 6px; }
.tn-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; cursor: pointer; background: var(--panel); }
.tn-chip.on { border-color: var(--primary); background: var(--primary-50); color: var(--primary); font-weight: 700; }
.tn-chip input { margin: 0; }

/* ---------- Pengingat ---------- */
.msg.out.reminder .bubble { background: #fff4e0; color: #7c2d12; border: 1px solid #fcd9a4; }
.badge-err { background: var(--red-50); color: var(--red); }
.nav a .badge-count.badge-soft { background: var(--orange-50); color: #9a3412; }
a.toast { display: block; color: #fff; text-decoration: none; cursor: pointer; }
a.toast:hover { filter: brightness(1.12); }
.rm-day { padding: 9px 16px; background: var(--panel-2); border-bottom: 1px solid var(--border); font-size: 12.5px; font-weight: 800; color: var(--muted); }
.rm-day.waiting { background: var(--orange-50); color: #9a3412; }
.rm-row { display: flex; gap: 14px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.card > .rm-row:last-child, .card > div:last-child > .rm-row:last-child { border-bottom: 0; }
.rm-time { width: 104px; flex: none; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.rm-time b { font-size: 15px; }
.rm-text { margin: 3px 0; white-space: pre-wrap; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rm-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex: none; max-width: 360px; }
.rm-err { color: var(--red); }
.rm-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip-btn { border: 1px solid var(--border-strong); background: var(--panel); border-radius: 999px; padding: 3px 11px; font-size: 12.5px; font-weight: 700; cursor: pointer; color: var(--muted); }
.chip-btn:hover { border-color: var(--primary); color: var(--primary); }
.chip-btn.on { border-color: var(--primary); background: var(--primary-50); color: var(--primary); }
.rm-preview { margin: -4px 0 14px; padding: 10px 12px; background: #efeae2; border-radius: 10px; display: flex; flex-direction: column; }
.rm-preview .msg { max-width: 92%; align-self: flex-end; }
.rm-mini { border: 1px solid #fcd9a4; background: #fffaf2; border-radius: 8px; padding: 7px 9px; margin-bottom: 6px; }
.rm-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 2px 0; }
.rm-past { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) {
  .rm-row { flex-wrap: wrap; }
  .rm-actions { max-width: none; justify-content: flex-start; }
}

/* ---------- Kolaborator, @sebut & notifikasi pribadi ---------- */
.nb { position: relative; display: inline-flex; }
.nb-btn { position: relative; }
.nb-count { position: absolute; top: 0; right: 0; transform: translate(35%, -25%); background: var(--red); color: #fff; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; line-height: 1; }
.nb-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 370px; max-width: calc(100vw - 24px); z-index: 50; padding: 0; overflow: hidden; box-shadow: var(--shadow-lg); }
.nb-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.nb-list { max-height: 420px; overflow-y: auto; }
.nb-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-bottom: 1px solid #f1f3f7; cursor: pointer; }
.nb-item:hover { background: var(--panel-2); }
.nb-item.unread { background: #f5f8ff; }
.nb-item.unread:hover { background: var(--primary-50); }
.nb-ic { font-size: 17px; line-height: 1.3; }
.nb-text { font-size: 13px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nb-item.unread .nb-text { font-weight: 700; }
.nb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex: none; margin-top: 6px; }
.nb-empty { padding: 22px 18px; color: var(--muted); text-align: center; font-size: 13px; }
.nb-foot { padding: 9px 14px; border-top: 1px solid var(--border); background: var(--panel-2); }
.collab-badge { font-size: 12px; line-height: 1; }
.collab-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.collab-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 6px 2px 2px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--panel); }
.collab-chip button { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 2px; }
.collab-chip button:hover { color: var(--red); }
.lock-bar { display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: var(--primary-50); border: 1px solid var(--primary-100); color: #1e3a8a; border-radius: 10px; font-size: 13px; }
.lock-bar .btn { flex: none; }
.bubble .mention, .mention { color: var(--primary); font-weight: 800; }
.mention-pop > div { display: flex; align-items: center; gap: 8px; }
.mention-pop > div:first-child { cursor: default; }
.mention-pop > div:first-child:hover { background: transparent; }
.mention-pop .avatar { padding: 0; border-bottom: 0; flex: none; }
@media (max-width: 900px) { .lock-bar { flex-wrap: wrap; } }
.composer-tabs button { white-space: nowrap; }

/* ---------- Simulator Pelanggan (tema kuning untuk pelanggan) ---------- */
:root {
  --sim-yellow: #facc15;
  --sim-yellow-600: #eab308;
  --sim-yellow-200: #fef08a;
  --sim-yellow-100: #fef9c3;
  --sim-ink: #422006;
  --sim-wall: #fffbeb;
}
.sim-pill { display: inline-flex; align-items: center; gap: 3px; background: var(--sim-yellow-100); color: #854d0e; border: 1px solid #fde047;
  border-radius: 999px; padding: 0 7px; font-size: 11px; font-weight: 800; white-space: nowrap; vertical-align: middle; }
.page-head h1 .sim-pill { font-size: 12px; padding: 2px 9px; margin-left: 6px; }
.sim-bar { display: flex; gap: 8px; align-items: center; background: var(--sim-yellow-100); color: #713f12; border-bottom: 1px solid #fde047;
  padding: 7px 16px; font-size: 12.5px; }
.sim-bar a { color: #854d0e; font-weight: 800; text-decoration: underline; }
.sim-warn { background: var(--orange-50); color: #92400e; border: 1px solid #fde3b5; border-radius: var(--radius-sm); padding: 9px 14px; margin-bottom: 14px; font-size: 13px; }

.sim-grid { display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); gap: 22px; align-items: start; }
.sim-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.sim-phone { display: flex; flex-direction: column; height: clamp(520px, calc(100vh - var(--topbar-h) - 150px), 780px);
  border: 10px solid #1f2937; border-radius: 34px; overflow: hidden; background: var(--sim-wall); box-shadow: var(--shadow-lg); }
.sim-top { display: flex; align-items: center; gap: 10px; background: var(--sim-yellow); color: var(--sim-ink); padding: 12px 14px; }
.sim-title { font-weight: 800; font-size: 15px; line-height: 1.2; }
.sim-status { font-size: 12px; opacity: 0.8; min-height: 16px; }
.sim-as { font-size: 11px; background: rgba(255, 255, 255, 0.55); border-radius: 999px; padding: 2px 8px; max-width: 150px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sim-avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 800;
  background: var(--sim-yellow); color: var(--sim-ink); border: 2px solid #fde047; }
.sim-avatar.biz { width: 36px; height: 36px; background: #fff; border-color: rgba(66, 32, 6, 0.15); font-size: 12.5px; }

.sim-wall { flex: 1; overflow-y: auto; padding: 12px 12px 6px; display: flex; flex-direction: column; gap: 4px;
  background-color: var(--sim-wall); background-image: radial-gradient(rgba(202, 138, 4, 0.12) 1px, transparent 1px); background-size: 16px 16px; }
.sim-note { align-self: center; text-align: center; background: var(--sim-yellow-100); color: #713f12; font-size: 11.5px;
  border-radius: 8px; padding: 6px 10px; max-width: 92%; margin-bottom: 6px; }
.sim-empty { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; color: #713f12;
  font-size: 13px; max-width: 240px; }
.sim-day { align-self: center; margin: 6px 0; }
.sim-day span { background: #fff; color: var(--muted); font-size: 11px; font-weight: 700; border-radius: 7px; padding: 3px 9px; box-shadow: var(--shadow); }
.sim-msg { display: flex; }
.sim-msg.me { justify-content: flex-end; }
.sim-bubble { max-width: 82%; padding: 6px 9px 4px; border-radius: 10px; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08); font-size: 13.5px;
  line-height: 1.42; overflow-wrap: anywhere; }
.sim-msg.me .sim-bubble { background: var(--sim-yellow-200); color: var(--sim-ink); border-top-right-radius: 3px; }
.sim-msg.them .sim-bubble { background: #fff; color: var(--text); border-top-left-radius: 3px; }
.sim-from { font-size: 10.5px; font-weight: 800; color: var(--faint); margin-bottom: 1px; }
.sim-text { white-space: pre-wrap; }
.sim-img { display: block; max-width: 100%; max-height: 260px; border-radius: 7px; margin-bottom: 3px; }
.sim-meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-size: 10.5px; color: var(--faint); margin-top: 1px; }
.sim-msg.me .sim-meta { color: #a16207; }
.sim-tick { letter-spacing: -3px; font-weight: 800; padding-right: 3px; }
.sim-tick.read { color: #2563eb; }
.sim-typing { display: flex; gap: 4px; padding: 11px 13px; }
.sim-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: sim-dot 1.2s infinite ease-in-out; }
.sim-typing span:nth-child(2) { animation-delay: 0.15s; }
.sim-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes sim-dot { 0%, 60%, 100% { opacity: 0.35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.sim-attach { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--sim-yellow-100); border-top: 1px solid #fde047; color: #713f12; }
.sim-attach img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.sim-compose { display: flex; align-items: flex-end; gap: 6px; padding: 8px; background: #fef3c7; }
.sim-input { flex: 1; resize: none; border: 0; border-radius: 20px; padding: 9px 14px; background: #fff; outline: none; max-height: 120px;
  line-height: 1.4; font-size: 13.5px; }
.sim-input:focus { box-shadow: 0 0 0 2px var(--sim-yellow-600); }
.sim-round { width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; flex: none;
  background: var(--sim-yellow); color: var(--sim-ink); }
.sim-round:hover { background: var(--sim-yellow-600); }
.sim-round:disabled { opacity: 0.5; cursor: not-allowed; }
.sim-round.ghost { background: transparent; color: #854d0e; }
.sim-round.ghost:hover { background: rgba(250, 204, 21, 0.35); }

.sim-state { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--panel-2); border: 1px solid var(--border); font-size: 13px; }
.sim-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.sim-chip:hover { border-color: var(--sim-yellow-600); color: #854d0e; background: var(--sim-yellow-100); }
.sim-events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sim-events li { display: flex; gap: 10px; font-size: 12.5px; padding: 7px 10px; border-radius: 8px; background: var(--panel-2);
  border: 1px solid var(--border); white-space: pre-line; overflow-wrap: anywhere; }
.sim-info { background: var(--sim-yellow-100); border: 1px solid #fde047; border-radius: var(--radius); padding: 14px 16px; color: #713f12; font-size: 13px; }
.sim-info ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }

@media (max-width: 900px) {
  .sim-grid { grid-template-columns: 1fr; }
  .sim-phone { height: 560px; border-width: 6px; border-radius: 24px; }
}

/* ---------- Tampilan HP (<= 760px): dipakai juga saat dibuka dari menu Chat Pelanggan di aplikasi USB Bali ---------- */
.chat-back { display: none; }
@media (max-width: 760px) {
  html, body { overflow-x: hidden; }
  .app, .app.collapsed { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; height: 100vh; height: 100dvh; }
  .main { grid-row: 1; grid-column: 1; }
  /* menu samping -> bilah menu di bawah (ikon saja, bisa digeser) */
  .sidebar { display: flex; flex-direction: row; grid-row: 2; grid-column: 1; border-right: 0; border-top: 1px solid var(--border); overflow-x: auto; }
  .sidebar .brand, .nav-section { display: none; }
  .nav, .sidebar-foot.nav { flex: none; flex-direction: row; overflow: visible; padding: 4px 6px; gap: 0; border-top: 0; }
  .nav a, .app.collapsed .nav a { flex-direction: column; justify-content: center; gap: 2px; padding: 6px 12px; min-width: 56px; font-size: 10.5px; }
  .nav a span:not(.badge-count):not(.status-dot), .app.collapsed .nav a span { display: block; max-width: 64px; }
  .nav a .badge-count { position: absolute; top: 2px; right: 6px; margin: 0; }
  .nav a .status-dot { position: absolute; top: 6px; right: 12px; margin: 0 !important; }
  /* bilah atas diringkas */
  .topbar { padding: 0 10px; gap: 8px; }
  .topbar > .icon-btn:first-child, .topbar .pill-info, .topbar .small.muted { display: none; }
  .topbar .row > div:last-child { display: none; }
  .topbar .pill-outline { padding: 4px 8px; font-size: 11.5px; min-width: 0; max-width: 46vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .page { padding: 14px 12px; }
  /* daftar chat dan percakapan bergantian (".chat.no-detail" lebih spesifik daripada ".chat", jadi harus ditimpa juga) */
  .chat, .chat.no-detail { grid-template-columns: minmax(0, 1fr); }
  .chat.no-detail .chat-main { display: none; }
  .chat:not(.no-detail) .chat-list { display: none; }
  .chat-back { display: inline-flex; align-items: center; flex: none; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border-strong); color: var(--primary); font-weight: 700; font-size: 12.5px; }
  .chat-head { padding: 8px 10px; gap: 8px; }
  .messages { padding: 12px; }
  .settings-grid, .img-list, .inbox-grid { grid-template-columns: minmax(0, 1fr); }
  .kpi-row, .an-page .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .an-grid, .csat-layout, .csat-results, .tk-form { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  /* kepala percakapan: baris 1 = Daftar + avatar + nama, baris 2 = tombol aksi */
  .chat-head { flex-wrap: wrap; row-gap: 6px; }
  .chat-head .grow { flex: 1 1 calc(100% - 130px); min-width: 0; }
  .chat-head > .row, .chat-head > .btn, .chat-head > .btn-group { flex: none; }
}
