/* CS Bot Admin — "Warm Bilingual" theme */
:root {
  --bg: #f7f2ec; --surface: #fffdfb; --surface-2: #f1eae2; --surface-3: #e4dbd0; --line: #f1eae2; --line-2: #e4dbd0;
  --text: #2b2520; --muted: #7a6e64; --faint: #a3968b;
  --accent: #c4541b; --accent-600: #9a3f12; --accent-soft: #fde2cf; --accent-soft-2: #fbf0e8;
  --ok: #1f6b35; --ok-bg: #e3f4e6; --warn: #9a5b12; --warn-bg: #fdebd6; --danger: #8a2d4b; --danger-bg: #fbe3ea;
  --note-bg: #fff7e0; --note-line: #f5dc9a; --purple: #4b3a86; --purple-bg: #e8e3f6;
  --radius: 18px; --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .05), 0 6px 20px rgba(60, 40, 20, .06);
  --shadow-lg: 0 10px 40px rgba(60, 40, 20, .18);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14.5px/1.5 "Kantumruy Pro", "Khmer UI", "Segoe UI", system-ui, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; } a:hover { color: var(--accent-600); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0 0 8px; font-weight: 700; }
h1 { font-size: 24px; letter-spacing: -.01em; line-height: 1.1; } h2 { font-size: 17px; } h3 { font-size: 13px; color: var(--faint); font-weight: 600; }
[hidden] { display: none !important; }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
svg.i.sm { width: 16px; height: 16px; }

/* ── Layout ─────────────────────────────── */
#app { display: flex; min-height: 100vh; }
#sidebar { width: 250px; flex-shrink: 0; display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; background: var(--bg); }
#sidebar .brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 18px; }
#sidebar .brand .logo { width: 40px; height: 40px; border-radius: 14px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgba(196, 84, 27, .35); flex-shrink: 0; }
#sidebar .brand b { display: block; font-size: 16px; line-height: 1.2; }
#sidebar .brand small { display: block; font-size: 12.5px; color: var(--faint); }
#sidebar nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
#sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--muted); }
#sidebar nav a:hover { background: rgba(255, 253, 251, .7); color: var(--text); }
#sidebar nav a.active { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 14px rgba(60, 40, 20, .06); }
#sidebar nav a .en { font-size: 14.5px; font-weight: 600; line-height: 1.15; }
#sidebar nav a .kh { font-size: 12px; opacity: .75; line-height: 1.3; }
#sidebar nav a .cnt { margin-left: auto; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
#sidebar .user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); }
#sidebar .user b { display: block; font-size: 14px; }
#sidebar .user small { color: var(--faint); font-size: 12px; }
#sidebar .user button { margin-left: auto; }
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#topbar { display: flex; align-items: center; gap: 16px; padding: 22px 24px 6px 8px; flex-wrap: wrap; }
#topbar .titles { flex: 1; min-width: 160px; }
#page-sub { font-size: 13.5px; color: var(--faint); }
#content { padding: 14px 24px 24px 8px; flex: 1; }
#menu-btn { display: none; }
.pw-warn { margin: 14px 24px 0 8px; background: var(--warn-bg); color: var(--warn); padding: 10px 16px; font-size: 13.5px; border-radius: var(--radius-sm); }
.pw-warn.danger { background: var(--danger-bg); color: var(--danger); }

/* ── Components ─────────────────────────── */
.card { background: var(--surface); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card.tight { padding: 0; overflow: hidden; }
.card h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.card h2 .spacer, .row .spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.kpi { background: var(--surface); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .lbl { color: var(--faint); font-size: 13px; font-weight: 600; }
.kpi .val { font-size: 28px; font-weight: 700; margin-top: 2px; line-height: 1.15; }
.kpi .sub { color: var(--faint); font-size: 12.5px; }
.kpi.warn .val { color: var(--warn); } .kpi.ok .val { color: var(--ok); } .kpi.danger .val { color: var(--danger); } .kpi.primary .val { color: var(--accent); }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--radius-sm); border: 0; background: var(--surface-2); cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text); white-space: nowrap; }
.btn:hover { background: var(--surface-3); } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #fff; } .btn.primary:hover { background: var(--accent-600); }
.btn.danger { background: var(--danger-bg); color: var(--danger); } .btn.danger:hover { background: #f6d3de; }
.btn.ok { background: var(--ok-bg); color: var(--ok); } .btn.ok:hover { background: #d2ecd7; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.ghost { background: transparent; } .btn.ghost:hover { background: var(--surface-2); }
.btn.icon { width: 40px; padding: 0; justify-content: center; } .btn.icon.sm { width: 32px; }
.input, select.input, textarea.input { width: 100%; padding: 10px 14px; border: 1.5px solid transparent; border-radius: var(--radius-sm); background: var(--bg); outline: none; }
.card .input, #modal .input { background: var(--bg); }
.input:focus { border-color: var(--accent); background: var(--surface); }
select.input { padding-right: 32px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a6e64' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
textarea.input { min-height: 96px; resize: vertical; }
label.f { display: block; margin-bottom: 14px; } label.f > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.hint { color: var(--faint); font-size: 12.5px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6; }
.badge.active { background: var(--ok-bg); color: var(--ok); } .badge.waiting { background: var(--warn-bg); color: var(--warn); }
.badge.ended { background: var(--surface-2); color: var(--faint); } .badge.blocked { background: var(--danger-bg); color: var(--danger); }
.badge.tag { background: var(--accent-soft-2); color: var(--accent); margin-right: 4px; }
.badge.super { background: var(--purple-bg); color: var(--purple); } .badge.agent { background: #e0ecf8; color: #234d7a; }
.badge.pending { background: var(--warn-bg); color: var(--warn); } .badge.sending { background: #e0ecf8; color: #234d7a; }
.badge.done { background: var(--ok-bg); color: var(--ok); } .badge.cancelled { background: var(--surface-2); color: var(--faint); }
.badge.in { background: var(--surface-2); color: var(--muted); } .badge.out { background: var(--accent-soft-2); color: var(--accent); } .badge.note { background: var(--note-bg); color: var(--warn); } .badge.system { background: var(--purple-bg); color: var(--purple); }
.badge.ERROR, .badge.CRITICAL { background: var(--danger-bg); color: var(--danger); } .badge.WARNING { background: var(--warn-bg); color: var(--warn); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: 12.5px; color: var(--faint); font-weight: 600; background: transparent; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--bg); }
.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .mono, .mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.tbl-wrap { overflow-x: auto; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 14px; color: var(--faint); font-size: 13px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { width: auto; min-width: 220px; background: var(--surface); box-shadow: var(--shadow); }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 6px 14px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.tabs a.active { background: var(--accent); color: #fff; }
.empty { color: var(--faint); text-align: center; padding: 34px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { width: 40px; height: 22px; margin: 0; appearance: none; background: var(--surface-3); border-radius: 11px; position: relative; cursor: pointer; transition: .15s; }
.switch input:checked { background: var(--ok); }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked::after { left: 21px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-600); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.av1 { background: #e0ecf8; color: #234d7a; } .avatar.av2 { background: #e8e3f6; color: #4b3a86; } .avatar.av3 { background: #dff2ea; color: #1f6b52; }
.avatar.av4 { background: #fbe3ea; color: #8a2d4b; } .avatar.av5 { background: #f1eae2; color: #7a6e64; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); font-size: 13.5px; font-weight: 600; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #2f9e4f; } .pill.off { background: var(--danger-bg); color: var(--danger); } .pill.off .dot { background: #c2415f; }
.pill .live { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); margin-left: 2px; opacity: .5; }
.pill .live.on { background: #2f9e4f; opacity: 1; box-shadow: 0 0 0 3px rgba(47, 158, 79, .2); animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(47, 158, 79, .2); } 50% { box-shadow: 0 0 0 6px rgba(47, 158, 79, .05); } }
.typing-tag { font-size: 11.5px; color: var(--accent); font-weight: 600; white-space: nowrap; }
.typing-bar { padding: 6px 18px; font-size: 13px; color: var(--accent); background: var(--accent-soft-2); border-bottom: 1px solid var(--line); }
.new-divider { align-self: stretch; text-align: center; font-size: 11.5px; color: var(--accent); font-weight: 600; margin: 4px 0; display: flex; align-items: center; gap: 10px; }
.new-divider::before, .new-divider::after { content: ""; flex: 1; border-top: 1px dashed var(--accent-soft); }
.jump-new { position: absolute; left: 50%; transform: translateX(-50%); bottom: 130px; box-shadow: var(--shadow-lg); z-index: 3; }
.inbox .thread { position: relative; }
.pre { white-space: pre-wrap; word-break: break-word; }
.media-thumb { max-width: 260px; max-height: 260px; border-radius: 12px; display: block; }
.dropzone { border: 2px dashed var(--line-2); border-radius: 14px; padding: 16px; text-align: center; color: var(--faint); cursor: pointer; }
.dropzone:hover { border-color: var(--accent); color: var(--accent); }
.chart-box { position: relative; height: 240px; }
.kb-phone { background: #17212b; border-radius: 14px; padding: 10px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.kb-input { background: #242f3d; color: #7d8b99; border-radius: 8px; padding: 8px 12px; font-size: 13.5px; margin-bottom: 4px; }
.kb-row { display: flex; gap: 6px; }
.kb-btn { flex: 1; background: #2b3947; color: #fff; text-align: center; padding: 9px 8px; border-radius: 8px; font-size: 14px; font-weight: 600; }
.kb-btn.off { opacity: .35; text-decoration: line-through; }
.search { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); color: var(--faint); }
.search input { flex: 1; border: 0; background: transparent; outline: none; color: var(--text); min-width: 0; }

/* ── Inbox ──────────────────────────────── */
.inbox { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; height: calc(100vh - 118px); }
.inbox .list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; padding: 12px; }
.inbox .list .filters { padding: 0 0 10px; }
.inbox .list .filters .tabs { margin: 0 0 10px; }
.inbox .list .filters .tabs a { padding: 5px 12px; font-size: 13px; }
.inbox .items { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.conv { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; cursor: pointer; }
.conv:hover { background: var(--bg); } .conv.sel { background: var(--accent-soft-2); }
.conv .meta { flex: 1; min-width: 0; }
.conv .name { font-weight: 700; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.conv .name .t { margin-left: auto; font-weight: 400; color: var(--faint); font-size: 12px; }
.conv .prev { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .unread { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.inbox .thread { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.thread .head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.thread .head .info { flex: 1; min-width: 160px; line-height: 1.3; } .thread .head .info b { font-size: 17px; } .thread .head .info small { color: var(--faint); display: block; font-size: 13px; }
.thread .msgs { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 68%; padding: 10px 14px; border-radius: 18px; background: var(--surface-2); font-size: 15px; line-height: 1.5; }
.msg .who { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.msg .time { font-size: 11.5px; color: var(--faint); text-align: right; margin-top: 3px; }
.msg .reacts:empty { display: none; }
.msg .reacts { display: flex; gap: 4px; margin-top: 4px; }
.msg .react { background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px; padding: 0 7px; font-size: 13px; line-height: 20px; }
.msg.out .react { background: rgba(255, 255, 255, .22); border-color: transparent; }
.msg.in { align-self: flex-start; border-bottom-left-radius: 6px; }
.msg.out { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.msg.out .who, .msg.out .time { color: rgba(255, 255, 255, .78); } .msg.out a { color: #fff; text-decoration: underline; }
.msg.note { align-self: center; background: var(--note-bg); border: 1px solid var(--note-line); border-radius: 14px; max-width: 80%; font-size: 13.5px; }
.msg.suggest { align-self: flex-end; background: #eef4ff; border: 1px dashed #9db4e8; color: var(--text); max-width: 72%; }
.msg.suggest .who { color: #2f4d8a; }
.msg .tr { margin-top: 4px; font-size: 13px; color: var(--muted); font-style: italic; }
.msg .tr .tr-btn { font-style: normal; font-size: 12px; color: var(--accent); }
.thread .compose .quick .chip.ai { background: #eef4ff; color: #2f4d8a; }
.thread .compose .quick .chip.ai:hover { background: #dbe6fb; }
.msg.system { align-self: center; background: var(--surface-2); color: var(--faint); font-size: 12px; padding: 3px 12px; border-radius: 999px; }
.thread .compose { border-top: 1px solid var(--line); padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; }
.thread .compose .quick { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.thread .compose .quick .chip { height: 30px; padding: 0 12px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 600; border: 0; cursor: pointer; }
.thread .compose .quick .chip:hover { background: var(--surface-3); color: var(--text); }
.thread .compose .line { display: flex; gap: 10px; align-items: flex-end; }
.thread .compose textarea { flex: 1; min-height: 48px; max-height: 160px; padding: 12px 16px; border-radius: 14px; border: 0; background: var(--bg); outline: none; resize: none; font-size: 15px; }
.thread .compose textarea:focus { box-shadow: 0 0 0 2px var(--accent-soft); }
.thread .compose .send { width: 48px; height: 48px; border-radius: 14px; padding: 0; justify-content: center; }
.thread .compose .send svg.i { width: 20px; height: 20px; }
.thread .empty { margin: auto; }
.attach-preview { display: inline-flex; align-items: center; gap: 8px; background: var(--accent-soft-2); color: var(--accent-600); padding: 4px 12px; border-radius: 999px; font-size: 13px; }

/* ── Modal / toast ──────────────────────── */
#modal-bg { position: fixed; inset: 0; background: rgba(43, 37, 32, .45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
#modal { background: var(--surface); border-radius: 22px; width: 100%; max-width: 660px; max-height: 92vh; overflow-y: auto; padding: 24px; box-shadow: var(--shadow-lg); }
#modal.wide { max-width: 920px; }
#modal h2 { margin-bottom: 16px; }
#modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--text); color: #fff; padding: 10px 16px; border-radius: 14px; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: pop .15s ease-out; max-width: 380px; }
.toast.ok { background: var(--ok); } .toast.err { background: var(--danger); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Login ──────────────────────────────── */
#login { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; overflow: hidden; }
#login::before { content: ""; position: absolute; width: 640px; height: 640px; border-radius: 50%; background: radial-gradient(circle, rgba(196, 84, 27, .16), transparent 70%); top: -200px; right: -160px; }
#login form { position: relative; background: var(--surface); padding: 34px 32px; border-radius: 24px; width: 100%; max-width: 380px; box-shadow: var(--shadow-lg); }
#login .logo { width: 56px; height: 56px; border-radius: 18px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; box-shadow: 0 8px 20px rgba(196, 84, 27, .35); }
#login .logo svg.i { width: 28px; height: 28px; }
#login h1 { text-align: center; margin-bottom: 4px; }
#login .sub { text-align: center; color: var(--faint); font-size: 13.5px; margin-bottom: 22px; }
#login .err { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; text-align: center; }

/* ── Notifications (bell) ───────────────── */
.notif-wrap { position: relative; }
#notif-btn { position: relative; }
#notif-btn.has { background: var(--accent-soft); color: var(--accent); }
.nbadge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #c2415f; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--bg); }
.notif-panel { position: absolute; right: 0; top: 46px; width: 460px; max-width: calc(100vw - 24px); max-height: min(80vh, 780px); display: flex; flex-direction: column; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); z-index: 45; overflow: hidden; border: 1px solid var(--line-2); }
.np-head { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px 12px; }
.np-ic { width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.np-title { flex: 1; min-width: 0; } .np-title b { font-size: 15px; } .np-title small { display: block; color: var(--faint); font-size: 12px; }
.np-tabs { display: flex; gap: 6px; padding: 0 18px 12px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.np-tabs a { padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; background: var(--surface-2); }
.np-tabs a.active { background: var(--accent); color: #fff; }
.np-list { overflow-y: auto; flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.np-card { background: var(--surface); border-radius: 16px; padding: 12px 14px; box-shadow: 0 1px 2px rgba(60, 40, 20, .06); cursor: pointer; border: 1px solid transparent; }
.np-card:hover { border-color: var(--line-2); }
.np-card.unread { box-shadow: inset 3px 0 0 var(--accent), 0 1px 2px rgba(60, 40, 20, .06); }
.np-card.mini { padding: 10px 12px; }
.np-top { display: flex; gap: 10px; align-items: flex-start; }
.np-who { flex: 1; min-width: 0; line-height: 1.35; } .np-who b { font-size: 14px; }
.np-emo { font-size: 18px; line-height: 1.2; }
.np-quote { font-size: 12.5px; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.np-time { text-align: right; font-size: 11.5px; color: var(--faint); white-space: nowrap; } .np-time b { display: block; color: var(--muted); font-size: 12.5px; } .np-time b.fresh { color: #c2415f; }
.np-pri { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 1px 9px; border-radius: 999px; margin-top: 3px; white-space: nowrap; }
.np-pri.urgent { background: var(--danger-bg); color: #b3264a; } .np-pri.high { background: var(--warn-bg); color: var(--warn); }
.np-pri.normal { background: #fbf1cf; color: #85650d; } .np-pri.low { background: var(--ok-bg); color: var(--ok); }
.np-box { margin-top: 10px; padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.np-box .lbl { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); margin-bottom: 3px; }
.np-msg { background: var(--accent-soft-2); box-shadow: inset 3px 0 0 var(--accent); } .np-msg i { display: block; color: var(--muted); margin-top: 4px; }
.np-why { background: #eef4ff; } .np-why .lbl { color: #2f4d8a; }
.np-why.urgent { background: #fff1f4; } .np-why.urgent .lbl { color: #b3264a; } .np-why.high { background: #fff6ea; } .np-why.high .lbl { color: var(--warn); }
.np-foot-card { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; font-size: 12.5px; }
.np-foot-card .spacer, .np-foot .spacer { flex: 1; }
.np-foot { display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 18px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--muted); }
.np-foot a { font-weight: 600; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); display: inline-block; } .live-dot.on { background: #2f9e4f; box-shadow: 0 0 0 3px rgba(47, 158, 79, .18); }
.sla-ok { color: var(--ok); font-weight: 600; } .sla-late { color: #b3264a; font-weight: 700; } .sla-done { color: var(--ok); font-weight: 600; }
.popover { position: fixed; z-index: 70; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 220px; max-width: 340px; border: 1px solid var(--line-2); max-height: 340px; overflow-y: auto; }
.popover button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 8px 10px; border: 0; background: transparent; border-radius: 10px; cursor: pointer; text-align: left; font-size: 13.5px; }
.popover button:hover { background: var(--surface-2); }
.pop-head { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); padding: 6px 10px 4px; }
.avatar.xs { width: 22px; height: 22px; font-size: 9.5px; }
.toast.warn { background: #9a5b12; } .toast.click { cursor: pointer; }

/* ── Lists: customers, content modules, reports ── */
.chip-total { background: var(--surface); box-shadow: var(--shadow); color: var(--muted); font-weight: 700; font-size: 12.5px; padding: 6px 14px; border-radius: 999px; }
.tabs.seg { margin: 0; background: var(--surface); padding: 4px; border-radius: 999px; box-shadow: var(--shadow); gap: 2px; }
.tabs.seg a { background: transparent; padding: 5px 12px; } .tabs.seg a.active { background: var(--accent); color: #fff; }
.tabs .n { opacity: .7; font-weight: 500; }
.cu-tbl th, .mod-tbl th, .ops-tbl th { text-transform: uppercase; letter-spacing: .04em; font-size: 11px; }
.cu-tbl td, .mod-tbl td { vertical-align: middle; }
.cu-name { display: flex; align-items: center; gap: 10px; } .cu-name small { display: block; color: var(--faint); font-size: 12px; line-height: 1.3; }
.cu-name small.vip { color: var(--accent); font-weight: 600; } .cu-name small.blocked { color: var(--danger); }
.tbl td .t { color: var(--faint); font-size: 12.5px; margin-left: 3px; } .tbl td.muted { color: var(--muted); }
.tbl td.act { white-space: nowrap; text-align: right; } .tbl td.act > * + * { margin-left: 6px; }
.pager2 { display: flex; align-items: center; gap: 6px; padding: 12px 16px; color: var(--faint); font-size: 13px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager2 .spacer { flex: 1; } .pager2 .btn.sm { min-width: 32px; justify-content: center; padding: 0 10px; } .pager2 .dots { padding: 0 4px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 8px; flex-wrap: wrap; } .card-head h2 { margin: 0; }
.card-title .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ops-tbl td { white-space: nowrap; vertical-align: middle; }
.hash { color: var(--accent); font-weight: 700; font-size: 13px; }
.csat { color: #c98a12; font-weight: 700; } .h-bot { color: #0e6a72; font-weight: 600; }
.sla.ok { color: var(--ok); font-weight: 700; } .sla.mid { color: #c26b12; font-weight: 700; } .sla.bad { color: #b3264a; font-weight: 700; }
.badge.r-bot { background: var(--ok-bg); color: var(--ok); } .badge.r-agent { background: #e0ecf8; color: #234d7a; } .badge.r-esc { background: var(--danger-bg); color: #b3264a; }
.badge.r-fwd { background: var(--purple-bg); color: var(--purple); } .badge.r-open { background: var(--surface-2); color: var(--muted); }
.legend-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; } .legend-list div { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend-list i { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; } .legend-list b { margin-left: auto; font-variant-numeric: tabular-nums; }
.donut-box { position: relative; height: 220px; } .donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-center b { font-size: 28px; line-height: 1; } .donut-center small { font-size: 10.5px; letter-spacing: .08em; color: var(--faint); font-weight: 700; margin-top: 4px; }
.auto-card { text-align: center; display: flex; flex-direction: column; justify-content: center; }
.auto-card .big { font-size: 42px; font-weight: 800; color: var(--ok); line-height: 1.1; margin: 6px 0 2px; } .auto-card .big span { font-size: 16px; font-weight: 600; }
.auto-bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 10px auto; width: 80%; }
.auto-bar i { display: block; height: 100%; background: linear-gradient(90deg, #2f9e4f, #0e7c86); border-radius: 999px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; } .mini-stats div { background: var(--bg); border-radius: 14px; padding: 10px 8px; }
.mini-stats b { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .mini-stats small { color: var(--faint); font-size: 12px; }
.crumb { font-size: 13.5px; color: var(--faint); } .crumb b { color: var(--accent); } .crumb a { color: var(--faint); } .crumb a:hover { color: var(--accent); }
.ct-filter { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 14px; } .ct-filter .search { flex: 1; min-width: 220px; box-shadow: none; background: var(--bg); }
.mod-name { display: flex; align-items: center; gap: 12px; } .mod-name b { font-size: 14px; }
.mod-ic { width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft-2); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.mod-name small { display: block; color: var(--faint); font-size: 12px; font-family: ui-monospace, Consolas, monospace; }
.mod-tbl tr.dim .mod-name b { color: var(--muted); }
.badge.st-off { background: var(--warn-bg); color: var(--warn); } .badge.st-draft { background: var(--surface-2); color: var(--faint); }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 8px; white-space: nowrap; }
.state.live { background: var(--ok-bg); color: var(--ok); } .state.synced { background: #e3f1f2; color: #0e6a72; } .state.dashboard { background: #e0ecf8; color: #234d7a; } .state.standby { background: var(--surface-2); color: var(--faint); }
.ct-editor { display: block; max-width: 980px; }
.compose .ro-note { display: none; } .compose.ro .quick, .compose.ro .line { display: none !important; } .compose.ro .ro-note { display: block; color: var(--faint); font-size: 13px; text-align: center; padding: 6px 0; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
body.no-ai .tr-btn { display: none; }

/* ── Agents: permissions ── */
.ag-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.ag-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; } .ag-head > div { flex: 1; } .ag-head h2 { margin: 0 0 2px; display: flex; align-items: center; gap: 8px; }
.lbl-like { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.perm-head { display: flex; align-items: flex-end; gap: 12px; margin: 4px 0 12px; padding-top: 14px; border-top: 1px solid var(--line-2); flex-wrap: wrap; } .perm-head > div:first-child { flex: 1; min-width: 220px; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.presets button { border: 0; border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); cursor: pointer; }
.presets button:hover { background: var(--surface-3); } .presets button.on { background: var(--accent-soft); color: var(--accent-600); }
.perm-group { background: var(--bg); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.pg-title { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-bottom: 8px; flex-wrap: wrap; } .pg-title .dot { width: 8px; height: 8px; border-radius: 50%; }
.pg-title .kh { color: var(--muted); } .pg-title small { color: var(--faint); margin-left: auto; font-size: 12px; }
.pg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 16px; }
label.chk { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; cursor: pointer; line-height: 1.4; } label.chk .kh { color: var(--faint); }
label.chk input { width: 16px; height: 16px; accent-color: var(--accent); margin: 2px 0 0; flex-shrink: 0; } label.chk input:disabled + span { opacity: .75; }
.perm-group.locked { opacity: .8; }
.badge.ro { background: var(--surface-2); color: var(--muted); } .badge.custom { background: var(--warn-bg); color: var(--warn); }
#modal .actions.sticky { position: sticky; bottom: -24px; background: var(--surface); padding: 12px 0 4px; margin: 12px 0 0; border-top: 1px solid var(--line-2); }
#sidebar .user > div:nth-child(2), #me-avatar { cursor: pointer; }

/* ── Responsive ─────────────────────────── */
@media (max-width: 1100px) { .grid.c4 { grid-template-columns: repeat(2, 1fr); } .grid.c3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) {
  #sidebar { position: fixed; left: -270px; z-index: 40; transition: left .2s; height: 100vh; background: var(--bg); box-shadow: none; }
  #sidebar.open { left: 0; box-shadow: 0 0 0 100vw rgba(43, 37, 32, .4); }
  #menu-btn { display: inline-flex; }
  #topbar { padding: 16px 16px 4px; } #content { padding: 10px 16px 16px; } .pw-warn { margin: 12px 16px 0; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 1fr; height: auto; }
  .ag-grid { grid-template-columns: 1fr; } .pg-grid { grid-template-columns: 1fr; } .mini-stats { grid-template-columns: 1fr; }
  .notif-panel { position: fixed; left: 10px; right: 10px; top: 62px; width: auto; max-width: none; max-height: calc(100vh - 80px); }
  .inbox .list { max-height: 48vh; } .inbox .thread { min-height: 65vh; }
  .inbox.threaded .list { display: none; } .inbox:not(.threaded) .thread { display: none; }
  .msg { max-width: 88%; }
}

/* ── Operation Record ── */
.or-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.or-side { display: flex; flex-direction: column; gap: 18px; } .or-side .card { margin: 0; }
@media (max-width: 1480px) { .or-grid { grid-template-columns: minmax(0, 1fr); } .or-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
@media (max-width: 860px) { .or-side { grid-template-columns: minmax(0, 1fr); } }
.or-tools .input { min-width: 0; width: auto; } .or-tools select.input { min-width: 150px; }
.or-tbl td:nth-child(1), .or-tbl td:nth-child(2), .or-tbl td:nth-child(5) { white-space: nowrap; }
.or-kpi { position: relative; padding-right: 58px; }
.or-kpi .or-ic { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft-2); color: var(--accent); }
.or-kpi .val small { font-size: 12px; font-weight: 600; vertical-align: middle; }
.or-live { color: var(--ok); } .or-chg { padding: 2px 7px; border-radius: 7px; } .or-chg.up { background: var(--ok-bg); color: var(--ok); } .or-chg.down { background: var(--danger-bg); color: var(--danger); }
.or-chip { font-size: 11.5px; font-weight: 600; color: var(--faint); background: var(--surface-2); padding: 3px 9px; border-radius: 8px; margin-left: 8px; font-family: ui-monospace, Consolas, monospace; vertical-align: middle; }
.or-search { max-width: 280px; }
.or-tbl td { vertical-align: middle; } .or-tbl tr.or-live-row td { background: #f3faf4; }
.or-role { color: var(--accent) !important; } .or-role.super { color: #b3264a !important; }
.or-feat { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; background: var(--surface-2); font-size: 12.5px; white-space: nowrap; }
.or-act { min-width: 240px; max-width: 440px; }
.or-kind { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; margin-right: 4px; white-space: nowrap; vertical-align: 1px; }
.or-kind.k-chat { background: var(--accent); color: #fff; } .or-kind.k-handle { background: var(--ok); color: #fff; } .or-kind.k-add { background: var(--ok-bg); color: var(--ok); }
.or-kind.k-update { background: #e0ecf8; color: #234d7a; } .or-kind.k-delete { background: var(--danger-bg); color: var(--danger); }
.or-kind.k-export { background: #e8875a; color: #fff; } .or-kind.k-sec { background: var(--purple-bg); color: var(--purple); } .or-kind.k-other { background: var(--surface-2); color: var(--muted); }
.or-spent { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; } .or-spent.live { color: var(--accent); }
.or-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 8px; white-space: nowrap; }
.or-state.verified, .or-state.active { background: var(--ok-bg); color: var(--ok); }
.or-state.active i { width: 7px; height: 7px; border-radius: 50%; background: #2f9e4f; animation: or-pulse 1.4s infinite; }
.or-state.tampered, .or-state.gap { background: var(--danger-bg); color: var(--danger); } .or-state.unsealed { background: var(--warn-bg); color: var(--warn); }
.or-state.message { background: var(--surface-2); color: var(--muted); }
@keyframes or-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.or-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-2); } .or-bar i { display: block; height: 100%; }
.or-sec-head { display: flex; align-items: center; gap: 6px; color: var(--accent); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.or-sev { background: var(--accent-soft-2); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
.or-sev-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 3px; } .or-sev code { color: var(--accent); font-weight: 700; font-size: 12px; word-break: break-all; }
.or-int-head { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 600; margin-top: 14px; }
.or-int-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 6px 0; } .or-int-bar i { display: block; height: 100%; background: var(--ok); } .or-int-bar.bad i { background: var(--danger); }
.ok-t { color: var(--ok); } .danger-t { color: var(--danger); }
.or-kvs { display: flex; flex-direction: column; margin: 10px 0 14px; }
.or-kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; } .or-kv > span { color: var(--faint); font-weight: 600; }
.or-hash { font-size: 11.5px; word-break: break-all; }
@media (max-width: 860px) { .or-kv { grid-template-columns: minmax(0, 1fr); gap: 2px; } .or-search { max-width: none; width: 100%; } .or-tools .input { min-width: 0; flex: 1 1 140px; } }