/* Tareas Pancake v2: menu lateral, tarjetas, ideas y chats. */
:root {
  --bg: #f4f5f8; --panel: #ffffff; --panel-2: #f9fafb; --text: #1a1f2b; --muted: #687083; --faint: #9aa1b0;
  --line: #e4e7ec; --line-2: #eef0f3;
  --accent: #e8590c; --accent-2: #ff7a2f; --accent-soft: #fff1e8; --accent-text: #c2410c;
  --side: #161a23; --side-text: #c4c9d4; --side-muted: #7d8494; --side-hover: #222837; --side-on: #2b3242;
  --danger: #d92d20; --danger-soft: #fef3f2; --ok: #12b76a; --ok-soft: #ecfdf3; --warn: #f79009; --warn-soft: #fffaeb;
  --blue: #2e90fa; --blue-soft: #eff8ff; --violet: #7a5af8; --violet-soft: #f4f3ff;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16,24,40,.05); --shadow-md: 0 4px 12px rgba(16,24,40,.08); --shadow-lg: 0 20px 40px rgba(16,24,40,.18);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1117; --panel: #181b23; --panel-2: #1d212b; --text: #e8eaf0; --muted: #9aa1b0; --faint: #6b7280;
    --line: #2a2f3b; --line-2: #232733; --accent-soft: #3a2216; --accent-text: #ff9a5c;
    --side: #0b0d12; --side-hover: #171a22; --side-on: #20242f;
    --danger-soft: #3b1715; --ok-soft: #0f2e1f; --warn-soft: #33260c; --blue-soft: #10243a; --violet-soft: #221d3d;
    --shadow: none; --shadow-md: 0 4px 12px rgba(0,0,0,.4); }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius-sm); padding: 7px 12px;
  font-weight: 500; display: inline-flex; align-items: center; gap: 6px; transition: background .12s, border-color .12s; }
button:hover { border-color: var(--faint); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
button.ghost { border-color: transparent; background: none; color: var(--muted); }
button.ghost:hover { background: var(--line-2); color: var(--text); }
button.link { border: 0; background: none; padding: 4px 6px; color: var(--muted); }
button.link:hover { color: var(--accent-text); }
button.danger { color: var(--danger); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius-sm); padding: 8px 10px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 84px; resize: vertical; }
label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 5px; font-weight: 600; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }

/* acceso */
.auth-wrap { min-height: 100%; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 20% 10%, var(--accent-soft), transparent 50%), var(--bg); }
.auth { width: 100%; max-width: 400px; background: var(--panel); padding: 32px; border-radius: 16px; box-shadow: var(--shadow-lg); }
.logo { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 20px; margin-bottom: 16px; }
.auth h1 { margin: 0 0 4px; font-size: 22px; }
.auth button { width: 100%; justify-content: center; margin-top: 18px; padding: 10px; }
.error { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* estructura */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100%; }
.side { background: var(--side); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 16px 12px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; font-weight: 700; font-size: 15px; color: #fff; }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; font-size: 15px; margin: 0; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .sec { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--side-muted); padding: 14px 10px 6px; font-weight: 600; }
.nav button { border: 0; background: none; color: var(--side-text); justify-content: flex-start; padding: 8px 10px; width: 100%; border-radius: 8px; font-weight: 500; }
.nav button:hover { background: var(--side-hover); color: #fff; }
.nav button.on { background: var(--side-on); color: #fff; }
.nav button.on svg { color: var(--accent-2); }
.badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 0 7px; min-width: 20px; text-align: center; line-height: 18px; }
.me { margin-top: auto; border-top: 1px solid #262b38; padding-top: 12px; display: flex; align-items: center; gap: 8px; }
.me .who { min-width: 0; flex: 1; }
.me .who b { display: block; color: #fff; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .who span { font-size: 12px; color: var(--side-muted); }
.me button { border: 0; background: none; color: var(--side-muted); padding: 6px; }
.me button:hover { color: #fff; background: var(--side-hover); }
.content { min-width: 0; display: flex; flex-direction: column; }
.pagehead { display: flex; align-items: center; gap: 12px; padding: 22px 28px 2px; flex-wrap: wrap; }
.pagehead h1 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.pagehead .subtitle { color: var(--muted); font-size: 13px; width: 100%; margin-top: -8px; }
.mobilebar, .veil { display: none; }
.toolbar { display: flex; gap: 8px; padding: 12px 28px; align-items: center; flex-wrap: wrap; }
.toolbar select, .toolbar input { width: auto; min-width: 150px; padding: 7px 10px; }
.seg { display: inline-flex; background: var(--line-2); border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 10px; color: var(--muted); border-radius: 7px; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.week-nav { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.week-nav button { border: 0; padding: 5px 8px; }
.week-nav span { padding: 0 6px; white-space: nowrap; }
main { padding: 4px 28px 40px; flex: 1; min-width: 0; }

/* piezas */
.avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; flex: none; }
.avatar.lg { width: 36px; height: 36px; font-size: 13px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 1px 9px; border-radius: 99px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-pendiente, .is-propuesta { background: var(--line-2); color: var(--muted); }
.st-en_curso, .is-en_evaluacion { background: var(--blue-soft); color: var(--blue); }
.st-bloqueada, .is-descartada { background: var(--danger-soft); color: var(--danger); }
.st-en_revision, .is-en_construccion { background: var(--violet-soft); color: var(--violet); }
.st-hecha, .is-lanzada { background: var(--ok-soft); color: var(--ok); }
.is-aprobada { background: var(--accent-soft); color: var(--accent-text); }
.pr-urgente { color: var(--danger); font-weight: 700; }
.pr-alta { color: var(--warn); font-weight: 600; }
.late { color: var(--danger); font-weight: 600; }
.lvl { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.lvl.good { background: var(--ok-soft); color: var(--ok); }
.lvl.bad { background: var(--danger-soft); color: var(--danger); }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.empty svg { width: 36px; height: 36px; color: var(--faint); margin-bottom: 8px; }
.empty b { display: block; color: var(--text); margin-bottom: 4px; }
.bar { height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width .3s; }

/* indicadores */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi span { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi b { display: block; font-size: 26px; letter-spacing: -.02em; margin-top: 2px; }
.kpi.bad b { color: var(--danger); }

/* semana */
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.group { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.group-head { padding: 14px 16px 12px; border-bottom: 1px solid var(--line-2); border-top: 3px solid var(--g-color, var(--line)); }
.group-head h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.group-head .meta { font-size: 12px; color: var(--muted); margin: 4px 0 8px; display: flex; gap: 10px; }
.group.empty-g .group-head { border-bottom: 0; }
.obj { margin: 10px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.obj-head { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.obj-head b { flex: 1; font-size: 13px; }
.task-row { display: flex; align-items: center; gap: 8px; padding: 7px 6px; border-radius: 7px; cursor: pointer; }
.task-row:hover { background: var(--line-2); }
.task-row .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row.done .t { text-decoration: line-through; color: var(--muted); }
.check { width: 18px; height: 18px; border: 2px solid var(--faint); border-radius: 6px; flex: none; display: grid; place-items: center; font-size: 11px; background: var(--panel); }
.check:hover { border-color: var(--ok); }
.done .check { background: var(--ok); border-color: var(--ok); color: #fff; }
.sub { padding: 10px 16px 2px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.list-pad { padding: 4px 10px 6px; }
.add { margin: 2px 10px 10px; }

/* lista */
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.grid th, table.grid td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid th { font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; white-space: nowrap; background: var(--panel-2); font-weight: 600; }
table.grid tr.click:hover td { background: var(--panel-2); cursor: pointer; }
.scroll-x { overflow-x: auto; }
.cell-person { display: flex; align-items: center; gap: 7px; white-space: nowrap; }

/* tableros (tareas e ideas) */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--line-2); border-radius: var(--radius); padding: 10px; min-height: 240px; }
.col h4 { margin: 2px 4px 10px; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.col.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 10px 14px; margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.card:hover { box-shadow: var(--shadow-md); }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--card-color, var(--line)); }
.card .t { font-weight: 600; margin-bottom: 6px; }
.card .m { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); }
.card .foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--muted); }

/* calendario */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal .h { background: var(--panel-2); padding: 8px; font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; }
.cal .d { background: var(--panel); min-height: 116px; padding: 6px; min-width: 0; }
.cal .d.out { background: var(--panel-2); }
.cal .d.out .n { color: var(--faint); }
.cal .d.today .n { background: var(--accent); color: #fff; border-radius: 99px; padding: 0 7px; }
.cal .n { font-size: 12px; font-weight: 600; display: inline-block; margin-bottom: 4px; }
.cal .ev { font-size: 12px; padding: 2px 6px; border-radius: 5px; margin-bottom: 3px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal .ev.done { opacity: .45; text-decoration: line-through; }

/* gantt */
.gantt { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.g-row { display: grid; align-items: center; border-bottom: 1px solid var(--line-2); min-height: 34px; }
.g-row.g-head { position: sticky; top: 0; background: var(--panel-2); z-index: 2; font-size: 11px; color: var(--muted); }
.g-label { position: sticky; left: 0; background: var(--panel); z-index: 1; padding: 4px 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-right: 1px solid var(--line); height: 100%; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.g-head .g-label { background: var(--panel-2); }
.g-area { background: var(--panel-2); font-weight: 700; font-size: 12px; }
.g-area .g-label { background: var(--panel-2); cursor: default; }
.g-track { position: relative; height: 34px; }
.g-day { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line-2); }
.g-day.we { background: rgba(127,127,127,.06); }
.g-day.today { border-left: 2px solid var(--accent); }
.g-bar { position: absolute; top: 8px; height: 18px; border-radius: 6px; color: #fff; font-size: 11px; padding: 0 7px; white-space: nowrap; overflow: hidden; cursor: pointer; line-height: 18px; font-weight: 600; }
.g-bar.done { opacity: .45; }
.g-bar.blocked { background-image: repeating-linear-gradient(45deg, transparent 0 6px, rgba(0,0,0,.2) 6px 12px); }
.g-dates { font-size: 11px; text-align: center; border-left: 1px solid var(--line-2); padding: 4px 0; }

/* personas */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.person-head { display: flex; align-items: center; gap: 10px; }
.load { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* chats */
.chat { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 100px); min-height: 460px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.chat-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.chat-list .top { padding: 12px; display: flex; gap: 8px; border-bottom: 1px solid var(--line-2); }
.chat-list .top button { flex: 1; justify-content: center; }
.chat-list .tabs { padding: 8px 12px; border-bottom: 1px solid var(--line-2); }
.convs { overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 10px; padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--line-2); align-items: center; }
.conv:hover { background: var(--panel-2); }
.conv.on { background: var(--accent-soft); }
.conv .txt { min-width: 0; flex: 1; }
.conv .txt b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.conv .txt span { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv.unread .txt span { color: var(--text); font-weight: 600; }
.conv-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--line-2); color: var(--muted); flex: none; }
.room { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.room-head { padding: 12px 16px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; }
.room-head .txt { min-width: 0; flex: 1; }
.room-head b { font-size: 15px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; background: var(--panel-2); }
.msg { display: flex; gap: 8px; max-width: 78%; align-items: flex-end; margin-top: 8px; }
.msg.mine { margin-left: auto; flex-direction: row-reverse; }
.bubble { background: var(--panel); border: 1px solid var(--line); padding: 7px 11px; border-radius: 14px 14px 14px 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mine .bubble { background: var(--accent); border-color: var(--accent); color: #fff; border-radius: 14px 14px 4px 14px; }
.bubble .who { font-size: 11px; font-weight: 700; color: var(--accent-text); }
.bubble .when { font-size: 10px; opacity: .65; margin-left: 8px; white-space: nowrap; }
.msg.cont { margin-top: 2px; }
.msg.cont .avatar { visibility: hidden; }
.mention { background: var(--accent-soft); color: var(--accent-text); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.msg.mine .mention { background: rgba(255,255,255,.25); color: #fff; }
.day-sep { text-align: center; font-size: 11px; color: var(--muted); margin: 14px 0 2px; font-weight: 600; }
.composer { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line-2); align-items: flex-end; background: var(--panel); }
.composer textarea { min-height: 40px; max-height: 140px; resize: none; }
.thread-box { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; height: 380px; margin-top: 8px; }
.thread-box .msgs { padding: 12px; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(15,17,23,.5); display: grid; place-items: start center; padding: 5vh 12px; z-index: 20; overflow-y: auto; }
.modal-card { background: var(--panel); border-radius: 16px; width: 100%; max-width: 700px; padding: 22px 24px; box-shadow: var(--shadow-lg); }
.modal-card h2 { margin: 0 0 4px; font-size: 18px; }
.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 10px 0 4px; overflow-x: auto; }
.tabs-line button { border: 0; background: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 10px; color: var(--muted); white-space: nowrap; }
.tabs-line button.on { border-color: var(--accent); color: var(--text); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; align-items: center; flex-wrap: wrap; }
.feed { margin-top: 8px; }
.feed .item { font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.feed .item.hist { color: var(--muted); font-size: 12px; padding: 5px 0; }
.warnbox { background: var(--warn-soft); color: #93370d; border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-top: 10px; }
.infobox { background: var(--blue-soft); color: var(--blue); border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-top: 10px; }
@media (prefers-color-scheme: dark) { .warnbox { color: #fec84b; } }
.conv-rows .r { display: grid; grid-template-columns: 1fr 170px 150px 34px; gap: 8px; margin-bottom: 8px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 30; box-shadow: var(--shadow-lg); cursor: pointer; max-width: calc(100% - 32px); }
.copy { font-family: ui-monospace, monospace; font-size: 12px; word-break: break-all; background: var(--panel-2); border: 1px solid var(--line); padding: 10px; border-radius: 8px; }
.pick { max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.pick label { display: flex; align-items: center; gap: 10px; margin: 0; padding: 8px 10px; font-size: 14px; color: var(--text); font-weight: 500; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.pick input { width: auto; }
.chat-list .seg button { white-space: nowrap; padding: 5px 8px; font-size: 12px; }
.chat-list .tabs { overflow-x: auto; }
.chat-list, .room { min-width: 0; }
.team-actions { white-space: nowrap; }
#back { display: none; }

/* ajuste fino: nada se sale de su caja en ningun ancho */
.groups { grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); }
.groups.wide { grid-template-columns: repeat(auto-fill, minmax(min(460px, 100%), 1fr)); }
.people { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
.task-row .meta { display: flex; align-items: center; gap: 8px; flex: none; max-width: 65%; min-width: 0; justify-content: flex-end; }
.task-row .meta .chip { min-width: 0; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.area-row input[data-aname], .area-row input[name=name] { flex: 1; min-width: 0; }
.area-row button { flex: none; }
.gantt > .g-row { width: max-content; min-width: 100%; }
.agenda { display: flex; flex-direction: column; gap: 10px; }
.agenda .day { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.agenda .day h4 { margin: 0; padding: 8px 12px; font-size: 13px; background: var(--panel-2); border-bottom: 1px solid var(--line-2); text-transform: capitalize; }
.agenda .day.today h4 { color: var(--accent-text); }
.pagehead h1 { min-width: 0; overflow-wrap: anywhere; }
.kanban { scroll-snap-type: x proximity; }
.col { scroll-snap-align: start; }
.modal-card { min-width: 0; }
.modal-card h2 { overflow-wrap: anywhere; }
/* En las tarjetas angostas, el titulo de la tarea va completo y sus datos debajo */
.group, .agenda .day, #idea-tasks { container-type: inline-size; }
@container (max-width: 460px) {
  .task-row { flex-wrap: wrap; row-gap: 2px; }
  .task-row .t { flex: 1 1 calc(100% - 30px); white-space: normal; }
  .task-row .meta { max-width: none; width: 100%; padding-left: 26px; justify-content: flex-start; flex-wrap: wrap; }
  .task-row .meta:empty { display: none; }
}
@media (min-width: 1600px) { main, .toolbar, .pagehead { max-width: 1680px; } }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, 1fr); } }

/* tablet y celular */
@media (max-width: 900px) {
  #back { display: inline-flex; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .shell.menu .side { transform: none; box-shadow: var(--shadow-lg); }
  .shell.menu .veil { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .mobilebar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--side); color: #fff; position: sticky; top: 0; z-index: 10; font-weight: 700; }
  .mobilebar button { border: 0; background: none; color: #fff; padding: 4px; }
  .pagehead, .toolbar { padding-left: 16px; padding-right: 16px; }
  main { padding: 4px 16px 40px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .toolbar select, .toolbar input { min-width: 0; flex: 1 1 140px; }
  .chat { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 128px); min-height: 380px; }
  .view-chats .pagehead .subtitle, .view-chats .pagehead { display: none; }
  .view-chats main { padding-top: 12px; padding-bottom: 12px; }
  .chat.open .chat-list { display: none; }
  .chat:not(.open) .room { display: none; }
  .msg { max-width: 92%; }
  .conv-rows .r { grid-template-columns: 1fr 1fr; }
  .modal { padding: 12px 8px; }
  .modal-card { padding: 18px 16px; border-radius: 14px; }
  .actions { justify-content: stretch; }
  .actions .primary { flex: 1; justify-content: center; }
}

/* celular */
@media (max-width: 640px) {
  .pagehead { padding-top: 16px; }
  .pagehead h1 { font-size: 20px; width: 100%; }
  .pagehead .spacer { display: none; }
  .pagehead button { flex: 1; justify-content: center; }
  .pagehead .subtitle { margin-top: 0; }
  .toolbar { gap: 6px; }
  .toolbar .week-nav { flex: 1; justify-content: space-between; }
  .toolbar .seg { width: 100%; }
  .toolbar .seg button { flex: 1; justify-content: center; }
  .kpi { padding: 10px 12px; }
  .kpi b { font-size: 22px; }
  .task-row { flex-wrap: wrap; row-gap: 2px; }
  .task-row .t { flex: 1 1 calc(100% - 30px); white-space: normal; }
  .task-row .meta { max-width: none; width: 100%; padding-left: 26px; justify-content: flex-start; flex-wrap: wrap; }
  .kanban { grid-auto-columns: 82vw; }
  /* listas de tareas y personas como tarjetas */
  table.cards, table.cards tbody { display: block; border: 0; background: none; box-shadow: none; }
  table.cards thead { display: none; }
  table.cards tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
  table.cards td { border: 0 !important; padding: 0; min-width: 0; }
  table.cards td.full { grid-column: 1 / -1; }
  table.cards td.team-actions { white-space: normal; }
  table.cards .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  table.cards td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
  table.cards td:empty, table.cards td.blank { display: none; }
  .groups.wide .list-pad.scroll-x { overflow: visible; }
  .conv-rows .r { grid-template-columns: 1fr 1fr 34px; }
  .conv-rows .r input[data-k=title] { grid-column: 1 / -1; }
}

/* iPhone con la app en la pantalla de inicio: respetar la barra de estado */
.mobilebar { padding-top: calc(10px + env(safe-area-inset-top)); }
@media (min-width: 901px) { .side { padding-top: calc(16px + env(safe-area-inset-top)); } }
