/* ============================================================
   Dashboard de avance — estilos
   Tema claro, profesional, responsive (pensado para abrir en celular).
   ============================================================ */
:root {
  --bg:        #f4f6fb;
  --surface:   #ffffff;
  --ink:       #1a2233;
  --ink-soft:  #5b6577;
  --ink-faint: #97a0b3;
  --line:      #e7eaf2;

  --brand:     #4f46e5;   /* indigo */
  --brand-dk:  #3730a3;

  --blue:      #2563eb;   /* en proceso (desarrollo) */
  --amber:     #d97706;   /* pendiente del cliente */
  --green:     #16a34a;   /* listo */
  --grey:      #94a3b8;   /* pendiente */

  --shadow:    0 1px 2px rgba(16,24,40,.04), 0 6px 24px rgba(16,24,40,.06);
  --radius:    16px;
  --maxw:      1080px;

  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
/* El atributo hidden debe ganarle a .state/.dashboard que usan display:flex */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app { min-height: 100vh; }

/* ---------- estados (loading / error / etc) ---------- */
.state {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; gap: 12px; padding: 32px;
}
.state h1 { font-size: 1.4rem; margin: 4px 0 0; }
.state p  { color: var(--ink-soft); max-width: 460px; margin: 0; }
.state-icon { font-size: 2.6rem; }
.spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn {
  margin-top: 8px; border: 0; cursor: pointer;
  background: var(--brand); color: #fff;
  padding: 10px 18px; border-radius: 10px; font-size: .95rem; font-weight: 600;
}
.btn:hover { background: var(--brand-dk); }

/* ---------- layout dashboard ---------- */
.dashboard {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px 18px 48px;
  display: flex; flex-direction: column; gap: 20px;
}

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 2px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--brand); color: #fff; font-weight: 800; letter-spacing: .5px;
}
.brand-tag { color: var(--ink-soft); font-size: .92rem; font-weight: 600; }
.updated { color: var(--ink-faint); font-size: .8rem; }

/* ---------- hero ---------- */
.hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.hero-info h1 { margin: 0 0 10px; font-size: 1.7rem; }
.hero-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hero-dates { color: var(--ink-soft); font-size: .9rem; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  font-size: .82rem; font-weight: 700;
  background: #eef2ff; color: var(--brand-dk);
}
.badge.is-listo   { background: #e7f7ee; color: var(--green); }
.badge.is-proceso { background: #e7f0ff; color: var(--blue); }
.badge.is-pend    { background: #f1f5f9; color: var(--ink-soft); }

/* anillo de progreso */
.hero-progress { position: relative; width: 132px; height: 132px; flex: none; }
.ring { width: 132px; height: 132px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 12; }
.ring-fg {
  fill: none; stroke: var(--brand); stroke-width: 12; stroke-linecap: round;
  stroke-dasharray: 327; stroke-dashoffset: 327;
  transition: stroke-dashoffset 1s cubic-bezier(.2,.7,.2,1);
}
.ring-label {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ring-pct { font-size: 1.7rem; font-weight: 800; line-height: 1; }
.ring-cap { font-size: .72rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .5px; }

/* ---------- cards de resumen ---------- */
.cards {
  display: grid; gap: 16px;
  grid-template-columns: repeat(3, 1fr);
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.card h2 {
  margin: 0 0 14px; font-size: 1rem; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.card-client { background: #fffdf6; border-color: #f6e7c6; }

.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot-blue  { background: var(--blue); }
.dot-amber { background: var(--amber); }
.dot-grey  { background: var(--grey); }

.task-mini { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.task-mini li { display: flex; flex-direction: column; gap: 5px; }
.task-mini .t-title { font-size: .92rem; font-weight: 600; }
.task-mini .t-sub { font-size: .78rem; color: var(--ink-faint); display: flex; gap: 8px; flex-wrap: wrap; }
.task-mini .empty { color: var(--ink-faint); font-size: .88rem; font-style: italic; }

/* mini barra */
.mini-bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.mini-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--blue); }

/* ---------- timeline / lista de tareas ---------- */
.timeline {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}
.timeline-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 12px; flex-wrap: wrap;
}
.timeline-head h2 { margin: 0; font-size: 1.1rem; }
.legend { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: #f1f5f9; color: var(--ink-soft);
}
.chip-listo    { background: #e7f7ee; color: var(--green); }
.chip-proceso  { background: #e7f0ff; color: var(--blue); }
.chip-pendiente{ background: #f1f5f9; color: var(--ink-soft); }

/* filtros del detalle */
.task-search {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font-size: .9rem; color: var(--ink);
  background: var(--bg); min-width: 200px; outline: none;
}
.task-search:focus { border-color: var(--brand); background: #fff; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-group { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.fbtn {
  border: 0; background: transparent; cursor: pointer;
  padding: 5px 12px; border-radius: 8px; font-size: .82rem; font-weight: 600;
  color: var(--ink-soft);
}
.fbtn:hover { color: var(--ink); }
.fbtn.is-active { background: #fff; color: var(--brand-dk); box-shadow: var(--shadow); }
.task-empty { text-align: center; color: var(--ink-faint); font-style: italic; padding: 18px 0; }

.task-list { list-style: none; margin: 0; padding: 0; counter-reset: t; }
.task-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px; align-items: center;
  padding: 14px 6px;
  border-top: 1px solid var(--line);
}
.task-list .task-row:first-child { border-top: 0; }

.t-status-dot {
  width: 12px; height: 12px; border-radius: 50%; flex: none;
  box-shadow: 0 0 0 4px rgba(0,0,0,.02);
}
.s-listo   { background: var(--green); }
.s-proceso { background: var(--blue); }
.s-pend    { background: var(--grey); }

.t-main { min-width: 0; }
.t-main .t-name { font-weight: 600; font-size: .98rem; }
.t-main .t-name.is-done { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: var(--line); }
.t-main .t-info { margin-top: 5px; display: flex; gap: 10px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-faint); }
.t-owner { font-weight: 700; }
.t-owner.is-cliente { color: var(--amber); }
.t-owner.is-dev     { color: var(--blue); }
.t-comment { color: var(--ink-soft); font-style: italic; }
.t-late { color: #dc2626; font-weight: 700; }

.t-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; width: 120px; }
.t-pct { font-size: .82rem; font-weight: 700; color: var(--ink-soft); }
.t-bar { width: 100%; height: 7px; border-radius: 999px; background: var(--line); overflow: hidden; }
.t-bar > span { display: block; height: 100%; border-radius: 999px; transition: width 1s cubic-bezier(.2,.7,.2,1); }
.t-bar.is-listo   > span { background: var(--green); }
.t-bar.is-proceso > span { background: var(--blue); }
.t-bar.is-pend    > span { background: var(--grey); }

/* ---------- footer ---------- */
.foot { text-align: center; color: var(--ink-faint); font-size: .82rem; padding-top: 4px; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .cards { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .hero { flex-direction: column-reverse; align-items: flex-start; }
  .hero-info h1 { font-size: 1.4rem; }
  .task-row { grid-template-columns: auto 1fr; }
  .t-right { grid-column: 2; width: 100%; align-items: stretch; flex-direction: row; justify-content: space-between; }
  .t-right .t-bar { order: 2; flex: 1; align-self: center; }
  .t-right .t-pct { order: 1; }
}
