:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8ee;
  --border-strong: #cfd7e0;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #8592a3;
  --accent: #0f766e;
  --accent-2: #14b8a6;
  --accent-soft: #e6f6f4;
  --side: #0b1324;
  --side-2: #131d33;
  --side-text: #b8c2d6;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --warn: #b45309;
  --warn-soft: #fef3e2;
  --ok: #15803d;
  --ok-soft: #e8f6ee;
  --info: #2563eb;
  --info-soft: #e8f0fe;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; height: 100vh; }
.sidebar { background: var(--side); color: var(--side-text); display: flex; flex-direction: column; overflow: hidden; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; color: #fff; font-weight: 800; font-size: 17px; letter-spacing: .04em; }
.brand-logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; }
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--side-text); letter-spacing: 0; }
.side-search { margin: 0 12px 8px; }
.side-search input { width: 100%; background: var(--side-2); border: 1px solid #22304d; border-radius: 8px; padding: 8px 10px; color: #fff; }
.nav { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.nav-sep { height: 1px; background: #1e2a44; margin: 8px 8px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-text); font-weight: 500; text-decoration: none; margin: 1px 0; }
.nav a:hover { background: var(--side-2); color: #fff; }
.nav a.active { background: var(--accent); color: #fff; }
.nav a .ico { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav a .count { margin-left: auto; background: #ef4444; color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; font-weight: 700; }
.side-foot { padding: 10px 12px; border-top: 1px solid #1e2a44; display: flex; align-items: center; gap: 10px; }
.side-foot .who { flex: 1; min-width: 0; }
.side-foot .who b { color: #fff; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { font-size: 12px; }
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar { height: 58px; flex: none; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 20px; }
.topbar h1 { font-size: 18px; font-weight: 700; }
.topbar .spacer { flex: 1; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); background: var(--surface); padding: 0 20px; overflow-x: auto; flex: none; }
.tabs a { padding: 11px 12px; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a.active { color: var(--accent); border-color: var(--accent); }
.content { flex: 1; overflow: auto; padding: 20px; }
.content.flush { padding: 0; overflow: hidden; display: flex; }
.btn.menu-btn { display: none; }
.i { width: 16px; height: 16px; flex: none; }

/* ---------- Components ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--surface); padding: 7px 13px; border-radius: 8px; cursor: pointer; font-weight: 600; white-space: nowrap; line-height: 1.2; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #0d6660; }
.btn.danger { color: var(--danger); border-color: #f3c4c4; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn.icon { padding: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.card-h h3 { font-size: 15px; }
.card-h .sub { color: var(--muted); font-size: 12px; }
.card-b { padding: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { margin-left: auto; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.stat { padding: 16px; }
.stat .lbl { color: var(--text-2); font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.stat .val { font-size: 26px; font-weight: 800; margin-top: 6px; letter-spacing: -.02em; }
.stat .delta { font-size: 12px; color: var(--muted); margin-top: 2px; }

.input, select.input, textarea.input { width: 100%; border: 1px solid var(--border-strong); background: #fff; border-radius: 8px; padding: 8px 10px; outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 118, 110, .15); }
textarea.input { resize: vertical; min-height: 80px; }
label.f { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13px; color: var(--text-2); }
label.f .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.form { display: grid; gap: 12px; }
.form.two { grid-template-columns: 1fr 1fr; }
.form .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.switch { position: relative; width: 38px; height: 22px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cbd5e1; border-radius: 99px; transition: .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { left: 19px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: #eef2f7; color: #334155; margin: 1px 2px 1px 0; }
.tag i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

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

table.t { width: 100%; border-collapse: separate; border-spacing: 0; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.t tr:hover td { background: #fafcfd; }
table.t tr.clickable { cursor: pointer; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow: auto; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg { width: 42px; height: 42px; opacity: .5; margin-bottom: 8px; }
.empty h4 { color: var(--text-2); margin-bottom: 4px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .input { width: auto; }
.bulkbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: var(--accent-soft); border: 1px solid #b7e3dd; padding: 8px 12px; border-radius: 10px; margin-bottom: 12px; }

/* Modal / drawer */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow: auto; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 860px; }
.modal-h { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-h h3 { font-size: 16px; flex: 1; }
.modal-b { padding: 20px; max-height: 70vh; overflow: auto; }
.modal-f { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.drawer-ov { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw); background: var(--bg); z-index: 41; display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0,0,0,.15); }
.drawer-h { background: var(--surface); padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.drawer-b { flex: 1; overflow: auto; padding: 16px; }

#toasts { position: fixed; bottom: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #0f172a; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: 380px; animation: tin .2s ease; }
.toast.err { background: var(--danger); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.tip { position: fixed; z-index: 120; background: #0f172a; color: #fff; padding: 7px 10px; border-radius: 8px; font-size: 12px; pointer-events: none; max-width: 260px; box-shadow: var(--shadow); }

.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12); min-width: 220px; z-index: 30; padding: 6px; }
.dropdown-menu.left { right: auto; left: 0; }
.dropdown-menu button, .dropdown-menu a { display: flex; width: 100%; align-items: center; gap: 8px; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 7px; cursor: pointer; color: var(--text); text-decoration: none; }
.dropdown-menu button:hover, .dropdown-menu a:hover { background: var(--surface-2); }
.dropdown-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

/* Kanban */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; min-height: 60vh; }
.kcol { flex: 0 0 280px; background: #eef1f5; border-radius: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 210px); }
.kcol-h { padding: 10px 12px; border-top: 4px solid var(--c, #94a3b8); border-radius: 12px 12px 0 0; background: #fff; }
.kcol-h b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.kcol-h span { font-size: 12px; color: var(--muted); }
.kcol-b { padding: 8px; overflow-y: auto; flex: 1; min-height: 80px; display: flex; flex-direction: column; gap: 8px; }
.kcol-b.over { background: #dff3f0; }
.kcard { background: #fff; border-radius: 9px; padding: 10px 12px; border: 1px solid var(--border); cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.kcard:hover { border-color: var(--accent-2); }
.kcard.dragging { opacity: .5; }
.kcard .t1 { font-weight: 600; }
.kcard .t2 { display: flex; justify-content: space-between; margin-top: 6px; color: var(--text-2); font-size: 12px; align-items: center; }

/* Inbox */
.inbox { display: grid; grid-template-columns: 300px minmax(0, 1fr) 280px; width: 100%; height: 100%; position: relative; }
.inbox.side-off { grid-template-columns: 300px minmax(0, 1fr); }
.inbox.side-off .inbox-side { display: none; }
.inbox-list { border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.inbox-filters { padding: 10px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.seg { display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.seg button { flex: 1; border: 0; background: none; padding: 5px 6px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 12px; color: var(--text-2); }
.seg button.on { background: #fff; color: var(--accent); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.conv-items { flex: 1; overflow-y: auto; }
.conv-item { display: flex; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--border); cursor: pointer; position: relative; }
.conv-item:hover { background: var(--surface-2); }
.conv-item.active { background: var(--accent-soft); }
.conv-item .ch { position: absolute; left: 34px; top: 33px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; display: grid; place-items: center; }
.conv-item .ch svg { width: 9px; height: 9px; }
.conv-item .unread { background: var(--accent); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 6px; font-weight: 700; }
.thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.thread-h { background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px; display: flex; align-items: center; gap: 10px; }
.msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: min(78%, 620px); padding: 9px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--border); white-space: pre-wrap; word-wrap: break-word; }
.msg.out { align-self: flex-end; background: #d8f3ef; border-color: #bfe7e1; }
.msg.note { align-self: center; background: #fff8e1; border: 1px dashed #f0c46b; max-width: 85%; }
.msg .meta { font-size: 11px; color: var(--muted); margin-top: 4px; display: flex; gap: 6px; justify-content: flex-end; }
.msg img { max-width: 240px; border-radius: 8px; display: block; margin-top: 4px; }
.day-sep { align-self: center; font-size: 11px; color: var(--muted); background: #e8ecf1; border-radius: 99px; padding: 2px 10px; margin: 6px 0; }
.composer { background: var(--surface); border-top: 1px solid var(--border); padding: 10px 14px; }
.composer textarea { min-height: 46px; border: 0; padding: 6px 2px; box-shadow: none !important; }
.composer .row { margin-top: 6px; }
.inbox-side { background: var(--surface); border-left: 1px solid var(--border); overflow-y: auto; padding: 16px; position: relative; }
.inbox-side .side-x { position: absolute; top: 8px; right: 8px; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border-left: 1px solid var(--border); border-top: 1px solid var(--border); background: #fff; border-radius: 10px; overflow: hidden; }
.cal .dow { padding: 8px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cal .day { min-height: 112px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; cursor: pointer; }
.cal .day:hover { background: #fafcfd; }
.cal .day.other { background: #fafbfc; color: var(--muted); }
.cal .day.today .n { background: var(--accent); color: #fff; }
.cal .n { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 99px; font-weight: 700; font-size: 12px; }
.cal .ev { font-size: 12px; padding: 2px 6px; border-radius: 5px; margin-top: 3px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }

/* Workflow builder */
.flow { display: flex; flex-direction: column; align-items: center; padding: 24px 12px 60px; }
.node { width: min(460px, 100%); background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 12px 14px; position: relative; }
.node.trigger { border-top: 4px solid #f59e0b; background: #fffaf0; }
.node.action { border-left: 4px solid var(--accent-2); }
.node.wait { border-left: 4px solid #8b5cf6; }
.node.cond { border-left: 4px solid #eab308; }
.node .nh { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.node .nd { color: var(--text-2); font-size: 13px; margin-top: 4px; white-space: pre-wrap; }
.node .acts { position: absolute; top: 8px; right: 8px; display: none; gap: 2px; }
.node:hover .acts { display: flex; }
.connector { width: 2px; height: 22px; background: var(--border-strong); }
.add-step { width: 28px; height: 28px; border-radius: 50%; border: 1px dashed var(--accent); color: var(--accent); background: #fff; cursor: pointer; display: grid; place-items: center; font-size: 18px; line-height: 1; }
.add-step:hover { background: var(--accent-soft); }

/* Site builder */
.builder { display: grid; grid-template-columns: 340px 1fr; height: 100%; width: 100%; }
.builder-side { background: #fff; border-right: 1px solid var(--border); overflow-y: auto; padding: 14px; }
.builder-prev { overflow: auto; background: #e9edf2; padding: 18px; }
.builder-prev iframe { width: 100%; height: 100%; min-height: 70vh; border: 0; border-radius: 10px; background: #fff; box-shadow: var(--shadow); }
.block-item { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; background: var(--surface-2); }
.block-item > .bh { display: flex; align-items: center; gap: 6px; padding: 8px 10px; font-weight: 600; cursor: pointer; }
.block-item > .bb { padding: 10px; border-top: 1px solid var(--border); background: #fff; border-radius: 0 0 10px 10px; }
.tpl-card { cursor: pointer; overflow: hidden; }
.tpl-card:hover { border-color: var(--accent-2); }
.tpl-thumb { height: 120px; display: flex; flex-direction: column; justify-content: flex-end; padding: 14px; color: #fff; font-weight: 800; font-size: 17px; }

/* Charts */
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis { stroke: var(--border); }
.chart .lbl { fill: var(--text-2); font-size: 11px; }
.chart .val { fill: var(--text); font-size: 11px; font-weight: 600; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: -1px; }
.funnel-row { display: grid; grid-template-columns: 170px 1fr 90px; align-items: center; gap: 10px; margin: 6px 0; font-size: 13px; }
.funnel-bar { height: 22px; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.progress { height: 8px; background: #e8edf2; border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 99px; }

/* Login */
.auth { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 20% 10%, #12304a 0, #0b1324 55%); padding: 20px; }
.auth .card { width: 100%; max-width: 400px; padding: 28px; }
.auth h2 { font-size: 22px; margin: 14px 0 4px; }

/* Chat IA */
.ai-panel { position: fixed; right: 18px; bottom: 18px; width: min(420px, calc(100vw - 36px)); height: min(600px, calc(100vh - 36px)); background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.25); z-index: 60; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); }
.ai-panel .h { background: var(--side); color: #fff; padding: 12px 14px; display: flex; align-items: center; gap: 8px; }
.ai-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.ai-msgs .msg { max-width: 88%; }

.checklist-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.checklist-item .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; flex: none; }
.checklist-item.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.checklist-item.done .t { text-decoration: line-through; color: var(--muted); }

.perm-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); }
.channel-card { display: flex; gap: 12px; align-items: center; padding: 14px; }
.channel-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none; }
.channel-ico svg { width: 20px; height: 20px; }
.timeline-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.timeline-item .ti { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; flex: none; }
.timeline-item .ti svg { width: 14px; height: 14px; }
.stars-v { color: #f59e0b; letter-spacing: 1px; }
.help-body { max-width: 860px; line-height: 1.65; }
.help-body h1 { font-size: 26px; margin: 10px 0 12px; }
.help-body h2 { font-size: 20px; margin: 28px 0 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.help-body h3 { font-size: 16px; margin: 18px 0 6px; }
.help-body code { background: #eef2f7; padding: 1px 6px; border-radius: 5px; font-size: 13px; }
.help-body pre { background: #0f172a; color: #e2e8f0; padding: 12px 14px; border-radius: 10px; overflow: auto; }
.help-body pre code { background: none; color: inherit; padding: 0; }
.help-body table { border-collapse: collapse; width: 100%; margin: 10px 0; }
.help-body th, .help-body td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; vertical-align: top; }
.help-body th { background: var(--surface-2); }
.help-body blockquote { margin: 10px 0; padding: 8px 14px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; }

@media (max-width: 1400px) {
  .inbox, .inbox.side-off { grid-template-columns: 280px minmax(0, 1fr); }
  .inbox-side { display: none; }
  .inbox.side-on .inbox-side { display: block; position: absolute; top: 0; right: 0; bottom: 0; width: min(300px, 90%); z-index: 6; box-shadow: -10px 0 28px rgba(15, 23, 42, .14); }
}
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 70; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .sidebar { transform: none; }
  .btn.menu-btn { display: inline-flex; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .form.two { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 1fr; }
  .inbox.has-thread .inbox-list { display: none; }
  .inbox:not(.has-thread) .thread { display: none; }
  .builder { grid-template-columns: 1fr; }
  .content { padding: 14px; }
  .topbar { padding: 8px 12px; height: auto; min-height: 54px; flex-wrap: wrap; }
  #pactions { order: 5; width: 100%; overflow-x: auto; padding-bottom: 2px; }
  #pactions .input { min-width: 140px; }
  .funnel-row { grid-template-columns: 110px 1fr 70px; }
}

/* Integracion con agente externo */
.agent-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 7px 14px; cursor: default; border-bottom: 1px solid var(--border); background: var(--info-soft); font-size: 13px; }
.agent-bar .i { color: var(--info); }
.agent-bar.humano { background: var(--warn-soft); }
.agent-bar.humano .i { color: var(--warn); }
.agent-bar.toma_solicitada, .agent-bar.devolucion_solicitada { background: var(--surface-2); }
.media-ref { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.media-ref summary { cursor: pointer; }
.media-ref[open] { display: flex; flex-wrap: wrap; gap: 2px 10px; padding: 6px 8px; border-radius: 8px; background: rgba(15, 23, 42, .06); color: var(--text-2); }
.media-ref[open] summary { flex-basis: 100%; }
.msg.out .media-ref { background: rgba(255, 255, 255, .18); }
.msg.incident { outline: 2px solid var(--danger); }

/* Destinova */
.dst-row { padding: 8px 0; border-bottom: 1px solid var(--border); }
.dst-row:last-child { border-bottom: 0; }
.dst-row.abierto { border-left: 3px solid var(--warn); padding-left: 8px; }
.dst-head .badge { margin-right: 4px; }

/* Ficha de solicitud (Destinova) */
.mt-s { margin-top: 8px; }
.sol { display: flex; flex-direction: column; gap: 16px; max-width: 1280px; }
.sol-hero { padding: 18px 20px; }
.sol-top { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.sol-kicker { font-size: 12px; color: var(--muted); font-weight: 600; }
.sol-top h2 { font-size: 22px; margin: 2px 0 4px; }
.sol-busca { color: var(--text-2); font-size: 14px; }
.sol-total { text-align: right; }
.sol-total b { font-size: 20px; display: block; }
.sol-steps { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 18px 0 0; padding: 0; }
.sol-steps li { display: flex; gap: 8px; align-items: flex-start; padding: 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); min-width: 0; }
.sol-steps li b { display: block; font-size: 13px; color: inherit; }
.sol-steps li .small { color: var(--text-2); overflow-wrap: anywhere; }
.sol-steps .dot { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: #fff; border: 2px solid var(--border-strong); }
.sol-steps .dot svg { width: 14px; height: 14px; }
.sol-steps li.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.sol-steps li.ok .small { color: var(--ok); }
.sol-steps li.ok .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.sol-steps li.now { background: #fff; border: 2px solid var(--accent); color: var(--text); }
.sol-steps li.now .dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.sol-steps.cerrada li { opacity: .55; }
.sol-closed { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-weight: 600; display: flex; gap: 8px; align-items: center; }
.sol-closed svg { width: 16px; height: 16px; }
.sol-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.sol-meta label { display: inline-flex; gap: 6px; align-items: center; }
.sol-meta select { width: auto; padding: 3px 8px; font-size: 12px; }
.sol-meta svg { width: 14px; height: 14px; vertical-align: -2px; }
.sol-cols { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.sol-cols > .col { gap: 16px; min-width: 0; }
.todo { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.todo:first-child { padding-top: 0; }
.todo:last-of-type { border-bottom: 0; }
.todo .ti { flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.todo.warn .ti { background: var(--warn-soft); color: var(--warn); }
.todo .ti svg { width: 16px; height: 16px; }
.todo .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.sol-done { color: var(--ok); font-weight: 600; display: flex; gap: 8px; align-items: center; }
.sol-done svg { width: 18px; height: 18px; }
.sol-luna { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--info-soft); font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.sol-luna svg { width: 16px; height: 16px; color: var(--info); flex: none; margin-top: 2px; }
details.fold > summary { cursor: pointer; color: var(--text-2); font-size: 13px; font-weight: 600; padding: 4px 0; }
details.sol-hist > summary { cursor: pointer; padding: 14px 16px; font-weight: 700; font-size: 15px; }
.sol-dl { margin: 0; display: grid; gap: 12px; }
.sol-dl > div { display: grid; gap: 1px; }
.sol-dl dt { font-size: 12px; color: var(--muted); }
.sol-dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.src { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 8px; white-space: nowrap; }
.src.ok { color: var(--ok); }
.pay-wrap { position: relative; padding: 3px 0; }
.pay-bar { height: 12px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); display: flex; overflow: hidden; }
.pay-bar .v { background: var(--ok); }
.pay-bar .p { background: #f5c46b; }
.pay-wrap i { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text-2); border-radius: 2px; }
.dst-act { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.dst-act:last-child { margin-bottom: 0; }
.dst-act.cancelada { opacity: .6; }
.dst-act .t td { padding: 3px 6px; }
.act-t { font-size: 15px; }
.act-facts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; color: var(--text-2); font-size: 13px; }
.act-facts span { display: inline-flex; gap: 6px; align-items: center; }
.act-facts svg { width: 15px; height: 15px; color: var(--muted); }
.act-st { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.st { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.st.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.st.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.st svg { width: 12px; height: 12px; }
.act-src { margin-top: 8px; }
.dst-act .small.muted svg { width: 13px; height: 13px; vertical-align: -2px; }
@media (max-width: 1200px) {
  .sol-cols { grid-template-columns: 1fr; }
  .sol-steps { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
