/* ===========================================================================
   CRM — modern light UI (Agent Builder UX patterns, CRM color palette)
   =========================================================================== */
:root {
  --bg: #f1f5f9;
  --bg-2: #f8fafc;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --primary: #4f46e5;
  --primary-2: #6366f1;
  --primary-ink: #ffffff;
  --primary-soft: #eef2ff;
  --primary-ghost: #4f46e514;
  --danger: #ef4444;
  --ok: #22c55e;
  --warn: #f59e0b;
  --sidebar: #1e1b4b;
  --sidebar-ink: #c7d2fe;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 4px 14px -4px rgba(15,23,42,.16);
  --shadow-lg: 0 18px 40px -12px rgba(15,23,42,.30);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
code, .codebox { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
  padding: 9px 15px; border-radius: var(--radius-sm); font-weight: 600; font-size: 13.5px;
  transition: .15s ease; white-space: nowrap; line-height: 1.1;
}
.btn:hover { background: var(--bg-2); border-color: var(--line-2); box-shadow: var(--shadow); }
.btn:active { transform: translateY(.5px); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-2); box-shadow: 0 4px 14px -3px var(--primary-ghost); }
.btn.danger { color: #b91c1c; border-color: #fecaca; background: #fef2f2; }
.btn.danger:hover { background: #fee2e2; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); box-shadow: none; }
.btn.ghost:hover { background: #0f172a0a; color: var(--ink); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.xs { padding: 4px 9px; font-size: 11.5px; border-radius: 7px; }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1100px 560px at 80% -10%, #6366f133 0%, transparent 60%),
              linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%); }
.login-card { background: var(--surface); padding: 34px; border-radius: 18px;
  width: 370px; box-shadow: var(--shadow-lg); }
.login-card h1 { margin: 0 0 4px; font-size: 23px; }
.login-card > p { margin: 0 0 22px; color: var(--muted); }
.login-card .field { margin-bottom: 14px; }

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; min-width: 0; }
.field label, .field-label { display: flex; align-items: center; gap: 7px; font-size: 12px;
  font-weight: 700; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.field input, .field select, .field textarea,
input.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); transition: .15s; }
.field input:focus, .field select:focus, .field textarea:focus,
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field input.invalid, .input.invalid { border-color: #dc8a8a; }
.field input.valid, .input.valid { border-color: #5fae79; }
.field-hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: 12px; margin-top: 5px; }
select { appearance: none; background-image:
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b'%3E%3Cpath d='M6 8 1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px !important; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- Info icon ("i" documentation convention) ---------- */
.info-wrap { position: relative; display: inline-flex; }
.info-icon {
  width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line-2);
  display: grid; place-items: center; font-size: 10px; font-style: italic; font-weight: 700;
  color: var(--muted); cursor: help; font-family: Georgia, "Times New Roman", serif; background: #fff; flex: none;
}
.info-icon:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.info-pop {
  position: absolute; top: 24px; left: -8px; z-index: 70; width: 270px;
  background: #fff; border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px;
  box-shadow: var(--shadow-lg); display: none; text-transform: none; letter-spacing: 0;
}
.info-pop.pop-left { left: auto; right: -8px; }
.info-wrap:hover .info-pop, .info-icon:focus + .info-pop { display: block; }
.info-pop-text { font-size: 12.5px; line-height: 1.55; color: var(--ink-2); font-weight: 400; white-space: pre-wrap; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-ink); padding: 18px 14px;
  display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { color: #fff; font-weight: 700; font-size: 18px; padding: 6px 10px 18px;
  display: flex; align-items: center; gap: 10px; }
.brand .dot { width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, #818cf8, #a855f7); box-shadow: 0 0 16px #818cf877; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--radius-sm); color: var(--sidebar-ink); cursor: pointer; font-weight: 600; font-size: 13.5px; transition: .12s; }
.nav-item:hover { background: #ffffff14; color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 6px 16px -6px #4f46e5cc; }
.nav-badge { margin-left: auto; background: #ef4444; color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-flex;
  align-items: center; justify-content: center; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.nav-spacer { flex: 1; }
.nav-user { font-size: 12px; color: #a5b4fc; padding: 10px 12px; border-top: 1px solid #ffffff1f; }

.main-col { display: flex; flex-direction: column; min-width: 0; }
.main { padding: 24px 28px; overflow: auto; }

/* Top bar (page title + description + account menu) */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px 28px; border-bottom: 1px solid var(--line); background: #ffffffcc;
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; min-height: 62px; }
.tb-meta { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tb-title { font-weight: 700; font-size: 17px; line-height: 1.2; }
.tb-desc { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; max-width: 52vw; }
.top-right { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }

/* Account menu */
.user-menu { position: relative; }
.user-trigger { display: inline-flex; align-items: center; gap: 9px; background: var(--surface);
  border: 1px solid var(--line); color: var(--ink); padding: 4px 9px 4px 13px; border-radius: 22px;
  cursor: pointer; transition: .15s; }
.user-trigger:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.user-name { font-size: 13px; font-weight: 600; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-size: 11px; font-weight: 700; flex: none; letter-spacing: .3px;
  background: linear-gradient(135deg, var(--primary-2), #a855f7); }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.chev { color: var(--muted); font-size: 11px; transition: transform .18s; }
.user-menu.open .chev { transform: rotate(180deg); }
.user-dropdown { position: absolute; right: 0; top: calc(100% + 8px); min-width: 250px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 7px; z-index: 30; display: none; }
.user-menu.open .user-dropdown { display: block; animation: menu-in .14s ease; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.menu-header { display: flex; align-items: center; gap: 11px; padding: 8px 10px 12px; }
.menu-id { min-width: 0; }
.menu-name { font-weight: 700; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-role { color: var(--muted); font-size: 12px; }
.menu-divider { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: transparent; border: none; color: var(--ink); padding: 9px 10px; border-radius: 9px;
  cursor: pointer; font-family: inherit; font-size: 13px; transition: .12s; }
.menu-item:hover { background: var(--bg-2); }
.menu-item.danger { color: #dc2626; }
.menu-item.danger:hover { background: #fef2f2; }
.menu-ico { width: 18px; text-align: center; }
.menu-lang { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; font-size: 13px; }
.menu-lang > span { display: inline-flex; align-items: center; gap: 10px; }
.lang-switch { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.lang-opt { background: transparent; color: var(--muted); border: none; padding: 5px 10px; font-size: 11.5px; font-weight: 700; cursor: pointer; transition: .12s; }
.lang-opt:hover { color: var(--ink); background: var(--bg-2); }
.lang-opt.active { background: var(--primary); color: #fff; }

/* ---------- Page head (in-content actions row) ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.page-head h2 { font-size: 20px; }
.head-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; background: #e2e8f0; border-radius: var(--radius-sm); padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-weight: 600; color: var(--muted); transition: .12s; }
.seg button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
/* Settings tab bar (mirrors the Agent Builder editor) */
.tabbar { display: flex; flex-wrap: wrap; gap: 2px 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabbar .tab { background: none; border: 0; color: var(--muted); padding: 9px 13px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; font-family: inherit; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabbar .tab:hover { color: var(--ink); }
.tabbar .tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.search { padding: 9px 12px 9px 34px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 10px center; min-width: 220px; transition: .15s; }
.search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ---------- Cards / tables ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.subhead { font-weight: 700; margin: 18px 0 10px; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13.5px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
  color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); background: #f8fafc88; }
td { padding: 13px 16px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:hover { background: #f8fafc; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: #f1f5f9; color: #334155; border: 1px solid #e7edf3; }
.chip .swatch { width: 8px; height: 8px; border-radius: 50%; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted);
  border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--bg-2); }
.empty .big { font-size: 40px; margin-bottom: 8px; opacity: .6; }

/* ---------- Kanban ---------- */
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.col { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  min-width: 280px; max-width: 280px; display: flex; flex-direction: column; }
.col-head { padding: 12px 14px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.col-head .count { background: #e2e8f0; border-radius: 999px; padding: 1px 9px; font-size: 12px; color: var(--muted); }
.col-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.col-body.drag-over { background: var(--primary-soft); }
.lead-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px;
  box-shadow: var(--shadow); cursor: grab; transition: .12s; }
.lead-card:hover { border-color: var(--line-2); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.lead-card:active { cursor: grabbing; }
.lead-card .lc-name { font-weight: 700; }
.lead-card .lc-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.lead-card .lc-meta { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 100; padding: 22px; }
.modal { background: var(--surface); border-radius: 16px; width: 560px; max-width: 100%;
  max-height: 90vh; overflow: hidden; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.modal.wide { width: min(960px, 94vw); }
.modal-head { display: flex; justify-content: space-between; align-items: center;
  padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 17px; font-weight: 700; }
.modal-body { padding: 22px; overflow-y: auto; }
/* Consistent vertical rhythm for stacked fields inside modals. */
.modal-body .field { margin-bottom: 14px; }
.modal-body .row2 { margin-bottom: 14px; }
.modal-body .row2 .field { margin-bottom: 0; }
.modal-body .field:last-child { margin-bottom: 0; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: var(--bg-2); }
.x { border: 0; background: transparent; font-size: 24px; color: var(--muted); cursor: pointer; line-height: 1; }
.x:hover { color: var(--ink); }
.multi-row { display: grid; grid-template-columns: 1fr 130px 80px 34px; gap: 8px; align-items: center; margin-bottom: 8px; }
.multi-row .pri { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.kv-row { display: grid; grid-template-columns: 1fr 1fr 34px; gap: 8px; margin-bottom: 8px; }

/* ---------- HTML email editor (RTE) ---------- */
.rte { border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.rte-tb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px;
  background: var(--bg-2); border-bottom: 1px solid var(--line-2); }
.rte-grp { display: inline-flex; align-items: center; gap: 4px; padding-right: 8px; margin-right: 2px;
  border-right: 1px solid var(--line); }
.rte-grp:last-of-type { border-right: 0; padding-right: 0; margin-right: 0; }
.rte-b { width: 32px; height: 32px; padding: 0; border: 1px solid transparent; background: transparent;
  border-radius: 8px; color: var(--ink-2); font-size: 14px; line-height: 1; cursor: pointer; transition: .12s;
  display: inline-flex; align-items: center; justify-content: center; }
.rte-b svg { display: block; }
.rte-b:hover { background: #fff; border-color: var(--line-2); color: var(--primary); box-shadow: var(--shadow); }
.rte-b.active { background: var(--primary); color: #fff; border-color: var(--primary); }
/* Scoped with .rte to beat the global ".field select/input/textarea { width:100% }"
   rule (the editor lives inside a .field, which otherwise stretched the toolbar
   controls to full width and broke the layout). */
.rte .rte-sel { width: auto; height: 32px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff;
  font-size: 12.5px; padding: 0 8px; cursor: pointer; max-width: 150px; }
.rte .rte-color { width: 34px; height: 32px; padding: 2px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; cursor: pointer; }
.rte-sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 5px; }
.rte-area { min-height: 240px; max-height: 50vh; overflow-y: auto; padding: 14px 16px; font-size: 14px; line-height: 1.55; outline: none; }
.rte-area:focus { box-shadow: inset 0 0 0 2px var(--primary-soft); }
.rte-area img { max-width: 100%; height: auto; }
.rte-area a { color: var(--primary); }
.rte .rte-code { width: 100%; min-height: 240px; max-height: 50vh; border: 0; padding: 14px 16px;
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12.5px; line-height: 1.5; resize: vertical; outline: none; }

/* ---------- Lead detail ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 330px; gap: 18px; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: grid; grid-template-columns: 30px 1fr; gap: 10px; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; margin: 4px auto 0; }
.tl-line { width: 2px; background: var(--line); margin: 0 auto; flex: 1; }
.tl-col { display: flex; flex-direction: column; align-items: center; }
.tl-body { padding-bottom: 18px; }
.tl-title { font-weight: 600; }
.tl-meta { color: var(--muted); font-size: 12px; }
.tl-text { margin-top: 4px; white-space: pre-wrap; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { background: #fff; color: var(--ink); padding: 12px 16px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); border: 1px solid var(--line); border-left: 3px solid var(--primary);
  font-weight: 500; animation: pop .2s ease; max-width: 360px; min-width: 220px; }
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Misc ---------- */
.codebox { background: #0f172a; color: #e2e8f0; padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: 13px; word-break: break-all; }
.banner { background: var(--primary-soft); border: 1px solid #c7d2fe; color: #3730a3;
  padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.selbar { background: var(--sidebar); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px; box-shadow: var(--shadow-md); }
.selbar .grow { flex: 1; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 8px; }
.camp-card { cursor: pointer; transition: .12s; }
.camp-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .row2 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}

/* ---- landing page editor (Phase A) ---- */
.lp-editor { position: fixed; inset: 0; z-index: 900; background: var(--bg); overflow: auto; }
.lp-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
.lp-body { max-width: 760px; margin: 0 auto; padding: 18px 16px 60px; }
.lp-card { margin-bottom: 12px; }
.lp-card .field { margin-bottom: 12px; }
.lp-cardhead { font-weight: 700; margin-bottom: 10px; color: var(--ink); }
.flab { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.lp-fieldrow { display: grid; grid-template-columns: 1.4fr 1fr .9fr auto auto; gap: 8px; align-items: center; margin-bottom: 7px; }
.lp-editor input:not([type=color]):not([type=checkbox]), .lp-editor select, .lp-editor textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font-size: 14px; }
.lp-editor textarea { resize: vertical; }
.lp-editor input[type=color] { width: 46px; height: 34px; padding: 2px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); }
@media (max-width: 640px) { .lp-fieldrow { grid-template-columns: 1fr 1fr; } }

/* ---- email image library (reusable, company-wide) ---- */
.imglib-ov { position: fixed; inset: 0; z-index: 1200; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.imglib-panel { width: min(760px, 96vw); max-height: 86vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; }
.imglib-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.imglib-bar { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.imglib-bar input[type=url] { padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); }
.imglib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; padding: 16px; overflow: auto; }
.imglib-cell { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: var(--bg-2); }
.imglib-cell img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; display: block; }
.imglib-cell img:hover { opacity: .85; }
.imglib-del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 6px; border: 0; background: #0009; color: #fff; cursor: pointer; font-size: 14px; line-height: 1; }
.imglib-del:hover { background: #dc2626; }

/* labeled RTE toolbar buttons (image / code) — icon + text, more discoverable */
.rte-b-lbl { width: auto; padding: 0 10px; gap: 5px; }
.rte-b-lbl .rte-lbl { font-size: 12px; font-weight: 600; }

/* email composer: locked-to-campaign audience + recipient count */
.camp-lock { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--primary); background: var(--primary-soft); border-radius: var(--radius-sm); color: var(--ink); font-size: 13px; }
.rcpt-count { font-weight: 700; color: var(--primary); }
.rcpt-line { margin-top: 8px; font-size: 13px; color: var(--muted); }
.rcpt-line .rcpt-count { color: var(--primary); }

/* ---- notifications bell (top bar) ---- */
.notif-bell { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 17px; line-height: 1; }
.notif-bell:hover { background: var(--bg-2); box-shadow: var(--shadow); }
.notif-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.notif-panel { position: fixed; top: 60px; right: 18px; width: min(380px, 94vw); max-height: 72vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 1100; overflow: hidden; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-list { overflow: auto; }
.notif-item { padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif-item:hover { background: var(--bg-2); }
.notif-item.unread { background: var(--primary-soft); }
.notif-item.unread:hover { background: #e6ecff; }
.notif-title { font-weight: 600; font-size: 13.5px; }
.notif-body { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.notif-time { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
