/* ============================================================
   HUPA · Operación — Dashboard
   Stylesheet v1 · paleta v2 dark/cyan · Satoshi
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Color — Primarios HUPA */
  --hupa-black: #0B0E1A;
  --hupa-cyan: #2DE4C5;
  --hupa-cyan-hover: #1FCFB0;
  --hupa-white: #FFFFFF;
  --hupa-fog: #9CA3AF;

  /* Secundarios */
  --hupa-magenta: #FF3DA5;
  --hupa-yellow: #FFD23F;
  --hupa-green: #34D399;
  --hupa-red: #F87171;

  /* Surfaces dark */
  --bg: #0B0E1A;
  --surface-1: #11151F;
  --surface-2: #1F2433;
  --surface-3: #262E40;
  --border: #2A3142;
  --border-strong: #3B4358;
  --text: #FFFFFF;
  --text-muted: #9CA3AF;
  --text-dim: #6B7280;

  /* Avatars */
  --color-manuel: #2DE4C5;
  --color-stephanie: #FF3DA5;
  --color-emilis: #FFD23F;

  /* Spacing */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;

  /* Radii */
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-pill: 999px;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lift: 0 12px 40px rgba(0,0,0,0.6);
  --glow-cyan: 0 0 24px rgba(45,228,197,0.35);

  /* Transitions */
  --t-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h: 72px;
}

/* Light theme */
[data-theme="light"] {
  --bg: #F7F8FA;
  --surface-1: #FFFFFF;
  --surface-2: #F1F3F7;
  --surface-3: #E5E8EF;
  --border: #E5E8EF;
  --border-strong: #D1D5DB;
  --text: #0B0E1A;
  --text-muted: #4B5563;
  --text-dim: #9CA3AF;
}

/* ---------- Reset & base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Satoshi', 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  transition: background var(--t-base), color var(--t-base);
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--hupa-cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: var(--r-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ---------- Layout ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  width: 100vw;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: var(--sp-4);
  overflow-y: auto;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) var(--sp-2) var(--sp-5);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.brand__mark {
  position: relative;
  font-family: 'Satoshi', sans-serif;
  font-weight: 900;
  font-size: 28px;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.04em;
  padding-right: 4px;
}
.brand__dot {
  position: absolute;
  top: 4px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hupa-cyan);
  box-shadow: var(--glow-cyan);
}
.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand__name {
  font-weight: 900;
  font-size: 16px;
  letter-spacing: -0.02em;
}
.brand__sub {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--text-muted);
}
.sidebar__close {
  display: none;
  font-size: 18px;
  color: var(--text-muted);
}

.sidebar__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  text-transform: uppercase;
  padding: var(--sp-4) var(--sp-2) var(--sp-2);
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
  transition: background var(--t-fast), color var(--t-fast);
  text-align: left;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.is-active { background: var(--surface-2); color: var(--text); border-left: 3px solid var(--hupa-cyan); padding-left: 9px; }
.nav-item__icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
  color: var(--hupa-cyan);
}

/* Person items con mini-progress integrado */
.person-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
  transition: background var(--t-fast), color var(--t-fast);
  text-align: left;
}
.person-item:hover { background: var(--surface-2); color: var(--text); }
.person-item.is-active { background: var(--surface-2); color: var(--text); }
.person-item__row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
}
.person-item__name { flex: 1; }
.person-item__count {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  min-width: 24px;
  text-align: center;
}
.person-item.is-active .person-item__count {
  background: var(--hupa-cyan);
  color: var(--hupa-black);
}

.person-progress {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding-left: 38px; /* alinea con el avatar de arriba */
}
.person-progress__track {
  flex: 1;
  height: 4px;
  background: var(--surface-2);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.person-item.is-active .person-progress__track {
  background: var(--surface-3);
}
.person-progress__fill {
  height: 100%;
  width: 0%;
  background: var(--hupa-cyan);
  border-radius: var(--r-pill);
  transition: width var(--t-base) ease-out;
}
.person-progress__pct {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  min-width: 30px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.person-item.is-active .person-progress__pct {
  color: var(--text);
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 12px;
  color: var(--hupa-black);
  flex-shrink: 0;
}
.avatar--all { background: linear-gradient(135deg, var(--hupa-cyan), var(--hupa-magenta)); color: var(--hupa-black); }
.avatar--manuel { background: var(--color-manuel); }
.avatar--stephanie { background: var(--color-stephanie); color: white; }
.avatar--emilis { background: var(--color-emilis); }

.sidebar__footer {
  margin-top: auto;
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.footer-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: var(--t-fast);
}
.footer-btn:hover { background: var(--surface-2); color: var(--text); }
.footer-btn--logout { color: var(--hupa-red); display: none; }
.footer-btn--logout:hover { background: rgba(248,113,113,0.1); color: var(--hupa-red); }
.mode-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  margin-bottom: var(--sp-2);
  background: var(--surface-2);
  color: var(--text-muted);
  text-align: center;
}
.mode-badge[data-mode="remote"] {
  background: rgba(45,228,197,0.1);
  color: var(--hupa-cyan);
}
.mode-badge[data-mode="remote"] ~ .footer-btn--logout { display: flex; }

/* ---------- Main ---------- */
.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* ---------- Topbar ---------- */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 0 var(--sp-6);
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
  flex-shrink: 0;
}
.topbar__menu {
  display: none;
  font-size: 22px;
  color: var(--text);
}
.topbar__title { flex: 1; min-width: 0; }
.topbar__title h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.topbar__subtitle {
  font-size: 13px;
  color: var(--text-muted);
}
.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search__icon {
  position: absolute;
  left: 12px;
  color: var(--text-dim);
  pointer-events: none;
  font-size: 14px;
}
.search input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 14px 8px 34px;
  width: 240px;
  font-size: 13px;
  color: var(--text);
  transition: var(--t-fast);
  outline: none;
}
.search input::placeholder { color: var(--text-dim); }
.search input:focus { border-color: var(--hupa-cyan); box-shadow: 0 0 0 3px rgba(45,228,197,0.15); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-weight: 700;
  font-size: 13px;
  transition: var(--t-fast);
  white-space: nowrap;
}
.btn--primary {
  background: var(--hupa-cyan);
  color: var(--hupa-black);
}
.btn--primary:hover {
  background: var(--hupa-cyan-hover);
  box-shadow: var(--glow-cyan);
  transform: translateY(-1px);
}
.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn--ghost:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.btn--danger {
  background: transparent;
  color: var(--hupa-red);
  border: 1px solid var(--hupa-red);
}
.btn--danger:hover { background: rgba(248,113,113,0.1); }

/* ---------- Views ---------- */
.view {
  display: none;
  flex: 1;
  padding: var(--sp-5) var(--sp-6);
  overflow-y: auto;
}
.view.is-active { display: block; }

/* ---------- Home ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.stat-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  transition: var(--t-base);
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--surface-3);
}
.stat-card--accent::after { background: var(--hupa-cyan); }
.stat-card--warn::after { background: var(--hupa-yellow); }
.stat-card--ok::after { background: var(--hupa-green); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.stat-card__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}
.stat-card__value {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text);
}
.stat-card__trend {
  font-size: 12px;
  color: var(--text-dim);
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}
.panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.panel--full { grid-column: 1 / -1; }
.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.panel__head h2 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.panel__pill {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: var(--r-pill);
}
.panel__pill--warn { color: var(--hupa-yellow); background: rgba(255,210,63,0.1); }
.panel__body {
  padding: var(--sp-3);
  max-height: 420px;
  overflow-y: auto;
}
.empty {
  padding: var(--sp-6);
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

.upcoming-item, .urgent-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: var(--t-fast);
}
.upcoming-item:hover, .urgent-item:hover { background: var(--surface-2); }
.upcoming-item__date {
  width: 50px;
  text-align: center;
  flex-shrink: 0;
}
.upcoming-item__day {
  font-size: 18px;
  font-weight: 900;
  color: var(--hupa-cyan);
  line-height: 1;
}
.upcoming-item__month {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}
.upcoming-item__body { flex: 1; min-width: 0; }
.upcoming-item__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upcoming-item__meta {
  font-size: 11px;
  color: var(--text-muted);
}

.team-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
}
.team-bar__name {
  width: 90px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.team-bar__track {
  flex: 1;
  height: 8px;
  background: var(--surface-2);
  border-radius: var(--r-pill);
  overflow: hidden;
  position: relative;
}
.team-bar__fill {
  height: 100%;
  border-radius: var(--r-pill);
  transition: width var(--t-base);
}
.team-bar__stats {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 80px;
  text-align: right;
}

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.chips {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.chip {
  padding: 6px 14px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  transition: var(--t-fast);
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.is-active {
  background: var(--hupa-cyan);
  color: var(--hupa-black);
  border-color: var(--hupa-cyan);
}

/* ---------- Kanban ---------- */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  gap: var(--sp-4);
  min-height: calc(100vh - var(--topbar-h) - 200px);
}
.kanban-col {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 200px;
}
.kanban-col.is-dragover {
  border-color: var(--hupa-cyan);
  box-shadow: var(--glow-cyan);
}
.kanban-col__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.kanban-col__title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 13px;
  font-weight: 700;
}
.kanban-col__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.kanban-col[data-status="todo"] .kanban-col__dot { background: var(--text-muted); }
.kanban-col[data-status="doing"] .kanban-col__dot { background: var(--hupa-cyan); }
.kanban-col[data-status="waiting"] .kanban-col__dot { background: var(--hupa-yellow); }
.kanban-col[data-status="done"] .kanban-col__dot { background: var(--hupa-green); }
.kanban-col__count {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: var(--r-pill);
}
.kanban-col__body {
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  flex: 1;
  overflow-y: auto;
}

.task-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  cursor: grab;
  transition: var(--t-fast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.task-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}
.task-card.is-dragging { opacity: 0.4; cursor: grabbing; }
.task-card__head {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
}
.task-card__priority {
  width: 4px;
  align-self: stretch;
  border-radius: 2px;
  flex-shrink: 0;
}
.task-card__priority--alta { background: var(--hupa-magenta); }
.task-card__priority--media { background: var(--hupa-cyan); }
.task-card__priority--baja { background: var(--text-dim); }
.task-card__title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}
.task-card.is-done .task-card__title {
  text-decoration: line-through;
  color: var(--text-muted);
}
.task-card__meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 11px;
  color: var(--text-muted);
}
.task-card__tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--hupa-cyan);
  background: rgba(45,228,197,0.1);
  padding: 2px 8px;
  border-radius: var(--r-pill);
}
.task-card__date { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Calendar ---------- */
.cal-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.cal-header h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  min-width: 200px;
  text-align: center;
  text-transform: capitalize;
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  margin-bottom: var(--sp-2);
}
.cal-weekdays span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: var(--sp-2);
  text-align: center;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(110px, auto);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.cal-cell {
  background: var(--surface-1);
  padding: var(--sp-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 110px;
  overflow: hidden;
}
.cal-cell--other { background: var(--bg); opacity: 0.4; }
.cal-cell--today { background: var(--surface-2); }
.cal-cell--today .cal-cell__num {
  background: var(--hupa-cyan);
  color: var(--hupa-black);
  border-radius: var(--r-pill);
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cal-cell__num {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  align-self: flex-end;
}
.cal-cell--other .cal-cell__num { color: var(--text-dim); }
.cal-event {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  border-left: 3px solid;
  background: var(--surface-2);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: var(--t-fast);
}
.cal-event:hover { background: var(--surface-3); }
.cal-event--manuel { border-color: var(--color-manuel); }
.cal-event--stephanie { border-color: var(--color-stephanie); }
.cal-event--emilis { border-color: var(--color-emilis); }
.cal-event__more {
  font-size: 10px;
  color: var(--text-muted);
  padding: 2px 6px;
  font-weight: 700;
}

/* ---------- Lista ---------- */
.table-wrap {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead {
  background: var(--surface-2);
}
.table th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.table td {
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border);
}
.table tbody tr {
  cursor: pointer;
  transition: var(--t-fast);
}
.table tbody tr:hover { background: var(--surface-2); }
.table tr.is-done td:first-child { text-decoration: line-through; color: var(--text-muted); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--r-pill);
}
.badge--todo { background: var(--surface-3); color: var(--text-muted); }
.badge--doing { background: rgba(45,228,197,0.15); color: var(--hupa-cyan); }
.badge--waiting { background: rgba(255,210,63,0.15); color: var(--hupa-yellow); }
.badge--done { background: rgba(52,211,153,0.15); color: var(--hupa-green); }

.badge--alta { background: rgba(255,61,165,0.15); color: var(--hupa-magenta); }
.badge--media { background: rgba(45,228,197,0.12); color: var(--hupa-cyan); }
.badge--baja { background: var(--surface-3); color: var(--text-muted); }

.assign-cell {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 600;
}
.assign-cell .avatar {
  width: 22px;
  height: 22px;
  font-size: 10px;
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal.is-open { display: flex; }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 200ms;
}
.modal__panel {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  box-shadow: var(--shadow-lift);
  animation: slideUp 250ms cubic-bezier(0.4,0,0.2,1);
}
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.modal__head h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.modal__close {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.modal__close:hover { background: var(--surface-2); color: var(--text); }

.form {
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.field input, .field select, .field textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: var(--t-fast);
  font-family: inherit;
  resize: vertical;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--hupa-cyan);
  box-shadow: 0 0 0 3px rgba(45,228,197,0.15);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}
.modal__foot {
  display: flex;
  gap: var(--sp-2);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
  margin-top: var(--sp-2);
  align-items: center;
}
.spacer { flex: 1; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: var(--sp-5);
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lift);
  z-index: 2000;
  transition: transform var(--t-base);
  pointer-events: none;
}
.toast.is-show {
  transform: translateX(-50%) translateY(0);
}
.toast--ok { border-color: var(--hupa-green); color: var(--hupa-green); }
.toast--warn { border-color: var(--hupa-yellow); color: var(--hupa-yellow); }

/* ---------- Sync badge (topbar) ---------- */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  user-select: none;
}
.sync-badge__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
  transition: background var(--t-fast);
}
.sync-badge[data-status="ok"] .sync-badge__dot {
  box-shadow: 0 0 0 0 rgba(52,211,153,0.7);
  animation: pulse-ok 2s infinite;
}
.sync-badge[data-status="syncing"] .sync-badge__dot {
  animation: spin-ring 1.2s linear infinite;
}
@keyframes pulse-ok {
  0%   { box-shadow: 0 0 0 0 rgba(52,211,153,0.5); }
  70%  { box-shadow: 0 0 0 6px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}
@keyframes spin-ring {
  0%, 100% { transform: scale(0.85); }
  50%      { transform: scale(1.15); }
}

/* ---------- Login Gate ---------- */
.login-gate {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at top, #1F2433 0%, #0B0E1A 60%);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}
.login-gate.is-open { display: flex; animation: fadeIn 300ms; }
.login-gate__card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  width: min(420px, 100%);
  box-shadow: var(--shadow-lift);
  position: relative;
  overflow: hidden;
}
.login-gate__card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--hupa-cyan), var(--hupa-magenta));
}
.login-gate__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.login-gate__brand h1 {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.login-gate__brand p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
.login-form__submit {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 14px;
  margin-top: var(--sp-2);
}
.login-form__error {
  font-size: 12px;
  color: var(--hupa-red);
  background: rgba(248,113,113,0.1);
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-weight: 600;
}
.login-form__hint {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
  text-align: center;
  margin-top: var(--sp-2);
}

/* ---------- Animations ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .home-grid { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform var(--t-base);
  }
  .sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow-lift); }
  .sidebar__close { display: inline-block; }
  .topbar { padding: 0 var(--sp-4); gap: var(--sp-2); }
  .topbar__menu { display: inline-block; }
  .topbar__subtitle { display: none; }
  .search input { width: 140px; }
  .sync-badge__label { display: none; }
  .sync-badge { padding: 6px 8px; }
  .view { padding: var(--sp-4); }
  .stats { grid-template-columns: 1fr 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .cal-grid { grid-auto-rows: minmax(70px, auto); font-size: 11px; }
  .cal-event { font-size: 10px; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr; }
  .cal-header h2 { min-width: 0; font-size: 15px; }
}
