/* García y García — azul claro + blanco */
:root {
  --bg: #EFF6FF;
  --bg-soft: #F8FBFF;
  --blue-100: #DBEAFE;
  --blue-200: #BFDBFE;
  --accent: #2563EB;
  --accent-dark: #1D4ED8;
  --ink: #1E293B;
  --ink-soft: #64748B;
  --ink-faint: #94A3B8;
  --white: #FFFFFF;
  --line: #E2E8F0;
  --glass: rgba(255, 255, 255, .72);
  --shadow: 0 1px 3px rgba(30, 64, 175, .06), 0 8px 24px rgba(30, 64, 175, .07);
  --shadow-lg: 0 4px 12px rgba(30, 64, 175, .10), 0 20px 48px rgba(30, 64, 175, .14);
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(1000px 600px at 85% -10%, var(--blue-100) 0%, transparent 60%),
    radial-gradient(800px 500px at -10% 100%, var(--blue-100) 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }
input, select, textarea {
  font: inherit; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; background: var(--white); width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
textarea { resize: vertical; }

/* ---------- Botones ---------- */
.btn {
  border: none; border-radius: 10px; padding: 10px 18px;
  font-weight: 600; font-size: 14px; letter-spacing: .01em;
  transition: transform .12s, box-shadow .12s, background .12s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  color: #fff; box-shadow: 0 2px 8px rgba(37, 99, 235, .32);
}
.btn-primary:hover { box-shadow: 0 4px 14px rgba(37, 99, 235, .42); }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--bg-soft); color: var(--ink); }
.btn-danger { background: #FEE2E2; color: #B91C1C; }
.btn-danger:hover { background: #FECACA; }
.btn-icon {
  background: none; border: none; color: var(--ink-faint);
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
}
.btn-icon:hover { background: var(--blue-100); color: var(--accent); }
.btn-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Login ---------- */
#login-screen {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 420px; background: var(--glass);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 22px; padding: 40px 36px; text-align: center;
  box-shadow: var(--shadow-lg);
}
.brand-logo {
  width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 20px;
  background: linear-gradient(160deg, var(--accent), var(--accent-dark));
  color: #fff; display: grid; place-items: center;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .35);
}
.brand-logo svg { width: 40px; height: 40px; }
.login-card h1 { font-family: Georgia, "Times New Roman", serif; font-size: 28px; font-weight: 600; letter-spacing: .01em; }
.login-card h1 span { color: var(--accent); }
.login-sub { color: var(--ink-soft); font-size: 13px; margin: 6px 0 26px; letter-spacing: .08em; text-transform: uppercase; }
.login-users { display: flex; flex-direction: column; gap: 10px; }
.login-user-btn {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--white); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; transition: border-color .15s, box-shadow .15s, transform .12s;
}
.login-user-btn:hover { border-color: var(--blue-200); box-shadow: var(--shadow); transform: translateY(-1px); }
.login-user-btn strong { font-size: 15px; }
.login-user-btn small { display: block; color: var(--ink-soft); font-size: 12px; }
.login-pin-area p:first-child { font-weight: 600; margin-bottom: 14px; }
#login-pin { text-align: center; font-size: 24px; letter-spacing: 12px; }
.login-error { color: #DC2626; font-size: 13px; min-height: 18px; margin-top: 8px; }
.login-actions { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
.login-actions .btn { flex: 1; }

/* ---------- Avatares ---------- */
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; color: #fff;
  font-weight: 700; font-size: 14px; letter-spacing: .02em;
}
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }

/* ---------- Layout app ---------- */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--glass);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-right: 1px solid rgba(226, 232, 240, .9);
  padding: 22px 14px;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 22px; }
.brand-mini {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(160deg, var(--accent), var(--accent-dark));
  color: #fff; display: grid; place-items: center;
  box-shadow: 0 4px 10px rgba(37, 99, 235, .3);
}
.brand-mini svg { width: 24px; height: 24px; }
.sidebar-brand strong { display: block; font-family: Georgia, serif; font-size: 16px; line-height: 1.15; }
.sidebar-brand small { color: var(--ink-soft); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-btn {
  display: flex; align-items: center; gap: 12px; position: relative;
  background: none; border: none; border-radius: 11px;
  padding: 11px 14px; font-size: 14.5px; font-weight: 500; color: var(--ink-soft);
  transition: background .15s, color .15s;
}
.nav-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-btn:hover { background: rgba(219, 234, 254, .6); color: var(--ink); }
.nav-btn.active { background: var(--accent); color: #fff; font-weight: 600; box-shadow: 0 3px 10px rgba(37, 99, 235, .3); }
.chat-badge {
  position: absolute; right: 12px; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px; background: #EF4444; color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.nav-btn.active .chat-badge { background: #fff; color: var(--accent); }
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--line); padding-top: 16px; margin-top: 12px;
}
.sidebar-user-main {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
  border-radius: 10px; padding: 4px 6px; margin: -4px -6px;
  transition: background .15s;
}
.sidebar-user-main:hover { background: rgba(219, 234, 254, .55); }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info small { color: var(--ink-soft); font-size: 11.5px; }

.main { flex: 1; padding: 34px 40px; min-width: 0; }
.view-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.view-header h2 { font-family: Georgia, serif; font-size: 26px; font-weight: 600; }
.view-sub { color: var(--ink-soft); font-size: 13.5px; margin-top: 3px; }
.header-actions { display: flex; gap: 10px; align-items: center; }
.header-actions select { width: auto; }

/* ---------- Filtros ---------- */
.filters { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.filters input[type="search"] { flex: 2; min-width: 220px; }
.filters select { flex: 1; min-width: 150px; width: auto; }

/* ---------- Expedientes ---------- */
.exp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.exp-card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); cursor: pointer;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  display: flex; flex-direction: column; gap: 10px;
}
.exp-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--blue-200); }
.exp-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.exp-numero { font-weight: 700; font-size: 13px; color: var(--accent); letter-spacing: .02em; }
.exp-cliente { font-size: 16.5px; font-weight: 600; line-height: 1.3; }
.exp-desc { font-size: 13px; color: var(--ink-soft); line-height: 1.45; }
.exp-ubicacion {
  display: flex; gap: 9px; align-items: flex-start;
  background: var(--bg); border: 1px solid var(--blue-100);
  border-radius: 10px; padding: 10px 12px;
}
.exp-ubicacion svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.exp-ubicacion strong { display: block; font-size: 13.5px; }
.exp-ubicacion small { color: var(--ink-soft); font-size: 12px; line-height: 1.4; }
.exp-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.exp-resp { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-soft); }
.exp-actions { display: flex; gap: 6px; }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.badge.civil { background: #DBEAFE; color: #1D4ED8; }
.badge.mercantil { background: #E0E7FF; color: #4338CA; }
.badge.familiar { background: #FCE7F3; color: #BE185D; }
.badge.laboral { background: #FEF3C7; color: #B45309; }
.badge.penal { background: #FEE2E2; color: #B91C1C; }
.badge.amparo { background: #CFFAFE; color: #0E7490; }
.badge.agrario { background: #ECFCCB; color: #4D7C0F; }
.badge.archivado { background: #F1F5F9; color: var(--ink-faint); }
.empty-msg { color: var(--ink-faint); text-align: center; padding: 60px 0; font-size: 14.5px; grid-column: 1 / -1; }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; }
.kanban-col {
  background: rgba(219, 234, 254, .35); border: 1px solid rgba(191, 219, 254, .55);
  border-radius: var(--radius); padding: 12px; min-height: 320px;
  transition: background .15s, border-color .15s;
}
.kanban-col.drag-over { background: rgba(191, 219, 254, .55); border-color: var(--accent); }
.kanban-col h3 {
  font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-soft); padding: 4px 6px 12px; display: flex; justify-content: space-between;
}
.col-count { color: var(--ink-faint); font-weight: 600; }
.col-body { display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.tarea-card {
  background: var(--white); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 14px; box-shadow: var(--shadow); cursor: grab;
  display: flex; flex-direction: column; gap: 8px;
  transition: transform .12s, box-shadow .12s;
}
.tarea-card:hover { box-shadow: var(--shadow-lg); }
.tarea-card.dragging { opacity: .45; transform: rotate(2deg); }
.tarea-card.mine { border-left: 3px solid var(--accent); }
.tarea-card.terminada { opacity: .6; }
.tarea-card.terminada .tarea-titulo { text-decoration: line-through; color: var(--ink-faint); }
.tarea-card.terminada .tarea-desc { text-decoration: line-through; }
.tarea-titulo { font-size: 14px; font-weight: 600; line-height: 1.35; }
.tarea-desc { font-size: 12.5px; color: var(--ink-soft); line-height: 1.4; }
.tarea-exp { font-size: 11.5px; color: var(--accent); font-weight: 600; }
.tarea-foot { display: flex; align-items: center; gap: 8px; }
.tarea-fecha { font-size: 11.5px; color: var(--ink-soft); margin-left: auto; display: flex; align-items: center; gap: 4px; }
.tarea-fecha.vencida { color: #DC2626; font-weight: 700; }
.prio { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.prio.alta { background: #EF4444; box-shadow: 0 0 0 3px #FEE2E2; }
.prio.media { background: #F59E0B; box-shadow: 0 0 0 3px #FEF3C7; }
.prio.baja { background: #10B981; box-shadow: 0 0 0 3px #D1FAE5; }

/* ---------- Filtro de persona (dropdown propio) ---------- */
.persona-filter { position: relative; }
.persona-filter-btn {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  background: var(--white); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 14px; font-size: 13.5px; font-weight: 600; color: var(--ink);
  min-width: 190px; transition: border-color .15s, box-shadow .15s;
}
.persona-filter-btn:hover { border-color: var(--blue-200); }
.persona-filter-btn .chev { width: 15px; height: 15px; stroke: var(--ink-faint); flex-shrink: 0; }
.persona-filter-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30;
  background: var(--white); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 6px; min-width: 220px;
  max-height: 320px; overflow-y: auto;
  animation: modalIn .15s ease-out;
}
.persona-opt {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; border-radius: 8px; padding: 9px 10px;
  font-size: 13.5px; text-align: left; color: var(--ink); white-space: nowrap;
}
.persona-opt:hover { background: var(--bg); }
.persona-opt.sel { font-weight: 700; color: var(--accent); }
.persona-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--ink-faint); }
.persona-opt .check { width: 15px; height: 15px; margin-left: auto; stroke: var(--accent); stroke-width: 2.4; flex-shrink: 0; }

/* ---------- Calendario ---------- */
.cal-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.cal-nav h3 { font-family: Georgia, serif; font-size: 18px; font-weight: 600; min-width: 170px; text-align: center; }
.cal-grid {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--bg); border-bottom: 1px solid var(--line); }
.cal-weekdays div { padding: 10px; text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.cal-days { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell {
  min-height: 108px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 8px; display: flex; flex-direction: column; gap: 6px;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.fuera { background: var(--bg-soft); }
.cal-cell.fuera .cal-day-num { color: var(--ink-faint); }
.cal-cell.hoy { background: rgba(37, 99, 235, .07); }
.cal-cell.hoy .cal-day-num { color: var(--accent); font-weight: 800; }
.cal-day-num { font-size: 12.5px; font-weight: 600; }
.cal-day-tasks { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.cal-chip {
  font-size: 11px; font-weight: 600; padding: 3px 7px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--bg); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-chip.vencida { box-shadow: inset 0 0 0 1px #DC2626; }
.cal-chip.terminada { text-decoration: line-through; opacity: .55; }

/* ---------- Chat ---------- */
.chat-box {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  height: calc(100vh - 190px); min-height: 420px; overflow: hidden;
}
.chat-msgs { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; max-width: 72%; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-bubble {
  background: var(--bg); border: 1px solid var(--blue-100);
  border-radius: 14px 14px 14px 4px; padding: 9px 13px;
}
.msg.mine .msg-bubble {
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  border: none; color: #fff; border-radius: 14px 14px 4px 14px;
}
.msg-meta { display: flex; gap: 8px; align-items: baseline; margin-bottom: 3px; }
.msg-nombre { font-size: 12px; font-weight: 700; }
.msg.mine .msg-nombre { color: rgba(255,255,255,.9); }
.msg-hora { font-size: 10.5px; color: var(--ink-faint); }
.msg.mine .msg-hora { color: rgba(255,255,255,.65); }
.msg-texto { font-size: 14px; line-height: 1.45; word-wrap: break-word; }
.chat-day { text-align: center; font-size: 11.5px; color: var(--ink-faint); font-weight: 600; letter-spacing: .04em; margin: 6px 0; }
.chat-form { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); background: var(--bg-soft); }
.chat-form .btn { display: grid; place-items: center; width: 46px; padding: 0; }
.chat-form .btn svg { width: 18px; height: 18px; }

/* ---------- Equipo ---------- */
.equipo-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.equipo-card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 13px;
}
.equipo-card.inactivo { opacity: .55; }
.equipo-info { flex: 1; min-width: 0; }
.equipo-info strong { display: block; font-size: 15px; }
.equipo-info small { color: var(--ink-soft); font-size: 12.5px; }

/* ---------- Actualizaciones de tarea ---------- */
.updates-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.updates-section h4 {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-soft); margin: 0 0 12px;
}
.updates-section h4 svg { width: 14px; height: 14px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.updates-list { display: flex; flex-direction: column; gap: 10px; max-height: 220px; overflow-y: auto; margin-bottom: 12px; }
.updates-empty { color: var(--ink-faint); font-size: 13px; padding: 2px 0 4px; }
.update-item { display: flex; gap: 9px; }
.update-bubble {
  background: var(--bg); border: 1px solid var(--blue-100);
  border-radius: 12px; padding: 8px 12px; flex: 1; min-width: 0;
}
.update-meta { display: flex; gap: 8px; align-items: baseline; margin-bottom: 2px; }
.update-nombre { font-size: 12px; font-weight: 700; }
.update-hora { font-size: 10.5px; color: var(--ink-faint); }
.update-texto { font-size: 13.5px; line-height: 1.45; color: var(--ink); word-wrap: break-word; white-space: pre-wrap; }
.updates-form { display: flex; gap: 10px; align-items: flex-end; }
.updates-form textarea { flex: 1; font-size: 13.5px; }
.updates-form .btn { flex-shrink: 0; }
.tarea-updates-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--ink-faint); font-weight: 600;
}
.tarea-updates-badge svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Modales ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(30, 58, 138, .28);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px;
  overflow-y: auto;
}
.modal {
  background: var(--white); border-radius: 18px; padding: 26px;
  width: 100%; max-width: 520px; box-shadow: var(--shadow-lg);
  animation: modalIn .18s ease-out;
}
.modal-wide { max-width: 640px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal h3 { font-family: Georgia, serif; font-size: 20px; margin-bottom: 18px; }
.modal-sub { color: var(--ink-soft); font-size: 13.5px; margin: -10px 0 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.form-grid .full { grid-column: 1 / -1; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ---------- Detalle / timeline ---------- */
.detalle-header { margin-bottom: 18px; }
.detalle-header .exp-numero { font-size: 14px; }
.detalle-header h3 { margin: 4px 0 2px; }
.detalle-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; font-size: 13px; color: var(--ink-soft); }
.timeline-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.timeline-section h4 {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-soft); margin: 0 0 18px;
}
.timeline-section h4 svg { width: 14px; height: 14px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.timeline-empty { color: var(--ink-faint); font-size: 13.5px; padding: 6px 0 2px; }
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 4px; bottom: 4px;
  width: 2px; background: var(--blue-200); border-radius: 2px;
}
.tl-item { position: relative; padding-bottom: 22px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ''; position: absolute; left: -25px; top: 3px; z-index: 1;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--white); border: 3px solid var(--blue-200);
}
.tl-item:first-child::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 5px rgba(37,99,235,.15); }
.tl-item strong { font-size: 14px; display: block; }
.tl-item .tl-motivo { font-size: 13px; color: var(--ink-soft); margin-top: 3px; line-height: 1.4; }
.tl-item .tl-meta { font-size: 11.5px; color: var(--ink-faint); margin-top: 6px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 14px; font-weight: 500;
  padding: 12px 22px; border-radius: 12px; z-index: 100;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  animation: toastIn .2s ease-out;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .kanban { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  #app { flex-direction: column; }

  /* Barra superior: logo + perfil */
  .sidebar {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 40;
    flex-direction: row; align-items: center; justify-content: space-between;
    padding: 10px 14px; gap: 10px;
    border-right: none; border-bottom: 1px solid var(--line);
    /* backdrop-filter crea containing block y rompería el nav fixed */
    backdrop-filter: none; -webkit-backdrop-filter: none;
    background: rgba(255, 255, 255, .92);
  }
  .sidebar-brand { padding: 0; flex: 1; min-width: 0; }
  .sidebar-brand strong { font-size: 15px; white-space: nowrap; }
  .sidebar-brand small { display: none; }
  .brand-mini { width: 36px; height: 36px; border-radius: 10px; }
  .brand-mini svg { width: 21px; height: 21px; }
  .sidebar-user { border-top: none; padding-top: 0; margin-top: 0; flex-shrink: 0; }
  .sidebar-user-info { display: none; }

  /* Nav: tab bar inferior estilo app */
  .sidebar nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    flex-direction: row; gap: 0; flex: none;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(226, 232, 240, .9);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 20px rgba(30, 64, 175, .08);
  }
  .nav-btn {
    flex: 1; flex-direction: column; justify-content: center; gap: 3px;
    padding: 7px 2px; font-size: 10.5px; font-weight: 600; border-radius: 10px;
    min-width: 0;
  }
  .nav-btn svg { width: 21px; height: 21px; flex-shrink: 0; }
  .nav-btn.active { box-shadow: none; }
  .chat-badge { top: 2px; right: auto; left: calc(50% + 6px); }

  /* Contenido: deja aire para la tab bar */
  .main { padding: 18px 16px calc(92px + env(safe-area-inset-bottom)); }
  .view-header h2 { font-size: 22px; }
  .header-actions { width: 100%; }
  .header-actions .persona-filter { flex: 1; }
  .persona-filter-btn { min-width: 0; width: 100%; }

  .kanban { grid-template-columns: 1fr; }
  .kanban-col { min-height: 0; }

  .cal-cell { min-height: 64px; padding: 5px; }
  .cal-day-num { font-size: 11px; }
  .cal-chip { font-size: 9.5px; padding: 2px 4px; }
  .cal-nav { flex-wrap: wrap; gap: 8px; }
  .cal-nav h3 { min-width: 0; font-size: 15px; flex: 1; }

  .msg { max-width: 88%; }
  .form-grid { grid-template-columns: 1fr; }
  .chat-box { height: calc(100dvh - 320px); min-height: 340px; }

  /* Modales: scroll seguro en pantallas cortas */
  .modal-backdrop { place-items: start center; }
  .modal { margin: 24px 0 48px; padding: 22px 18px; }

  /* iOS: inputs bajo 16px provocan zoom al enfocar */
  input, select, textarea { font-size: 16px; }
  .updates-form textarea { font-size: 16px; }

  .toast {
    bottom: calc(84px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 32px); text-align: center;
  }
}

@media (max-width: 760px) and (display-mode: standalone) {
  .sidebar { padding-top: calc(10px + env(safe-area-inset-top)); }
}
