/* =========================================================
   Flujo · estilos
   ========================================================= */
:root {
  --bg: #FAFAF8;
  --panel: #FFFFFF;
  --side: #F3F2EE;
  --hover: #ECEAE4;
  --line: #E4E2DC;
  --line-2: #D6D3CB;
  --ink: #1A1A19;
  --ink-2: #4A4945;
  --muted: #7C7A73;
  --accent: #4F46E5;
  --accent-ink: #FFFFFF;
  --accent-soft: #ECEBFC;
  --danger: #D93036;
  --warn: #E2761B;
  --ok: #2F9E62;
  --shadow: 0 1px 2px rgba(20, 20, 18, .06), 0 8px 24px rgba(20, 20, 18, .08);
  --radius: 10px;
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211; --panel: #1A1A19; --side: #161615; --hover: #252523;
    --line: #2A2A28; --line-2: #3A3A37; --ink: #EDECE8; --ink-2: #C3C1BA; --muted: #8E8C85;
    --accent: #8B83F6; --accent-ink: #121211; --accent-soft: #24223F;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.center { text-align: center; }
[hidden] { display: none !important; }

/* ---------- Botones e inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--ink);
  font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger { color: var(--danger); }
.btn-sm { height: 26px; padding: 0 8px; font-size: 13px; border-radius: 6px; }
.btn-block { width: 100%; height: 40px; }
.icon-btn {
  width: 28px; height: 28px; display: inline-grid; place-items: center;
  border: 0; background: transparent; border-radius: 6px; cursor: pointer; color: var(--muted);
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn svg, .btn svg { width: 16px; height: 16px; flex: none; }

.input, .form input, .form select, textarea.input {
  width: 100%; height: 36px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--panel); outline: none;
}
textarea.input { height: auto; padding: 8px 10px; resize: vertical; }
.input:focus, .form input:focus, textarea.input:focus, select.input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.form { display: grid; gap: 14px; margin: 18px 0; }
.form label { display: grid; gap: 6px; font-weight: 500; font-size: 13px; }
.alert { background: #FDECEC; color: #9B1C20; border-radius: 8px; padding: 10px 12px; margin: 10px 0; font-size: 13px; }
@media (prefers-color-scheme: dark) { .alert { background: #3A1618; color: #FFB4B6; } }

/* ---------- Pantallas de acceso ---------- */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 32px; box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 22px; letter-spacing: -.02em; margin: 18px 0 6px; line-height: 1.2; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px; background: var(--accent); position: relative;
}
.brand-mark::after {
  content: ''; position: absolute; left: 5px; right: 5px; top: 10px; height: 2px; background: var(--accent-ink);
  box-shadow: 0 -4px 0 var(--accent-ink), 0 4px 0 var(--accent-ink); border-radius: 2px;
}

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: 264px 1fr; height: 100vh; overflow: hidden; }
.sidebar {
  background: var(--side); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.loading { padding: 40px; color: var(--muted); }
.scrim { display: none; }

/* ---------- Sidebar ---------- */
.ws-switch {
  margin: 12px; padding: 8px; border-radius: 8px; display: flex; align-items: center; gap: 10px;
  border: 0; background: transparent; cursor: pointer; text-align: left;
}
.ws-switch:hover { background: var(--hover); }
.ws-switch > svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.ws-avatar {
  width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center;
  background: var(--ink); color: var(--bg); font-weight: 700; font-size: 13px; flex: none;
}
.ws-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav { padding: 0 8px; display: grid; gap: 1px; }
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 7px;
  color: var(--ink-2); cursor: pointer; border: 0; background: transparent; width: 100%; text-align: left;
}
.side-link:hover { background: var(--hover); text-decoration: none; }
.side-link.active { background: var(--panel); color: var(--ink); box-shadow: 0 0 0 1px var(--line); font-weight: 500; }
.side-link svg { width: 16px; height: 16px; color: var(--muted); }
.side-link .count { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.side-section {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 12px 6px 18px; font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.side-scroll { flex: 1; overflow-y: auto; padding-bottom: 12px; }
.space { padding: 0 8px; }
.space-head {
  display: flex; align-items: center; gap: 8px; padding: 6px 4px 6px 10px; border-radius: 7px;
  font-weight: 600; cursor: pointer; color: var(--ink);
}
.space-head:hover { background: var(--hover); }
.space-head .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-head .icon-btn { width: 22px; height: 22px; display: none; }
.space-head:hover .icon-btn, .space-head .icon-btn:focus { display: inline-grid; }
@media (hover: none) { .space-head .icon-btn { display: inline-grid; } }
.dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.space.collapsed .space-lists { display: none; }
.space-lists { padding-left: 14px; display: grid; gap: 1px; margin-bottom: 4px; }
.side-foot {
  border-top: 1px solid var(--line); padding: 10px 12px; display: flex; align-items: center; gap: 10px;
}
.side-foot .who { flex: 1; min-width: 0; font-size: 13px; }
.side-foot .who div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Avatares ---------- */
.avatar {
  width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 10px; font-weight: 600; color: #fff; flex: none; border: 2px solid var(--panel);
}
.avatar-lg { width: 32px; height: 32px; font-size: 12px; }
.avatars { display: inline-flex; }
.avatars .avatar + .avatar { margin-left: -7px; }
.avatar-empty {
  background: transparent; border: 1.5px dashed var(--line-2); color: var(--muted);
}

/* ---------- Cabecera de vista ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 24px;
  border-bottom: 1px solid var(--line); background: var(--bg); flex-wrap: wrap;
}
.topbar h1 { font-size: 18px; margin: 0; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar h1 .crumb { color: var(--muted); font-weight: 500; }
.topbar .spacer { flex: 1; }
.menu-toggle { display: none; }
.seg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--hover); }
.seg button {
  height: 28px; padding: 0 12px; border: 0; background: transparent; border-radius: 6px;
  cursor: pointer; color: var(--muted); font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
}
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg svg { width: 14px; height: 14px; }
.search { position: relative; }
.search input { width: 200px; height: 32px; padding-left: 30px; }
.search svg { position: absolute; left: 9px; top: 8px; width: 16px; height: 16px; color: var(--muted); }
.chip-toggle {
  height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--panel); cursor: pointer; color: var(--ink-2); font-weight: 500;
}
.chip-toggle { display: inline-flex; align-items: center; gap: 6px; }
.chip-toggle svg { width: 14px; height: 14px; flex: none; }
.chip-toggle.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.content { flex: 1; overflow: auto; padding: 16px 24px 80px; }

/* ---------- Estado, prioridad, fechas ---------- */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: #fff;
  border: 0; cursor: pointer; white-space: nowrap;
}
.status-dot {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--c, var(--muted));
  display: inline-grid; place-items: center; flex: none; cursor: pointer; background: transparent; padding: 0;
}
.status-dot.done { background: var(--c); }
.status-dot.done::after {
  content: ''; width: 6px; height: 3px; border: solid #fff; border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px,-1px);
}
.prio { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.prio svg { width: 14px; height: 14px; }
.prio-1 { color: var(--danger); } .prio-2 { color: var(--warn); } .prio-3 { color: #3E63DD; } .prio-4 { color: var(--muted); }
.due { font-family: var(--mono); font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.due.overdue { color: var(--danger); }
.due.today { color: var(--warn); }
.meta-ico { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: 12px; font-family: var(--mono); }
.meta-ico svg { width: 13px; height: 13px; }

/* ---------- Vista lista ---------- */
.group { margin-bottom: 22px; }
.group-head { display: flex; align-items: center; gap: 10px; padding: 6px 0; position: sticky; top: -16px; background: var(--bg); z-index: 1; }
.group-head .n { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.group-toggle { border: 0; background: transparent; cursor: pointer; color: var(--muted); padding: 0; display: grid; place-items: center; width: 18px; }
.group-toggle svg { width: 14px; height: 14px; transition: transform .15s; }
.group.collapsed .group-toggle svg { transform: rotate(-90deg); }
.group.collapsed .rows { display: none; }
.rows { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.row {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) 96px 90px 84px;
  align-items: center; gap: 12px; padding: 0 14px; min-height: 42px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.row:hover { background: var(--hover); }
.row .title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row .title span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.is-done .title span.t { color: var(--muted); text-decoration: line-through; }
.row .cell { display: flex; align-items: center; }
.row-head {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) 96px 90px 84px; gap: 12px; padding: 0 14px;
  font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; height: 28px; align-items: center;
}
.add-row { display: flex; align-items: center; gap: 10px; padding: 0 14px; min-height: 40px; }
.add-row input { border: 0; background: transparent; outline: none; flex: 1; height: 38px; }
.add-row .plus { color: var(--muted); width: 20px; display: grid; place-items: center; }
.add-row .plus svg { width: 14px; height: 14px; }

/* ---------- Tablero Kanban ---------- */
.board { display: flex; gap: 14px; align-items: flex-start; min-height: 100%; padding-bottom: 20px; }
.col {
  width: 290px; flex: none; background: var(--side); border-radius: 12px; padding: 8px;
  display: flex; flex-direction: column; max-height: calc(100vh - 150px);
}
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 10px; }
.col-head .n { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.col-body { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 40px; padding: 2px; }
.col-body.drag-over { background: var(--accent-soft); border-radius: 8px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px;
  cursor: grab; display: grid; gap: 8px; box-shadow: 0 1px 1px rgba(0,0,0,.03);
}
.card:hover { border-color: var(--line-2); }
.card.dragging { opacity: .4; }
.card .t { font-weight: 500; line-height: 1.35; word-break: break-word; }
.card.is-done .t { color: var(--muted); text-decoration: line-through; }
.card .meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card .meta .avatars { margin-left: auto; }
.drop-mark { height: 3px; border-radius: 2px; background: var(--accent); margin: -2px 0; }
.col-add { margin-top: 6px; }
.col-add input { width: 100%; height: 34px; border-radius: 8px; border: 1px dashed var(--line-2); background: transparent; padding: 0 10px; outline: none; }
.col-add input:focus { border-style: solid; border-color: var(--accent); background: var(--panel); }
.col-new { width: 260px; flex: none; }

.progress { height: 4px; border-radius: 2px; background: var(--hover); overflow: hidden; width: 48px; display: inline-block; }
.progress > i { display: block; height: 100%; background: var(--ok); }

/* ---------- Panel de tarea ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw);
  background: var(--panel); border-left: 1px solid var(--line); box-shadow: var(--shadow);
  transform: translateX(102%); transition: transform .2s ease; z-index: 30;
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 13px; }
.drawer-head .crumbs { flex: 1; min-width: 0; color: var(--muted); display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; }
.drawer-head .crumbs a { color: var(--muted); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px 40px; }
.task-title {
  width: 100%; border: 0; outline: none; background: transparent; resize: none;
  font-size: 22px; font-weight: 650; letter-spacing: -.02em; line-height: 1.25; padding: 4px 6px; margin: 0 -6px; border-radius: 6px;
  overflow: hidden;
}
.task-title:focus { background: var(--hover); }
.fields { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 18px 0 22px; align-items: center; }
.fields .k { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.fields .k svg { width: 14px; height: 14px; }
.fields .v { min-height: 32px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.field-btn {
  border: 1px solid transparent; background: transparent; border-radius: 6px; height: 30px; padding: 0 8px;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--ink);
}
.field-btn:hover { border-color: var(--line-2); }
.fields .field-btn { white-space: nowrap; height: auto; min-height: 30px; flex-wrap: wrap; }
.field-btn.placeholder { color: var(--muted); }
.date-input { border: 1px solid transparent; background: transparent; border-radius: 6px; height: 30px; padding: 0 6px; font-family: var(--mono); font-size: 12px; cursor: pointer; }
.date-input:hover, .date-input:focus { border-color: var(--line-2); outline: none; }
.section-title { font-size: 13px; font-weight: 600; margin: 24px 0 8px; display: flex; align-items: center; gap: 8px; }
.section-title .n { font-family: var(--mono); color: var(--muted); font-weight: 400; }
.desc { min-height: 90px; }
.subtasks { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.subtask { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.subtask:hover { background: var(--hover); }
.subtask .t { flex: 1; min-width: 0; }
.subtask.is-done .t { text-decoration: line-through; color: var(--muted); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 24px 0 14px; }
.tabs button { border: 0; background: transparent; padding: 8px 10px; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-color: var(--ink); }
.comment { display: flex; gap: 10px; margin-bottom: 14px; }
.comment .bubble { flex: 1; min-width: 0; }
.comment .head { font-size: 13px; display: flex; gap: 8px; align-items: baseline; }
.comment .head .when { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.comment .body { white-space: pre-wrap; word-break: break-word; margin-top: 2px; color: var(--ink-2); }
.comment .del { margin-left: auto; font-size: 12px; color: var(--muted); border: 0; background: transparent; cursor: pointer; opacity: 0; }
.comment:hover .del { opacity: 1; }
.composer { display: grid; gap: 8px; margin-top: 8px; }
.composer .actions { display: flex; justify-content: flex-end; }
.act { font-size: 13px; color: var(--ink-2); padding: 5px 0; display: flex; gap: 8px; }
.act .when { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 11px; white-space: nowrap; }

/* ---------- Menús flotantes ---------- */
.menu {
  position: fixed; z-index: 50; min-width: 200px; max-width: 280px; max-height: 320px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 4px;
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; background: transparent;
  border-radius: 6px; cursor: pointer; text-align: left;
}
.menu-item:hover, .menu-item:focus, .menu-item.active { background: var(--hover); outline: none; }
.mention-menu { max-height: 260px; overflow-y: auto; }
.mention-menu .menu-item.active { box-shadow: inset 2px 0 0 var(--accent); }
.menu-item.danger { color: var(--danger); }
.menu-item svg { width: 16px; height: 16px; flex: none; }
.menu-item .check { margin-left: auto; color: var(--accent); width: 16px; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 0; }
.menu-label { padding: 6px 10px 2px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Modal ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(10,10,9,.35); display: grid; place-items: center; z-index: 60; padding: 20px; }
.modal { width: 100%; max-width: 420px; background: var(--panel); border-radius: 14px; padding: 22px; box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 12px; font-size: 17px; letter-spacing: -.01em; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 24px; height: 24px; border-radius: 6px; border: 2px solid transparent; cursor: pointer; }
.swatch.on { border-color: var(--ink); }

/* ---------- Páginas (miembros, mis tareas, ajustes) ---------- */
.page { max-width: 860px; }
.card-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; }
.card-box > h3 { margin: 0; padding: 14px 16px; font-size: 14px; border-bottom: 1px solid var(--line); }
.member { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.member:last-child { border-bottom: 0; }
.member .who { flex: 1; min-width: 0; }
.member .who .e { color: var(--muted); font-size: 12px; }
.role-tag { font-family: var(--mono); font-size: 11px; text-transform: uppercase; color: var(--muted); }
.invite-form { display: flex; gap: 8px; padding: 14px 16px; flex-wrap: wrap; }
.invite-form .input { flex: 1; min-width: 200px; }
.invite-form select.input { flex: none; width: 130px; }
.link-box { display: flex; gap: 8px; padding: 0 16px 14px; }
.link-box input { font-family: var(--mono); font-size: 12px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.bucket-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 0 8px; display: flex; gap: 8px; }
.bucket-title.overdue { color: var(--danger); }
.mine-row { grid-template-columns: 20px minmax(0,1fr) 160px 96px 90px 84px; }
.where { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* =========================================================
   v2 · Etiquetas, calendario, bandeja, objetivos, adjuntos
   ========================================================= */
.badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink); font: 600 11px/18px var(--mono); text-align: center;
}
.labels { display: inline-flex; gap: 4px; flex-wrap: wrap; min-width: 0; }
.label {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; font-weight: 600;
  color: var(--lc); background: color-mix(in srgb, var(--lc) 14%, transparent); white-space: nowrap;
}
.row .title .labels { flex-wrap: nowrap; overflow: hidden; }
.card .labels { margin-bottom: -2px; }
.kr-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12.5px;
  background: color-mix(in srgb, var(--gc) 12%, transparent); color: var(--ink);
}
.kr-chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--gc); }
.mention { color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 2px; font-weight: 500; }
.mention.me { color: #fff; background: var(--accent); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.check-line { display: flex !important; align-items: flex-start; gap: 8px; font-weight: 400 !important; font-size: 14px !important; }
.check-line input { width: 16px !important; height: 16px !important; margin-top: 2px; flex: none; }
.pill-soft { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--hover); font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.who-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.who-inline .avatar { width: 20px; height: 20px; font-size: 9px; }
.bar { display: inline-block; height: 6px; border-radius: 3px; background: var(--hover); overflow: hidden; flex: 1; min-width: 40px; }
.bar > i { display: block; height: 100%; border-radius: 3px; transition: width .3s; }

/* Calendario */
.content-cal { padding-bottom: 24px; }
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 16px; align-items: start; }
.cal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-head { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.cal-head h2 { margin: 0; font-size: 16px; text-transform: capitalize; letter-spacing: -.01em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { padding: 6px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--line); }
.cal-day { min-height: 112px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.weekend { background: color-mix(in srgb, var(--side) 55%, transparent); }
.cal-day.other .cal-num span { color: var(--line-2); }
.cal-day.drag-over, .cal-side.drag-over { background: var(--accent-soft); }
.cal-num { display: flex; align-items: center; justify-content: space-between; padding: 0 2px; font: 500 12px var(--mono); color: var(--ink-2); height: 22px; }
.cal-day.today .cal-num span { background: var(--accent); color: var(--accent-ink); border-radius: 5px; padding: 1px 6px; }
.cal-add { width: 20px; height: 20px; opacity: 0; }
.cal-day:hover .cal-add, .cal-add:focus { opacity: 1; }
.cal-items { display: grid; gap: 3px; min-width: 0; }
.cal-chip {
  display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 6px; font-size: 12px; cursor: grab;
  background: color-mix(in srgb, var(--c) 10%, var(--panel)); border: 1px solid color-mix(in srgb, var(--c) 25%, transparent); min-width: 0;
}
.cal-chip .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip .dot { width: 7px; height: 7px; border-radius: 50%; }
.cal-chip .avatar { width: 18px; height: 18px; font-size: 8px; border-width: 1px; }
.cal-chip.is-done .t { text-decoration: line-through; color: var(--muted); }
.cal-chip.dragging { opacity: .4; }
.cal-more { border: 0; background: transparent; color: var(--muted); font-size: 12px; text-align: left; cursor: pointer; padding: 2px 6px; }
.cal-more:hover { color: var(--ink); }
.cal-side { background: var(--side); border-radius: var(--radius); padding: 12px; display: grid; gap: 6px; min-height: 200px; position: sticky; top: 0; }
.cal-side-title { font-weight: 600; display: flex; gap: 8px; align-items: baseline; }

/* Bandeja */
.notif { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; }
.notif:last-child { border-bottom: 0; }
.notif:hover { background: var(--hover); }
.notif.unread { background: color-mix(in srgb, var(--accent-soft) 60%, var(--panel)); }
.notif.unread::before { content: ''; position: absolute; left: 6px; top: 22px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.notif-body { flex: 1; min-width: 0; font-size: 14px; }
.notif-detail { color: var(--muted); font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif .when { color: var(--muted); font-size: 11px; white-space: nowrap; }

/* Objetivos */
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.goal-card {
  display: grid; gap: 10px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  color: var(--ink); text-decoration: none; border-top: 3px solid var(--gc);
}
.goal-card:hover { border-color: var(--line-2); border-top-color: var(--gc); text-decoration: none; box-shadow: var(--shadow); }
.goal-card.archived { opacity: .6; }
.goal-top { display: flex; align-items: baseline; gap: 10px; }
.goal-name { font-weight: 650; font-size: 15px; letter-spacing: -.01em; flex: 1; }
.goal-pct { font: 600 20px var(--mono); letter-spacing: -.03em; }
.goal-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.goal-meta .due { display: inline-flex; align-items: center; gap: 4px; }
.goal-meta .due svg { width: 13px; height: 13px; }
.kr-mini { display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.kr-mini-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 38px; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-2); }
.kr-mini-row .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kr-mini-row .mono { text-align: right; color: var(--muted); }
.goal-page { max-width: 900px; }
.goal-hero { display: flex; gap: 22px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.goal-ring {
  --p: 0; width: 96px; height: 96px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--gc) calc(var(--p) * 1%), var(--hover) 0);
}
.goal-ring span { width: 76px; height: 76px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; font: 600 20px var(--mono); letter-spacing: -.03em; }
.goal-hero-txt { flex: 1; min-width: 0; }
.goal-desc { margin: 8px 0 0; white-space: pre-wrap; color: var(--ink-2); }
.topbar h1 a.crumb { color: var(--muted); font-weight: 500; }
.kr-row { display: grid; grid-template-columns: minmax(0, 1fr) 180px auto 28px; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.kr-name { font-weight: 600; }
.kr-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; font-size: 12px; }
.kr-prog { display: flex; align-items: center; gap: 8px; }
.kr-prog .mono { width: 38px; text-align: right; }
.kr-tasks { padding: 8px 16px 12px 32px; border-bottom: 1px solid var(--line); display: grid; gap: 2px; background: var(--bg); }
.kr-task { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; color: var(--ink); }
.kr-task:hover { background: var(--hover); text-decoration: none; }
.kr-task .t { flex: 1; }
.kr-task.is-done .t { text-decoration: line-through; color: var(--muted); }
.timeline { display: grid; gap: 0; border-left: 2px solid var(--line); margin-left: 6px; }
.tl-item { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0 8px 16px; position: relative; font-size: 14px; }
.tl-item > div { flex: 1; }
.tl-dot { position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--bg); }
.tl-item .when { color: var(--muted); font-size: 11px; white-space: nowrap; }

/* Adjuntos */
.atts { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.dropzone { border: 1.5px dashed transparent; border-radius: var(--radius); transition: background .15s, border-color .15s; padding: 2px; }
.dropzone.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.drop-hint { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); padding: 10px; text-align: center; border: 1px dashed var(--line-2); border-radius: 8px; }
.att { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); min-width: 0; }
.att-thumb { width: 44px; height: 44px; border-radius: 6px; background: var(--hover); flex: none; display: grid; place-items: center; overflow: hidden; color: var(--muted); position: relative; }
.att-thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-thumb svg { width: 20px; height: 20px; }
.att-thumb .ext { position: absolute; bottom: 2px; font: 600 8px var(--mono); text-transform: uppercase; }
.att-info { flex: 1; min-width: 0; display: grid; }
.att-name { color: var(--ink); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-info .mono { font-size: 11px; }
.atts-sm { margin-top: 6px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.atts-sm .att-thumb { width: 34px; height: 34px; }
.pending { display: flex; gap: 6px; flex-wrap: wrap; }
.pending-file { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 4px 0 8px; border-radius: 6px; background: var(--hover); font-size: 12px; max-width: 220px; }
.pending-file svg { width: 13px; height: 13px; flex: none; }
.pending-file button { border: 0; background: transparent; cursor: pointer; color: var(--muted); display: grid; place-items: center; padding: 2px; }
.composer .actions { align-items: center; }

@media (max-width: 860px) {
  .cal-wrap { grid-template-columns: 1fr; }
  .cal-day { min-height: 72px; }
  .cal-chip .avatar, .cal-chip .dot { display: none; }
  .cal-chip { padding: 2px 4px; font-size: 11px; }
  .goal-grid { grid-template-columns: 1fr; }
  .kr-row { grid-template-columns: minmax(0, 1fr) 28px; }
  .kr-row .kr-prog { grid-column: 1 / -1; grid-row: 2; }
  .kr-row > .btn { grid-column: 1; grid-row: 3; justify-self: start; }
  .goal-hero { flex-direction: column; align-items: flex-start; }
  .topbar h1 .crumb { display: none; }
}

.rep-select { width: auto; height: 32px; padding: 0 8px; }
.report { max-width: 1100px; }
.rep-head h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.rep-head p { margin: 4px 0 16px; font-size: 13px; }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi-v { font: 600 30px/1.1 var(--mono); letter-spacing: -.04em; }
.kpi-l { font-weight: 600; margin-top: 4px; }
.kpi-h { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.bad .kpi-v { color: var(--danger); }
.kpi.good .kpi-v { color: var(--ok); }
.kpi.warn .kpi-v { color: var(--warn); }
.rep-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.rep-grid .card-box { margin-bottom: 18px; }
.rep-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rep-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.rep-table td { padding: 9px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.rep-table tr:last-child td { border-bottom: 0; }
.rep-table .num { font-family: var(--mono); text-align: right; width: 70px; }
.rep-table th:not(:first-child) { text-align: right; }
.rep-table td.bar-td { width: 180px; }
.table-wrap { overflow-x: auto; }
.rep-table td:first-child { min-width: 150px; }
.bar-cell { display: flex; align-items: center; gap: 8px; }
.bad { color: var(--danger); }
.link-row { cursor: pointer; }
.link-row:hover td { background: var(--hover); }
.stack { display: flex; flex: 1; height: 8px; border-radius: 4px; overflow: hidden; background: var(--hover); min-width: 70px; }
.stack i, .legend-stack i { display: block; height: 100%; }
.s-done { background: var(--ok); } .s-open { background: #3E63DD; } .s-late { background: var(--danger); }
.weeks { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; padding: 16px 16px 6px; height: 190px; }
.wk { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.wk-bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; border-bottom: 1px solid var(--line); }
.wk-bars i { width: 38%; max-width: 22px; border-radius: 4px 4px 0 0; position: relative; min-height: 2px; }
.wk-bars b { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); font: 500 11px var(--mono); color: var(--ink-2); }
.b-created { background: var(--line-2); } .b-done { background: var(--ok); }
.wk-l { font: 11px var(--mono); color: var(--muted); white-space: nowrap; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; padding: 6px 16px 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend > span > i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend-stack { margin-left: auto; }
.legend-stack i { width: 10px !important; height: 10px; border-radius: 3px; display: inline-block !important; margin-left: 6px; }
@media (max-width: 1000px) { .rep-grid { grid-template-columns: 1fr; } .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .kpis { grid-template-columns: repeat(2, 1fr); } .weeks { gap: 4px; padding: 16px 8px 6px; } .wk-l { font-size: 9px; } .rep-table th, .rep-table td { padding: 8px 10px; } .legend-stack { margin-left: 0; } }

/* Imprimir / guardar como PDF: solo el reporte */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; }
  .sidebar, .drawer, .toasts, .no-print, .scrim { display: none !important; }
  .shell { display: block; height: auto; overflow: visible; }
  .main, .content { overflow: visible; height: auto; padding: 0; }
  .card-box, .kpi { break-inside: avoid; box-shadow: none; }
  .rep-grid { grid-template-columns: 1fr 1fr; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* =========================================================
   v3 · Chat
   ========================================================= */
.chat { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: 100%; min-height: 0; }
.chat-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.chat-list-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chat-list-head h1 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.chat-channels { flex: 1; overflow-y: auto; padding: 6px 8px 20px; }
.ch-section { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 6px; }
.ch-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.ch-item:hover { background: var(--hover); text-decoration: none; }
.ch-item.active { background: var(--panel); box-shadow: 0 0 0 1px var(--line); }
.ch-item.unread .ch-name { font-weight: 700; }
.ch-item.unread .ch-prev { color: var(--ink-2); }
.ch-txt { flex: 1; min-width: 0; display: grid; }
.ch-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-prev { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-item .badge { margin-left: 0; }
.ch-ico { width: 28px; height: 28px; border-radius: 8px; flex: none; display: grid; place-items: center; font: 700 15px var(--mono);
  background: color-mix(in srgb, var(--cc) 16%, transparent); color: var(--cc); }
.ch-ico.grp { background: var(--hover); color: var(--ink-2); }
.ch-ico svg { width: 15px; height: 15px; }
.chat-head .ch-ico { width: 34px; height: 34px; font-size: 17px; }
.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; background: var(--panel); }
.chat-main.drag-over::after { content: 'Suelta para adjuntar'; position: absolute; inset: 8px; border: 2px dashed var(--accent); border-radius: 12px;
  background: color-mix(in srgb, var(--accent-soft) 85%, transparent); display: grid; place-items: center; font-weight: 600; color: var(--accent); z-index: 5; }
.chat-empty { margin: auto; max-width: 380px; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); min-height: 61px; }
.chat-head-txt { min-width: 0; }
.chat-head-name { font-weight: 650; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head-sub { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-back { display: none; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 12px 0 8px; }
.chat-more, .chat-start { text-align: center; padding: 10px; color: var(--muted); font-size: 13px; }
.day-sep { display: flex; align-items: center; gap: 12px; margin: 14px 20px 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.day-sep::before, .day-sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.msg-sys { text-align: center; color: var(--muted); font-size: 12.5px; padding: 6px 20px; }
.msg { display: flex; gap: 10px; padding: 4px 20px; position: relative; }
.msg:not(.cont) { margin-top: 8px; }
.msg:hover { background: color-mix(in srgb, var(--hover) 55%, transparent); }
.msg-av { width: 32px; flex: none; display: flex; justify-content: center; padding-top: 2px; }
.msg-av .avatar { width: 32px; height: 32px; font-size: 12px; }
.msg-time { font: 10.5px var(--mono); color: var(--muted); opacity: 0; padding-top: 3px; }
.msg:hover .msg-time { opacity: 1; }
.msg-main { flex: 1; min-width: 0; }
.msg-head { display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.msg-head .when { font-size: 11px; color: var(--muted); }
.msg-body { white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.msg-body.deleted { color: var(--muted); font-style: italic; }
.msg-body a { word-break: break-all; }
.task-ref { font-family: var(--mono); font-size: 13px; background: var(--hover); padding: 1px 5px; border-radius: 4px; color: var(--accent); }
.edited { font-size: 11.5px; color: var(--muted); }
.msg-edit { margin: 4px 0 2px; min-height: 60px; }
.msg-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.msg-files .att { width: 260px; }
.msg-img img { max-width: 320px; max-height: 240px; border-radius: 10px; border: 1px solid var(--line); display: block; }
.msg-actions { position: absolute; right: 16px; top: -10px; display: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 2px; }
.msg:hover .msg-actions { display: flex; }
.msg-actions .icon-btn { width: 26px; height: 26px; }
.chat-compose { border-top: 1px solid var(--line); padding: 10px 16px 14px; background: var(--panel); }
.chat-compose .pending { margin-bottom: 8px; }
.compose-row { display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--line-2); border-radius: 12px; padding: 6px 6px 6px 8px; background: var(--bg); }
.compose-row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.compose-row textarea { flex: 1; border: 0; outline: none; background: transparent; resize: none; padding: 6px 2px; max-height: 180px; line-height: 1.45; }
.team-list { display: grid; gap: 2px; max-height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.team-row { display: flex !important; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 7px; cursor: pointer; font-weight: 400 !important; font-size: 14px !important; }
.team-row:hover { background: var(--hover); }
.team-row input { width: 16px; height: 16px; flex: none; }
.team-row .role-tag { margin-left: auto; }
@media (max-width: 860px) {
  .chat { grid-template-columns: 1fr; }
  .chat.has-current .chat-list { display: none; }
  .chat:not(.has-current) .chat-main { display: none; }
  .chat-back { display: inline-grid; }
  .hide-sm { display: none !important; }
  .msg { padding: 4px 12px; }
  .msg-img img { max-width: 100%; }
  .msg-files .att { width: 100%; }
  .chat-compose { padding: 8px 10px 12px; }
  .chat-head { padding: 8px 10px; }
}

/* =========================================================
   v4 · Campos personalizados y dependencias
   ========================================================= */
.rows { overflow-x: auto; }
.row .c-cf, .row-head .c-cf { min-width: 0; overflow: hidden; }
.row-head .c-cf { white-space: nowrap; text-overflow: ellipsis; }
.cf-btn { max-width: 100%; overflow: hidden; }
.cf-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; max-width: 140px; }
.cf-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; }
.cf-link svg { width: 13px; height: 13px; }
.cf-check { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-2); background: var(--panel); display: inline-grid; place-items: center; cursor: pointer; padding: 0; color: #fff; }
.cf-check.on { background: var(--ok); border-color: var(--ok); }
.cf-check svg { width: 12px; height: 12px; stroke-width: 3; }
.sum-row { background: var(--bg); cursor: default; font-size: 12.5px; min-height: 34px; }
.sum-row:hover { background: var(--bg); }
.sum { font-weight: 600; }
.meta-ico.lock { color: var(--warn); }
.dep-chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 6px; background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--ink); font-size: 12.5px; max-width: 260px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dep-chip svg { width: 12px; height: 12px; flex: none; color: var(--warn); }
.dep-chip.done { background: var(--hover); color: var(--muted); text-decoration: line-through; }
.dep-chip.done svg { color: var(--ok); }
a.dep-chip:hover { text-decoration: underline; }
.dep-results { display: grid; gap: 2px; max-height: 320px; overflow-y: auto; margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.dep-results .dep-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dep-results .where { max-width: 160px; }
.dep-results .is-done .dep-title { text-decoration: line-through; color: var(--muted); }
.fm-list { display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 10px; padding: 4px; max-height: 260px; overflow-y: auto; }
.fm-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; }
.fm-row:hover { background: var(--hover); }
.fm-row .icon-btn:disabled { opacity: .3; cursor: default; }
.fm-row [data-fm=up] svg { transform: rotate(90deg); }
.fm-row [data-fm=down] svg { transform: rotate(90deg); }
.fm-name { font-weight: 500; }
.modal:has(.fm-list), .modal:has(.dep-results) { max-width: 560px; }
@media (max-width: 860px) {
  .group .row, .group .row-head { grid-template-columns: 20px minmax(0, 1fr) 70px !important; min-width: 0 !important; }
  .row .c-cf, .row-head .c-cf, .sum-row { display: none; }
}

.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-bottom: 8px; }
.tpl-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.tpl-top { display: flex; align-items: center; gap: 8px; }
.tpl-name { font-weight: 650; font-size: 15px; flex: 1; letter-spacing: -.01em; }
.tpl-desc { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.tpl-meta { font-size: 12px; color: var(--muted); }
.tpl-steps { margin: 4px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line); list-style: none; display: grid; gap: 4px; font-size: 13px; flex: 1; }
.tpl-steps li { display: flex; gap: 8px; align-items: center; }
.tpl-steps .mono { width: 46px; flex: none; font-size: 11px; }
.tpl-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }

.ap-badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.ap-badge svg, .meta-ico.ap-pending svg, .meta-ico.ap-approved svg, .meta-ico.ap-changes svg { width: 13px; height: 13px; }
.ap-pending { color: var(--warn); } .ap-badge.ap-pending { background: color-mix(in srgb, var(--warn) 14%, transparent); }
.ap-approved { color: var(--ok); } .ap-badge.ap-approved { background: color-mix(in srgb, var(--ok) 14%, transparent); }
.ap-changes { color: var(--danger); } .ap-badge.ap-changes { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.section-title > svg { width: 15px; height: 15px; color: var(--muted); }
.client-thread { display: grid; gap: 8px; border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line)); background: color-mix(in srgb, var(--accent-soft) 35%, var(--panel)); border-radius: var(--radius); padding: 10px; }
.cmsg { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.cmsg.client { border-left: 3px solid var(--accent); }
.cmsg-head { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.cmsg-head .when { margin-left: auto; color: var(--muted); font-size: 11px; }
.cmsg-body { white-space: pre-wrap; margin-top: 3px; color: var(--ink-2); word-break: break-word; }
.client-reply { display: flex; gap: 8px; align-items: flex-end; }
.client-reply textarea { flex: 1; }
.icon-btn.eye-on { color: var(--accent); }

.digest-frame { width: 100%; height: 60vh; border: 1px solid var(--line); border-radius: 10px; background: #f6f5f1; }
.modal:has(.digest-frame) { max-width: 680px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 80; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 9px; box-shadow: var(--shadow); font-size: 13px; animation: pop .18s ease; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Móvil ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  body.side-open .sidebar { transform: none; }
  body.side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 35; }
  .menu-toggle { display: inline-grid; }
  .topbar { padding: 12px 16px; }
  .content { padding: 12px 16px 80px; }
  .search input { width: 140px; }
  .row, .row-head { grid-template-columns: 20px minmax(0,1fr) 70px; }
  .row .c-prio, .row .c-who, .row-head .c-prio, .row-head .c-who { display: none; }
  .mine-row { grid-template-columns: 20px minmax(0,1fr) 70px; }
  .mine-row .c-where, .mine-row .c-prio, .mine-row .c-who { display: none; }
  .fields { grid-template-columns: 96px 1fr; }
  .drawer-body { padding: 16px; }
  .col { width: 270px; max-height: calc(100vh - 170px); }
}

/* ---------- Inicio ---------- */
.home { max-width: 1180px; margin: 0 auto; display: grid; gap: 16px; }
.home-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 28px; border-radius: 16px;
  background: linear-gradient(120deg, var(--accent-soft), var(--panel) 70%); border: 1px solid var(--line); }
.hh-kicker { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.hh-kicker svg { width: 15px; height: 15px; }
.home-hero h2 { margin: 6px 0 6px; font-size: 30px; letter-spacing: -.03em; line-height: 1.1; }
.home-hero p { margin: 0; color: var(--ink-2); max-width: 560px; }
.home-clock { text-align: right; flex: none; }
.hc-time { font: 600 42px var(--font); font-variant-numeric: tabular-nums; letter-spacing: -.04em; line-height: 1; }
.hc-date { margin-top: 6px; color: var(--muted); font-size: 13.5px; }
.home-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.home-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.hk { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 2px; }
.hk b { font: 600 28px var(--mono); letter-spacing: -.04em; }
.hk span { font-size: 12.5px; color: var(--muted); }
.hk small { font-size: 11.5px; color: var(--ok); font-weight: 600; }
.hk.bad b { color: var(--danger); } .hk.warn b { color: var(--warn); } .hk.ok b { color: var(--ok); }
.hk.zero b { color: var(--muted); }
.home-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.home-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; min-width: 0; }
.hc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12.5px; }
.hc-head h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; margin-right: auto; }
.hc-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.hc-dot.bad { background: var(--danger); } .hc-dot.ok { background: var(--ok); } .hc-dot.accent { background: var(--accent); }
.hc-link { font-size: 12.5px; color: var(--accent); font-weight: 500; }
.hc-sub { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 14px 4px 4px; }
.ht-list, .hcm-list { display: grid; grid-template-columns: minmax(0, 1fr); }
.ht { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 8px; cursor: pointer; }
.ht:hover, .hcm:hover { background: var(--hover); }
.ht + .ht { border-top: 1px solid var(--line); }
.ht:hover + .ht, .ht + .ht:hover { border-top-color: transparent; }
.ht-main { flex: 1; min-width: 0; }
.ht-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ht.is-done .ht-title { color: var(--muted); text-decoration: line-through; }
.ht-where { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ht-where .dot { width: 7px; height: 7px; }
.ht-right { display: flex; align-items: center; gap: 6px; flex: none; font-size: 12px; }
.ht-right .prio { padding: 0; } .ht-right .prio svg { width: 14px; height: 14px; }
.onb-done { display: flex; align-items: center; gap: 6px; margin: 6px 6px 0; font-size: 12px; color: var(--muted); }
.onb-done svg { width: 13px; height: 13px; color: var(--ok); flex: none; }
.ht-when { color: var(--muted); font-size: 11.5px; }
.hcm { display: flex; gap: 10px; padding: 9px 6px; border-radius: 8px; cursor: pointer; }
.hcm + .hcm { border-top: 1px solid var(--line); }
.hcm.me { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.hcm-main { min-width: 0; flex: 1; }
.hcm-head { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.hcm-head .when { margin-left: auto; color: var(--muted); font-size: 11px; }
.hcm-tag { font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 5px; padding: 1px 6px; }
.hcm-task { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hcm-body { font-size: 13.5px; color: var(--ink-2); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; white-space: pre-line; }
.h-empty { padding: 18px 8px; color: var(--muted); font-size: 13px; display: grid; gap: 2px; }
.h-empty strong { color: var(--ink); font-size: 14px; }
.onb .onb-count { color: var(--muted); }
.onb-bar { height: 6px; border-radius: 99px; background: var(--hover); overflow: hidden; margin: 2px 0 10px; }
.onb-bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.onb-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px 16px; }
.onb-steps li { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 8px; }
.onb-steps li div { flex: 1; display: grid; min-width: 0; }
.onb-steps li strong { font-size: 13.5px; font-weight: 600; }
.onb-steps li span:not(.onb-check) { font-size: 12px; color: var(--muted); }
.onb-steps li.done strong { color: var(--muted); text-decoration: line-through; }
.onb-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; display: grid; place-items: center; color: #fff; }
.onb-steps li.done .onb-check { background: var(--ok); border-color: var(--ok); }
.onb-check svg { width: 12px; height: 12px; }
@media (max-width: 1100px) { .home-grid { grid-template-columns: 1fr 1fr; } .home-grid .home-card:last-child { grid-column: 1 / -1; } }
@media (max-width: 760px) {
  .home-hero { flex-direction: column; align-items: flex-start; padding: 18px; gap: 12px; }
  .home-hero h2 { font-size: 24px; }
  .home-clock { text-align: left; } .hc-time { font-size: 30px; }
  .home-kpis { grid-template-columns: repeat(2, 1fr); }
  .home-kpis .hk:last-child { grid-column: 1 / -1; }
  .home-grid { grid-template-columns: 1fr; }
  .hk b { font-size: 22px; }
}

/* Inicio · por cliente */
.home-clients { display: grid; gap: 10px; }
.hcl-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }
.hcl-head h3 { margin: 0; font-size: 16px; }
.cc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; }
.cc { grid-template-columns: minmax(0, 1fr); background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; cursor: pointer; min-width: 0; transition: box-shadow .15s, border-color .15s; }
.cc:hover { box-shadow: var(--shadow); }
.cc.on { border-color: var(--c); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 30%, transparent); }
.cc-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cc-head strong { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14.5px; }
.cc-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.cc-pct { font-size: 12px; color: var(--muted); }
.cc-bar { height: 5px; border-radius: 99px; background: var(--hover); overflow: hidden; }
.cc-bar span { display: block; height: 100%; background: var(--c); border-radius: 99px; }
.cc-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.cc-chip { font-size: 11.5px; padding: 2px 7px; border-radius: 6px; background: var(--hover); color: var(--ink-2); white-space: nowrap; }
.cc-chip.bad { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-weight: 600; }
.cc-chip.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); font-weight: 600; }
.cc-chip.ok { background: color-mix(in srgb, var(--ok) 13%, transparent); color: var(--ok); font-weight: 600; }
.cc-foot { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.cc-next { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-next.late { color: var(--danger); font-weight: 500; }
.cc-foot .icon-btn { width: 26px; height: 26px; }
.cc-filter { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--c); background: color-mix(in srgb, var(--c) 10%, var(--panel)); color: var(--ink); font-weight: 500; cursor: pointer; font-size: 13px; }
.cc-filter svg { width: 13px; height: 13px; }
.hg-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 10px 6px 2px; }
.hg-head:first-of-type { margin-top: 2px; }
.hg-head .dot { width: 8px; height: 8px; }
.hg-head .mono { margin-left: auto; color: var(--muted); font-weight: 400; }
.hcm-task .dot { width: 7px; height: 7px; display: inline-block; margin-right: 4px; vertical-align: 1px; }
@media (max-width: 760px) { .cc-grid { grid-template-columns: 1fr; } }

/* Crear tarea */
.side-new { width: calc(100% - 16px); margin: 2px 8px 8px; justify-content: center; }
.add-row .qa-go, .add-row .qa-more { display: none; flex: none; }
.add-row.typing .qa-go { display: inline-flex; }
.add-row:hover .qa-more, .add-row:focus-within .qa-more { display: inline-flex; }
.col-add-btn { width: 100%; display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 1px dashed var(--line-2); border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font: inherit; }
.col-add-btn:hover { color: var(--ink); border-color: var(--ink-2); background: var(--panel); }
.col-add-btn svg { width: 14px; height: 14px; }
.modal:has(.tc-form) { max-width: 560px; }
.tc-form { display: grid; gap: 12px; }
.tc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tc-label { font-size: 13px; font-weight: 500; margin-bottom: -6px; }
.tc-people { display: flex; flex-wrap: wrap; gap: 6px; }
.tc-person { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px 0 4px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; font: inherit; font-size: 13px; color: var(--ink-2); }
.tc-person.on { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); font-weight: 500; }
.tc-person .avatar { width: 24px; height: 24px; font-size: 10px; }
.form label.tc-more { margin-right: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 400; cursor: pointer; }
.tc-more input[type=checkbox] { width: 16px; height: 16px; margin: 0; padding: 0; accent-color: var(--accent); }
.tc-form .actions { align-items: center; margin-top: 4px; }
@media (max-width: 560px) { .tc-row { grid-template-columns: 1fr; } }

/* Recuperar contraseña */
.notice { background: color-mix(in srgb, var(--ok) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); color: var(--ink); border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.label-row a { font-weight: 400; font-size: 12.5px; }
.db-alert { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 10%, var(--panel)); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); }
.db-alert svg { width: 18px; height: 18px; color: var(--warn); flex: none; }
.db-alert div { flex: 1; display: grid; font-size: 13px; } .db-alert span { color: var(--ink-2); }

/* Campos para agencias */
.fm-presets { border: 1px dashed var(--line-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; display: grid; gap: 8px; background: var(--bg); }
.fm-presets-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.fm-presets-head .btn { margin-left: auto; }
.fm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fm-chip { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; font: inherit; font-size: 13px; color: var(--ink); }
.fm-chip:hover { border-color: var(--accent); color: var(--accent); }
.fm-chip svg { width: 12px; height: 12px; }
.fm-chip span { color: var(--muted); font-size: 11.5px; }
.cc-foot .icon-btn.on { color: var(--accent); }
