/* Subtle Ambient Animations (cards remain strictly fixed) */
@keyframes auroraFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes ambientOrbA {
  0%, 100% { transform: translate3d(0px, 0px, 0) scale(1); }
  50% { transform: translate3d(24px, -18px, 0) scale(1.06); }
}

@keyframes ambientOrbB {
  0%, 100% { transform: translate3d(0px, 0px, 0) scale(1); }
  50% { transform: translate3d(-22px, 16px, 0) scale(1.05); }
}

@keyframes cardReveal {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes shimmerSweep {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(240%); }
}

/* Auth view (Soft Green Materialized Split) */
.auth-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow: hidden;
  background: var(--auth-gradient);
  background-size: 200% 200%;
  animation: auroraFlow 22s ease infinite;
}

.floating-scene {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.float-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.45;
  will-change: transform;
}

.float-orb-1 {
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, var(--orb-1), transparent 70%);
  top: -90px;
  left: -80px;
  animation: ambientOrbA 18s ease-in-out infinite;
}

.float-orb-2 {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, var(--orb-2), transparent 70%);
  bottom: -110px;
  right: -90px;
  animation: ambientOrbB 20s ease-in-out infinite;
}

.float-orb-3 {
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, var(--orb-3), transparent 70%);
  top: 40%;
  left: 44%;
  animation: ambientOrbA 15s ease-in-out infinite reverse;
}

.auth-shell {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1020px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 2.25rem;
  align-items: center;
}

.auth-showcase {
  color: #f4faf6;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  padding: 0.5rem;
}

.auth-showcase-badge {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.85rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffffff;
}

.auth-showcase h1 {
  margin: 0;
  font-size: 2.15rem;
  font-weight: 800;
  line-height: 1.16;
  letter-spacing: -0.02em;
}

.auth-showcase p {
  margin: 0;
  color: #dff1e7;
  font-size: 0.96rem;
  font-weight: 500;
  max-width: 470px;
}

.showcase-float-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  margin-top: 0.35rem;
}

/* Fixed Materialized Showcase Cards (no floating movement) */
.showcase-mini-card {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.26);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  padding: 0.95rem 1rem;
  color: #ffffff;
  box-shadow: var(--elev-2);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.showcase-mini-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #dcf0e5;
}

.showcase-mini-val {
  font-size: 1.2rem;
  font-weight: 800;
  margin-top: 0.12rem;
}

.auth-card {
  width: 100%;
  max-width: 445px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(220, 233, 225, 0.9);
  border-radius: var(--radius-lg);
  box-shadow: var(--elev-4);
  padding: 1.75rem;
  animation: cardReveal 0.35s ease both;
}

.btn-glow {
  position: relative;
  overflow: hidden;
}

.btn-glow::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 45%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transform: translateX(-120%);
}

.btn-glow:hover::after {
  animation: shimmerSweep 0.85s ease;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  background: var(--bg-muted);
  padding: 0.32rem;
  border-radius: var(--radius-md);
  margin: 1rem 0 1.25rem;
}

.auth-tab {
  border: none;
  background: transparent;
  padding: 0.52rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s ease;
}

.auth-tab.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--elev-1);
}

/* Dashboard Materialized Stage & Hero (Fixed Cards) */
.dashboard-stage {
  position: relative;
  flex: 1;
  overflow: hidden;
}

.dash-ambient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.dash-ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(65px);
  opacity: 0.42;
}

.dash-ambient-orb-1 {
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, var(--orb-1), transparent 70%);
  top: -70px;
  right: 4%;
  animation: ambientOrbA 20s ease-in-out infinite;
}

.dash-ambient-orb-2 {
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, var(--orb-2), transparent 70%);
  bottom: 5%;
  left: -40px;
  animation: ambientOrbB 22s ease-in-out infinite;
}

.dashboard-content {
  position: relative;
  z-index: 1;
}

.dashboard-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.35rem;
  color: #ffffff;
  background: var(--hero-gradient);
  box-shadow: var(--elev-3);
}

.hero-float-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1.15rem;
}

/* Fixed Materialized Hero KPI Cards */
.hero-float-card {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  box-shadow: var(--elev-1);
  display: flex;
  align-items: center;
  gap: 0.78rem;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.hero-float-card:hover {
  background: rgba(255, 255, 255, 0.22);
  box-shadow: var(--elev-2);
}

.hero-float-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #e3f5eb;
}

.hero-float-value {
  font-size: 1.32rem;
  font-weight: 800;
  margin-top: 0.12rem;
  color: #ffffff;
}

/* Projects grid (Fixed Cards with Heavier Typography) */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(305px, 1fr));
  gap: 1.05rem;
}

.project-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.78rem;
  cursor: pointer;
  animation: cardReveal 0.3s ease both;
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--card-accent-gradient);
}

.project-card:hover {
  box-shadow: var(--elev-3);
  border-color: var(--primary);
}

.project-card-title {
  margin: 0 0 0.25rem;
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--text-primary);
}

.project-card-desc {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.progress-fill {
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.32), transparent);
  animation: shimmerSweep 3s ease-in-out infinite;
}

.project-code {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary-text);
}

.invite-banner {
  background: var(--invite-bg);
  border: 1px solid var(--invite-border);
  border-radius: var(--radius-md);
  box-shadow: var(--elev-1);
  padding: 0.95rem 1.05rem;
  margin-bottom: 1rem;
  font-weight: 500;
}

/* Project shell header & tabs */
.project-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--elev-1);
  padding: 0.95rem 1.25rem 0;
}

.project-header-top {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.project-kpis-inline {
  display: flex;
  gap: 1.15rem;
  flex-wrap: wrap;
  align-items: center;
}

.mini-kpi {
  display: flex;
  flex-direction: column;
}

.mini-kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.mini-kpi-value {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.project-tabs {
  max-width: 1400px;
  margin: 0.85rem auto 0;
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.project-tab {
  border: none;
  background: transparent;
  padding: 0.65rem 1rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.project-tab:hover {
  color: var(--primary);
}

.project-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Kanban Board */
.board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.board-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.board-filters input,
.board-filters select {
  width: auto;
  min-width: 155px;
  min-height: 36px;
  padding: 0.36rem 0.65rem;
  font-size: 0.83rem;
}

.status-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
  overflow-x: auto;
  padding-bottom: 2px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.36rem 0.78rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.81rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--elev-1);
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.status-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.status-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.status-chip-count {
  padding: 0.05rem 0.42rem;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 800;
}

.status-chip.active .status-chip-count {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.status-chip-danger.active {
  background: var(--danger);
  border-color: var(--danger);
}

.board-columns {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  min-height: 62vh;
  -webkit-overflow-scrolling: touch;
}

.board-col {
  flex: 0 0 320px;
  background: var(--board-col-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--elev-1);
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.68rem;
  max-height: 75vh;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.board-col.drag-over {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.board-col-header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.board-col-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.board-col-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}

.board-col-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.board-cards {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow-y: auto;
  padding-right: 2px;
  min-height: 40px;
}

.activity-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--info);
  border-radius: var(--radius-sm);
  padding: 0.78rem 0.82rem;
  box-shadow: var(--elev-1);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
  font-weight: 500;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.activity-card:hover {
  box-shadow: var(--elev-2);
  border-color: var(--primary);
}

.activity-card.dragging {
  opacity: 0.5;
}

.activity-card.prio-low { border-left-color: #64748b; }
.activity-card.prio-medium { border-left-color: #3b8ea5; }
.activity-card.prio-high { border-left-color: #c98a2c; }
.activity-card.prio-critical { border-left-color: #c84b4b; }

.activity-card-title {
  font-weight: 700;
  font-size: 0.93rem;
  color: var(--text-primary);
  line-height: 1.32;
}

.activity-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-weight: 600;
}

.avatar-stack {
  display: flex;
  align-items: center;
}

.avatar-stack .avatar {
  margin-left: -6px;
  border: 2px solid var(--bg-surface);
}

.avatar-stack .avatar:first-child {
  margin-left: 0;
}

.quick-move-bar {
  display: flex;
  justify-content: flex-end;
  gap: 0.25rem;
  border-top: 1px dashed var(--border-color);
  padding-top: 0.35rem;
}

/* Modal tabs */
.modal-tabs {
  display: flex;
  gap: 0.35rem;
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.25rem;
  background: var(--bg-subtle);
  overflow-x: auto;
}

.modal-tab {
  border: none;
  background: transparent;
  padding: 0.65rem 0.85rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.modal-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Gantt Chart */
.gantt-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--elev-2);
  overflow-x: auto;
}

.gantt-table {
  min-width: 760px;
}

.gantt-header {
  display: grid;
  grid-template-columns: 240px 1fr;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.gantt-header-label {
  padding: 0.65rem 0.8rem;
  border-right: 1px solid var(--border-color);
}

.gantt-header-dates {
  display: flex;
  justify-content: space-between;
  padding: 0.65rem 0.8rem;
}

.gantt-row {
  display: grid;
  grid-template-columns: 240px 1fr;
  border-bottom: 1px solid var(--border-color);
  align-items: center;
}

.gantt-row:last-child {
  border-bottom: none;
}

.gantt-task-cell {
  padding: 0.58rem 0.8rem;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  cursor: pointer;
  background: var(--bg-surface);
}

.gantt-task-cell:hover {
  background: var(--bg-subtle);
}

.gantt-track {
  position: relative;
  height: 42px;
  background-image: linear-gradient(to right, rgba(190, 212, 198, 0.45) 1px, transparent 1px);
  background-size: 10% 100%;
}

.gantt-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--danger);
  opacity: 0.75;
  z-index: 2;
}

.gantt-bar {
  position: absolute;
  top: 10px;
  height: 22px;
  border-radius: 6px;
  background: var(--gantt-bar-bg);
  border: 1px solid var(--gantt-bar-border);
  overflow: hidden;
  cursor: pointer;
  z-index: 3;
  display: flex;
  align-items: center;
}

.gantt-bar.overdue {
  background: #fadcdc;
  border-color: #df7777;
}

.gantt-bar-fill {
  height: 100%;
  background: var(--primary);
  opacity: 0.88;
}

.gantt-bar.overdue .gantt-bar-fill {
  background: var(--danger);
}

.gantt-bar-text {
  position: relative;
  z-index: 2;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-primary);
  padding: 0 6px;
  white-space: nowrap;
}

.gantt-milestone {
  position: absolute;
  top: 13px;
  width: 16px;
  height: 16px;
  transform: translateX(-50%) rotate(45deg);
  background: var(--warning);
  border: 2px solid #ffffff;
  box-shadow: var(--elev-1);
  z-index: 4;
  cursor: pointer;
}

/* Analytics (Fixed Materialized KPI Cards with Heavier Text) */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--elev-2);
  padding: 0.95rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  font-weight: 500;
}

.kpi-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.kpi-value {
  font-size: 1.48rem;
  font-weight: 800;
  color: var(--text-primary);
}

.kpi-sub {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Team & Roles */
.team-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 1024px) {
  .team-grid {
    grid-template-columns: 1.05fr 1fr;
  }
}

.perm-group {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
  margin-bottom: 0.65rem;
  background: var(--bg-subtle);
}

.perm-group-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 0.45rem;
}

.perm-check {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}

.perm-check input {
  width: auto;
  margin-top: 2px;
}

.assignee-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.assignee-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.62rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.assignee-chip.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-text);
  font-weight: 700;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .hero-float-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 880px) {
  .auth-shell {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .auth-showcase {
    text-align: center;
    align-items: center;
  }
  .auth-showcase-badge {
    align-self: center;
  }
  .auth-showcase h1 {
    font-size: 1.6rem;
  }
  .showcase-float-stack {
    display: none;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0.85rem;
  }
  .dashboard-hero {
    padding: 1.1rem;
  }
  .projects-grid {
    grid-template-columns: 1fr;
  }
  .project-header {
    padding: 0.8rem 0.85rem 0;
  }
  .project-kpis-inline {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }
  .board-filters {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .board-filters input#flt-search {
    grid-column: 1 / -1;
    width: 100%;
  }
  .board-filters select {
    width: 100%;
    min-width: 0;
  }
  .board-columns {
    scroll-snap-type: x mandatory;
  }
  .board-col {
    flex: 0 0 84vw;
    scroll-snap-align: start;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .gantt-task-cell {
    position: sticky;
    left: 0;
    z-index: 5;
  }
}

@media (max-width: 390px) {
  .hero-float-grid,
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

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