/* ============================================================
   ACCIONA — Sistema de diseño
   Organiza. Asigna. Controla.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Marca — extraído del logo */
  --blue: #1E5FBF;
  --blue-dark: #123B7A;
  --blue-light: #E8F0FD;
  --teal: #14B08A;
  --green: #27AE60;

  /* Acentos por categoría (íconos del logo) */
  --tag-tareas: #3B82F6;
  --tag-equipos: #22C55E;
  --tag-planificacion: #F97316;
  --tag-resultados: #8B5CF6;

  /* Prioridades */
  --prio-baja: #22C55E;
  --prio-media: #EAB308;
  --prio-alta: #F97316;
  --prio-urgente: #EF4444;

  /* Neutros */
  --ink: #16213D;
  --ink-soft: #4B5A7A;
  --line: #E3E8F1;
  --bg: #F5F7FB;
  --surface: #FFFFFF;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-card: 0 1px 2px rgba(22, 33, 61, 0.06), 0 1px 12px rgba(22, 33, 61, 0.04);
  --shadow-pop: 0 12px 32px rgba(22, 33, 61, 0.16);

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, .brand {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 0;
}
a { color: var(--blue); }
button { font-family: var(--font-body); }
img { max-width: 100%; display: block; }

/* ---------- Marca ---------- */
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.brand-mark .logo-badge {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--teal) 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 17px;
  flex-shrink: 0;
}
.brand-mark .brand-name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand-tagline {
  font-size: 12.5px;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

/* ---------- Layout genérico ---------- */
.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1100px 500px at 20% -10%, var(--blue-light) 0%, transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 32px 28px;
}
.auth-card .brand-mark { margin-bottom: 4px; }
.auth-card h1 {
  font-size: 21px;
  margin-top: 20px;
  margin-bottom: 4px;
}
.auth-sub {
  color: var(--ink-soft);
  font-size: 14px;
  margin-bottom: 24px;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-family: var(--font-body);
  color: var(--ink);
  background: #fff;
  transition: border-color .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--blue);
}
.field textarea { resize: vertical; min-height: 70px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .08s ease, opacity .15s ease;
  font-family: var(--font-body);
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary {
  background: linear-gradient(135deg, var(--blue) 0%, #2A6FD6 100%);
  color: #fff;
  width: 100%;
}
.btn-primary:hover:not(:disabled) { opacity: .92; }
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1.5px solid var(--line);
}
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-danger { background: #FEE2E2; color: #B91C1C; }

.form-msg {
  font-size: 13px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: none;
}
.form-msg.error { display: block; background: #FEF2F2; color: #B91C1C; border: 1px solid #FCA5A5; }
.form-msg.ok { display: block; background: #F0FDF4; color: #15803D; border: 1px solid #86EFAC; }

.auth-switch {
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-top: 18px;
}
.auth-switch a { font-weight: 600; text-decoration: none; }

/* ---------- Shell de la app ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand-mark { padding: 6px 8px 20px; }
.nav-group { margin-top: 6px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item .ico { width: 18px; text-align: center; font-size: 15px; }
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item.active { background: var(--blue-light); color: var(--blue); }
.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px;
  border-radius: var(--radius-sm);
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700;
  flex-shrink: 0;
}
.user-chip .who { min-width: 0; }
.user-chip .who .name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .who .role { font-size: 11.5px; color: var(--ink-soft); text-transform: capitalize; }
.signout-link {
  display: block;
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 8px;
  text-decoration: none;
  padding: 4px 6px;
}
.signout-link:hover { color: #B91C1C; }

.main {
  flex: 1;
  min-width: 0;
  padding: 26px 32px 60px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
}
.topbar h1 { font-size: 22px; }
.topbar .greeting-sub { color: var(--ink-soft); font-size: 14px; margin-top: 3px; }

/* ---------- Tarjetas de resumen ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 26px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
}
.stat-card .num { font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1; }
.stat-card .lbl { font-size: 12px; color: var(--ink-soft); margin-top: 6px; }
.stat-card.c-urgent .num { color: var(--prio-urgente); }
.stat-card.c-today .num { color: var(--blue); }
.stat-card.c-soon .num { color: var(--prio-alta); }
.stat-card.c-overdue .num { color: #B91C1C; }
.stat-card.c-progress .num { color: var(--tag-planificacion); }
.stat-card.c-done .num { color: var(--prio-baja); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-head h3 { font-size: 15px; }
.panel-body { padding: 6px 18px 14px; }

/* ---------- Lista de tareas ---------- */
.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.task-row:last-child { border-bottom: none; }
.task-row:hover { background: var(--bg); margin: 0 -8px; padding-left: 12px; padding-right: 12px; border-radius: 8px; }
.prio-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.task-row .t-title { font-size: 14px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row .t-meta { font-size: 12px; color: var(--ink-soft); flex-shrink: 0; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge.st-todo { background: #EEF2F7; color: #475569; }
.badge.st-progress { background: #DBEAFE; color: #1D4ED8; }
.badge.st-review { background: #FEF3C7; color: #B45309; }
.badge.st-done { background: #DCFCE7; color: #15803D; }

/* ---------- Kanban ---------- */
.kanban-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.kanban-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: flex-start;
}
.kanban-col {
  background: #EEF1F7;
  border-radius: var(--radius-md);
  width: 270px;
  flex-shrink: 0;
  padding: 12px 10px 10px;
  min-height: 120px;
}
.kanban-col.drag-over { outline: 2px dashed var(--blue); outline-offset: -2px; }
.kanban-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 6px 10px;
}
.kanban-col-head .title { font-size: 13px; font-weight: 700; }
.kanban-col-head .count {
  font-size: 11.5px;
  background: #fff;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 1px 8px;
}
.kcard {
  background: #fff;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  padding: 11px 12px;
  margin-bottom: 9px;
  cursor: grab;
  box-shadow: var(--shadow-card);
}
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: 0.4; }
.kcard .kc-prio { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; margin-bottom: 6px; }
.kcard .kc-title { font-size: 13.5px; font-weight: 600; margin-bottom: 8px; line-height: 1.3; }
.kcard .kc-foot { display: flex; align-items: center; justify-content: space-between; }
.kcard .kc-due { font-size: 11.5px; color: var(--ink-soft); }
.kcard .kc-due.overdue { color: #B91C1C; font-weight: 600; }
.kcard .kc-avatar { width: 22px; height: 22px; font-size: 10px; }
.add-task-col-btn {
  width: 100%;
  text-align: left;
  background: none;
  border: 1.5px dashed #C6CEDD;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12.5px;
  color: var(--ink-soft);
  cursor: pointer;
  font-weight: 600;
}
.add-task-col-btn:hover { border-color: var(--blue); color: var(--blue); }

/* ---------- Fab ---------- */
.fab {
  position: fixed;
  right: 30px;
  bottom: 30px;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 13px 20px 13px 16px;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-pop);
}
.fab:hover { opacity: .93; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(16, 24, 45, 0.45);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  z-index: 100;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-pop);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--ink-soft); cursor: pointer; line-height: 1; }
.modal-body { padding: 20px 22px; max-height: 70vh; overflow-y: auto; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-soft);
  font-size: 13.5px;
}

/* ---------- Roles ---------- */
.role-pill {
  display: inline-flex;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.role-superadmin { background: #FDE68A; color: #92400E; }
.role-admin { background: #DBEAFE; color: #1D4ED8; }
.role-supervisor { background: #E0E7FF; color: #4338CA; }
.role-colaborador { background: #DCFCE7; color: #15803D; }

/* ---------- Tabla usuarios ---------- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--ink-soft);
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}
.data-table td { padding: 12px 8px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.data-table tr:last-child td { border-bottom: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .sidebar { position: fixed; z-index: 90; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-pop); }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 18px 16px 80px; }
  .menu-toggle { display: inline-flex !important; }
}
@media (min-width: 901px) { .menu-toggle { display: none; } }
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .field-row { flex-direction: column; gap: 0; }
}

.menu-toggle {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius-sm);
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  font-size: 16px;
  cursor: pointer;
}
