/* =========================================================
   Tablero del equipo · Sistema de diseño
   Tokens → base → controles → estructura → vistas → responsive
   ========================================================= */

/* ---------- 1. Tokens ---------- */
:root {
  /* Marca (el color principal lo sobreescribe la app desde Ajustes) */
  --accent: #4f46e5;
  --accent-contrast: #fff;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --accent-soft-2: color-mix(in srgb, var(--accent) 20%, transparent);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);

  /* Superficies */
  --bg: #f5f6f9;
  --surface: #ffffff;
  --surface-2: #eef0f5;
  --surface-3: #e5e8f0;
  --border: #e2e5ed;
  --border-strong: #cdd2de;

  /* Texto */
  --text: #12151f;
  --muted: #5f6980;

  /* Estados */
  --danger: #dc2626;
  --warn: #c2700a;
  --ok: #15803d;
  --info: #0369a1;

  /* Elevación */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 2px 6px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .1), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 16px 40px rgba(16, 24, 40, .18), 0 2px 8px rgba(16, 24, 40, .08);

  /* Formas */
  --r-xs: 6px;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-full: 999px;

  /* Medidas */
  --col-w: 304px;
  --topbar-h: 56px;
  --content-max: 1360px;

  color-scheme: light;
}

/* Tema oscuro: por preferencia del sistema antes de que arranque la app… */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0e14;
    --surface: #151821;
    --surface-2: #1d212c;
    --surface-3: #262b38;
    --border: #2a2f3d;
    --border-strong: #3a4152;
    --text: #e9ebf2;
    --muted: #97a0b4;
    --danger: #f87171;
    --warn: #fbbf24;
    --ok: #4ade80;
    --info: #38bdf8;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 6px rgba(0, 0, 0, .3);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, .45);
    --shadow-lg: 0 18px 44px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
/* …y por elección explícita del usuario. */
:root[data-theme="dark"] {
  --bg: #0c0e14;
  --surface: #151821;
  --surface-2: #1d212c;
  --surface-3: #262b38;
  --border: #2a2f3d;
  --border-strong: #3a4152;
  --text: #e9ebf2;
  --muted: #97a0b4;
  --danger: #f87171;
  --warn: #fbbf24;
  --ok: #4ade80;
  --info: #38bdf8;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 6px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .45);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.011em; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a.btn { text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

::selection { background: var(--accent-soft-2); }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.spacer { flex: 1 1 auto; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Las rejillas de formulario se pliegan solas cuando no hay sitio. */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 14px; }

/* Barras de desplazamiento discretas */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

.splash {
  display: grid; place-items: center; gap: 14px; height: 100vh; height: 100dvh;
  color: var(--muted);
}
.splash::before {
  content: ""; width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid var(--border); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}

/* ---------- Iconos SVG ---------- */
.i {
  width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -0.2em;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.i.inline { width: 1em; height: 1em; vertical-align: -0.15em; }
.btn .i { width: 16px; height: 16px; vertical-align: 0; }
.btn.sm .i { width: 14px; height: 14px; }
.btn.icon .i { width: 18px; height: 18px; }
.btn.icon.sm .i { width: 15px; height: 15px; }
.i.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.due, .spent { display: inline-flex; align-items: center; gap: 3px; }
.due .i, .spent .i { width: 13px; height: 13px; }
.panel h3 .i { width: 18px; height: 18px; color: var(--accent); }
.goal { display: flex; align-items: center; gap: 6px; }
.goal .i { color: var(--accent); }
#notif-status { display: inline-flex; align-items: center; gap: 6px; }
.load > span { display: inline-flex; align-items: center; gap: 5px; }
.load .i { width: 14px; height: 14px; }

/* ---------- 3. Controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  padding: 7px 13px; border-radius: var(--r-sm); font-weight: 550; font-size: 13.5px;
  white-space: nowrap; box-shadow: var(--shadow-xs);
  transition: background .15s ease, border-color .15s ease, transform .1s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }

.btn.primary {
  background: var(--accent); border-color: transparent; color: var(--accent-contrast);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); border-color: transparent; }

.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); border-color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: transparent; }
.btn.danger.solid:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }

.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); border-color: transparent; }

.btn.sm { padding: 4px 9px; font-size: 12.5px; border-radius: var(--r-xs); }
.btn.icon { padding: 0; width: 34px; height: 34px; flex: 0 0 auto; }
.btn.icon.sm { width: 26px; height: 26px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.input, select.input, textarea.input {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.input:hover { border-color: var(--muted); }
.input:focus { border-color: var(--accent); box-shadow: var(--ring); }
.input:focus-visible { outline: none; }

select.input {
  appearance: none; padding-right: 30px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
textarea.input { resize: vertical; min-height: 84px; line-height: 1.55; }
input[type="color"].input { padding: 3px; height: 38px; cursor: pointer; }
input[type="search"].input { -webkit-appearance: none; }

label.field, .field.color-field { display: block; margin-bottom: 14px; }
label.field > span, .field.color-field > span {
  display: block; font-size: 12px; font-weight: 650; color: var(--muted);
  letter-spacing: .01em; margin-bottom: 5px;
}
.check { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.switch { display: flex; align-items: center; gap: 9px; cursor: pointer; }

.error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 4px 0; }

/* ---------- 4. Acceso ---------- */
.auth {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(60% 55% at 15% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(50% 50% at 100% 100%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 396px; background: var(--surface); padding: 30px;
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}
.auth-logo {
  width: 52px; height: 52px; display: grid; place-items: center; font-size: 27px; margin-bottom: 14px;
  background: var(--accent-soft); border-radius: var(--r); color: var(--accent); font-weight: 800;
}
.auth-logo .i { width: 28px; height: 28px; }
.auth-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.auth-card > p.muted { margin: 0 0 22px; }
.auth-card .btn.primary { width: 100%; padding: 10px; margin-top: 4px; font-size: 14px; }

/* ---------- 5. Estructura ---------- */
.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px; min-height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap; row-gap: 0;
  position: relative; z-index: 40;
}

.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; min-width: 0; }
.brand .logo {
  width: 30px; height: 30px; border-radius: var(--r-sm); background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 14px; font-weight: 800; flex: 0 0 auto;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--accent) 45%, transparent);
}
.brand .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.project-picker { display: flex; align-items: center; gap: 4px; min-width: 0; }
.project-picker select { max-width: 210px; font-weight: 600; padding-block: 6px; }

.nav { display: flex; gap: 2px; }
.nav a {
  border: 0; background: transparent; padding: 7px 11px; border-radius: var(--r-sm);
  color: var(--muted); font-weight: 600; font-size: 13.5px; text-decoration: none;
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav .ico { display: inline-flex; line-height: 1; }
.nav .ico .i { width: 17px; height: 17px; }
.nav-short { display: none; }

.user-btn {
  display: flex; align-items: center; gap: 8px; border: 0; background: transparent;
  padding: 4px 10px 4px 4px; border-radius: var(--r-full); font-weight: 600;
  max-width: 180px; transition: background .15s ease;
}
.user-btn:hover { background: var(--surface-2); }
.user-btn .uname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main.view {
  flex: 1; overflow: auto; padding: 20px 20px 28px;
  scroll-padding-top: 20px;
}

/* Cabecera de vista: título · filtros · acciones */
.view-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.view-head h2 {
  margin: 0; font-size: 19px; font-weight: 700;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.filters { display: flex; align-items: center; gap: 8px; flex: 1 1 320px; min-width: 0; }
.filters .input { width: auto; flex: 0 0 auto; max-width: 190px; }
.filters .search { flex: 1 1 200px; min-width: 130px; max-width: 320px; }
.head-actions { display: flex; gap: 8px; margin-left: auto; flex-shrink: 0; }

/* Filtro por personas (avatares) */
.people-filter { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.person-pick {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0; flex: 0 0 40px;
  border: 0; background: transparent; border-radius: 50%; cursor: pointer; line-height: 0;
}
.person-pick .avatar {
  width: 30px; height: 30px; font-size: 11px; border: 0;
  opacity: .45; filter: grayscale(.7);
  transition: opacity .15s ease, filter .15s ease, box-shadow .15s ease, transform .15s ease;
}
.person-pick:hover .avatar { opacity: .85; filter: none; }
.person-pick .avatar.none { opacity: .75; }
/* Seleccionado: anillo del color de acento separado del avatar por un hueco del color de fondo */
.person-pick.on .avatar { opacity: 1; filter: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.person-pick:active .avatar { transform: scale(.94); }
.person-pick:focus-visible { outline: none; }
.person-pick:focus-visible .avatar { outline: 2px solid var(--accent); outline-offset: 6px; }
.avatar.none { background: var(--surface-2); color: var(--muted); border: 1.5px dashed var(--border-strong) !important; }
.people-filter .btn { margin-left: 2px; }

/* Buscador global de tareas */
.global-search { position: relative; display: flex; align-items: center; flex: 0 1 260px; min-width: 0; }
.global-search > .i { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.global-search .input { width: 100%; padding-left: 32px; padding-block: 6px; }
.gs-results {
  position: absolute; top: calc(100% + 6px); right: 0; width: 400px; max-width: calc(100vw - 20px);
  max-height: min(62vh, 460px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; animation: pop .12s ease;
}
.gs-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 0; background: transparent; padding: 8px 10px; border-radius: var(--r-sm); color: inherit;
}
.gs-item:hover, .gs-item.active { background: var(--surface-2); }
.gs-item .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.gs-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.gs-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-title.done { text-decoration: line-through; color: var(--muted); }
.gs-title mark { background: var(--accent-soft); color: var(--accent); border-radius: 3px; padding: 0 1px; }
.gs-item .prio { flex: 0 0 auto; }
.gs-empty, .gs-more { margin: 0; padding: 10px; text-align: center; }

/* Menú flotante */
.menu {
  position: absolute; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 6px; min-width: 210px; z-index: 60;
  animation: pop .12s ease;
}
.menu button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 8px 10px; border-radius: var(--r-xs); font-size: 13.5px;
}
.menu button:hover { background: var(--surface-2); }
.menu button { display: flex; align-items: center; gap: 9px; }
.menu button .i { width: 16px; height: 16px; color: var(--muted); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }

/* ---------- 6. Avatares y etiquetas ---------- */
.avatar {
  width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 10.5px; font-weight: 700; color: #fff; flex-shrink: 0;
  border: 2px solid var(--surface); letter-spacing: -.02em;
}
.avatar.lg { width: 42px; height: 42px; font-size: 15px; }
.avatar.xl { width: 96px; height: 96px; font-size: 32px; border-width: 3px; box-shadow: var(--shadow-xs); }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; pointer-events: none; }
.avatars { display: flex; }
.avatars .avatar + .avatar { margin-left: -8px; }

.tag {
  display: inline-block; padding: 2px 9px; border-radius: var(--r-full);
  font-size: 11px; font-weight: 650; letter-spacing: .01em;
}
.prio {
  font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: var(--r-xs);
  letter-spacing: .02em; white-space: nowrap;
}
.prio.baja { background: #e0f2fe; color: #075985; }
.prio.media { background: #fef3c7; color: #854d0e; }
.prio.alta { background: #ffedd5; color: #9a3412; }
.prio.urgente { background: #fee2e2; color: #991b1b; }
[data-theme="dark"] .prio.baja { background: #0b3a54; color: #bae6fd; }
[data-theme="dark"] .prio.media { background: #5c3209; color: #fde68a; }
[data-theme="dark"] .prio.alta { background: #5f2410; color: #fed7aa; }
[data-theme="dark"] .prio.urgente { background: #601c1c; color: #fecaca; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .prio.baja { background: #0b3a54; color: #bae6fd; }
  :root:not([data-theme="light"]) .prio.media { background: #5c3209; color: #fde68a; }
  :root:not([data-theme="light"]) .prio.alta { background: #5f2410; color: #fed7aa; }
  :root:not([data-theme="light"]) .prio.urgente { background: #601c1c; color: #fecaca; }
}

.pts {
  font-size: 11px; font-weight: 700; background: var(--surface-2); color: var(--muted);
  padding: 2px 8px; border-radius: var(--r-full); font-variant-numeric: tabular-nums;
}
.due { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.due.over { color: var(--danger); font-weight: 700; }
.due.soon { color: var(--warn); font-weight: 700; }

.badge {
  font-size: 11px; font-weight: 650; padding: 3px 9px; border-radius: var(--r-full);
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.badge.active { background: var(--accent); color: #fff; }
.badge.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }

/* ---------- 7. Tablero Kanban ---------- */
main.view:has(> .board) { display: flex; flex-direction: column; padding-bottom: 20px; }
.board {
  display: flex; gap: 14px; align-items: flex-start; flex: 1; min-height: 0;
  overflow-x: auto; overflow-y: hidden; padding-bottom: 10px;
  scrollbar-gutter: stable;
}
.column {
  width: var(--col-w); flex: 0 0 auto; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  display: flex; flex-direction: column; max-height: 100%;
}
.col-head {
  display: flex; align-items: center; gap: 8px; padding: 11px 12px 9px;
  font-weight: 650; font-size: 13.5px;
}
.col-head .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.col-head .count {
  font-size: 11.5px; color: var(--muted); font-weight: 650;
  background: var(--surface); border-radius: var(--r-full); padding: 1px 8px;
  font-variant-numeric: tabular-nums;
}
.col-head .wip-over { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.col-name {
  border: 0; background: transparent; font: inherit; font-weight: 650;
  padding: 2px 6px; margin-left: -6px; border-radius: var(--r-xs);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.col-name:hover { background: var(--surface-3); }

.col-body {
  padding: 0 9px 9px; display: flex; flex-direction: column; gap: 9px;
  min-height: 56px; overflow-y: auto; overscroll-behavior: contain;
}
.col-add { margin: 0 9px 9px; justify-content: flex-start; color: var(--muted); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 11px; box-shadow: var(--shadow-xs); cursor: grab;
  user-select: none; -webkit-user-select: none;
  border-left: 3px solid transparent;
  transition: box-shadow .15s ease, border-color .15s ease, transform .12s ease;
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.card .labels { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 7px; }
.card .title { font-weight: 600; margin: 0 0 9px; word-break: break-word; line-height: 1.4; }
.card .meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; row-gap: 5px; }
.card.done { opacity: .72; }
.card.done .title { text-decoration: line-through; color: var(--muted); }
.card.ghost {
  position: fixed; pointer-events: none; z-index: 100;
  box-shadow: var(--shadow-lg); transform: rotate(2.5deg); opacity: .96;
}
.placeholder {
  border: 2px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: var(--r); background: var(--accent-soft);
}
body.dragging, body.dragging * { cursor: grabbing !important; }

.card-cover {
  display: block; width: calc(100% + 22px); margin: -11px -11px 9px; height: 128px;
  object-fit: cover; border-radius: 9px 9px 0 0; background: var(--surface-2); pointer-events: none;
}

/* ---------- 8. Paneles, listas y Scrum ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow-xs);
}
.panel h3 {
  margin: 0 0 12px; font-size: 15px; font-weight: 650;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.sprint-active { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: 0 0 0 1px var(--accent-soft), var(--shadow); }

.progress { height: 7px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: inherit; transition: width .3s ease; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.stat { background: var(--surface-2); border-radius: var(--r); padding: 11px 13px; }
.stat b {
  display: block; font-size: 22px; font-weight: 700; line-height: 1.2;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.stat span { font-size: 12px; color: var(--muted); }

.task-list { display: flex; flex-direction: column; container-type: inline-size; container-name: tasklist; }
.task-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 8px;
  border-radius: var(--r-sm); cursor: pointer; min-width: 0;
  box-shadow: 0 1px 0 var(--border);
  transition: background .12s ease;
}
.task-row:last-child { box-shadow: none; }
.task-row:hover { background: var(--surface-2); }
.task-row .t {
  flex: 1 1 auto; min-width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 500;
}
.task-row .status { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.task-row select.input {
  flex: 0 0 auto; width: 150px; padding: 4px 24px 4px 8px; font-size: 12px;
  background-position: calc(100% - 13px) 52%, calc(100% - 9px) 52%;
}
.task-row.is-done .t { text-decoration: line-through; color: var(--muted); }

/* En listas estrechas se recortan primero los datos menos útiles. */
@container tasklist (max-width: 640px) {
  .task-row .status { display: none; }
  .task-row select.input { width: 124px; }
}
@container tasklist (max-width: 440px) {
  .task-row { gap: 8px; }
  .task-row select.input { width: 98px; }
}

.scrum-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1180px) { .scrum-grid { grid-template-columns: minmax(0, 1fr); } }

.chart svg { width: 100%; max-width: 560px; height: auto; display: block; margin: 0 auto; }
.chart .row { justify-content: center; margin-top: 8px; }
.chart .axis { stroke: var(--border-strong); }
.chart text { fill: var(--muted); font-size: 10px; }

.empty { text-align: center; padding: 28px 20px; color: var(--muted); }

.group-title {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 20px 0 8px;
}
.group-title.over { color: var(--danger); }

/* ---------- 8b. Actividad y cronómetro ---------- */
.timer-btn { color: var(--muted); font-size: 11px; opacity: .75; }
.timer-btn:hover { background: var(--accent-soft); color: var(--accent); opacity: 1; }
.timer-btn.on {
  color: var(--accent); background: var(--accent-soft); opacity: 1;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent);
}
.card .timer-btn { margin: -3px -3px -3px 0; }
.spent { font-size: 11.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.spent.live { color: var(--accent); font-weight: 650; }

.now-panel { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.now-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.now-label { font-size: 12px; font-weight: 650; color: var(--accent); letter-spacing: .02em; }
.now-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: 0 0 auto;
  box-shadow: 0 0 0 0 var(--accent-soft-2); animation: pulse 2s ease-out infinite;
}
.now-title {
  display: block; border: 0; background: transparent; padding: 0; text-align: left;
  font-size: 19px; font-weight: 700; color: var(--text); line-height: 1.3; word-break: break-word;
}
.now-title:hover { color: var(--accent); }
.now-clock {
  font-size: clamp(36px, 9vw, 52px); font-weight: 700; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; line-height: 1.1; margin: 6px 0 2px; color: var(--accent);
}
.now-sub { margin: 0 0 4px; }
.now-note { margin: 14px 0; }
.now-panel.idle { text-align: center; padding: 30px 18px; }
.now-panel.idle h3 { margin: 10px 0 6px; font-size: 17px; justify-content: center; }
.now-panel.idle .muted { max-width: 46ch; margin-inline: auto; }
.now-icon { line-height: 1; color: var(--accent); }
.now-icon .i { width: 42px; height: 42px; stroke-width: 1.6; }
.offline-icon { color: var(--muted); margin-bottom: 6px; }
.offline-icon .i { width: 44px; height: 44px; stroke-width: 1.6; }
.start-row { justify-content: center; margin-top: 16px; }
.start-row .input { width: auto; max-width: 340px; flex: 1 1 220px; }

.log-dur {
  font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
  background: var(--surface-2); color: var(--text); padding: 2px 9px; border-radius: var(--r-full); font-size: 12.5px;
}
.log-dur.live { background: var(--accent-soft); color: var(--accent); }

/* ---------- Timeline de la actividad ---------- */
.tl-head { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.tl-head h3 { margin: 0; min-width: 0; }
.tl-head b { font-size: 15px; white-space: nowrap; }

.tl-scroll { overflow-x: auto; overflow-y: hidden; margin: 0 -4px; padding: 0 4px 4px; }
/* Cada hora ocupa al menos 64 px: en pantallas pequeñas aparece el scroll horizontal. */
.tl { --who: 0px; min-width: calc(var(--hours) * 64px + var(--who)); position: relative; }
.tl.multi { --who: 96px; }
.tl-hours { position: relative; height: 20px; margin-left: var(--who); }
.tl-hours span {
  position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--muted);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.tl-hours span:first-child { transform: none; }
.tl-hours span:last-child { transform: translateX(-100%); }
.tl-body { position: relative; }
.tl-grid { position: absolute; inset: 0 0 0 var(--who); pointer-events: none; }
.tl-grid i { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--border); }
.tl-now { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--danger); z-index: 2; }
/* La hora actual se superpone a la fila de horas, encima de la línea. */
.tl-now span {
  position: absolute; top: -20px; left: 0; transform: translateX(-50%); z-index: 1;
  font-size: 10.5px; font-weight: 700; color: #fff; background: var(--danger); font-variant-numeric: tabular-nums;
  padding: 1px 5px; border-radius: var(--r-full); line-height: 1.4;
}
.tl-lane { display: flex; align-items: center; min-height: 58px; }
.tl-lane + .tl-lane { border-top: 1px solid var(--border); }
.tl-who { width: var(--who); flex: none; display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; min-width: 0; }
.tl-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-track { position: relative; flex: 1; height: 46px; background: var(--surface-2); border-radius: var(--r-sm); margin: 6px 0; }
.tl-block {
  position: absolute; top: 3px; bottom: 3px; min-width: 4px; z-index: 1;
  border: 0; border-radius: 6px; padding: 4px 7px; overflow: hidden; text-align: left;
  background: color-mix(in srgb, var(--c) 22%, var(--surface)); color: var(--text);
  box-shadow: inset 3px 0 0 var(--c);
  display: flex; flex-direction: column; justify-content: center; gap: 1px;
  transition: filter .15s ease, box-shadow .15s ease;
}
.tl-block:hover { filter: brightness(.96); box-shadow: inset 3px 0 0 var(--c), 0 0 0 1.5px var(--c); z-index: 3; }
.tl-block.live { border-right: 2px dashed var(--c); border-radius: 6px 0 0 6px; }
.tl-block-t, .tl-block-d { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-block-t { font-size: 12px; font-weight: 650; }
.tl-block-d { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-track.mine { cursor: copy; }
.tl-track.mine:hover { background: var(--surface-3); }

/* Editor de tiempos */
.log-form-times { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; }
.log-form-dur { margin: -4px 0 12px; font-variant-numeric: tabular-nums; }
.log-list { display: grid; gap: 2px; margin: 8px -6px 0; max-height: 190px; overflow: hidden auto; }
.log-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 5px 6px; border-radius: 6px; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text); min-width: 0;
}
button.log-item:hover { background: var(--surface-3); }
.log-item .when { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.log-item b { white-space: nowrap; }


.time-box { background: var(--surface-2); border-radius: var(--r-sm); padding: 9px 11px; }
.time-total { font-variant-numeric: tabular-nums; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--accent-soft-2); }
  70% { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---------- 9. Calendario ---------- */
.cal {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden;
  background: var(--border); gap: 1px;
}
.cal .dow {
  background: var(--surface-2); text-align: center; padding: 8px 4px;
  font-weight: 650; font-size: 11.5px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.cal .day {
  background: var(--surface); min-height: 112px; padding: 5px;
  cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-width: 0;
  transition: background .12s ease;
}
.cal .day:hover { background: var(--surface-2); }
.cal .day.other { background: color-mix(in srgb, var(--bg) 70%, var(--surface)); }
.cal .day.other .num { opacity: .45; }
.cal .day.today .num { background: var(--accent); color: #fff; }
.cal .day.in-sprint { box-shadow: inset 0 3px 0 var(--accent-soft-2); }
.cal .day.drop { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.cal .num {
  font-size: 11.5px; font-weight: 700; align-self: flex-start;
  min-width: 21px; height: 21px; display: grid; place-items: center;
  border-radius: var(--r-full); font-variant-numeric: tabular-nums;
}
.cal .chip {
  font-size: 11px; padding: 2px 6px; border-radius: var(--r-xs);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
  background: color-mix(in srgb, var(--c, var(--accent)) 16%, var(--surface));
  border-left: 3px solid var(--c, var(--accent));
}
.cal .chip:hover { background: color-mix(in srgb, var(--c, var(--accent)) 26%, var(--surface)); }
.cal .chip { display: flex; align-items: center; gap: 4px; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.cal .chip .chip-t { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cal .chip .avatars { flex-shrink: 0; }
.cal .chip .avatar { width: 15px; height: 15px; font-size: 7px; border-width: 1px; }
.cal .chip .avatars .avatar + .avatar { margin-left: -5px; }
.cal .chip.done .chip-t { text-decoration: line-through; }
.cal .chip.done { opacity: .55; }
.chip.ghost, .task-row.ghost {
  position: fixed; pointer-events: none; z-index: 100; box-shadow: var(--shadow-lg);
  transform: rotate(2deg); opacity: .96; background: var(--surface);
}
.chip.ghost {
  font-size: 11px; padding: 2px 6px; border-radius: var(--r-xs); display: flex; gap: 4px; align-items: center;
  white-space: nowrap; overflow: hidden; border-left: 3px solid var(--c, var(--accent));
  background: color-mix(in srgb, var(--c, var(--accent)) 22%, var(--surface));
}
.chip.ghost .avatar { width: 15px; height: 15px; font-size: 7px; border-width: 1px; }
.task-row.ghost { border-radius: var(--r-sm, 8px); }
.cal .placeholder.chip-ph { height: 20px; border-radius: var(--r-xs); border-width: 1.5px; flex-shrink: 0; }
#undated .task-row { touch-action: manipulation; cursor: grab; }
.cal-bar { margin-bottom: 12px; gap: 6px; }
.cal-bar h3 { margin: 0 0 0 6px; font-size: 16px; }

/* ---------- 10. Equipo y ajustes ---------- */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.member { display: flex; gap: 12px; align-items: center; }
.member .info { flex: 1; min-width: 0; }
.member .name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.load {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 10px;
  font-size: 12px; color: var(--muted); margin-top: 14px;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.load > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.settings { max-width: 860px; margin: 0 auto; }
.settings .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.settings .field .input[type=color] { height: 38px; padding: 4px; cursor: pointer; }
.field > span small { font-weight: 400; }
.panel-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.settings .swatches { gap: 6px; margin: 2px 0 8px; }
.profile { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 22px; align-items: start; }

/* Selector de color con colores predefinidos */
.swatch-picker { display: flex; flex-wrap: wrap; gap: 8px; padding: 3px 0; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; width: 0; height: 0; }
.swatch span {
  display: block; width: 30px; height: 30px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .12); transition: transform .12s ease, box-shadow .12s ease;
}
.swatch:hover span { transform: scale(1.08); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text, currentColor); }
.swatch input:checked + span::after {
  content: ''; display: block; width: 100%; height: 100%; background: #fff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 16px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 16px no-repeat;
}
.swatch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 4px; }

/* Equipo: logo/foto, cabecera y lista de proyectos */
.brand .logo, .auth-logo, .team-logo { overflow: hidden; }
.brand .logo img, .auth-logo img, .team-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.team-logo {
  width: 34px; height: 34px; border-radius: var(--r-sm); background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: 0 0 auto;
}
.team-logo .i { width: 18px; height: 18px; }
.team-logo.xl { width: 96px; height: 96px; border-radius: 22px; font-size: 32px; box-shadow: var(--shadow-xs); }
.team-logo.xl .i { width: 42px; height: 42px; }
.team-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.team-title h2 { min-width: 0; }
/* Ventana de ajustes del equipo */
.team-settings .section-title { display: flex; align-items: center; gap: 8px; margin: 22px 0 12px; font-size: 14px; }
.team-settings .section-title.first { margin-top: 0; }
.team-settings .section-title .i { width: 17px; height: 17px; color: var(--accent); }
.team-settings .profile { grid-template-columns: 150px minmax(0, 1fr); gap: 22px; align-items: start; }
.team-settings .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.team-settings .project-list { border: 1px solid var(--border); border-radius: var(--r); padding: 0 14px; }
.team-settings .project-row:first-child { padding-top: 11px; }
@media (max-width: 640px) {
  .team-settings .profile, .team-settings .grid2 { grid-template-columns: minmax(0, 1fr); }
}
.project-list { display: flex; flex-direction: column; }
.project-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); }
.project-row:first-child { border-top: 0; padding-top: 2px; }
.project-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.project-info { flex: 1; min-width: 0; }
.project-name { font-weight: 650; display: flex; align-items: center; gap: 6px; }
.project-info .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Foto de perfil */
.photo-field { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.photo-actions { display: flex; flex-direction: column; align-items: center; gap: 2px; }
#user-photo { margin-bottom: 14px; }
.col-editor {
  display: grid; grid-template-columns: 38px minmax(0, 1fr) 74px auto auto;
  gap: 7px; align-items: center; margin-bottom: 7px;
}
.col-editor .input { padding: 6px 8px; }

/* ---------- 11. Modales ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(9, 11, 18, .55);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 44px 16px; overflow-y: auto; z-index: 80; animation: fade .14s ease;
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  width: 100%; max-width: 580px; box-shadow: var(--shadow-lg);
  animation: pop .16s ease; margin: auto 0;
}
.modal.wide { max-width: 860px; }
.modal-head {
  display: flex; align-items: center; gap: 8px; padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 650; flex: 1; min-width: 0; }
.modal-body { padding: 18px; }
.modal-foot {
  display: flex; gap: 8px; align-items: center; padding: 13px 18px;
  border-top: 1px solid var(--border); background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.task-layout { display: grid; grid-template-columns: minmax(0, 1fr) 248px; gap: 20px; }
.title-input {
  font-size: 18px; font-weight: 650; border-color: transparent; padding-left: 6px;
  background: transparent; box-shadow: none;
}
.title-input:hover { border-color: var(--border-strong); background: var(--surface); }
.title-input:focus { background: var(--surface); }

.people { display: flex; flex-wrap: wrap; gap: 6px; }
.person {
  display: flex; align-items: center; gap: 6px; padding: 3px 11px 3px 3px;
  border: 1px solid var(--border-strong); border-radius: var(--r-full);
  font-size: 12.5px; background: var(--surface);
  transition: border-color .15s ease, background .15s ease;
}
.person:hover { border-color: var(--muted); }
.person .avatar { width: 22px; height: 22px; font-size: 9.5px; border: 0; }
.person.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }

.checklist-item { display: flex; align-items: center; gap: 9px; padding: 5px 0; }
.checklist-item span { flex: 1; word-break: break-word; }
.checklist-item.done span { text-decoration: line-through; color: var(--muted); }

.comment { display: flex; gap: 9px; margin-bottom: 11px; }
.comment .bubble {
  background: var(--surface-2); border-radius: var(--r); padding: 9px 12px; flex: 1;
  white-space: pre-wrap; word-break: break-word;
}
.comment .who { font-size: 12.5px; font-weight: 650; margin-bottom: 2px; }
.section-title { font-weight: 650; margin: 20px 0 9px; font-size: 13px; }

/* ---------- 12. Notificaciones ---------- */
.bell { position: relative; font-size: 16px; }
.notif-count {
  position: absolute; top: 1px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--r-full); background: var(--danger); color: #fff;
  font-size: 9.5px; font-weight: 700; line-height: 16px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
.notif-panel { width: 370px; max-width: calc(100vw - 20px); }
.notif-list { max-height: min(62vh, 480px); overflow-y: auto; }
.menu .notif { display: flex; gap: 10px; align-items: flex-start; line-height: 1.45; }
.notif .notif-text { display: block; }
.notif.unread { background: var(--accent-soft); }
.notif.unread .notif-text { font-weight: 600; }
.notif.unread::after {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0; margin-top: 7px;
}

/* ---------- 13. Ideas ---------- */
/* Ideas en rejilla: tantas columnas como quepan, cada tarjeta de al menos 290px */
.ideas-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; align-items: stretch; }
.idea {
  display: flex; flex-direction: column; gap: 8px; margin: 0; min-width: 0; cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.idea:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.idea-top { display: flex; align-items: center; gap: 8px; min-height: 22px; }
.idea-task { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; color: var(--ok); font-weight: 600; }
.idea-task .i { width: 14px; height: 14px; }
.idea-title { font-weight: 650; font-size: 15px; line-height: 1.35; word-break: break-word; }
.idea-desc {
  margin: 0; color: var(--muted); white-space: pre-wrap; font-size: 13.5px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.idea-meta { display: flex; align-items: center; gap: 7px; min-width: 0; margin-top: auto; padding-top: 4px; }
.idea-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-top: 10px; border-top: 1px solid var(--border);
}
.idea-meta .avatar { width: 22px; height: 22px; font-size: 9px; }
.idea-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.idea-comments { display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; }
.idea-comments .i { width: 13px; height: 13px; }
.idea .vote { flex-direction: row; padding: 3px; gap: 2px; border-radius: var(--r-full); }
.idea .vote-btn { padding: 3px 9px; font-size: 12.5px; }
.idea .vote-btn .i { width: 14px; height: 14px; }
.idea .score { font-size: 13.5px; min-width: 26px; }
.vote {
  display: flex; flex-direction: column; align-items: center; gap: 5px; flex-shrink: 0;
  background: var(--surface-2); border-radius: var(--r); padding: 7px 6px;
}
#idea-votes .vote { flex-direction: row; background: transparent; padding: 0; }
.vote-btn {
  border: 1px solid transparent; background: var(--surface); border-radius: var(--r-full);
  padding: 3px 11px; font-size: 13px; display: flex; gap: 5px; align-items: center;
  transition: transform .1s ease, background .15s ease, border-color .15s ease;
}
.vote-btn:hover { background: var(--surface-3); }
.vote-btn:active { transform: scale(.93); }
.vote-btn.on.up { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--surface)); color: var(--ok); }
.vote-btn.on.down { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.score {
  font-weight: 800; font-size: 15px; min-width: 32px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.score.pos { color: var(--ok); }
.score.neg { color: var(--danger); }

/* ---------- 14. Adjuntos ---------- */
.dropzone {
  display: block; border: 1.5px dashed var(--border-strong); border-radius: var(--r);
  padding: 14px; text-align: center; color: var(--muted); font-size: 13px;
  margin-top: 6px; cursor: pointer; transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.att-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 10px; }
.att-thumb {
  position: relative; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-2);
}
.att-open { border: 0; padding: 0; width: 100%; height: 100%; cursor: zoom-in; background: none; }
.att-open img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-del {
  position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, .62); color: #fff; font-size: 12px;
  opacity: 0; transition: opacity .15s ease; display: grid; place-items: center;
}
.att-del .i { width: 13px; height: 13px; }
.att-thumb:hover .att-del, .att-del:focus-visible { opacity: 1; }
@media (hover: none) { .att-del { opacity: 1; } }

.att-file {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px;
  border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: 7px;
}
.att-file.pending { border-style: dashed; }
.att-icon { display: inline-flex; color: var(--muted); }
.att-icon .i { width: 22px; height: 22px; }
.att-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.att-info a, .att-info > span:first-child {
  font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.att-info .progress { margin-top: 5px; }

.lightbox {
  position: fixed; inset: 0; z-index: 150; background: rgba(4, 5, 9, .93);
  display: grid; place-items: center; padding: 24px; animation: fade .14s ease;
}
.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 100%; }
.lightbox img { max-width: 92vw; max-height: 78vh; object-fit: contain; border-radius: var(--r-sm); box-shadow: var(--shadow-lg); }
.lightbox figcaption {
  color: #e5e7eb; font-size: 13px; display: flex; gap: 12px;
  align-items: center; flex-wrap: wrap; justify-content: center;
}
.lb-nav, .lb-close {
  position: fixed; border: 0; background: rgba(255, 255, 255, .13); color: #fff;
  border-radius: 50%; width: 44px; height: 44px; display: grid; place-items: center;
  transition: background .15s ease;
}
.lb-nav { top: 50%; transform: translateY(-50%); }
.lb-nav .i, .lb-close .i { width: 22px; height: 22px; }
.lb-nav:hover, .lb-close:hover { background: rgba(255, 255, 255, .27); }
.lb-nav.prev { left: 16px; }
.lb-nav.next { right: 16px; }
.lb-close { top: 16px; right: 16px; font-size: 17px; }

/* ---------- 15. Avisos ---------- */
#toasts {
  position: fixed; bottom: calc(22px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%); z-index: 120;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; padding: 0 12px; max-width: 100%;
}
.toast {
  background: #10131c; color: #fff; padding: 11px 18px; border-radius: var(--r-full);
  box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 500;
  animation: pop .2s ease; pointer-events: auto; text-align: center;
}
[data-theme="dark"] .toast { background: #2b3040; }
.toast.err { background: var(--danger); color: #fff; }

.offline {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(6px);
}
.offline-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: 30px; max-width: 390px; text-align: center;
}
.offline-card h2 { margin: 10px 0 6px; font-size: 19px; }

/* ---------- 16. Animaciones ---------- */
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

/* =========================================================
   17. Responsive
   ========================================================= */

/* Portátiles estrechos: la navegación baja a su propia fila */
@media (max-width: 1080px) {
  .topbar { padding: 8px 14px 0; row-gap: 8px; }
  .nav {
    order: 10; flex: 1 0 100%;
    margin: 0 -14px; padding: 0 14px 6px;
    overflow-x: auto; scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: 0 0 auto; }
  .project-picker { flex: 0 1 auto; min-width: 0; }
  .project-picker select { max-width: 240px; }
}

/* Tabletas */
@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .task-layout { grid-template-columns: minmax(0, 1fr); }
}

/* Teléfonos */
@media (max-width: 720px) {
  :root { --col-w: min(84vw, 320px); }

  .topbar { padding: 8px 12px; gap: 8px; row-gap: 0; flex-wrap: nowrap; }
  .brand .name { display: none; }
  .topbar > .spacer { display: none; }
  .user-btn .uname { display: none; }
  .global-search { flex: 1 1 140px; }
  .gs-results { position: fixed; top: calc(var(--topbar-h) + 4px); left: 10px; right: 10px; width: auto; max-width: none; }
  .user-btn { padding: 4px; }
  .project-picker { flex: 1 1 auto; }
  .project-picker select { max-width: none; width: 100%; }

  /* La navegación pasa a la barra inferior */
  .nav {
    position: fixed; bottom: 0; left: 0; right: 0; order: 0; margin: 0; flex: none;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid var(--border);
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0;
    padding: 5px 2px calc(5px + env(safe-area-inset-bottom));
    overflow: visible; z-index: 50;
  }
  .nav a {
    flex-direction: column; gap: 2px; font-size: 9.5px; font-weight: 600;
    padding: 5px 2px; border-radius: var(--r-sm); min-width: 0;
  }
  .nav a > span:not(.ico) { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  /* Con la barra inferior no cabe el nombre largo: se usa el corto si lo hay. */
  .nav a:has(.nav-short) .nav-long { display: none; }
  .nav-short { display: block; }
  .nav a.active { background: transparent; }
  .nav .ico .i { width: 21px; height: 21px; }

  main.view { padding: 14px 14px calc(76px + env(safe-area-inset-bottom)); }

  /* Cabecera de vista en dos filas: título + acción, luego filtros */
  .view-head {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    align-items: center; gap: 10px; margin-bottom: 14px;
  }
  .view-head h2 { font-size: 17px; grid-area: 1 / 1; }
  .view-head > .badge, .view-head > .spacer, .view-head > .muted { display: none; }
  .head-actions { grid-area: 1 / 2; margin-left: 0; }
  .head-actions .btn { padding: 6px 10px; font-size: 12.5px; }
  .filters {
    grid-area: 2 / 1 / 3 / -1; flex: none;
    overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
  }
  .filters::-webkit-scrollbar { display: none; }
  .filters .search { flex: 1 0 58%; max-width: none; }
  .filters .input { flex: 0 0 auto; max-width: none; }
  /* Con filtro de personas: búsqueda + sprint en una fila y los avatares debajo, sin desplazamiento */
  .filters:has(.people-filter) { flex-wrap: wrap; overflow: visible; row-gap: 6px; }
  .filters:has(.people-filter) .search { flex: 1 1 150px; }
  .filters:has(.people-filter) select.input { flex: 0 1 auto; min-width: 0; max-width: 46%; }
  .people-filter { flex: 1 0 100%; flex-wrap: wrap; margin-left: -1px; }

  .board { scroll-snap-type: x mandatory; }
  .column { scroll-snap-align: start; }

  .panel { padding: 15px; border-radius: var(--r); }
  .settings .grid2, .settings .grid3 { grid-template-columns: minmax(0, 1fr); }
  .profile { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .swatch-picker { display: grid; grid-template-columns: repeat(5, 30px); justify-content: space-between; row-gap: 10px; max-width: 260px; }
  .panel-actions .btn { flex: 1 1 auto; }
  .settings .panel-actions .spacer { display: none; }

  .task-row { gap: 8px; }
  .task-row .status { display: none; }
  .task-row select.input { width: 112px; }

  .cal-hint { display: none; }
  .cal { border-radius: var(--r); }
  .cal .day { min-height: 74px; padding: 3px; }
  .cal .chip { font-size: 10px; padding: 1px 4px; border-left-width: 2px; }
  .cal .chip .avatars { display: none; }
  .cal .num { font-size: 11px; min-width: 19px; height: 19px; }

  .log-form-times { grid-template-columns: 1fr 1fr; }
  .log-form-times .field:first-child { grid-column: 1 / -1; }
  .tl.multi { --who: 40px; }
  .tl-who span { display: none; }
  .now-panel.idle { padding: 24px 14px; }
  .start-row .input { flex: 1 1 100%; max-width: none; }

  .ideas-list { grid-template-columns: minmax(0, 1fr); gap: 12px; }

  .col-editor { grid-template-columns: 34px minmax(0, 1fr) 58px auto auto; }

  /* Modales a pantalla completa, con pie siempre accesible */
  .modal-bg { padding: 0; align-items: flex-start; }
  .modal {
    border-radius: 0; border: 0; margin: 0;
    min-height: 100%; max-width: none;
    display: flex; flex-direction: column;
  }
  .modal-head { position: sticky; top: 0; background: var(--surface); z-index: 2; }
  .modal-body { flex: 1; }
  .modal-foot {
    position: sticky; bottom: 0; border-radius: 0; flex-wrap: wrap;
    padding-bottom: calc(13px + env(safe-area-inset-bottom));
  }

  #toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }
}

@media (max-width: 400px) {
  .nav a { font-size: 9px; }
  .nav .ico .i { width: 19px; height: 19px; }
  .head-actions .btn { padding: 6px 9px; }
}
