/* Oficina de Agentes · sistema visual "Mint & Black" (tokens tomados de RONDA-APP/DESIGN.md) */
:root {
  --primary: #7bf59a; --primary-strong: #3fe074; --primary-soft: #d4fbe0; --primary-glow: #8bf7a6;
  --ink: #0a0a0a; --ink-secondary: #3d3d3d; --ink-mute: #6f6f6f; --ink-faint: #bdbdbd;
  --canvas: #f5f5f5; --surface: #ffffff; --surface-soft: #f1f1f1; --surface-dark: #050505; --surface-dark-raised: #1c1c1c;
  --hairline: #ececec; --hairline-strong: #dcdcdc;
  --warning: #f5a524; --warning-ink: #8a5a00; --danger: #ef4444; --danger-ink: #b42318; --on-ink: #ffffff;
  --r-xs: 6px; --r-sm: 10px; --r-md: 16px; --r-lg: 24px; --r-xl: 32px;
  --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.10);
  --font: 'Outfit', 'Urbanist', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
:root:not([data-theme="light"]) { color-scheme: light dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #f5f5f5; --ink-secondary: #d6d6d6; --ink-mute: #a3a3a3; --ink-faint: #5c5c5c;
    --canvas: #0b0b0b; --surface: #151515; --surface-soft: #1d1d1d; --surface-dark: #000000; --surface-dark-raised: #262626;
    --hairline: #262626; --hairline-strong: #333333; --primary-soft: #173d22; --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f5f5f5; --ink-secondary: #d6d6d6; --ink-mute: #a3a3a3; --ink-faint: #5c5c5c;
  --canvas: #0b0b0b; --surface: #151515; --surface-soft: #1d1d1d; --surface-dark: #000000; --surface-dark-raised: #262626;
  --hairline: #262626; --hairline-strong: #333333; --primary-soft: #173d22; --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--canvas); color: var(--ink); font: 300 15px/1.45 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary-strong); outline-offset: 2px; }
h1, h2, h3, h4 { font-weight: 400; margin: 0; }
.muted { color: var(--ink-mute); }
.num, .tabular { font-variant-numeric: tabular-nums; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.spacer { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; }

/* ---------- botones (píldoras) ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border: 0; border-radius: 9999px; background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 400; line-height: 1; white-space: nowrap; }
.btn:hover { background: var(--surface-soft); }
.btn.primary, .btn.dark { background: var(--ink); color: var(--canvas); }
.btn.primary:hover, .btn.dark:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); background: var(--ink); }
.btn.mint { background: var(--primary); color: #0a0a0a; }
.btn.mint:hover { background: var(--primary-glow); }
.btn.ghost { background: var(--surface-soft); }
.btn.active { box-shadow: inset 0 0 0 1.5px var(--primary-strong); }
.btn.danger { color: var(--danger-ink); }
.btn:disabled { opacity: .4; cursor: default; transform: none; box-shadow: none; }
.btn.wide { width: 100%; justify-content: center; padding: 14px 18px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 0; background: var(--surface); color: var(--ink); }
.icon-btn:hover { background: var(--surface-soft); }

/* ---------- estructura: riel + barra lateral + escenario ---------- */
.app { height: 100vh; display: grid; grid-template-columns: 76px 300px 1fr; }
.rail { background: var(--surface-soft); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 0; }
.logo-badge { width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: #0a0a0a; display: grid; place-items: center; margin-bottom: 18px; }
.logo-badge .icon { fill: currentColor; stroke: none; width: 22px; height: 22px; }
.rail-link { width: 44px; height: 44px; border-radius: 50%; border: 0; background: none; color: var(--ink-mute); display: grid; place-items: center; position: relative; }
.rail-link:hover, .rail-link.active { background: var(--surface); color: var(--ink); }
.rail-link.active { box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.me-avatar { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--primary); padding: 0; overflow: hidden; background: var(--primary-soft); }
.me-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.sidebar { background: var(--canvas); padding: 22px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; border-right: 1px solid var(--hairline); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 500; letter-spacing: -0.2px; margin-bottom: 12px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--ink); color: var(--primary); display: grid; place-items: center; font-size: 15px; }
.side-nav { display: grid; gap: 2px; margin: 12px 0 4px; }
.side-link { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 12px; background: none; color: var(--ink); font-size: 15px; font-weight: 300; text-align: left; }
.side-link .icon { color: var(--ink-mute); }
.side-link:hover, .side-link.active { background: var(--surface); }
.badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 9999px; background: var(--ink); color: var(--canvas); font-size: 12px; font-weight: 500; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.badge.red { background: var(--danger); color: #fff; }
.badge:empty { display: none; }
.side-title { display: flex; align-items: center; justify-content: space-between; margin: 18px 4px 4px; font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-mute); }
.side-title .mini { border: 0; background: none; color: var(--ink-mute); font-size: 18px; line-height: 1; padding: 0 4px; border-radius: 6px; }
.side-title .mini:hover { color: var(--ink); background: var(--surface); }
.dep-list { display: grid; gap: 1px; }
.dep-link { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 0; border-radius: 12px; background: none; width: 100%; text-align: left; font-size: 15px; }
.dep-link:hover, .dep-link.active { background: var(--surface); }
.dep-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

.team { display: grid; gap: 2px; }
.card { display: grid; grid-template-columns: 44px 1fr; gap: 0 12px; align-items: center; padding: 8px 10px; border: 0; border-radius: 14px; background: none; text-align: left; width: 100%; color: inherit; }
.card:hover { background: var(--surface); }
.portrait { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: var(--primary-soft); grid-row: span 2; position: relative; display: grid; place-items: center; font-weight: 500; }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait.needs { box-shadow: 0 0 0 2px var(--canvas), 0 0 0 4px var(--danger); }
.card .nm { font-size: 15px; font-weight: 400; display: flex; align-items: center; gap: 6px; min-width: 0; }
.card .sub { font-size: 13px; color: var(--ink-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .sub.alert { color: var(--danger-ink); }
.st-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 9999px; font-size: 12px; font-weight: 400; color: #0a0a0a; }

/* ---------- escenario 3D y capas ---------- */
.stage-wrap { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
#stage { display: block; width: 100%; height: 100%; touch-action: none; cursor: pointer; }
.topbar { position: absolute; top: 16px; left: 16px; right: 16px; display: flex; align-items: flex-start; gap: 10px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.greeting { background: var(--surface); border-radius: var(--r-md); padding: 12px 18px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.greeting h1 { font-size: 22px; letter-spacing: -0.3px; }
.greeting p { margin: 2px 0 0; font-size: 13px; color: var(--ink-mute); }
.pill-status { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 9999px; padding: 10px 16px; font-size: 14px; }
.conn { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); display: inline-block; }
.conn.on { background: var(--primary-strong); }
.name { width: 130px; padding: 10px 14px; border: 0; border-radius: 9999px; background: var(--surface); color: var(--ink); font-size: 14px; }
.kpis { position: absolute; left: 16px; bottom: 116px; display: flex; gap: 8px; pointer-events: none; }
.kpi { background: var(--surface); border-radius: var(--r-md); padding: 10px 16px; min-width: 110px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.kpi b { display: block; font-size: 26px; font-weight: 400; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi span { font-size: 12px; color: var(--ink-mute); }
.kpi.dark { background: var(--surface-dark); color: var(--on-ink); }
.kpi.dark span { color: #a3a3a3; }
.kpi.glow { background: radial-gradient(circle at 30% 20%, var(--primary-glow) 0%, rgba(139,247,166,.35) 35%, var(--surface) 80%); }

.activity { position: absolute; top: 84px; right: 16px; width: 290px; max-height: calc(100% - 220px); background: var(--surface); border-radius: var(--r-md); padding: 4px 14px 10px; overflow: auto; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.activity summary { cursor: pointer; padding: 10px 0 6px; font-size: 14px; font-weight: 400; list-style: none; display: flex; align-items: center; gap: 8px; }
.activity summary::-webkit-details-marker { display: none; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.feed li { padding: 7px 10px; border-radius: var(--r-sm); background: var(--canvas); overflow-wrap: anywhere; }
.feed time { color: var(--ink-mute); font-size: 11px; margin-right: 6px; font-variant-numeric: tabular-nums; }

.hint { position: absolute; left: 50%; bottom: 116px; transform: translateX(-50%); padding: 8px 16px; border-radius: 9999px; background: var(--ink); color: var(--canvas); font-size: 14px; box-shadow: var(--shadow-2); }
.hint kbd { background: var(--surface-dark-raised); color: #fff; border: 0; }
.chatlog { position: absolute; left: 16px; bottom: 190px; max-width: min(420px, 60%); display: grid; gap: 4px; pointer-events: none; }
.chatlog div { padding: 8px 12px; border-radius: var(--r-md); background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.06); font-size: 14px; overflow-wrap: anywhere; }
.chatlog b { font-weight: 500; margin-right: 6px; }
.chat { position: absolute; left: 16px; right: 16px; bottom: 16px; padding: 10px 10px 10px 18px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-2); }
.near { font-size: 12px; color: var(--ink-mute); margin-bottom: 6px; }
.chat .row input { flex: 1; min-width: 0; padding: 10px 4px; border: 0; background: none; color: var(--ink); font-size: 15px; }
.chat .row input:focus-visible { outline: none; }
.send { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--ink); color: var(--canvas); display: grid; place-items: center; }

.editor { position: absolute; top: 108px; left: 16px; width: 310px; padding: 16px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-2); display: grid; gap: 10px; max-height: calc(100% - 210px); overflow: auto; }
.editor-title { font-size: 18px; }
.editor small { color: var(--ink-mute); font-size: 12px; }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tools .btn { justify-content: flex-start; padding: 8px 12px; font-size: 13px; background: var(--surface-soft); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tools .btn.active { background: var(--primary-soft); box-shadow: inset 0 0 0 1.5px var(--primary-strong); }
kbd { padding: 1px 6px; border: 1px solid var(--hairline-strong); border-radius: 6px; background: var(--surface-soft); font: 400 12px var(--font); }

/* ---------- paneles (tablero, skills, departamentos, reporte) ---------- */
.view { position: absolute; inset: 16px; background: var(--canvas); border-radius: var(--r-lg); box-shadow: var(--shadow-2); display: flex; flex-direction: column; overflow: hidden; z-index: 5; }
.view-head { display: flex; align-items: flex-end; gap: 12px; padding: 22px 26px 14px; flex-wrap: wrap; }
.view-head h1 { font-size: 34px; letter-spacing: -1px; line-height: 1.1; }
.view-head p { margin: 4px 0 0; color: var(--ink-mute); font-size: 14px; }
.view-body { flex: 1; overflow: auto; padding: 4px 26px 26px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 9px 18px; border-radius: 9999px; border: 0; background: var(--surface); font-size: 14px; }
.chip.active { box-shadow: inset 0 0 0 1.5px var(--primary-strong); }
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 16px; align-items: start; }
.col { background: var(--surface-soft); border-radius: var(--r-md); padding: 12px; min-height: 160px; display: grid; gap: 8px; align-content: start; }
.col.drop { box-shadow: inset 0 0 0 2px var(--primary-strong); }
.col h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; padding: 2px 4px 6px; }
.col h3 .count { color: var(--ink-mute); font-variant-numeric: tabular-nums; }
.tcard { background: var(--surface); border-radius: 14px; padding: 12px 14px; display: grid; gap: 8px; cursor: grab; border: 0; text-align: left; width: 100%; color: inherit; }
.tcard:hover { box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.tcard .tt { font-size: 15px; font-weight: 400; }
.tcard .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-mute); flex-wrap: wrap; }
.mini-portrait { width: 24px; height: 24px; border-radius: 50%; overflow: hidden; background: var(--primary-soft); flex: none; }
.mini-portrait img { width: 100%; height: 100%; object-fit: cover; }
.prio-high { color: var(--danger-ink); font-weight: 400; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.xcard { background: var(--surface); border-radius: var(--r-lg); padding: 20px; display: grid; gap: 10px; align-content: start; }
.xcard h3 { font-size: 18px; display: flex; align-items: center; gap: 10px; }
.xcard .emoji { font-size: 24px; }
.xcard p { margin: 0; color: var(--ink-mute); font-size: 14px; }
.who { display: flex; gap: 4px; flex-wrap: wrap; }
.report { background: var(--surface); border-radius: var(--r-lg); padding: 24px; white-space: pre-wrap; font: 400 14px/1.6 var(--font); }

/* ---------- formularios y diálogos ---------- */
.palette { position: fixed; inset: 0; display: grid; place-items: start center; padding-top: 12vh; background: rgba(10, 10, 10, .35); z-index: 10; }
.palette-box { width: min(560px, calc(100vw - 32px)); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: 14px; }
.palette-box input { width: 100%; padding: 14px 20px; border: 0; border-radius: 9999px; background: var(--canvas); color: var(--ink); font-size: 15px; }
.palette-box ul { list-style: none; margin: 10px 0 0; padding: 0; max-height: 50vh; overflow: auto; }
.palette-box li { padding: 10px 14px; border-radius: 12px; cursor: pointer; font-size: 15px; }
.palette-box li[aria-selected="true"], .palette-box li:hover { background: var(--primary-soft); }
.modal-box { display: grid; gap: 12px; padding: 20px; }
.modal-box h2 { font-size: 22px; letter-spacing: -0.3px; }
.auth-dialog { width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); margin: auto; border: 0; border-radius: var(--r-lg); padding: 28px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2); overflow: auto; }
.auth-dialog::backdrop { background: rgba(10, 10, 10, .55); }
.auth-dialog h2 { font-size: 24px; font-weight: 500; }
.auth-dialog p { line-height: 1.5; overflow-wrap: anywhere; }
.auth-dialog .form input { min-width: 0; width: 100%; font-size: 16px; }
.auth-dialog [role=alert] { color: var(--danger-ink); }
.auth-dialog :focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.modal-box table { width: 100%; border-collapse: collapse; }
.modal-box td, .modal-box th { padding: 8px 4px; border-bottom: 1px solid var(--hairline); text-align: left; font-size: 14px; font-weight: 300; }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 6px; font-size: 14px; color: var(--ink-mute); }
.form input:not([type=checkbox]):not([type=color]), .form select, .form textarea { padding: 12px 16px; border: 1px solid var(--hairline-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 300; }
.form textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: grid; gap: 6px; font-size: 14px; color: var(--ink-mute); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--hairline-strong); cursor: pointer; padding: 0; }
.sw.on { box-shadow: 0 0 0 2px var(--primary-strong); }
.swatches input[type=color] { width: 32px; height: 32px; padding: 0; border: 0; background: none; cursor: pointer; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.chk { display: inline-flex !important; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 9999px; background: var(--surface-soft); color: var(--ink) !important; font-size: 13px !important; cursor: pointer; }
.chk:has(input:checked) { background: var(--primary-soft); box-shadow: inset 0 0 0 1.5px var(--primary-strong); }
.chk input { accent-color: var(--primary-strong); }
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); padding: 12px 20px; border-radius: 9999px; background: var(--ink); color: var(--canvas); font-size: 14px; z-index: 20; box-shadow: var(--shadow-2); }

/* ---------- ficha del personaje ---------- */
.sheet { padding-top: 14px; }
.sheet-box { width: min(1020px, calc(100vw - 24px)); max-height: calc(100vh - 28px); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: 18px; display: grid; gap: 12px; grid-template-rows: auto 1fr; overflow: hidden; }
.sheet-top { gap: 10px; }
.sheet-top strong { font-size: 22px; font-weight: 400; letter-spacing: -0.3px; }
.sheet-body { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 18px; min-height: 0; }
.sheet-left { display: grid; gap: 10px; align-content: start; justify-items: center; }
#sheet-canvas { width: 100%; height: 430px; border-radius: var(--r-md); background: radial-gradient(circle at 30% 20%, var(--primary-glow) 0%, rgba(139,247,166,.25) 40%, var(--surface-soft) 80%); cursor: grab; touch-action: none; }
.poses { justify-content: center; flex-wrap: wrap; }
.poses .btn { background: var(--surface-soft); }
.sheet-right { overflow: auto; max-height: calc(100vh - 120px); padding-right: 4px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs .btn { background: var(--surface-soft); }
.tabs .btn.active { background: var(--ink); color: var(--canvas); box-shadow: none; }
.info-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; margin-bottom: 8px; }
.info-head h3 { font-size: 28px; letter-spacing: -0.6px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.fact { background: var(--canvas); border-radius: var(--r-md); padding: 12px 14px; }
.fact span { font-size: 12px; color: var(--ink-mute); display: block; }
.fact b { font-size: 22px; font-weight: 400; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; }
.fact.dark { background: var(--surface-dark); color: #fff; }
.fact.dark span { color: #a3a3a3; }
.mini-feed { list-style: none; padding: 0; margin: 6px 0 14px; display: grid; gap: 6px; font-size: 13px; }
.mini-feed li { padding: 8px 12px; background: var(--canvas); border-radius: var(--r-sm); overflow-wrap: anywhere; }
.skill-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); background: var(--canvas); cursor: pointer; }
.skill-row input { margin-top: 4px; accent-color: var(--primary-strong); }
.skill-row b { font-weight: 400; }
.skill-row small { display: block; color: var(--ink-mute); }
.skill-row:has(input:checked) { background: var(--primary-soft); }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 9999px; background: var(--canvas); font-size: 13px; }

@media (max-width: 1100px) { .app { grid-template-columns: 64px 250px 1fr; } .activity { display: none; } }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto minmax(420px, 1fr) auto; height: auto; min-height: 100vh; }
  .rail { flex-direction: row; justify-content: center; padding: 8px; gap: 4px; overflow-x: auto; }
  .rail .spacer, .logo-badge { display: none; }
  .sidebar { order: 3; border-right: 0; border-top: 1px solid var(--hairline); }
  .stage-wrap { height: 70vh; }
  .board { grid-template-columns: 1fr; }
  .sheet-body { grid-template-columns: 1fr; } #sheet-canvas { height: 300px; } .sheet-right { max-height: none; }
  .kpis { display: none; } .greeting p { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Panel de conversación con un agente */
.agent-chat { position: absolute; top: 16px; right: 16px; bottom: 16px; width: min(400px, calc(100% - 32px)); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); display: flex; flex-direction: column; z-index: 6; overflow: hidden; }
.agent-chat-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px 18px; border-bottom: 1px solid var(--hairline); }
.agent-chat-head .portrait { grid-row: auto; flex: none; }
.agent-chat-title { display: grid; min-width: 0; flex: 1; }
.agent-chat-title strong { font-weight: 400; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-chat-title span { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.agent-chat-head .btn { padding: 8px 14px; }
.agent-chat-list { flex: 1; overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.chat-empty { margin: auto 0; text-align: center; display: grid; gap: 10px; }
.chat-empty h3 { font-size: 22px; letter-spacing: -0.3px; }
.chat-empty p { margin: 0; color: var(--ink-mute); font-size: 14px; }
.chat-suggest { display: grid; gap: 8px; margin-top: 8px; }
.chat-suggest button { text-align: left; padding: 12px 16px; border: 0; border-radius: var(--r-md); background: var(--canvas); font-size: 14px; }
.chat-suggest button:hover { background: var(--primary-soft); }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 92%; }
.msg.me { align-self: flex-end; }
.msg .mini-portrait { display: grid; place-items: center; font-size: 13px; }
.bubble-msg { padding: 10px 14px; border-radius: var(--r-md); background: var(--canvas); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.msg.me .bubble-msg { background: var(--ink); color: var(--canvas); border-bottom-right-radius: 6px; }
.msg.agent .bubble-msg { border-bottom-left-radius: 6px; }
.msg.auto .bubble-msg { background: var(--primary-soft); border-bottom-left-radius: 6px; }
.bubble-msg .meta { font-size: 11px; opacity: .65; margin-bottom: 2px; }
.agent-chat-form { display: flex; gap: 8px; align-items: flex-end; padding: 12px 12px 12px 18px; border-top: 1px solid var(--hairline); }
.agent-chat-form textarea { flex: 1; border: 0; background: none; color: var(--ink); resize: none; font-size: 15px; padding: 10px 0; max-height: 120px; }
.agent-chat-form textarea:focus-visible { outline: none; }
.card .chat-btn { grid-column: 2; justify-self: start; }
.card-row { position: relative; }
.card-row .chat-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; font-size: 15px; opacity: 0; background: var(--surface); }
.card-row:hover .chat-btn, .card-row .chat-btn:focus-visible { opacity: 1; }
@media (hover: none) { .card-row .chat-btn { opacity: 1; } }

/* ───────── hoy (barra lateral) ───────── */
.upcoming { display: grid; gap: 6px; margin-bottom: 8px; }
.up-item { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 14px; border: 0; border-radius: var(--r-md); background: var(--surface); text-align: left; font-size: 14px; }
.up-item time { color: var(--ink-mute); font-variant-numeric: tabular-nums; font-size: 13px; }
.up-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-item b { font-weight: 500; font-size: 11px; padding: 3px 8px; border-radius: 9999px; background: var(--primary); color: #0a0a0a; }
.up-item.live { box-shadow: inset 0 0 0 1.5px var(--primary-strong); }
.up-empty { font-size: 13px; margin: 0 0 4px 4px; }

/* ───────── calendario ───────── */
.row3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; }
.cal-wrap { display: grid; grid-template-columns: 1fr 260px; gap: 18px; align-items: start; }
.cal { background: var(--surface); border-radius: var(--r-lg); padding: 14px 14px 18px; min-width: 0; }
.cal-range { font-size: 15px; color: var(--ink-mute); padding: 0 4px 10px; }
.cal-head, .cal-grid { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); }
.cal-head { position: sticky; top: 0; background: var(--surface); z-index: 2; padding-bottom: 8px; }
.cal-head span { text-align: center; font-size: 13px; color: var(--ink-mute); text-transform: capitalize; }
.cal-head span b { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-weight: 500; color: var(--ink); }
.cal-head span.today b { background: var(--ink); color: var(--canvas); }
.cal-hours span { display: block; height: var(--row); font-size: 11px; color: var(--ink-mute); transform: translateY(-7px); font-variant-numeric: tabular-nums; }
.cal-col { position: relative; border-left: 1px solid var(--hairline); }
.cal-col.today { background: color-mix(in srgb, var(--primary) 7%, transparent); }
.cal-slot { height: var(--row); border-top: 1px solid var(--hairline); cursor: copy; }
.cal-slot:hover { background: var(--surface-soft); }
.cal-ev { position: absolute; left: 3px; right: 3px; display: flex; flex-direction: column; gap: 1px; padding: 5px 8px; border: 0; border-radius: 10px; background: var(--ink); color: var(--canvas); text-align: left; overflow: hidden; font-size: 12px; z-index: 1; }
.cal-ev b { font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev span { opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.live { background: var(--primary); color: #0a0a0a; box-shadow: 0 6px 18px rgba(63, 224, 116, .35); }
.cal-ev.past { background: var(--surface-soft); color: var(--ink-mute); }
.cal-ev .cal-live { font-weight: 500; opacity: 1; }
.cal-who { display: flex; gap: 3px; margin-top: 2px; opacity: 1 !important; }
.cal-who i { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 1.5px rgba(255,255,255,.7); }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 2; pointer-events: none; }
.cal-now::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.cal-side { display: grid; gap: 10px; position: sticky; top: 0; }
.cal-side h3 { font-size: 18px; }
.cal-item { display: grid; gap: 6px; padding: 14px; border-radius: var(--r-md); background: var(--surface); }
.cal-item b { font-weight: 500; }
.cal-item span { font-size: 13px; color: var(--ink-mute); }
.cal-item.live { box-shadow: inset 0 0 0 1.5px var(--primary-strong); }
@media (max-width: 1100px) { .cal-wrap { grid-template-columns: 1fr; } .cal-side { position: static; } }

/* ───────── pizarra ───────── */
.wb { place-items: center; padding: 20px; z-index: 30; }
.wb-box { width: min(1200px, 100%); max-height: 100%; display: flex; flex-direction: column; gap: 10px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: 14px; }
.wb-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.wb-title { font-weight: 500; font-size: 16px; margin-right: 6px; }
.wb-group { display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 9999px; background: var(--surface-soft); }
.wb-group .chip { padding: 7px 14px; background: transparent; }
.wb-group .chip.active { background: var(--surface); }
.wb-color { width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.wb-color.active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary-strong); }
.wb-size { width: 30px; height: 30px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; }
.wb-size i { width: var(--s); height: var(--s); border-radius: 50%; background: var(--ink); }
.wb-size.active { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--primary-strong); }
.wb-stage { min-height: 0; display: grid; place-items: center; }
.wb-canvas { width: min(100%, calc((100vh - 190px) * 4 / 3)); height: auto; aspect-ratio: 4 / 3; border-radius: var(--r-md); box-shadow: inset 0 0 0 1px var(--hairline-strong); background: #fff; cursor: crosshair; touch-action: none; }
.wb-canvas[data-tool="eraser"] { cursor: cell; }
.wb-canvas[data-tool="text"] { cursor: text; }
.wb-foot { font-size: 12px; }

/* ───────── Meet ───────── */
.meet { position: absolute; top: 96px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 25; max-width: calc(100% - 32px); touch-action: none; transition: width .2s ease, max-height .2s ease; }
.meet-bar-head { display: flex; align-items: center; justify-content: space-between; width: 100%; min-width: 240px; padding: 5px 12px; border-radius: 9999px; background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: #fff; font-size: 12px; font-weight: 500; cursor: move; user-select: none; box-shadow: var(--shadow-2); }
.meet-drag-handle { display: flex; align-items: center; gap: 6px; cursor: grab; }
.meet-drag-handle:active { cursor: grabbing; }
.meet-drag-handle svg { width: 14px; height: 14px; opacity: 0.8; }
.meet-top-actions { display: flex; align-items: center; gap: 6px; }
.meet-top-btn { background: transparent; border: 0; color: #fff; opacity: 0.85; width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; cursor: pointer; padding: 0; }
.meet-top-btn svg { width: 14px; height: 14px; }
.meet-top-btn:hover { opacity: 1; background: rgba(255,255,255,0.2); }
.meet-tiles { display: flex; gap: 8px; overflow-x: auto; max-width: 100%; padding: 2px; }
.meet-tile { position: relative; width: 168px; aspect-ratio: 4 / 3; flex: none; border-radius: var(--r-md); overflow: hidden; background: var(--surface-dark-raised); box-shadow: var(--shadow-2); display: grid; place-items: center; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.meet-tile:hover { transform: scale(1.02); }
.meet-tile.spotlight { box-shadow: 0 0 0 2px var(--primary), var(--shadow-2); }
.meet-tile video { width: 100%; height: 100%; object-fit: cover; }
.meet-tile.mirror video { transform: scaleX(-1); }
.meet-tile img { width: 72px; height: 72px; border-radius: 50%; background: var(--primary-soft); object-fit: cover; }
.meet-tile.agent { background: linear-gradient(160deg, #1c1c1c, #0a0a0a); box-shadow: var(--shadow-2), inset 0 0 0 1.5px rgba(123, 245, 154, .5); }
.meet-name { position: absolute; left: 8px; bottom: 8px; right: 8px; padding: 3px 10px; border-radius: 9999px; background: rgba(10,10,10,.6); color: #fff; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: fit-content; max-width: calc(100% - 16px); }
.meet-name small { opacity: .7; }
.meet-controls { display: flex; gap: 8px; padding: 6px; border-radius: 9999px; background: var(--surface); box-shadow: var(--shadow-2); }
.meet-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--surface-soft); cursor: pointer; }
.meet-btn.off { background: var(--danger); color: #fff; }
.meet-btn.on { background: var(--primary); color: #0a0a0a; }
.meet-btn.leave { background: var(--danger); color: #fff; }
.meet-join { position: absolute; top: 96px; left: 50%; transform: translateX(-50%); z-index: 25; display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border: 0; border-radius: 9999px; background: var(--ink); color: var(--canvas); box-shadow: var(--shadow-2); font-size: 14px; }
.meet-join:hover { transform: translateX(-50%) translateY(-1px); }

/* Meet Modo Expandido / Cuadrícula (Tipo Google Meet) */
.meet.expanded { position: fixed !important; top: 50% !important; left: 50% !important; transform: translate(-50%, -50%) !important; width: min(94vw, 1100px); max-height: 88vh; background: rgba(15, 23, 42, 0.95); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); padding: 18px; border-radius: 20px; box-shadow: 0 25px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.12); }
.meet.expanded .meet-bar-head { margin-bottom: 8px; background: transparent; box-shadow: none; padding: 0 4px; }
.meet.expanded .meet-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; max-height: calc(88vh - 170px); overflow-y: auto; width: 100%; }
.meet.expanded .meet-tile { width: 100%; aspect-ratio: 16 / 10; min-height: 180px; }
.meet.expanded .meet-tile.spotlight { grid-column: 1 / -1; aspect-ratio: 16 / 9; max-height: 480px; }
.meet.expanded .meet-tile img { width: 96px; height: 96px; }

/* Meet Modo Minimizado */
.meet.minimized .meet-tiles, .meet.minimized .meet-devices, .meet.minimized .meet-quality { display: none !important; }
.meet.minimized { gap: 4px; }

/* ───────── integraciones ───────── */
.int-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; align-items: start; }
.int-card { display: grid; gap: 12px; padding: 20px; border-radius: var(--r-lg); background: var(--surface); min-width: 0; }
.int-card header { display: flex; align-items: center; gap: 12px; }
.int-card h3 { font-size: 20px; }
.int-card h4 { font-size: 14px; font-weight: 500; margin: 6px 0 4px; color: var(--ink-mute); }
.int-card header p { margin: 2px 0 0; font-size: 13px; }
.int-logo { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-weight: 500; font-size: 20px; flex: none; }
.int-logo.gh { background: var(--ink); color: var(--canvas); }
.int-logo.jira { background: #2684ff; color: #fff; }
.int-logo.spotify { background: #1db954; color: #0a0a0a; }
.int-form input { flex: 1; min-width: 0; padding: 11px 16px; border: 1px solid var(--hairline-strong); border-radius: 9999px; background: var(--canvas); color: var(--ink); font-weight: 300; }
.int-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.int-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; }
.int-row:hover { background: var(--surface-soft); }
.int-row a, .int-list.commits a { color: var(--ink); text-decoration: none; font-size: 14px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.int-row a:hover, .int-list.commits a:hover { text-decoration: underline; }
.int-row small, .int-list.commits small { display: block; font-size: 12px; }
.int-list.commits li { padding: 6px 10px; }
.int-list code { font-size: 12px; padding: 2px 6px; border-radius: 6px; background: var(--surface-soft); }
.int-row .tag { font-size: 11px; padding: 3px 8px; border-radius: 9999px; background: var(--surface-soft); white-space: nowrap; }
.int-row .tag.ok { background: var(--primary-soft); }
.int-row .tag.doing { background: #dbeafe; color: #1e3a8a; }
.int-actions { justify-content: flex-end; padding-top: 4px; }
.mini-select { padding: 9px 14px; border-radius: 9999px; border: 1px solid var(--hairline-strong); background: var(--surface); }
.int-error { margin: 0; padding: 10px 14px; border-radius: 12px; background: #fde8e8; color: var(--danger-ink); font-size: 14px; }
.int-help p { margin: 0 0 8px; font-size: 14px; color: var(--ink-mute); }
.int-help pre { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-dark); color: #d4fbe0; font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.int-spotify { width: 100%; height: 352px; border: 0; border-radius: 14px; }

/* ───────── música (Spotify) ───────── */
.music-dock { position: absolute; left: 16px; bottom: 120px; width: 340px; z-index: 4; border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-2); background: var(--surface); }
.music-dock iframe { display: block; width: 100%; height: 152px; border: 0; }
.music-empty { display: grid; gap: 6px; padding: 16px; }
.music-empty p { margin: 0; font-size: 13px; }
.cal-ev.short { flex-direction: row; align-items: center; gap: 6px; padding: 2px 8px; }
.cal-ev.short span, .cal-ev.short .cal-who { display: none; }
.cal-ev.short b { font-size: 12px; }
.int-card > *, .int-list li, .int-row > div { min-width: 0; }
.int-list li { overflow: hidden; }

/* Acciones de selección: presentes tanto con ratón como con pantalla táctil. */
.selection { position:absolute; z-index:8; right:16px; top:108px; width:280px; max-width:calc(100% - 32px); padding:16px; border:1px solid var(--hairline); border-radius:var(--r-lg); background:var(--surface); box-shadow:var(--shadow-2); }
.selection-head { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.selection-head strong { overflow-wrap:anywhere; }
.selection-head button { min-width:40px; min-height:40px; font-size:22px; }
.selection p, .editor-instruction { font-size:13px; color:var(--ink-mute); margin:4px 0 12px; line-height:1.5; }
.selection-actions { display:flex; flex-wrap:wrap; gap:8px; }
.selection-actions .btn { min-height:40px; flex:1 0 auto; }
.selection-actions .danger { color:var(--red, #dc2626); }
.editor-instruction { margin:0; }
@media (max-width:820px) {
  .selection { top:auto; bottom:120px; right:12px; max-height:40%; overflow:auto; }
  .editor { top:100px; left:12px; width:min(310px, calc(100% - 24px)); }
  .editor.selecting #tools, .editor.selecting small { display:none; }
  .selection { max-width:calc(100% - 24px); }
}

#ed-palette summary { cursor:pointer; font-size:13px; color:var(--ink-mute); padding:6px 0; }
@media (max-width:820px) {
  .editor { top:12px; padding:12px; gap:6px; max-height:calc(100% - 145px); }
  .editor-instruction, .editor small { display:none; }
  .editor.selecting #ed-palette { display:none; }
}

.quality-control { display:flex; align-items:center; gap:6px; background:var(--surface); padding:8px 12px; border-radius:9999px; font-size:12px; white-space:nowrap; }
.quality-control select { border:0; background:transparent; color:var(--ink); max-width:110px; font:inherit; min-height:28px; }
.template-intro { line-height:1.55; margin:0 0 16px; }
.template-list { display:grid; gap:12px; }
.template-option { display:grid; grid-template-columns:150px 1fr; gap:16px; align-items:center; text-align:left; border:1px solid var(--hairline); background:var(--surface); color:var(--ink); border-radius:12px; padding:12px; cursor:pointer; font:inherit; }
.template-option:hover { border-color:var(--primary-strong); background:var(--primary-soft); }
.template-option svg { display:block; width:150px; border-radius:6px; }
.template-option strong { display:block; font-size:16px; }
.template-description, .template-departments { display:block; font-size:13px; line-height:1.5; margin-top:6px; color:var(--ink-mute); }
.template-departments { color:var(--ink); }
@media(max-width:820px) {
  .greeting { display:none; }
  .topbar { flex-wrap:wrap; gap:6px; }
  .topbar .spacer { display:none; }
  .quality-control { order:3; padding:5px 10px; }
  .template-option { grid-template-columns:100px 1fr; gap:10px; padding:10px; }
  .template-option svg { width:100px; }
  .editor { top:94px; }
}
.palette:has(.template-list) { padding-top:24px; padding-bottom:24px; }
.modal-box:has(.template-list) { width:min(680px, calc(100vw - 32px)); max-height:calc(100dvh - 48px); overflow:auto; }
@media(max-width:820px) {
  .editor { top:12px; }
  .stage-wrap:has(#editor:not([hidden])) .topbar { visibility:hidden; }
}
.meet-quality { padding: 4px 12px; border-radius: 9999px; background: var(--surface); color: var(--ink); font-size: 12px; text-align: center; }

.meet-devices { background: var(--surface); padding: 8px 12px; border-radius: 10px; max-width: 100%; font-size: 13px; }
.meet-devices label { display: grid; gap: 4px; margin: 8px 0; }
.meet-devices select { max-width: 280px; width: 100%; background: var(--surface); border: 1px solid var(--hairline-strong); padding: 6px; border-radius: 6px; }
