/* ===================== WA-SaaS · professional theme ===================== */
:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --line: #e7e8f1;
  --line-2: #eef0f7;
  --ink: #131836;
  --ink-2: #414968;
  --muted: #7b83a0;
  --brand: #3a30c9;      /* Call Extreme royal indigo */
  --brand-d: #2a22a0;
  --brand-l: #ecebfc;
  --accent: #e11d3a;     /* Call Extreme red (the X) */
  --accent-2: #8e2f9e;   /* purple */
  --blue: #2f7ee5;
  --violet: #7c5cff;
  --amber: #e8a33d;
  --red: #e11d3a;
  --sidebar: #0e1440;    /* deep navy */
  --sidebar-2: #1b2258;
  --sidebar-ink: #a8afd6;
  --shadow: 0 1px 2px rgba(16,27,45,.04), 0 4px 16px rgba(16,27,45,.05);
  --shadow-lg: 0 12px 40px rgba(16,27,45,.18);
  --radius: 12px;
  --radius-sm: 9px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv02","cv03","cv04","ss01";
}
a { color: var(--brand); text-decoration: none; }
h1,h2,h3,h4 { margin: 0; color: var(--ink); font-weight: 650; letter-spacing: -.01em; }

/* ---------- buttons ---------- */
button, .btn {
  font: inherit; cursor: pointer; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 9px 15px; background: var(--surface-2); color: var(--ink-2); font-weight: 550;
  display: inline-flex; align-items: center; gap: 7px; transition: .15s ease;
  white-space: nowrap;
}
button:hover { background: #eef1f6; }
button.primary { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 1px 2px rgba(58,48,201,.28); }
button.primary:hover { background: var(--brand-d); }
button.ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
button.ghost:hover { background: var(--surface-2); border-color: #d7dde7; }
button.danger { background: #fff; border-color: #f3c4c6; color: var(--red); }
button.danger:hover { background: #fdeded; }
button.sm { padding: 6px 11px; font-size: 12.5px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.icon { padding: 7px 9px; }

/* ---------- inputs ---------- */
input, select, textarea {
  font: inherit; width: 100%; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(58,48,201,.14);
}
textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
label { display: block; font-size: 12.5px; color: var(--ink-2); margin: 14px 0 6px; font-weight: 550; }
label .hint { color: var(--muted); font-weight: 400; }
.field-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }

/* ---------- login (multi-color, professional) ---------- */
#login { min-height: 100vh; display: flex; }
.login-visual {
  flex: 1; position: relative; overflow: hidden; color: #fff; padding: 56px;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(760px 520px at 12% 18%, rgba(58,48,201,.55), transparent 55%),
    radial-gradient(720px 620px at 88% 8%, rgba(90,80,230,.45), transparent 55%),
    radial-gradient(760px 720px at 80% 92%, rgba(142,47,158,.5), transparent 55%),
    radial-gradient(680px 520px at 4% 96%, rgba(225,29,58,.42), transparent 55%),
    linear-gradient(135deg, #0b1038, #0e1440 55%, #0b1036);
}
.login-visual::after { /* subtle grid texture */
  content: ""; position: absolute; inset: 0; opacity: .06; pointer-events: none;
  background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px);
  background-size: 44px 44px;
}
.login-visual > * { position: relative; z-index: 1; }
.lv-brand { font-size: 20px; font-weight: 750; display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  background: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.3); overflow: hidden; }
.brand-mark img { width: 38px; height: 38px; object-fit: contain; }
.lv-mid h2 { color: #fff; font-size: 38px; line-height: 1.15; letter-spacing: -.025em; }
.lv-sub { color: #c9d6df; max-width: 400px; margin-top: 16px; font-size: 15px; line-height: 1.6; }
.lv-feats { display: grid; gap: 11px; margin-top: 28px; max-width: 360px; }
.feat { display: flex; align-items: center; gap: 11px; font-size: 14px; color: #e7eef2;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.09); padding: 11px 15px; border-radius: 11px;
  backdrop-filter: blur(4px); }
.feat .fi { font-size: 10px; }
.fi.c1 { color: #25d366; } .fi.c2 { color: #53bdeb; } .fi.c3 { color: #ffbd59; } .fi.c4 { color: #a77bf5; } .fi.c5 { color: #ff7ab8; }
.lv-bot { color: #8fa3ad; font-size: 12.5px; }

.login-panel { width: 480px; display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--surface); }
.login-card { width: 100%; max-width: 340px; }
.lc-logo { margin-bottom: 22px; }
.lc-logo img { height: 46px; width: auto; max-width: 100%; object-fit: contain; display: block; }
.login-card h1 { font-size: 25px; }
.login-card .sub { color: var(--muted); margin: 5px 0 24px; }
.login-card .primary.lg { padding: 12px; font-size: 15px; }
.guide-link { display: block; text-align: center; margin-top: 16px; font-size: 13.5px; font-weight: 550;
  color: var(--brand); padding: 9px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.guide-link:hover { background: var(--brand-l); border-color: var(--brand); }
.lc-foot { color: var(--muted); font-size: 12px; text-align: center; margin-top: 14px; }
@media (max-width: 860px){ .login-visual{ display:none; } .login-panel{ width:100%; } }

/* ---------- app shell ---------- */
#app { display: none; }
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 244px; background: var(--sidebar); color: var(--sidebar-ink);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
}
/* keep the dark bg painted even if the flex column is shorter than the viewport */
.shell { background: var(--sidebar); }
.main { background: var(--bg); }
.sidebar::-webkit-scrollbar { width: 7px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.brand { display: flex; align-items: center; gap: 12px; padding: 8px 8px 22px; }
.brand .logo { width: 44px; height: 44px; border-radius: 13px; background: #fff; display: grid; place-items: center; flex: none; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255,255,255,.1), 0 8px 22px rgba(58,48,201,.5); transition: transform .18s ease, box-shadow .18s ease; }
.brand:hover .logo { transform: translateY(-1px) scale(1.02); box-shadow: 0 0 0 1px rgba(255,255,255,.18), 0 12px 28px rgba(225,29,58,.4); }
.brand .logo img { width: 36px; height: 36px; object-fit: contain; }
.brand-name { display: flex; flex-direction: column; line-height: 1; }
.brand-name .n { font-weight: 800; font-size: 20px; letter-spacing: -.02em; color: #fff; }
.brand-name .n .ce-x { background: linear-gradient(90deg, #8b83ff 10%, #e11d3a 90%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-name small { font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: #6b78b3; margin-top: 5px; }
/* login two-tone name */
.lv-name .ce-x { background: linear-gradient(90deg, #9a92ff, #ff5a72); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-sec { font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: #5c7280; margin: 16px 12px 6px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px;
  color: var(--sidebar-ink); cursor: pointer; font-weight: 500; font-size: 13.5px; transition: .12s;
}
.nav-item .ic { width: 20px; height: 20px; display: grid; place-items: center; flex: none; }
.nav-item .ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; opacity: .95; }
.nav-item:hover { background: var(--sidebar-2); color: #eef0ff; }
.nav-item.active { background: linear-gradient(90deg, rgba(90,80,230,.32), rgba(58,48,201,.06)); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav-item.active .ic svg { opacity: 1; stroke: #fff; }
.sidebar .spacer { flex: 1; }

.main { flex: 1; min-width: 0; height: 100vh; overflow-y: auto; }
.topbar {
  position: sticky; top: 0; z-index: 10; background: rgba(244,246,251,.85); backdrop-filter: blur(8px);
  display: flex; align-items: center; gap: 14px; padding: 16px 30px; border-bottom: 1px solid var(--line);
}
.topbar .crumb { color: var(--muted); font-size: 12.5px; }
.topbar h2 { font-size: 19px; }
.topbar .head { flex: 1; min-width: 0; }
.tenant-switch { width: 210px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg,var(--brand),var(--accent)); color: #fff; display: grid; place-items: center; font-weight: 650; font-size: 13px; }
.content { padding: 26px 30px 60px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.card .card-h { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.card .card-h h3 { font-size: 15.5px; }
.card .card-h .sub { color: var(--muted); font-size: 12.5px; }
.section-hint { color: var(--muted); font-size: 13px; margin: -6px 0 16px; }
.license { border-radius: 10px; padding: 11px 16px; margin-bottom: 16px; font-size: 13.5px; font-weight: 500; border: 1px solid; }
.license.exp-ok { background: #e7f7ee; color: #12683f; border-color: #b9e6cd; }
.license.exp-warn { background: #fdf3e3; color: #8a5a12; border-color: #f0dcb4; }
.license.exp-over { background: #fdeaea; color: #b02a2f; border-color: #f2c4c6; }

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2,1fr); }
.grid.c3 { grid-template-columns: repeat(3,1fr); }
.grid.c4 { grid-template-columns: repeat(4,1fr); }
@media (max-width: 1050px){ .grid.c4{ grid-template-columns: repeat(2,1fr);} .grid.c3{grid-template-columns:1fr;} }
@media (max-width: 720px){ .grid.c2,.grid.c4{ grid-template-columns:1fr;} .field-row{grid-template-columns:1fr;} }

/* ---------- stat tiles ---------- */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat .top { display: flex; align-items: center; justify-content: space-between; }
.stat .chip { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; }
.chip.g { background: var(--brand-l); } .chip.b { background: #e8f1fd; } .chip.v { background: #efeaff; } .chip.a { background: #fdf3e3; }
.stat .n { font-size: 27px; font-weight: 720; letter-spacing: -.02em; margin-top: 12px; }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 12px 16px; font-size: 13px; border-bottom: 1px solid var(--line-2); }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td.num { font-variant-numeric: tabular-nums; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- badges / pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.badge::before { content:""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-connected { background: #e7f7ee; color: #12874a; }
.b-qr, .b-connecting { background: #fdf3e3; color: #a9701a; }
.b-disconnected, .b-banned { background: #fdeaea; color: #c23b3f; }
.b-running { background: #e8f1fd; color: #1d5fbd; }
.b-completed { background: #e7f7ee; color: #12874a; }
.b-paused, .b-draft { background: #eef1f6; color: #64748b; }
.pill { background: var(--surface-2); border: 1px solid var(--line); padding: 4px 11px; border-radius: 20px; font-size: 12px; color: var(--ink-2); }
.tag { background: var(--brand-l); color: var(--brand-d); padding: 3px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 550; }
.varchips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.varchip { background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); padding: 4px 10px; border-radius: 7px; font-size: 12px; font-weight: 550; cursor: pointer; font-family: ui-monospace, Menlo, monospace; transition: .12s; }
.varchip:hover { background: var(--brand-l); border-color: var(--brand); color: var(--brand-d); }
.varchip.add { border-style: dashed; }
.img-prev { width: 76px; height: 76px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; flex: none; }
.img-prev img { width: 100%; height: 100%; object-fit: cover; }
.tpl-thumb { width: 100%; height: 120px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); margin: 4px 0 8px; background: var(--surface-2); }
.link-btn { background: none; border: none; color: var(--brand); font-weight: 550; padding: 0; cursor: pointer; font-size: 12.5px; }
.link-btn:hover { text-decoration: underline; background: none; }
.summary-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 16px; }
.summary-row .kv { background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; font-size: 12.5px; }
.summary-row .kv b { display: block; color: var(--ink); font-weight: 600; margin-top: 1px; }
.summary-row .kv span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }

.s-sent{color:var(--blue);font-weight:600;} .s-delivered{color:#12874a;font-weight:600;}
.s-read{color:var(--violet);font-weight:600;} .s-failed,.s-invalid{color:var(--red);font-weight:600;}
.s-pending,.s-queued{color:var(--muted);}

/* ---------- misc ---------- */
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.right { margin-left: auto; }
.muted { color: var(--muted); }
.hide { display: none !important; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }

/* progress bar */
.pbar { height: 9px; background: var(--line); border-radius: 6px; overflow: hidden; display: flex; gap: 2px; }
.pbar > div { height: 100%; }
.pb-read{background:var(--violet);} .pb-delivered{background:var(--accent);} .pb-sent{background:var(--blue);} .pb-failed{background:var(--red);}
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: middle; }

/* selectable option cards (wizard) */
.pick-grid { display: grid; gap: 12px; grid-template-columns: repeat(2,1fr); }
.pick { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px; cursor: pointer; background: var(--surface); transition: .12s; }
.pick:hover { border-color: #cfd6e2; }
.pick.sel { border-color: var(--brand); background: var(--brand-l); box-shadow: 0 0 0 3px rgba(18,140,126,.1); }
.pick .t { font-weight: 600; }
.pick .d { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

/* wizard steps */
.steps { display: flex; gap: 8px; margin-bottom: 20px; }
.step { flex: 1; padding: 10px 12px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); font-weight: 550; }
.step.active { background: var(--brand-l); border-color: var(--brand); color: var(--brand-d); }
.step.done { color: var(--brand-d); }
.step .num { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--line); color: var(--ink-2); font-size: 11px; margin-right: 7px; }
.step.active .num, .step.done .num { background: var(--brand); color: #fff; }

/* dropzone */
.dropzone { border: 2px dashed #cfd6e2; border-radius: var(--radius); padding: 30px; text-align: center; color: var(--muted); background: var(--surface-2); cursor: pointer; transition: .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-l); color: var(--brand-d); }

/* ---------- conversations / team inbox ---------- */
.chat { display: grid; grid-template-columns: 320px 1fr; gap: 0; height: calc(100vh - 150px); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.chat-list { border-right: 1px solid var(--line); overflow-y: auto; background: var(--surface); }
.chat-list .conv { padding: 12px 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.chat-list .conv:hover { background: var(--surface-2); }
.chat-list .conv.sel { background: var(--brand-l); box-shadow: inset 3px 0 0 var(--brand); }
.chat-list .conv .r1 { display: flex; align-items: center; gap: 8px; }
.chat-list .conv .peer { font-weight: 600; font-size: 13.5px; }
.chat-list .conv .time { margin-left: auto; color: var(--muted); font-size: 11px; }
.chat-list .conv .last { color: var(--muted); font-size: 12.5px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-list .conv .gw { font-size: 10.5px; color: var(--brand-d); background: var(--brand-l); padding: 1px 7px; border-radius: 10px; }
.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-head { padding: 13px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; background: var(--surface); }
.chat-head .peer { font-weight: 650; }
.chat-body { flex: 1; overflow-y: auto; padding: 20px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 68%; padding: 9px 13px; border-radius: 12px; font-size: 13.5px; line-height: 1.45; box-shadow: var(--shadow); word-wrap: break-word; }
.bubble .meta { font-size: 10px; color: var(--muted); margin-top: 4px; text-align: right; }
.bubble.in { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px; }
.bubble.out { align-self: flex-end; background: #e9e7fc; border-bottom-right-radius: 4px; }
.bubble-img { display: block; max-width: 240px; max-height: 260px; border-radius: 9px; margin-bottom: 5px; object-fit: cover; }
.chat-reply { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.chat-reply textarea { min-height: 44px; max-height: 120px; }
.chat-empty { flex: 1; display: grid; place-items: center; color: var(--muted); text-align: center; }
.chat-back { display: none; background: transparent; border: none; font-size: 20px; padding: 0 8px 0 0; color: var(--ink-2); }
@media (max-width: 760px){
  .chat { grid-template-columns: 1fr; height: calc(100vh - 128px); }
  .chat.thread-open .chat-list { display: none; }
  .chat:not(.thread-open) .chat-main { display: none; }
  .chat-back { display: inline-flex; align-items: center; }
}

/* ---------- profile menu (topbar) ---------- */
.profile { position: relative; }
.avatar { cursor: pointer; user-select: none; box-shadow: 0 4px 12px rgba(58,48,201,.3); transition: transform .12s; }
.avatar:hover { transform: translateY(-1px); }
.profile-menu { position: absolute; right: 0; top: 46px; width: 244px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow-lg); padding: 8px; display: none; z-index: 45; }
.profile-menu.show { display: block; animation: slidein .15s ease; }
.pm-head { display: flex; align-items: center; gap: 11px; padding: 10px 10px 13px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.pm-av { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--accent)); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.pm-name { font-weight: 700; font-size: 14px; }
.pm-sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.pm-role { display: inline-block; margin-top: 5px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; background: var(--brand-l); color: var(--brand-d); padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.pm-item { padding: 9px 11px; border-radius: 8px; cursor: pointer; font-size: 13.5px; display: flex; align-items: center; gap: 10px; color: var(--ink-2); }
.pm-item:hover { background: var(--surface-2); }
.pm-item.danger { color: var(--red); }
.pm-item.danger:hover { background: #fdeded; }

/* ---------- campaign cards ---------- */
.camp-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); }
.camp-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 14px 15px; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, border-color .15s; }
.camp-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: #d3d8e6; }
.cc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.cc-name { font-weight: 700; font-size: 14px; letter-spacing: -.01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-top .badge { font-size: 10.5px; padding: 2px 8px; flex: none; }
.cc-meta { color: var(--muted); font-size: 11.5px; margin-bottom: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-metrics { display: flex; gap: 14px; margin-bottom: 11px; }
.cc-metric { display: flex; flex-direction: column; }
.cc-metric .v { font-size: 17px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1; }
.cc-metric .k { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 3px; }
.cc-metric.d .v { color: #12874a; } .cc-metric.r .v { color: var(--violet); } .cc-metric.f .v { color: var(--red); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }
.badge .live-dot { margin-left: 4px; }
.live-badge { display: inline-flex; align-items: center; gap: 6px; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(225,29,58,.55); } 70% { box-shadow: 0 0 0 7px rgba(225,29,58,0); } 100% { box-shadow: 0 0 0 0 rgba(225,29,58,0); } }
.live-dot.on { animation: pulse 1.5s infinite; }

/* ---------- live activity feed (campaign monitor) ---------- */
.feed-head { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.feed { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 6px; }
.feed-row { display: flex; align-items: center; gap: 11px; padding: 8px 11px; font-size: 13px; border-radius: 8px; }
.feed-row + .feed-row { border-top: 1px solid var(--line-2); }
.feed-row .fp { font-family: var(--mono); font-weight: 600; }
.feed-row .fs { font-weight: 600; }
.feed-row .ft { margin-left: auto; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.feed-row.new { animation: slidein .22s ease; }
.feed-empty { color: var(--muted); text-align: center; padding: 26px; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .live-dot.on { animation: none; } .feed-row.new { animation: none; } }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15,27,45,.5); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 60; padding: 24px; }
.modal-bg.show { display: flex; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 24px; width: 520px; max-width: 100%; max-height: 92vh; overflow-y: auto; }
.modal.wide { width: 860px; }
.modal .m-h { display: flex; align-items: center; margin-bottom: 6px; }
.modal .m-h h3 { font-size: 18px; }
.close-x { cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1; margin-left: auto; padding: 2px 6px; border-radius: 6px; }
.close-x:hover { background: var(--surface-2); color: var(--ink); }
.qr-box { text-align: center; padding: 8px; }
.qr-box img { width: 250px; height: 250px; border-radius: 12px; border: 1px solid var(--line); }

/* toasts */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--sidebar); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); max-width: 340px; font-size: 13px; border-left: 3px solid var(--brand); animation: slidein .2s ease; }
.toast.err { border-left-color: var(--red); } .toast.ok { border-left-color: var(--accent); }
@keyframes slidein { from{ transform: translateY(8px); opacity: 0;} to{ transform: none; opacity: 1;} }

/* ===================== RESPONSIVE (all devices) ===================== */
.hamburger { display: none; background: transparent; border: 1px solid var(--line); border-radius: 9px; padding: 6px 11px; font-size: 18px; line-height: 1; color: var(--ink); }
.sb-backdrop { position: fixed; inset: 0; background: rgba(10,14,40,.5); z-index: 29; display: none; }

/* tablets */
@media (max-width: 1024px) {
  .content { padding: 22px 20px 50px; }
  .grid.c4 { grid-template-columns: repeat(2, 1fr); }
}

/* phones & small tablets — sidebar becomes a slide-in drawer */
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 30; width: 250px; transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .sidebar.open { transform: none; }
  .sb-backdrop.show { display: block; }
  .hamburger { display: inline-flex; align-items: center; }
  .main { width: 100%; }
  .topbar { padding: 12px 16px; gap: 10px; }
  .topbar h2 { font-size: 17px; }
  .topbar .crumb { display: none; }
  .content { padding: 18px 16px 60px; }
  .tenant-switch { width: 150px; }
  .grid.c4, .grid.c3, .grid.c2 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .modal, .modal.wide { width: 100%; padding: 18px; border-radius: 14px; }
  .card { padding: 16px; }
  .summary-row { gap: 8px; }
  .summary-row .kv { flex: 1 1 40%; }
  .login-panel { padding: 26px 20px; }
}

/* small phones */
@media (max-width: 480px) {
  .camp-grid { grid-template-columns: 1fr; }
  .stat .n { font-size: 23px; }
  .cc-metrics { gap: 12px; }
  .topbar { flex-wrap: wrap; }
  .tenant-switch { width: 130px; }
  th, td { padding: 9px 11px; font-size: 12.5px; }
  .profile-menu { width: 220px; }
  .bubble { max-width: 82%; }
  h2 { font-size: 20px; }
}
