/* ═══════════════════════════════════════════════════
   Noramind Családi Dashboard · Famille — Design System
   Charte : Teal #26A69A + Ambre #FFCA28
   Mobile-first · Dark theme · <500ms
   ═══════════════════════════════════════════════════ */

/* ── Reset & Base ───────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Brand */
  --teal: #26A69A;
  --teal-dim: #1a7d75;
  --teal-glow: rgba(38, 166, 154, 0.25);
  --amber: #FFCA28;
  --amber-dim: #d4a820;
  --amber-glow: rgba(255, 202, 40, 0.2);

  /* Surfaces */
  --bg-deep: #0D1117;
  --bg-card: #161B22;
  --bg-card-hover: #1C2333;
  --bg-elevated: #21262D;

  /* Text */
  --text-primary: #E6EDF3;
  --text-secondary: #8B949E;
  --text-muted: #484F58;

  /* Borders & utils */
  --border: #30363D;
  --border-light: #21262D;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Timing */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --tt: 200ms;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ── App Layout ─────────────────────────────── */
.app {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px 32px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border-light);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo {
  color: var(--teal);
  font-size: 22px;
}

.brand-name {
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.brand-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--amber);
  background: var(--amber-glow);
  padding: 2px 8px;
  border-radius: 100px;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--teal);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--tt) var(--ease-out);
}

.btn-ghost:hover {
  background: var(--teal-glow);
  border-color: var(--teal);
}

.btn-label {
  display: none;
}

@media (min-width: 480px) {
  .btn-label {
    display: inline;
  }
}

/* ── Family Bar ─────────────────────────────── */
.family-bar {
  padding: 12px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.family-bar::-webkit-scrollbar {
  display: none;
}

.family-members {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}

.family-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 100px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all var(--tt) var(--ease-out);
  cursor: default;
}

.family-pill .pill-emoji {
  font-size: 15px;
}

.family-pill .pill-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 100px;
  background: var(--bg-elevated);
}

.family-pill.active-badge {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-glow);
}

.family-pill.active-badge .pill-badge {
  background: var(--teal);
  color: white;
  font-weight: 600;
}

/* ── Beta pill ──────────────────────────── */
.family-pill.beta-pill {
  border-color: rgba(255, 152, 0, 0.4);
  color: #FFB74D;
  background: rgba(255, 152, 0, 0.08);
}

.pill-badge.beta-badge {
  background: #FF9800;
  color: #1a1a1a;
  font-weight: 700;
  font-size: 10px;
}

/* ── Tab Navigation ─────────────────────────── */
.tab-nav {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 20px;
  border: 1px solid var(--border-light);
}

.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--tt) var(--ease-out);
  white-space: nowrap;
}

.tab:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.tab.active {
  background: var(--teal-glow);
  color: var(--teal);
}

.tab svg {
  flex-shrink: 0;
}

.tab span {
  display: none;
}

@media (min-width: 420px) {
  .tab span {
    display: inline;
  }
  .tab {
    padding: 10px 12px;
  }
}

/* ── Main Content ───────────────────────────── */
.main-content {
  flex: 1;
  animation: fadeIn 300ms var(--ease-out);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Section Headers ────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.section-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Stats Row ──────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

@media (min-width: 480px) {
  .stats-row {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-value.teal  { color: var(--teal); }
.stat-value.amber { color: var(--amber); }

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Progress Bar ───────────────────────────── */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 100px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 600ms var(--ease-out);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── Project Cards ──────────────────────────── */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  transition: all var(--tt) var(--ease-out);
  cursor: pointer;
}

.project-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border);
}

.project-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.project-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.project-lead {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 2px 8px;
  border-radius: 100px;
  white-space: nowrap;
}

.project-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.45;
}

.project-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.project-pct {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}

.project-tasks {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Agent View ──────────────────────────────── */
.agent-header {
  margin-bottom: 16px;
}

.agent-header .section-title {
  font-size: 17px;
  font-weight: 600;
}

.agent-header .section-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  display: block;
}

/* Agent hero card (active) */
.agent-hero {
  background: var(--bg-card);
  border: 1px solid var(--teal);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.agent-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--amber));
}

.agent-hero-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.agent-hero-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
  border: 2px solid var(--border);
}

.agent-hero-info {
  flex: 1;
}

.agent-hero-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.agent-hero-role {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.agent-hero-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--teal);
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--teal-glow);
}

.agent-hero-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}

.agent-hero-desc strong {
  color: var(--amber);
  font-weight: 600;
}

/* Agent grid (pending members) */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 520px) {
  .agent-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all var(--tt) var(--ease-out);
}

.agent-card:hover {
  border-color: var(--border);
  background: var(--bg-card-hover);
}

.agent-card-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 10px;
  background: var(--bg-elevated);
}

.agent-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.agent-card-role {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.3;
}

.agent-card-status {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--bg-elevated);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ── Beta card ──────────────────────────── */
.agent-card.beta-card {
  border-color: rgba(255, 152, 0, 0.25);
  background: rgba(255, 152, 0, 0.04);
}

.agent-card.beta-card:hover {
  border-color: rgba(255, 152, 0, 0.5);
  background: rgba(255, 152, 0, 0.1);
}

.agent-card-status.beta-status {
  background: rgba(255, 152, 0, 0.15);
  color: #FFB74D;
  font-weight: 600;
}

.agent-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
  line-height: 1.45;
  display: none;
}

@media (min-width: 520px) {
  .agent-card-desc {
    display: block;
  }
}

/* ── Quick Wins ─────────────────────────────── */
.qw-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.qw-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  transition: all var(--tt) var(--ease-out);
}

.qw-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--tt) var(--ease-out);
}

.qw-item.done .qw-check {
  background: var(--teal);
  border-color: var(--teal);
}

.qw-item.done .qw-check::after {
  content: '✓';
  font-size: 11px;
  font-weight: 700;
  color: white;
}

.qw-item.done .qw-text {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: var(--border);
}

.qw-text {
  font-size: 14px;
  color: var(--text-secondary);
  flex: 1;
}

.qw-progress {
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Projects View (detailed) ───────────────── */
.projects-view-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 640px) {
  .projects-view-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.project-status-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 100px;
}

.status-active {
  background: rgba(38, 166, 154, 0.15);
  color: var(--teal);
}

/* ── Loading ────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 14px;
  gap: 8px;
}

.loading::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Toast ──────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  animation: slideUp 300ms var(--ease-out);
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}

.toast.fadeout {
  animation: slideDown 200ms var(--ease-out) forwards;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(12px); }
}

/* ── Utility ────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
