:root {
  color-scheme: dark;
  --bg: #0b0614; --bg2: #120a22; --panel: #170d2b; --ink: #f3ecff; --muted: #a395c4; --line: #2b1c4a; --soft: #21143a;
  --accent: #ff4fd8; --accent-ink: #1a0720; --accent-soft: rgb(255 79 216 / .14);
  --cyan: #3df5ff; --lime: #b8ff4a; --violet: #8b5cff;
  --warn: #ffc94a; --warn-soft: rgb(255 201 74 / .1);
  --bad: #ff7aa8; --bad-soft: rgb(255 122 168 / .1);
  --live: #ff8a3d;
  --radius: 16px;
  --shadow: 0 1px 0 rgb(255 255 255 / .02) inset;
  --font: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: radial-gradient(800px 420px at 92% -10%, rgb(255 79 216 / .12), transparent 70%) no-repeat, var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--cyan); }
a:hover { color: var(--lime); }
::selection { background: var(--accent); color: var(--accent-ink); }
h1, h2, .ws-name, .brand, .pill, .usage, .tab, .chip, .run-meta, .btn, .ghost, .danger { font-family: var(--mono); }
h1, .ws-name { letter-spacing: -.02em; font-weight: 800; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* top bar */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem clamp(1rem, 3vw, 2rem); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; font-weight: 600; min-width: 0; }
.brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-mark { width: 24px; height: 24px; border-radius: 7px; flex: none; background: linear-gradient(135deg, var(--accent), var(--violet) 55%, var(--cyan));
  box-shadow: 0 0 16px rgb(255 79 216 / .5); }
.brand { font-weight: 800; }
.top-nav { display: flex; align-items: center; gap: .75rem; }
.usage { color: var(--muted); font-size: .85rem; white-space: nowrap; }
@media (max-width: 560px) { .usage { display: none; } }

.view { max-width: 1240px; margin: 0 auto; padding: clamp(1rem, 3vw, 2rem); }

/* controls */
.btn, .ghost, .danger { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border-radius: 8px;
  padding: .55rem .95rem; border: 1px solid transparent; cursor: pointer; font-weight: 550; text-decoration: none; white-space: nowrap; }
.btn { background: var(--accent); color: var(--accent-ink); font-weight: 800; box-shadow: 0 6px 22px rgb(255 79 216 / .3); }
.btn, .ghost, .danger { border-radius: 10px; min-height: 2.6rem; }
.btn:hover { filter: brightness(1.06); }
.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.ghost:hover { background: var(--soft); }
.danger { background: transparent; border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); color: var(--bad); }
.danger:hover { background: var(--bad-soft); }
button:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
label { display: block; font-weight: 550; margin: 0 0 .3rem; }
.field { margin-bottom: 1rem; }
.hint { color: var(--muted); font-size: .85rem; margin-top: .3rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], input[type=date], input[type=tel], textarea, select {
  width: 100%; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); }
input::placeholder, textarea::placeholder { color: #7d6fa3; }
input[type=checkbox] { accent-color: var(--accent); }
textarea { min-height: 7rem; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1 1 12rem; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.stack > * + * { margin-top: 1rem; }

/* login */
.auth { max-width: 420px; margin: 8vh auto 0; }
.auth .card { padding: 1.75rem; }
.auth h1 { margin-bottom: .5rem; }

/* team */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.emp { display: flex; flex-direction: column; gap: .5rem; color: inherit; text-decoration: none; transition: border-color .15s; }
.emp:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.emp-top { display: flex; align-items: center; gap: .75rem; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font: 800 1rem var(--mono); flex: none;
  background: var(--cyan); color: var(--bg); box-shadow: 0 0 20px rgb(61 245 255 / .35); }
.emp-name { font-weight: 650; }
.emp-role { color: var(--muted); font-size: .9rem; }
.emp-last { color: var(--muted); font-size: .88rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.empty { text-align: center; padding: 3rem 1rem; }

.pill { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 600; padding: .15rem .55rem; border-radius: 99px;
  background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.pill { border: 1px solid color-mix(in srgb, currentColor 40%, transparent); }
.pill.running { background: color-mix(in srgb, var(--live) 14%, transparent); color: var(--live); }
.pill.done { background: rgb(184 255 74 / .08); color: var(--lime); }
.pill.failed { background: var(--bad-soft); color: var(--bad); }
.pill.queued, .pill.stopped { background: var(--warn-soft); color: var(--warn); }

/* workspace */
.ws { display: grid; grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .ws { grid-template-columns: 1fr; } .screen-col { order: -1; } }
.ws-head { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.ws-head .grow { flex: 1; min-width: 0; }
.ws-head h1 { margin: 0; }
.composer textarea { min-height: 5.5rem; }
.composer .row { justify-content: space-between; margin-top: .6rem; }
.examples { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 99px; padding: .25rem .7rem; font-size: .83rem; cursor: pointer; color: var(--muted); }
.chip:hover { color: var(--ink); border-color: var(--muted); }

.timeline { list-style: none; margin: 0; padding: 0; max-height: 46vh; overflow: auto; }
.timeline li { display: grid; grid-template-columns: 1.1rem 1fr; gap: .5rem; padding: .35rem 0; font-size: .9rem; }
.timeline .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: .45rem; background: var(--line); }
.timeline li.act .dot { background: var(--accent); }
.timeline li.think { color: var(--muted); }
.timeline li.warn .dot { background: var(--warn); }
.timeline li.end .dot { background: var(--ink); }
.answer { white-space: pre-wrap; background: var(--soft); border-radius: 8px; padding: .75rem .9rem; font-size: .93rem; }

.pending { border-color: rgb(255 201 74 / .55); background: linear-gradient(180deg, var(--warn-soft), var(--panel) 60%); }
.pending h2 { color: var(--warn); }

.screen-col { position: sticky; top: 4.2rem; }
.screen { position: relative; aspect-ratio: 1280 / 800; background: #07040e; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.screen > iframe, .screen > img { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: contain; background: #0e0f10; }
.screen .shield { position: absolute; inset: 0; cursor: not-allowed; }
.screen.working { box-shadow: 0 0 0 2px var(--accent), 0 0 44px rgb(255 79 216 / .25); }
.screen.human { box-shadow: 0 0 0 3px var(--warn); }
.screen .idle { position: absolute; inset: 0; display: grid; place-items: center; color: #9aa0a6; text-align: center; padding: 1rem; }
.screen-bar { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-top: .6rem; flex-wrap: wrap; }
.status-line { font-size: .9rem; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

.runs { list-style: none; margin: 0; padding: 0; }
.runs li { border-top: 1px solid var(--line); padding: .7rem 0; }
.runs li:first-child { border-top: 0; }
.run-head { display: flex; gap: .6rem; align-items: baseline; justify-content: space-between; cursor: pointer; }
.run-goal { font-weight: 550; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.run-meta { font-size: .8rem; color: var(--muted); }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .4rem; margin-top: .6rem; }
.shots img { width: 100%; border-radius: 6px; border: 1px solid var(--line); cursor: zoom-in; }

.toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: .6rem 1rem; border-radius: 8px; box-shadow: var(--shadow); max-width: calc(100vw - 2rem); z-index: 20; }
.devlink { word-break: break-all; font-family: var(--mono); font-size: .8rem; }
.sites { font-family: var(--mono); font-size: .9rem; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); max-width: min(92vw, 1100px); padding: .5rem; }
dialog img { max-width: 100%; display: block; }
dialog::backdrop { background: rgb(0 0 0 / .55); }

/* memory + files lists */
.mem { list-style: none; margin: 0; padding: 0; }
.mem li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .5rem 0; border-top: 1px solid var(--line); }
.mem li:first-child { border-top: 0; }
.mem a { font-weight: 550; word-break: break-word; }
.ghost.small { padding: .3rem .6rem; font-size: .8rem; }

/* agent cursor over the live screen */
.agent-cursor { position: absolute; width: 0; height: 0; pointer-events: none; z-index: 3; transition: left .35s ease, top .35s ease; }
.agent-cursor::before { content: ""; position: absolute; left: -1px; top: -1px; border-left: 9px solid transparent; border-right: 9px solid transparent;
  border-bottom: 20px solid var(--live); transform: rotate(-30deg); transform-origin: 0 0; filter: drop-shadow(0 1px 2px rgb(0 0 0 / .5)); }
.agent-cursor span { position: absolute; left: 14px; top: 16px; background: var(--live); color: #fff; font-size: .72rem; font-weight: 650;
  padding: .1rem .45rem; border-radius: 99px; white-space: nowrap; }
.agent-cursor[data-kind=type] span::after { content: " ⌨"; }
.agent-cursor[data-kind=scroll] span::after { content: " ↕"; }
.agent-cursor.pulse[data-kind=click]::after { content: ""; position: absolute; left: -14px; top: -14px; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--live); animation: ripple .6s ease-out forwards; }
@keyframes ripple { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .agent-cursor { transition: none; } .agent-cursor.pulse[data-kind=click]::after { animation: none; } }
.danger.small { padding: .3rem .6rem; font-size: .8rem; }

/* approval card */
.pending.money { border-color: rgb(255 79 216 / .6); background: linear-gradient(180deg, rgb(255 79 216 / .12), var(--panel) 60%); box-shadow: 0 0 34px rgb(255 79 216 / .14); }
.pending.money h2 { color: var(--accent); }
.pending .btn { background: var(--lime); color: #0b0614; box-shadow: 0 0 18px rgb(184 255 74 / .3); }
table.fields { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.fields th { text-align: left; font-weight: 550; color: var(--muted); padding: .25rem .6rem .25rem 0; width: 40%; vertical-align: top; }
table.fields td { padding: .25rem 0; word-break: break-word; }
table.fields tr + tr th, table.fields tr + tr td { border-top: 1px solid var(--line); }

.chip.proc { border-color: rgb(61 245 255 / .45); color: var(--cyan); }
pre.steps { white-space: pre-wrap; font: .8rem/1.45 var(--mono); background: var(--soft); border-radius: 8px; padding: .6rem .7rem; margin: .5rem 0 0; max-height: 18rem; overflow: auto; }
details summary { cursor: pointer; }
.btn.small { padding: .3rem .7rem; font-size: .8rem; }

/* ---------- workspace v2: top bar · live sidebar · big screen ---------- */
.view.wide { max-width: none; padding: .9rem clamp(.75rem, 2vw, 1.5rem) 1.5rem; }
.ws-top { position: sticky; top: 3.1rem; z-index: 8; display: flex; align-items: center; justify-content: space-between; gap: .75rem 1rem; flex-wrap: wrap;
  padding: .55rem .2rem .7rem; margin-bottom: .9rem; background: var(--bg); border-bottom: 1px solid var(--line); }
.ws-id { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.ws-name { font-weight: 650; font-size: 1.1rem; line-height: 1.2; }
.ws-role { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30ch; }
.ws-pills { display: flex; gap: .4rem; flex-wrap: wrap; }
.pill-btn { display: inline-flex; align-items: center; gap: .5rem; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 99px; padding: 0 1.1rem; min-height: 2.75rem; font-weight: 550; font-size: .9rem; cursor: pointer; }
.pill-btn:hover, .pill-btn[aria-expanded=true] { border-color: var(--violet); background: var(--soft); }
.pill-btn.cfg { border-color: var(--lime); color: var(--lime); background: rgb(184 255 74 / .07); font-weight: 700; }
.pill-btn.cfg:hover { background: rgb(184 255 74 / .14); border-color: var(--lime); }
.pill-btn .count:not(:empty) { min-width: 1.35rem; padding: 0 .4rem; border-radius: 99px; background: var(--cyan); color: var(--bg); font-family: var(--mono); font-weight: 700; font-size: .75rem; text-align: center; }
.pop-wrap { position: relative; }
.popover { position: absolute; right: 0; top: calc(100% + .5rem); z-index: 20; width: min(440px, calc(100vw - 1.5rem)); max-height: 72vh; overflow: auto;
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 24px 70px rgb(0 0 0 / .6), 0 0 0 1px rgb(139 92 255 / .25); }
.popover > .card { border: 0; box-shadow: none; }

.ws { grid-template-columns: var(--side-w, 400px) 24px minmax(0, 1fr); gap: 0; }
.ws.no-side { grid-template-columns: minmax(0, 1fr); }
.ws.no-side .ws-side, .ws.no-side .ws-grip { display: none; }
.ws-side .card { border-radius: 18px; padding: 1.4rem; }
.ws-grip { align-self: stretch; position: sticky; top: 7.6rem; height: calc(100vh - 9rem); border: 0; padding: 0; background: transparent; cursor: col-resize; display: grid; place-items: center; touch-action: none; }
.ws-grip::before { content: ""; width: 4px; height: 56px; border-radius: 99px; background: var(--line); transition: background .15s, box-shadow .15s; }
.ws-grip:hover::before, .ws-grip:focus-visible::before, .ws-grip.dragging::before { background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.ws.dragging { user-select: none; cursor: col-resize; }
.ws { position: relative; }
.ws-side { position: sticky; }
.side-hide { position: absolute; top: .55rem; right: .55rem; z-index: 2; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--muted); font: 700 .85rem var(--mono); cursor: pointer; display: grid; place-items: center; }
.side-hide:hover { color: var(--ink); border-color: var(--violet); }
.screen-col { position: relative; }
.side-show { position: absolute; left: calc(-1 * clamp(.75rem, 2vw, 1.5rem)); top: 1rem; z-index: 4; width: 20px; height: 56px; padding: 0;
  border: 1px solid var(--line); border-left: 0; border-radius: 0 10px 10px 0; background: var(--panel); color: var(--muted); font: 700 .8rem var(--mono); cursor: pointer; }
.side-show:hover { color: var(--ink); border-color: var(--accent); box-shadow: 0 0 14px rgb(255 79 216 / .3); }
.live-dot { flex: none; font: 600 .75rem var(--mono); color: var(--accent); display: inline-flex; align-items: center; gap: .45rem; }
.live-dot[hidden] { display: none; }
.live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.ws .screen { border-radius: 18px; }
.ws-side { display: flex; flex-direction: column; gap: .9rem; position: sticky; top: 7.6rem; max-height: calc(100vh - 8.5rem); overflow: auto; padding-bottom: .5rem; }
.ws-side .timeline { max-height: none; }
.ws .screen-col { position: static; }
.ws .screen { border-radius: 12px; }
@media (max-width: 900px) {
  .ws, .ws.no-side { grid-template-columns: 1fr; gap: 1rem; }
  .ws-grip, .side-hide, .side-show { display: none !important; }
  .ws.no-side .ws-side { display: flex; }
  .ws-top { position: static; }
  .ws-side { position: static; max-height: none; overflow: visible; }
}

.drawer { position: fixed; inset: 0; z-index: 30; pointer-events: none; display: grid; place-items: center; padding: 1.5rem; }
.drawer-scrim { position: absolute; inset: 0; background: rgb(7 4 14 / .72); backdrop-filter: blur(4px); opacity: 0; transition: opacity .18s; }
.drawer-panel { position: relative; width: min(920px, 100%); height: min(660px, calc(100vh - 3rem)); background: var(--bg2); border: 1px solid var(--line);
  border-radius: 20px; display: grid; grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); overflow: hidden;
  box-shadow: 0 0 0 1px rgb(139 92 255 / .35), 0 30px 90px rgb(0 0 0 / .7), 0 0 60px rgb(139 92 255 / .18);
  opacity: 0; transform: translateY(8px) scale(.98); transition: opacity .18s, transform .18s; }
.drawer.open { pointer-events: auto; }
.drawer.open .drawer-scrim { opacity: 1; }
.drawer.open .drawer-panel { opacity: 1; transform: none; }
.drawer-head { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.3rem; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 1.1rem; }
.tabs { display: flex; flex-direction: column; gap: .25rem; padding: 1rem; border-right: 1px solid var(--line); overflow-y: auto; }
.tab { text-align: left; border: 0; background: transparent; color: var(--muted); padding: .7rem .9rem; border-radius: 10px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.tab:hover { background: var(--soft); color: var(--ink); }
.tab.active { background: var(--line); color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }
.drawer-body { overflow: auto; padding: 1.4rem 1.6rem 2rem; }
.drawer-body > .card { border: 0; box-shadow: none; padding: 0; background: transparent; }
@media (max-width: 700px) {
  .drawer { padding: 0; }
  .drawer-panel { height: 100%; border-radius: 0; grid-template-columns: 1fr; grid-template-rows: auto auto minmax(0, 1fr); }
  .tabs { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) { .drawer-panel, .drawer-scrim { transition: none; } }
code.addr { font: .85rem var(--mono); color: var(--cyan); background: var(--soft); border-radius: 6px; padding: .35rem .55rem; word-break: break-all; }

/* operator dashboard */
.test-badge { display: inline-block; margin-left: .45rem; font: 800 .65rem var(--mono); letter-spacing: .08em; color: #0b0614; background: var(--warn);
  border-radius: 6px; padding: .12rem .4rem; vertical-align: middle; }
.admin-link { border-color: var(--violet); color: var(--violet); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.tile-v { font: 800 1.8rem var(--mono); letter-spacing: -.03em; }
.tile-l { color: var(--muted); font-size: .85rem; }
table.admin-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.admin-table th { text-align: left; font: 600 .75rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: .5rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin-table td { padding: .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table tr.off td { opacity: .55; }
.admin-table td.goal { max-width: 36ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

details.guide { border: 1px solid var(--line); border-radius: 12px; padding: .7rem .9rem; background: var(--bg); }
details.guide summary { font-weight: 600; color: var(--warn); }
details.guide ol { margin: .6rem 0 0; padding-left: 1.2rem; display: grid; gap: .45rem; color: var(--muted); }
details.guide strong { color: var(--ink); }

/* activity view (connected apps) over the screen box */
.screen-wrap { position: relative; }
.activity { position: absolute; inset: 0; z-index: 4; overflow: auto; padding: 1rem; border-radius: 18px; background: #0d0718; border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: .8rem; }
.activity .idle { position: static; color: var(--muted); text-align: center; margin: auto; max-width: 40ch; }
.vtabs { display: flex; flex: none; gap: 2px; padding: 3px; border-radius: 99px; background: rgb(11 6 20 / .8); border: 1px solid var(--line); }
.vtab { border: 0; background: transparent; color: var(--muted); font: 600 .75rem var(--mono); padding: .3rem .75rem; border-radius: 99px; cursor: pointer; display: inline-flex; gap: .35rem; align-items: center; }
.vtab.on { background: var(--line); color: var(--ink); }
.vcount:not(:empty) { background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: 0 .4rem; font-size: .7rem; }
.act-card { border: 1px solid var(--line); background: var(--panel); border-radius: 14px; padding: .8rem .9rem; display: flex; flex-direction: column; gap: .6rem; }
.act-card.publish { border-color: rgb(255 79 216 / .45); }
.act-head { display: flex; align-items: center; gap: .6rem; }
.act-title { flex: 1; font-weight: 600; }
.app-badge { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font: 800 .8rem var(--mono); background: var(--line); color: var(--ink); flex: none; }
.app-badge.fb { background: #1877f2; color: #fff; }
.app-badge.ig { background: linear-gradient(135deg, #f58529, #dd2a7b 50%, #8134af); color: #fff; }
.app-badge.g { background: #fff; color: #4285f4; }
.post-preview { background: #fff; color: #1c1e21; border-radius: 12px; padding: .8rem; display: flex; flex-direction: column; gap: .55rem; max-width: 520px; }
.post-preview .muted { color: #65676b; }
.pp-head { display: flex; gap: .55rem; align-items: center; }
.pp-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #e4e6eb; font-weight: 800; color: #1c1e21; }
.pp-text { white-space: pre-wrap; font-size: .92rem; line-height: 1.4; }
.pp-img { width: 100%; border-radius: 8px; max-height: 320px; object-fit: cover; }
.draft-text { white-space: pre-wrap; font-size: .88rem; line-height: 1.45; background: var(--bg); border: 1px dashed var(--line); border-radius: 10px; padding: .7rem .8rem; max-height: 260px; overflow: auto; }

/* chat sidebar */
.card.chat { display: flex; flex-direction: column; gap: .7rem; padding: 1rem; height: calc(100vh - 10rem); min-height: 420px; }
.chat-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding-right: 2rem; }
.thread { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: .7rem; padding: .2rem .1rem; }
.thread-empty { color: var(--muted); font-size: .9rem; margin: auto 0; text-align: center; padding: 1rem; }
.msg { display: flex; flex-direction: column; max-width: 92%; }
.msg.you { align-self: flex-end; align-items: flex-end; }
.msg.agent { align-self: flex-start; }
.msg .bub { padding: .6rem .8rem; border-radius: 14px; font-size: .92rem; line-height: 1.45; word-break: break-word; }
.msg.you .bub { background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.agent .bub { background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.agent.warn .bub { border-color: rgb(255 201 74 / .5); }
.msg .meta { font: .7rem var(--mono); color: var(--muted); margin-top: .2rem; }
.md > div { min-height: 1.2em; } .md .gap { min-height: .5em; }
.md .q { border-left: 3px solid var(--violet); padding-left: .6rem; color: var(--ink); }
.md code { font: .82rem var(--mono); background: var(--soft); border-radius: 4px; padding: 0 .25rem; }
.msg.working .bub { width: 100%; }
.msg.working .timeline { max-height: none; margin-top: .3rem; }
.timeline li.you { color: var(--accent); }
.typing { display: inline-flex; gap: 4px; margin-bottom: .3rem; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blinkdot 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blinkdot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing span { animation: none; opacity: .6; } }
.steps-fold { margin-top: .4rem; }
.linkish { background: none; border: 0; padding: 0; color: var(--cyan); font: 600 .78rem var(--mono); cursor: pointer; }
.chat-form { display: flex; gap: .4rem; align-items: flex-end; }
.chat-form textarea { flex: 1; min-height: 2.75rem; max-height: 10rem; resize: vertical; }
.chat-form .send { min-width: 2.75rem; padding: 0 .8rem; font-size: 1.1rem; }
.chat-form .plus { min-height: 2.75rem; min-width: 2.75rem; font-size: 1.1rem; }
.chat-more { border: 1px solid var(--line); border-radius: 12px; padding: .7rem; display: flex; flex-direction: column; gap: .6rem; }
.ws-side .card.chat { padding: 1rem; }
.ws-side .pending { margin: 0; }

/* app cards inside the chat */
.timeline li.act-card { display: flex; list-style: none; padding: .55rem .65rem; margin: .35rem 0; font-size: .85rem; gap: .45rem; }
.timeline li.act-card .act-head { gap: .5rem; }
.timeline li.act-card .app-badge { width: 22px; height: 22px; font-size: .72rem; border-radius: 6px; }
.timeline li.act-card .pill { font-size: .68rem; }
.timeline.cards:empty { display: none; }
.timeline.cards { margin-top: .5rem; }
.act-card.draft .draft-text { max-height: 180px; }
.act-card .post-preview { max-width: 100%; }
.app-badge.li { background: #0a66c2; color: #fff; }
.app-badge.pi { background: #e60023; color: #fff; }
.app-badge.cv { background: linear-gradient(135deg, #00c4cc, #7d2ae8); color: #fff; }
.app-badge.no { background: #fff; color: #111; }

/* ---------- inicio + empresa ---------- */
.home-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 900px) { .home-grid { grid-template-columns: 1fr; } }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; }
.row-between h2 { margin: 0; }
pre.norte { margin: 0; white-space: pre-wrap; font: .95rem/1.55 var(--sans, inherit); color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; max-height: 22rem; overflow: auto; }
.onboard { border-color: rgb(184 255 74 / .45); box-shadow: 0 0 26px rgb(184 255 74 / .08); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.steps li { display: flex; gap: .75rem; align-items: flex-start; }
.steps .tick { width: 1.4rem; height: 1.4rem; flex: none; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font: 700 .8rem var(--mono); color: var(--bg); }
.steps li.ok .tick { background: var(--lime); border-color: var(--lime); }
.steps li.ok a { color: var(--muted); text-decoration: line-through; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.kpi { background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .7rem; display: flex; flex-direction: column; }
.kpi strong { font: 700 1.4rem var(--mono); color: var(--cyan); }
.emp-mini { display: flex; align-items: center; gap: .55rem; min-width: 0; }
.avatar.sm { width: 1.8rem; height: 1.8rem; font-size: .75rem; }
.chip.on { border-color: rgb(61 245 255 / .45); color: var(--cyan); cursor: default; }
.tabs-row { display: flex; gap: .4rem; flex-wrap: wrap; margin: -0.4rem 0 1rem; }
.tabs-row .tab { padding: .4rem .9rem; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); text-decoration: none; font-size: .88rem; }
.tabs-row .tab:hover { color: var(--ink); border-color: var(--muted); }
.tabs-row .tab.on { color: var(--bg); background: var(--cyan); border-color: var(--cyan); }
.switch-row { display: flex; align-items: center; gap: .6rem; cursor: pointer; }
.switch-row input { width: 1.05rem; height: 1.05rem; accent-color: var(--lime); }
textarea { width: 100%; }

/* ---------- screen tabs: Agente · Web · Mapa ---------- */
.screen-tabs { display: flex; gap: .35rem; margin-bottom: .55rem; }
.stab { position: relative; font: 600 .82rem var(--mono); color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 99px; padding: .32rem .85rem; cursor: pointer; }
.stab:hover { color: var(--ink); border-color: var(--muted); }
.stab.on { color: var(--bg); background: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 16px rgb(61 245 255 / .3); }
.stab[hidden] { display: none; }
.stab .stab-dot { display: none; position: absolute; top: -2px; right: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.stab.new .stab-dot { display: block; }
.screen.panel { overflow: auto; }
.screen[hidden] { display: none; }
.agent-view { position: absolute; inset: 0; padding: 1.4rem 1.6rem; display: flex; flex-direction: column; gap: 1rem; overflow: auto; background: radial-gradient(ellipse at top right, rgb(139 92 255 / .12), transparent 60%), #0c0718; }
.av-head { display: flex; gap: .9rem; align-items: center; }
.av-name { font: 700 1.05rem var(--mono); display: flex; gap: .6rem; align-items: center; }
.av-goal { color: var(--muted); margin-top: .15rem; }
.av-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.av-steps li { display: flex; gap: .6rem; align-items: center; color: var(--muted); font-size: .95rem; }
.av-steps li .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.av-steps li.now { color: var(--ink); }
.av-steps li.now .dot { background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: pulse 1.2s infinite; }
.av-steps li.app span:nth-child(2) { color: var(--ink); }
.av-steps li .pill { margin-left: auto; }
.av-answer { background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.2rem; }
@keyframes pulse { 50% { opacity: .35; } }
.map-wrap { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) 290px; }
.map-canvas { position: relative; height: 100%; background: #0b0614; }
.map-side { border-left: 1px solid var(--line); background: #0e0820; overflow: auto; display: flex; flex-direction: column; }
.map-title { padding: .8rem 1rem; font: 700 .9rem var(--mono); border-bottom: 1px solid var(--line); }
.map-list { list-style: none; margin: 0; padding: 0; }
.map-list li { display: flex; gap: .65rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); cursor: pointer; }
.map-list li:hover { background: var(--soft); }
.map-num, .lf-pin span { width: 1.5rem; height: 1.5rem; flex: none; border-radius: 50%; background: var(--accent); color: #0b0614; display: grid; place-items: center; font: 700 .75rem var(--mono); border: 2px solid #fff; }
.lf-pin { background: none; border: 0; }
.map-canvas .leaflet-tile-pane { filter: invert(1) hue-rotate(200deg) brightness(.85) saturate(.6); }
@media (max-width: 760px) { .map-wrap { grid-template-columns: 1fr; grid-template-rows: 1fr 40%; } .map-side { border-left: 0; border-top: 1px solid var(--line); } }

/* ---------- top-right menu ---------- */
.menu { position: relative; }
.menu-btn { display: flex; align-items: center; gap: .4rem; padding: .25rem .55rem .25rem .3rem; }
.menu-avatar { width: 1.9rem; height: 1.9rem; border-radius: 50%; display: grid; place-items: center; font: 800 .78rem var(--mono); color: var(--bg);
  background: linear-gradient(135deg, var(--accent), var(--violet) 55%, var(--cyan)); }
.menu-caret { color: var(--muted); font-size: .8rem; }
.menu-list { position: absolute; right: 0; top: calc(100% + .45rem); z-index: 60; min-width: 220px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 18px 50px rgb(0 0 0 / .55); padding: .4rem; display: flex; flex-direction: column; }
.menu-list[hidden] { display: none; }
.menu-who { display: flex; flex-direction: column; gap: .1rem; padding: .55rem .7rem .65rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; min-width: 0; }
.menu-who > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.menu-list a, .menu-list button { font: 600 .9rem var(--mono); color: var(--ink); text-decoration: none; text-align: left; background: none; border: 0; border-radius: 9px; padding: .55rem .7rem; cursor: pointer; }
.menu-list a:hover, .menu-list button:hover, .menu-list a:focus-visible, .menu-list button:focus-visible { background: var(--soft); color: var(--ink); outline: none; }
.menu-list a[hidden] { display: none; }
.menu-list .admin-link { color: var(--violet); border: 0; }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: .3rem 0; }
.menu-list #logout { color: var(--muted); }

/* ---------- working documents: tabs, table grid, document page ---------- */
.screen-tabs { align-items: center; flex-wrap: wrap; }
.doc-tabs { display: contents; }
.stab.doc { display: inline-flex; align-items: center; gap: .35rem; max-width: 220px; }
.stab.doc > :nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stab-ico { opacity: .8; }
.stab-x { margin-left: .15rem; opacity: .55; padding: 0 .15rem; border-radius: 4px; }
.stab-x:hover { opacity: 1; background: rgb(0 0 0 / .2); }
.stab-new { position: relative; }
.new-list { right: auto; left: 0; min-width: 190px; }
.doc-panel { background: #0c0718; }
.doc-view { position: absolute; inset: 0; display: flex; flex-direction: column; }
.doc-bar { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; padding: .55rem .7rem; border-bottom: 1px solid var(--line); background: #110a22; }
.doc-name { font: 700 .9rem var(--mono); margin-right: .3rem; max-width: 30ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-filter { width: 150px !important; padding: .3rem .55rem !important; font-size: .85rem !important; }
.doc-status { margin-left: auto; }
.doc-status.busy { color: var(--cyan); }
.doc-status.bad { color: var(--bad); }
.doc-bar .fmt { display: inline-flex; gap: .2rem; }
.doc-bar .fmt .ghost { min-width: 2rem; }
.grid-wrap { flex: 1; overflow: auto; }
table.sheet { border-collapse: separate; border-spacing: 0; font-size: .88rem; min-width: 100%; }
table.sheet th, table.sheet td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0; background: #0e0820; }
table.sheet thead th { position: sticky; top: 0; z-index: 2; background: #160d2b; }
table.sheet .rn { position: sticky; left: 0; z-index: 1; width: 2.8rem; min-width: 2.8rem; text-align: center; color: var(--muted); font: .75rem var(--mono); background: #140b27; }
table.sheet thead .rn { z-index: 3; }
table.sheet .row-x { display: none; position: absolute; inset: 0; border: 0; background: rgb(255 79 216 / .18); color: var(--accent); cursor: pointer; font-weight: 700; }
table.sheet tr:hover .row-x { display: block; }
table.sheet input { width: 100%; min-width: 9rem; background: transparent; border: 0; border-radius: 0; color: var(--ink); padding: .45rem .6rem; font: inherit; }
table.sheet input:focus { outline: 2px solid var(--cyan); outline-offset: -2px; background: rgb(61 245 255 / .06); }
table.sheet th input { font: 700 .82rem var(--mono); color: var(--cyan); }
.th-in { display: flex; align-items: center; }
.th-btn { border: 0; background: none; color: var(--muted); cursor: pointer; padding: .2rem .35rem; font-size: .8rem; }
.th-btn:hover { color: var(--ink); }
.doc-scroll { flex: 1; overflow: auto; padding: 1.6rem 1rem; }
.doc-page { max-width: 760px; margin: 0 auto; min-height: 100%; outline: none; line-height: 1.65; font-size: 1rem; color: var(--ink); }
.doc-page h1 { font: 700 1.6rem var(--mono); margin: .2rem 0 .8rem; }
.doc-page h2 { font: 700 1.2rem var(--mono); margin: 1.2rem 0 .5rem; color: var(--cyan); }
.doc-page h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; }
.doc-page p { margin: 0 0 .8rem; }
.doc-page ul, .doc-page ol { margin: 0 0 .8rem; padding-left: 1.4rem; }
.doc-page[data-empty]::before { content: "Escribí acá…"; color: var(--muted); }
table.sheet td.rn { position: sticky; }

/* ---------- workspace = a fixed app shell: nothing moves; only the chat (and inside documents/lists) scrolls ---------- */
@media (min-width: 901px) {
  body.ws-page { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
  body.ws-page .top { position: static; flex: none; }
  body.ws-page #view.wide { flex: 1; min-height: 0; width: 100%; box-sizing: border-box; margin: 0; display: flex; flex-direction: column; overflow: hidden; padding-bottom: .9rem; }
  body.ws-page .ws-top { position: static; flex: none; }
  body.ws-page .ws { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  body.ws-page .ws-side { position: static; top: auto; max-height: none; height: 100%; min-height: 0; overflow: hidden; padding-bottom: 0; }
  body.ws-page .ws-side .card.chat { height: 100%; min-height: 0; flex: 1; }
  body.ws-page .ws-grip { position: static; height: auto; }
  body.ws-page .screen-col { display: flex; flex-direction: column; min-height: 0; height: 100%; }
  body.ws-page .screen-tabs { flex: none; }
  body.ws-page .screen-wrap { flex: 1; min-height: 0; container-type: size; display: grid; place-items: start center; }
  /* the browser keeps its 16:10 shape and fits the space left; maps and documents use all of it */
  body.ws-page .screen-wrap > .screen { grid-area: 1 / 1; width: min(100cqw, calc(100cqh * 1.6)); }
  body.ws-page .screen-wrap > .screen.panel { width: 100cqw; height: 100cqh; aspect-ratio: auto; }
  body.ws-page .screen-bar { flex: none; }
}
.act-count { color: var(--cyan); font-family: var(--mono); }
.team-notes { display: flex; gap: 1.2rem; flex-wrap: wrap; padding: .75rem 1rem; margin-bottom: 1rem; border-color: rgb(184 255 74 / .4); }
.screen.remote > img { cursor: pointer; }
.key-catcher { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; resize: none; }

/* address bar above the browser */
.url-bar { display: flex; align-items: center; gap: .3rem; margin-bottom: .5rem; flex: none; }
.url-bar[hidden] { display: none; }
.url-btn { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 9px; width: 2.1rem; height: 2.1rem; cursor: pointer; font-size: .95rem; }
.url-btn:hover { color: var(--ink); border-color: var(--muted); }
.url-input { flex: 1; min-width: 0; background: var(--soft) !important; border: 1px solid var(--line) !important; border-radius: 99px !important; padding: .42rem .9rem !important; font: .85rem var(--mono) !important; color: var(--ink); }
.url-input:focus { border-color: var(--cyan) !important; outline: none; }

/* ---------- employee header inside the chat card (no top bar) ---------- */
.side-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: nowrap; padding: 0 2rem .75rem 0; border-bottom: 1px solid var(--line); }
.side-head .ws-id { flex: 1 1 auto; min-width: 0; gap: .6rem; }
.side-head .avatar { width: 38px; height: 38px; font-size: .9rem; }
.side-head .ws-name { font-size: 1rem; }
.side-head .ws-role { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-name-row { display: flex; align-items: center; gap: .45rem; min-width: 0; }
.ws-name-row .ws-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-head .ws-id > div { min-width: 0; }
.side-head .pill { font-size: .72rem; padding: .12rem .5rem; white-space: nowrap; }
.side-icons { position: relative; display: flex; align-items: center; gap: .3rem; flex: none; }
.side-icons .pop-wrap { position: static; }
.side-icons .popover { right: -2rem; left: auto; width: min(440px, calc(var(--side-w, 400px) - 1.5rem), calc(100vw - 2rem)); }
.icon-btn { position: relative; width: 2.3rem; height: 2.3rem; padding: 0; justify-content: center; border-radius: 11px; gap: 0; }
.icon-btn .ico { font-size: 1.05rem; line-height: 1; }
.icon-btn .count:not(:empty) { position: absolute; top: -.35rem; right: -.4rem; min-width: 1.05rem; height: 1.05rem; padding: 0 .25rem; font-size: .65rem; line-height: 1.05rem; }
.gear-btn { width: 2.6rem; height: 2.6rem; border-radius: 12px; border: 1px solid var(--lime); background: rgb(184 255 74 / .08); color: var(--lime); font-size: 1.45rem; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.gear-btn:hover { background: rgb(184 255 74 / .16); box-shadow: 0 0 16px rgb(184 255 74 / .25); }

/* ---------- sidebar: header with gear + tabs over one pane ---------- */
.lucide { display: inline-flex; line-height: 0; }
.side-head { padding-right: 2.2rem; border-bottom: 0; padding-bottom: .4rem; }
.gear-btn { color: var(--lime); }
.gear-btn .lucide svg { display: block; }
.side-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); padding-bottom: .45rem; flex: none; }
.side-tab { position: relative; display: inline-flex; align-items: center; gap: .4rem; flex: 1 1 0; min-width: 0; justify-content: center; border: 1px solid transparent; background: transparent;
  color: var(--muted); border-radius: 10px; padding: .42rem .45rem; font: 600 .8rem var(--mono); cursor: pointer; }
.side-tab:hover { color: var(--ink); background: var(--soft); }
.side-tab.on { color: var(--ink); border-color: var(--line); background: var(--soft); box-shadow: inset 0 -2px 0 var(--accent); }
.side-tab-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-tab .count:not(:empty) { min-width: 1.05rem; height: 1.05rem; padding: 0 .28rem; border-radius: 99px; background: var(--cyan); color: var(--bg); font: 700 .65rem/1.05rem var(--mono); text-align: center; }

.side-pane { flex: 1; min-height: 0; overflow-y: auto; }
.side-pane[hidden] { display: none !important; }
.side-pane > .card { border: 0; box-shadow: none; padding: .2rem 0 0; background: transparent; }
.chat-pane { display: flex; flex-direction: column; gap: .7rem; overflow: hidden; }
.chat-pane[hidden] { display: none; }
/* narrow sidebar: icons only */
.side-tab:not(.on) { flex: 0 0 auto; padding: .42rem .6rem; }
.side-tab:not(.on) .side-tab-label { display: none; }

/* screen tabs: one line, Chrome-like width cap, overflow dropdown at the far right */
.screen-tabs { flex-wrap: nowrap; overflow: visible; min-width: 0; }
.stab { white-space: nowrap; flex: none; }
.stab.doc { max-width: 15rem; }
.stab.doc .stab-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; max-width: 24ch; }
.stab.doc[hidden] { display: none; }
.stab-more { position: relative; margin-left: auto; flex: none; }
.more-btn[hidden] { display: none; }
.more-list { right: 0; left: auto; top: calc(100% + .4rem); min-width: 220px; max-width: 320px; }
.more-list button { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the hide-column button belongs to the sidebar card, not over the screen tabs */
@media (min-width: 901px) { body.ws-page .ws-side { position: relative; } }

/* ---------- Contactos (CRM) ---------- */
.crm-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 960px) { .crm-grid { grid-template-columns: 1fr; } }
.crm-table-wrap { overflow: auto; max-height: calc(100vh - 19rem); }
.crm-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.crm-table th { text-align: left; font: 600 .75rem var(--mono); color: var(--muted); padding: .45rem .5rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.crm-table td { padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.crm-table tbody tr { cursor: pointer; }
.crm-table tbody tr:hover { background: var(--soft); }
.crm-table tbody tr.on { background: rgb(61 245 255 / .07); box-shadow: inset 3px 0 0 var(--cyan); }
.pill.st-lead { color: var(--cyan); background: rgb(61 245 255 / .08); }
.pill.st-cliente { color: var(--lime); background: rgb(184 255 74 / .08); }
.pill.st-inactivo { color: var(--muted); background: var(--soft); }
.late { color: var(--warn); }
.chip.on { color: var(--bg); background: var(--cyan); border-color: var(--cyan); cursor: pointer; }
.crm-detail { position: sticky; top: 4.5rem; max-height: calc(100vh - 6rem); overflow: auto; }
.crm-activity { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.crm-activity li { display: flex; gap: .6rem; align-items: flex-start; }
.act-kind { flex: none; font: 600 .68rem var(--mono); text-transform: uppercase; padding: .12rem .4rem; border-radius: 6px; background: var(--soft); color: var(--muted); border: 1px solid var(--line); }
.act-kind.k-email { color: var(--cyan); }
.act-kind.k-llamada { color: var(--lime); }
.act-kind.k-tarea { color: var(--warn); }

/* ---------- Calendario ---------- */
.cal-title { font: 700 1rem var(--mono); margin: 0 .4rem; }
.cal-card { padding: 0; overflow: hidden; }
.cal-grid { display: flex; flex-direction: column; height: calc(100vh - 13rem); min-height: 420px; }
.cal-row { display: grid; grid-template-columns: 3.6rem repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.cal-dayhead { padding: .5rem .4rem; display: flex; gap: .4rem; align-items: baseline; color: var(--muted); font: 600 .8rem var(--mono); border-left: 1px solid var(--line); }
.cal-dayhead strong { color: var(--ink); font-size: 1rem; }
.cal-dayhead.today strong { color: var(--bg); background: var(--accent); border-radius: 99px; padding: 0 .45rem; }
.cal-allcell { border-left: 1px solid var(--line); padding: .25rem; display: flex; flex-direction: column; gap: .2rem; min-height: 1.8rem; }
.cal-gutter { font: .7rem var(--mono); color: var(--muted); }
.cal-allday .cal-gutter { padding: .4rem .3rem; }
.cal-body { flex: 1; overflow-y: auto; display: grid; grid-template-columns: 3.6rem repeat(7, minmax(0, 1fr)); }
.cal-hour { text-align: right; padding-right: .4rem; transform: translateY(-.45rem); }
.cal-col { position: relative; border-left: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 46px); cursor: cell; }
.cal-col.today { background-color: rgb(255 79 216 / .035); }
.cal-ev { position: absolute; left: 3px; right: 3px; border-radius: 8px; padding: .25rem .4rem; overflow: hidden; cursor: pointer;
  background: rgb(61 245 255 / .14); border: 1px solid rgb(61 245 255 / .45); color: var(--ink); font-size: .78rem; display: flex; flex-direction: column; gap: .05rem; }
.cal-ev:hover { background: rgb(61 245 255 / .24); }
.cal-ev strong { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev span { color: var(--muted); font: .7rem var(--mono); }
.cal-chip { text-align: left; border: 1px solid rgb(184 255 74 / .45); background: rgb(184 255 74 / .1); color: var(--ink); border-radius: 6px; padding: .12rem .35rem; font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.cal-empty { padding: 2rem; color: var(--muted); }
.cal-dialog { width: min(520px, calc(100vw - 2rem)); border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--ink); padding: 1.2rem; }
.cal-dialog::backdrop { background: rgb(5 2 12 / .7); backdrop-filter: blur(3px); }
.cal-dialog h2 { margin: 0; }
input[type=datetime-local] { width: 100%; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); padding: .55rem .7rem; font: inherit; color-scheme: dark; }

/* calendar layers */
.cal-legend { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin: -0.4rem 0 .7rem; }
.cal-key { display: inline-flex; align-items: center; gap: .4rem; font: 600 .8rem var(--mono); color: var(--ink); border: 1px solid var(--line); border-radius: 99px; padding: .25rem .65rem; cursor: pointer; }
.cal-key input { display: none; }
.cal-key.off { color: var(--muted); opacity: .55; }
.cal-dot { width: .65rem; height: .65rem; border-radius: 50%; display: inline-block; }
.cal-ev { width: auto; }
.cal-ev.g { background: rgb(160 150 190 / .14); border-color: rgb(160 150 190 / .5); }
.cal-ev.t { background: color-mix(in srgb, var(--c) 16%, transparent); border: 1px dashed var(--c); }
.cal-ev.t strong { color: var(--c); }
.cal-ev.r { background: color-mix(in srgb, var(--c) 9%, transparent); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); opacity: .85; }
.cal-ev.r.st-failed { border-color: var(--bad); }
.cal-ev.paused, .cal-chip.paused { opacity: .45; }
.cal-chip.t { border: 1px dashed var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); color: var(--c); }
.cal-chip.g { border-color: rgb(160 150 190 / .5); background: rgb(160 150 190 / .12); }
.agenda-h { margin: .4rem 0 0; font: 700 .8rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.mem.agenda li { justify-content: flex-start; gap: .7rem; align-items: baseline; }
.agenda-when { flex: none; min-width: 7.5rem; font: 600 .78rem var(--mono); color: var(--cyan); }
.cal-ev.draggable { cursor: grab; touch-action: none; }
.cal-ev.dragging { cursor: grabbing; z-index: 5; box-shadow: 0 8px 24px rgb(0 0 0 / .5); opacity: .95; }

/* ---------- Calendario / Contactos as components (page or tab next to the chat) ---------- */
.calapp, .crmapp { display: flex; flex-direction: column; gap: .6rem; min-height: 0; }
.calapp:not(.embedded) { height: calc(100vh - 11.5rem); }
.calapp.embedded, .crmapp.embedded { position: absolute; inset: 0; padding: .7rem .8rem; background: var(--bg); }
.calapp-bar { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; flex: none; }
.calapp-bar .grow { flex: 1; }
.calapp .cal-legend { margin: 0; flex: none; }
.calapp .cal-card { flex: 1; min-height: 0; display: flex; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--panel); }
.calapp .cal-grid { height: auto; flex: 1; min-height: 0; min-width: 0; overflow-x: auto; }
.cal-row, .cal-body { grid-template-columns: 3.4rem repeat(7, minmax(7.5rem, 1fr)); }
.cal-row { min-width: calc(3.4rem + 7 * 7.5rem); }
.cal-body { min-width: calc(3.4rem + 7 * 7.5rem); }
.cal-col { background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 52px); }
/* readability */
.cal-hour { font: .76rem var(--mono); color: #b7a9d8; }
.cal-dayhead { font: 600 .85rem var(--mono); padding: .55rem .5rem; color: #b7a9d8; }
.cal-dayhead strong { font-size: 1.1rem; }
.cal-ev { font-size: .84rem; line-height: 1.25; padding: .28rem .45rem .28rem .5rem; border-radius: 7px; color: #f6f1ff; }
.cal-ev strong { font-weight: 650; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cal-ev span { font: .74rem var(--mono); color: #cfc4ea; }
.cal-ev.g { background: rgb(150 140 190 / .24); border: 1px solid rgb(170 160 210 / .55); border-left: 3px solid #b9aee0; }
.cal-ev.t { background: color-mix(in srgb, var(--c) 17%, #120a22); border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); border-left: 3px solid var(--c); }
.cal-ev.t strong { color: #fff; }
.cal-ev.r { background: color-mix(in srgb, var(--c) 10%, #120a22); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); border-left: 3px solid color-mix(in srgb, var(--c) 70%, transparent); opacity: .9; }
.cal-ev.r strong { -webkit-line-clamp: 1; font-weight: 600; font-size: .78rem; }
.cal-ev.r.st-failed { border-left-color: var(--bad); }
.cal-chip { font-size: .78rem; padding: .18rem .45rem; }
.cal-chip.t { color: #fff; border-left: 3px solid var(--c); }
.cal-title { font-size: .95rem; }
/* Contactos inside a tab: list over detail when narrow */
.crmapp .crm-grid { flex: 1; min-height: 0; grid-template-columns: minmax(0, 1.2fr) minmax(300px, 1fr); }
.crmapp.embedded .crm-list, .crmapp.embedded .crm-detail { height: 100%; min-height: 0; overflow: auto; position: static; max-height: none; }
.crmapp.embedded .crm-table-wrap { max-height: none; }
@container (max-width: 760px) { .crmapp .crm-grid { grid-template-columns: 1fr; } }
.app-panel { background: var(--bg); border: 0; }
.cal-ev.short { flex-direction: row; align-items: center; padding: .1rem .4rem .1rem .45rem; }
.cal-ev.short strong { -webkit-line-clamp: 1; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .78rem; line-height: 1.2; }
.cal-ev.short strong em { font: normal .72rem var(--mono); color: #cfc4ea; }
/* a long status never squeezes the employee's name: the pill wraps under it */
.side-head .ws-name-row { flex-wrap: wrap; row-gap: .15rem; }
.side-head .ws-name-row .ws-name { flex: 0 0 auto; max-width: 100%; }
