/* NOXIGY OS — componentes reutilizables. */

/* ---------- Avatares de persona (círculo con iniciales o mini-avatar) ---------- */
.pfp {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: inline-grid; place-items: center;
  background: var(--panel-2); border: 1.5px solid var(--border); color: var(--text);
  font: 700 12px var(--font-display); overflow: hidden; position: relative;
}
.pfp svg { width: 100%; height: 100%; display: block; }
.pfp.me { border-color: var(--accent); color: var(--accent); }
.pfp.xs { width: 22px; height: 22px; font-size: 9px; border-width: 1px; }
.pfp.sm { width: 26px; height: 26px; font-size: 10px; }
.pfp.lg { width: 44px; height: 44px; font-size: 15px; }
.pfp.xl { width: 72px; height: 72px; font-size: 24px; }
.pfp-stack { display: inline-flex; }
.pfp-stack .pfp { margin-left: -7px; border-color: var(--panel); border-width: 2px; }
.pfp-stack .pfp:first-child { margin-left: 0; }

/* ---------- Estado / prioridad ---------- */
.status {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px;
  font: 700 10.5px var(--font-body); letter-spacing: .05em; text-transform: uppercase; white-space: nowrap;
  background: var(--panel-2); color: var(--text-dim);
}
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.pendiente { color: var(--text-dim); }
.status.curso, .status.proceso { color: var(--info); background: var(--info-dim); }
.status.revision { color: var(--warn); background: var(--warn-dim); }
.status.aprobado, .status.aprobada, .status.resuelto, .status.pagada { color: var(--ok); background: var(--ok-dim); }
.status.completado, .status.final { color: var(--accent); background: var(--accent-dim); }
.status.cambios, .status.vencida { color: var(--danger); background: var(--danger-dim); }
.prio { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-faint); font-weight: 600; }
.prio-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.prio-dot.alta { background: var(--danger); } .prio-dot.media { background: var(--accent); } .prio-dot.baja { background: var(--text-faint); }
.label-strip { height: 6px; width: 30px; border-radius: 3px; display: inline-block; }
.label-pill { padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 700; color: var(--accent-ink); display: inline-block; }
.load { font: 700 10.5px var(--font-body); letter-spacing: .08em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; }
.load.normal { color: var(--ok); background: var(--ok-dim); }
.load.alta { color: var(--warn); background: var(--warn-dim); }
.load.saturada { color: var(--danger); background: var(--danger-dim); }

.progress { height: 5px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .6s var(--ease); }

/* ---------- Tarjetas de estadística ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 26px; }
/* Sin cifras huérfanas: 6 → 3 + 3; 7 u 8 → 4 + 4 (en móvil, siempre de 2 en 2). */
@media (min-width: 761px) {
  .stats:has(> :nth-child(6):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats:has(> :nth-child(7)) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 18px 16px; transition: border-color var(--t-fast); }
.stat:hover { border-color: var(--text-faint); }
.stat .kicker { margin-bottom: 14px; display: block; }
.stat .num { font: 700 34px var(--font-display); line-height: 1; letter-spacing: -.02em; }
.stat .num.accent { color: var(--accent); }
.stat .sub { font-size: 11.5px; color: var(--text-faint); margin-top: 8px; }

/* ---------- Secciones ---------- */
.section { margin-bottom: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-head h2 { font-size: 17px; }
.section-head .kicker { font-size: 10px; }
.cols-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
.cols-2-eq { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .cols-2, .cols-2-eq { grid-template-columns: 1fr; } }

/* ---------- Listas ---------- */
.list:not(.bi) { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border-soft);
  transition: background var(--t-fast); cursor: default;
}
.list-item:last-child { border-bottom: 0; }
.list-item.click { cursor: pointer; }
.list-item.click:hover { background: rgba(255,255,255,.02); }
.list-item .main-col { flex: 1; min-width: 0; }
.list-item .t { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .s { font-size: 12px; color: var(--text-faint); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .ico { width: 34px; height: 34px; border-radius: 10px; background: var(--panel-2); display: grid; place-items: center; flex-shrink: 0; font-size: 15px; }
.check-round {
  width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--text-faint); background: none; cursor: pointer;
  flex-shrink: 0; display: grid; place-items: center; transition: all var(--t-fast); padding: 0;
}
.check-round:hover { border-color: var(--accent); }
.check-round.done { background: var(--accent); border-color: var(--accent); }
.check-round.done::after { content: ''; width: 5px; height: 9px; border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.done-text { text-decoration: line-through; color: var(--text-faint) !important; }

/* ---------- Feed de actividad ---------- */
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; line-height: 1.45; }
.feed-item:last-child { border-bottom: 0; }
.feed-item .when { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.feed-item b { color: var(--text); font-weight: 600; }
.feed-item .txt { color: var(--text-dim); }

/* ---------- Vacío ---------- */
.empty { text-align: center; padding: 38px 18px; color: var(--text-faint); font-size: 13px; }
.empty .big { font-size: 28px; margin-bottom: 8px; filter: grayscale(.3); }
.empty h3 { color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ---------- Pestañas subrayadas (detalle de proyecto) ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  background: none; border: 0; color: var(--text-faint); padding: 11px 14px; cursor: pointer; white-space: nowrap;
  font: 700 11px var(--font-body); letter-spacing: .1em; text-transform: uppercase; position: relative;
  transition: color var(--t-fast);
}
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--accent); }
.tabs button.on::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; }
.tabs .badge { margin-left: 6px; background: var(--panel-2); color: var(--text-dim); border-radius: 99px; padding: 1px 6px; font-size: 10px; }

/* ---------- Modal ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.66); display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 16px; animation: fadeIn var(--t-med) var(--ease);
}
.overlay.closing { animation: fadeOut var(--t-fast) forwards; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px; width: 100%; max-width: 500px;
  max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-pop); animation: popIn var(--t-med) var(--ease);
}
.modal.wide { max-width: 940px; }
.modal.mid { max-width: 680px; }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.modal-head h2 { font-size: 18px; }
.modal-body { padding: 18px 22px 22px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.x-btn { background: none; border: 0; color: var(--text-dim); font-size: 18px; cursor: pointer; padding: 2px 6px; border-radius: 8px; line-height: 1; }
.x-btn:hover { color: var(--text); background: var(--panel-2); }
@media (max-width: 640px) {
  .overlay { align-items: flex-end; padding: 0; }
  .modal { max-height: 94vh; border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); animation: sheetIn var(--t-med) var(--ease); }
  @keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } }
}

/* ---------- Popover / menú ---------- */
.popover {
  position: absolute; z-index: 120; background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px; min-width: 220px; box-shadow: var(--shadow-pop); animation: popIn var(--t-fast) var(--ease);
}
.popover .pop-title { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); padding: 6px 8px 8px; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; background: none; border: 0; padding: 8px 9px; border-radius: 8px; font-size: 13px; color: var(--text); cursor: pointer; text-align: left; }
.menu-item:hover { background: var(--panel-3); }
.menu-item.danger { color: var(--danger); }

/* ---------- Notificaciones ---------- */
.notif-dot { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font: 700 10.5px/18px var(--font-body); text-align: center; box-shadow: 0 0 0 2px var(--bg); }
.notif-panel { width: 380px; max-width: calc(100vw - 24px); max-height: 72vh; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.notif-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 8px; }
.notif-head .n { font: 700 10.5px var(--font-body); background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: 1px 7px; }
.notif { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 14px; border-radius: 12px; cursor: pointer; font-size: 13px; line-height: 1.45; border: 1px solid transparent; }
.notif .mark { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--border); }
.notif.unread .mark { background: var(--accent); box-shadow: 0 0 0 3px rgba(201,243,29,.15); }
.notif.unread { border-color: rgba(201,243,29,.18); }
.notif:hover { background: var(--panel-3); }
.notif.unread { background: var(--accent-dim); }
.notif .when { font-size: 11px; color: var(--text-faint); margin-top: 4px; }
.notif-day { font: 500 10px var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint); padding: 8px 6px 2px; }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--accent); color: var(--text);
  padding: 12px 16px; border-radius: 12px; font-size: 13px; box-shadow: var(--shadow-pop); max-width: 360px;
  animation: toastIn var(--t-med) var(--ease);
}
.toast.error { border-left-color: var(--danger); }
.toast.out { animation: fadeOut .25s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
@media (max-width: 980px) { .toasts { left: 16px; right: 16px; bottom: calc(var(--tabbar-h) + 14px); align-items: stretch; } }

/* ---------- Kanban (estilo Trello, un solo tablero) ---------- */
.board-scroll { overflow-x: auto; padding-bottom: 10px; margin: 0 -34px; padding-left: 34px; padding-right: 34px; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(268px, 1fr); gap: 14px; align-items: start; min-height: 60vh; }
.column { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; display: flex; flex-direction: column; }
.column-head { padding: 14px 14px 10px; display: flex; align-items: center; gap: 8px; }
.column-title { font-weight: 800; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.column-count { font-size: 11px; color: var(--text-dim); background: var(--panel-2); border-radius: 999px; padding: 1px 8px; }
.column-head .add { margin-left: auto; }
.cards { padding: 0 10px 10px; display: flex; flex-direction: column; gap: 9px; min-height: 60px; border-radius: 10px; transition: background var(--t-fast); }
.cards.dragover { background: var(--accent-dim); }
.kcard {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 11px; padding: 12px; cursor: pointer;
  transition: border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.kcard:hover { border-color: #34343b; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.kcard.dragging { opacity: .4; }
.kcard .labels-row { display: flex; gap: 4px; margin-bottom: 8px; flex-wrap: wrap; }
.kcard .name { font-size: 13px; font-weight: 600; margin-bottom: 3px; line-height: 1.35; }
.kcard .client { font-size: 11px; color: var(--text-faint); margin-bottom: 10px; }
.kcard .foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 11px; color: var(--text-faint); }
.kcard .foot .late { color: var(--danger); font-weight: 700; }
.kcard .foot .pfp-stack { margin-left: auto; }
.empty-col { padding: 14px 8px; text-align: center; color: var(--text-faint); font-size: 11.5px; }
.col-dot { width: 8px; height: 8px; border-radius: 50%; }

/* ---------- Tarjeta detalle tipo Trello ---------- */
.card-modal { display: flex; flex-direction: column; max-height: 92vh; overflow: hidden; }
.card-modal .modal-head { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.card-title-input { font: 700 21px var(--font-display); background: none; border: 0; color: var(--text); width: 100%; outline: none; border-radius: 8px; padding: 4px 8px; margin: -4px -8px; }
.card-title-input:focus { background: var(--panel-2); }
.card-sub { font-size: 12px; color: var(--text-faint); margin-top: 4px; }
.card-body { display: flex; flex: 1; overflow: hidden; }
.card-left { flex: 1.5; overflow-y: auto; padding: 18px 22px 24px; border-right: 1px solid var(--border); }
.card-right { width: 340px; flex-shrink: 0; display: flex; flex-direction: column; overflow: hidden; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.meta-item { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; }
.meta-item .k { font-size: 9.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .08em; font-weight: 800; margin-bottom: 4px; }
.meta-item select, .meta-item input { background: none; border: 0; color: var(--text); font: 600 13px var(--font-body); width: 100%; padding: 0; outline: none; }
.meta-item input { height: auto; }
.meta-item select { height: auto; min-height: 0; padding-right: 22px !important; background: var(--sel-chev) no-repeat right 0 center / 14px 14px; box-shadow: none; }
.meta-item select:focus { background-image: var(--sel-chev-on); }
.meta-item .v { font-size: 13px; font-weight: 600; }
.sec-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); margin: 20px 0 10px; display: flex; align-items: center; gap: 8px; }
.desc-box { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: 13px; line-height: 1.55; color: var(--text-dim); cursor: text; min-height: 48px; white-space: pre-wrap; }
.desc-box:hover { border-color: #34343b; }
.check-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.check-item input[type=checkbox] { width: 16px; height: 16px; flex-shrink: 0; }
.check-item .del { margin-left: auto; opacity: 0; }
.check-item:hover .del { opacity: 1; }
.attach { display: flex; align-items: center; gap: 10px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; margin-bottom: 8px; font-size: 12.5px; }
.attach .ico { font-size: 16px; }
.attach a:hover { color: var(--accent); }
.comment-box { padding: 16px 18px; border-bottom: 1px solid var(--border); }
.comment-box textarea { min-height: 64px; }
.activity-list { flex: 1; overflow-y: auto; padding: 12px 18px 18px; }
.act { display: flex; gap: 10px; margin-bottom: 14px; font-size: 12.5px; line-height: 1.45; color: var(--text-dim); }
.act b { color: var(--text); font-weight: 600; }
.act .bubble { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; color: var(--text); margin-top: 5px; white-space: pre-wrap; }
.act .when { font-size: 11px; color: var(--text-faint); margin-top: 3px; }
@media (max-width: 820px) {
  .card-body { flex-direction: column; overflow-y: auto; }
  .card-left { border-right: 0; overflow: visible; }
  .card-right { width: auto; overflow: visible; border-top: 1px solid var(--border); }
  .activity-list { overflow: visible; }
}

/* ---------- Tabla ---------- */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font: 800 10px var(--font-body); text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); padding: 13px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: rgba(255,255,255,.02); }
.tbl .num { text-align: right; font-family: var(--font-mono); font-size: 12.5px; }

/* ---------- Búsqueda global ---------- */
.search-modal { max-width: 620px; align-self: flex-start; margin-top: 10vh; }
.search-modal input { border: 0; background: none; font-size: 17px; padding: 18px 20px; border-bottom: 1px solid var(--border); border-radius: 0; }
.search-results { max-height: 50vh; overflow-y: auto; padding: 8px; }
.search-group { font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint); padding: 10px 10px 4px; }

/* ---------- Dropzone ---------- */
.dropzone {
  border: 1.5px dashed var(--border); border-radius: 14px; padding: 22px; text-align: center; color: var(--text-faint);
  font-size: 13px; cursor: pointer; transition: all var(--t-fast);
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
