/* ============================================================
   BPA · Project Management — Static mockups v2 (Deploy #3)
   Author: Fractal (continuación de A3 Web Architect)
   Pure CSS vanilla, mobile-first, no external dependencies.
   Corporate palette extracted from BPA logo via pixel sampling.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* Corporate palette (from BPA logo) */
  --bpa-mint:       #94BEA4;
  --bpa-mint-dark:  #60806F;
  --bpa-mint-light: #C7D0BA;
  --bpa-mint-tint:  #E0EBE3;
  --bpa-cream:      #F4E2C0;
  --bpa-cream-soft: #F8EED4;
  --bpa-off-white:  #F1ECE3;
  --bpa-paper:      #FBF8F1;
  --bpa-burgundy:   #762444;
  --bpa-burgundy-dark: #5A1B34;
  --bpa-burgundy-soft: #F2E0E6;
  --bpa-charcoal:   #21140F;
  --bpa-charcoal-soft: #4A3C32;

  /* Year palette — Andrés's color code, KEEP AS IS */
  --year-2020: #FFFF00;
  --year-2021: #C0C0C0;
  --year-2022: #92D050;
  --year-2023: #00D0D2;
  --year-2024: #F79646;
  --year-2025: #A99AC8;
  --year-2026: #E6B8B7;
  --year-2027: #DDDDDD;

  /* Phase palette (derived from corporate palette) */
  --phase-design-hot:    #4F8C73;  /* mint deeper, urgent */
  --phase-design:        #94BEA4;  /* mint principal */
  --phase-const-hot:     #762444;  /* burgundy strong */
  --phase-const-follow:  #A05870;  /* burgundy soft */
  --phase-standby:       #8A8378;  /* warm gray */
  --phase-closed:        #3E342C;  /* dark warm */

  /* Entity palette (within corporate tones) */
  --entity-bpa:  #60806F;   /* mint-dark */
  --entity-bpai: #B89456;   /* warm gold inside cream family */
  --entity-wsdg: #762444;   /* burgundy */

  /* Neutrals (warm, paper feel) */
  --bg:           #F8F4EA;
  --surface:      #FFFFFF;
  --surface-alt:  #FBF8F1;
  --border:       #DDD3C2;
  --border-soft:  #ECE5D5;
  --text:         var(--bpa-charcoal);
  --text-muted:   #5B5045;
  --text-faint:   #8C7F71;
  --accent:       var(--bpa-burgundy);
  --accent-hover: var(--bpa-burgundy-dark);
  --accent-soft:  var(--bpa-burgundy-soft);
  --link:         var(--bpa-mint-dark);
  --danger:       #B23A48;
  --warning:      #C97A1B;
  --success:      var(--bpa-mint-dark);

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --fs-xs: 0.72rem;
  --fs-sm: 0.82rem;
  --fs-md: 0.94rem;
  --fs-lg: 1.10rem;
  --fs-xl: 1.35rem;
  --fs-xxl: 1.70rem;

  /* Spacing */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;

  /* Shape */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(33, 20, 15, 0.06);
  --shadow-md: 0 2px 6px rgba(33, 20, 15, 0.08);
  --shadow-lg: 0 6px 18px rgba(33, 20, 15, 0.10);

  --tap: 44px;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--bpa-mint-dark); }

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

h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--bpa-charcoal); }
h1 { font-size: var(--fs-xxl); letter-spacing: -0.01em; }
h2 { font-size: var(--fs-xl); letter-spacing: -0.005em; }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }

/* ---------- Top app bar ---------- */
.appbar {
  background: var(--surface);
  border-bottom: 2px solid var(--bpa-mint);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.appbar__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.appbar__logo {
  height: 48px;
  width: auto;
  display: block;
}
.appbar__brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.appbar__brand-text strong {
  font-size: var(--fs-lg);
  color: var(--bpa-burgundy);
  letter-spacing: 0.01em;
  line-height: 1;
}
.appbar__brand-text span {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.appbar__date {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}
.appbar__meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.appbar__version {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--bpa-charcoal);
  color: var(--bpa-cream);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 4px;
  text-decoration: none;
}
.appbar__version:hover {
  background: var(--bpa-burgundy);
  text-decoration: none;
}
@media (max-width: 480px) {
  .appbar__date { display: none; }
}
.appbar__nav { display: none; gap: var(--sp-1); }
.appbar__nav a {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
}
.appbar__nav a:hover { background: var(--bpa-mint-tint); text-decoration: none; color: var(--bpa-charcoal); }
.appbar__nav a.is-active { background: var(--bpa-mint); color: var(--bpa-charcoal); }
.appbar__home {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0 !important;
  margin-right: var(--sp-2);
  border-radius: var(--radius-sm);
  background: var(--bpa-mint-tint);
  color: var(--bpa-mint-dark) !important;
}
.appbar__home:hover {
  background: var(--bpa-mint) !important;
  color: var(--bpa-charcoal) !important;
}

@media (min-width: 768px) {
  .appbar { padding: var(--sp-3) var(--sp-5); }
  .appbar__nav { display: flex; }
}
@media (max-width: 480px) {
  .appbar__brand-text { display: none; }
  .appbar__logo { height: 36px; }
}

/* ---------- Layout ---------- */
.shell {
  padding: var(--sp-4);
  max-width: 1440px;
  margin: 0 auto;
}
@media (min-width: 1024px) {
  .shell { padding: var(--sp-5) var(--sp-6); }
}

.page-header {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}
.page-header__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.page-header p { color: var(--text-muted); margin: 0; font-size: var(--fs-sm); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  padding: 0 var(--sp-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn:hover { background: var(--surface-alt); }
.btn--primary {
  background: var(--bpa-burgundy);
  color: #fff;
  border-color: var(--bpa-burgundy);
}
.btn--primary:hover { background: var(--bpa-burgundy-dark); border-color: var(--bpa-burgundy-dark); }
.btn--secondary {
  background: var(--bpa-mint);
  color: var(--bpa-charcoal);
  border-color: var(--bpa-mint-dark);
}
.btn--secondary:hover { background: var(--bpa-mint-dark); color: #fff; }
.btn--ghost {
  background: transparent;
  border-color: var(--bpa-mint-dark);
  color: var(--bpa-mint-dark);
}
.btn--ghost:hover { background: var(--bpa-mint-tint); }
.btn--sm { min-height: 32px; padding: 0 var(--sp-3); font-size: var(--fs-xs); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
}
.card__title {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: var(--sp-2);
}

/* ---------- KPI grid ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
@media (min-width: 640px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }

/* 3-column variant for breakdown row */
.kpi-grid--three { grid-template-columns: 1fr; }
@media (min-width: 768px) {
  .kpi-grid--three { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .kpi-grid--three { grid-template-columns: repeat(3, 1fr); }
}

/* Pie chart */
.pie-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.pie {
  width: 180px;
  height: 180px;
  flex: 0 0 auto;
}
.pie-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  min-width: 0;
}
.pie-legend li {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  white-space: nowrap;
}
.pie-legend b {
  color: var(--bpa-charcoal);
  font-weight: 700;
  margin-left: var(--sp-1);
}
.pie-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid rgba(33,20,15,0.15);
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  box-shadow: var(--shadow-sm);
}
.kpi__label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.kpi__value {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
  color: var(--bpa-charcoal);
}
.kpi__hint { font-size: var(--fs-xs); color: var(--text-faint); }
.kpi--accent { border-left: 4px solid var(--bpa-burgundy); }
.kpi--mint { border-left: 4px solid var(--bpa-mint-dark); }

/* Phase breakdown bar */
.phase-bars { display: grid; grid-template-columns: 1fr; gap: var(--sp-2); }
.phase-bar {
  display: grid;
  grid-template-columns: minmax(0, 18ch) 1fr auto;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
}
.phase-bar__label { color: var(--text-muted); font-weight: 500; }
.phase-bar__track {
  height: 10px;
  background: var(--bpa-mint-tint);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
}
.phase-bar__fill { height: 100%; border-radius: 999px; }
.phase-bar__value { font-weight: 700; min-width: 3ch; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- PM / Entity tags ---------- */
.tag-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-2);
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  background: var(--surface-alt);
  border: 1px solid var(--border-soft);
  color: var(--text);
  line-height: 1.2;
}
.tag b { font-weight: 700; }
.tag--pm {
  background: var(--bpa-mint-tint);
  color: var(--bpa-mint-dark);
  border-color: var(--bpa-mint);
}
.tag--pm-inactive {
  background: #ECEAE6;
  color: var(--text-faint);
  border-color: var(--border);
  text-decoration: line-through;
}
.tag--entity-bpa  { background: var(--bpa-mint-tint); color: var(--bpa-mint-dark); border-color: var(--bpa-mint); }
.tag--entity-bpai { background: var(--bpa-cream-soft); color: #7E6020; border-color: var(--bpa-cream); }
.tag--entity-wsdg { background: var(--bpa-burgundy-soft); color: var(--bpa-burgundy); border-color: #E0BFC9; }

/* ---------- Year code chip ---------- */
.code-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-sm);
  color: var(--bpa-charcoal);
  letter-spacing: 0.02em;
  border: 1px solid rgba(33, 20, 15, 0.12);
  white-space: nowrap;
}
.code-chip.y-2020 { background: var(--year-2020); }
.code-chip.y-2021 { background: var(--year-2021); }
.code-chip.y-2022 { background: var(--year-2022); }
.code-chip.y-2023 { background: var(--year-2023); }
.code-chip.y-2024 { background: var(--year-2024); }
.code-chip.y-2025 { background: var(--year-2025); }
.code-chip.y-2026 { background: var(--year-2026); }
.code-chip.y-2027 { background: var(--year-2027); }

/* ---------- Phase badge ---------- */
.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-2);
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}
.phase-badge--design-hot    { background: var(--phase-design-hot); }
.phase-badge--design        { background: var(--phase-design); color: var(--bpa-charcoal); }
.phase-badge--const-hot     { background: var(--phase-const-hot); }
.phase-badge--const-follow  { background: var(--phase-const-follow); }
.phase-badge--standby       { background: var(--phase-standby); }
.phase-badge--closed        { background: var(--phase-closed); }

/* ---------- Progress bar ---------- */
.progress {
  position: relative;
  height: 8px;
  background: var(--bpa-mint-tint);
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--bpa-mint-dark), var(--bpa-mint));
  border-radius: 999px;
}
.progress--lg { height: 12px; }

/* ---------- Year selector tabs ---------- */
.year-tabs {
  display: flex;
  gap: var(--sp-1);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}
.year-tab {
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
}
.year-tab.is-active {
  background: var(--bpa-burgundy);
  color: #fff;
  border-color: var(--bpa-burgundy);
}

/* ---------- Attention list ---------- */
.attention-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3);
}
@media (min-width: 768px) { .attention-list { grid-template-columns: repeat(2, 1fr); } }

.attention-item {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3);
  background: var(--bpa-cream-soft);
  border: 1px solid var(--bpa-cream);
  border-left: 4px solid var(--bpa-burgundy);
  border-radius: var(--radius-md);
}
.attention-item__head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.attention-item__name { font-weight: 600; }
.attention-item__remark {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: 1.4;
}
.attention-item__meta {
  display: flex;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--text-faint);
}

/* ---------- Filter bar ---------- */
.filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-4);
  position: sticky;
  top: 76px;
  z-index: 30;
  box-shadow: var(--shadow-sm);
}
.filterbar select,
.filterbar input[type="search"] {
  min-height: var(--tap);
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--fs-sm);
}
.filterbar input[type="search"] { flex: 1 1 200px; min-width: 180px; }
.filterbar__group {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.filterbar__label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}

/* Chip filters */
.chip-row { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 4px var(--sp-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}
.chip.is-active {
  background: var(--bpa-mint);
  color: var(--bpa-charcoal);
  border-color: var(--bpa-mint-dark);
}
.chip__count {
  font-weight: 700;
  background: rgba(33, 20, 15, 0.08);
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10px;
}

/* ---------- View tabs ---------- */
.view-tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  width: fit-content;
  margin-bottom: var(--sp-3);
}
.view-tabs button {
  border: none;
  background: var(--surface);
  padding: var(--sp-2) var(--sp-4);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
}
.view-tabs button:last-child { border-right: none; }
.view-tabs button.is-active { background: var(--bpa-burgundy); color: #fff; }
.view-tabs button.is-disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- Phase sections (projects list grouped by phase) ---------- */
.phase-section {
  margin-bottom: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.phase-section > summary {
  list-style: none;
  cursor: pointer;
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: linear-gradient(to right, var(--bpa-cream-soft), var(--surface));
  border-bottom: 1px solid var(--border-soft);
  font-weight: 700;
  user-select: none;
}
.phase-section > summary::-webkit-details-marker { display: none; }
.phase-section > summary::after {
  content: "−";
  font-size: 1.4rem;
  color: var(--text-muted);
  margin-left: auto;
}
.phase-section:not([open]) > summary::after { content: "+"; }
.phase-section__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bpa-burgundy);
  color: #fff;
  font-weight: 700;
  font-size: var(--fs-sm);
}
.phase-section__name { font-size: var(--fs-lg); color: var(--bpa-charcoal); }
.phase-section__count {
  margin-left: var(--sp-2);
  font-size: var(--fs-xs);
  background: var(--bpa-charcoal);
  color: var(--bpa-cream);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
}
.phase-section--standby > summary { background: linear-gradient(to right, #EEEAE0, var(--surface)); }
.phase-section--closed > summary { background: linear-gradient(to right, #E5E0D5, var(--surface)); }
.phase-section--closed .phase-section__num { background: var(--phase-closed); }

/* ---------- Projects table ---------- */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
}
.projects-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  min-width: 1080px;
}
.projects-table thead th {
  text-align: left;
  background: var(--bpa-paper);
  padding: var(--sp-3);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.projects-table tbody td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.projects-table tbody tr:hover { background: var(--bpa-mint-tint); }
.projects-table tbody tr:last-child td { border-bottom: none; }
.projects-table .col-name { font-weight: 600; min-width: 220px; }
.projects-table .col-name a { color: var(--bpa-charcoal); }
.projects-table .col-name a:hover { color: var(--bpa-burgundy); }
.projects-table .col-remarks { color: var(--text-muted); max-width: 280px; }
.projects-table .col-cad { text-align: center; }
.projects-table .col-adv { min-width: 130px; }
.projects-table .col-pm { white-space: nowrap; }
.projects-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Placeholder views */
.placeholder-view {
  padding: var(--sp-7) var(--sp-5);
  text-align: center;
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}
.placeholder-view h3 { margin-bottom: var(--sp-2); }

/* ---------- Project detail page ---------- */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-4);
}
@media (min-width: 1024px) {
  .detail-grid { grid-template-columns: 2fr 1fr; align-items: start; }
}

.detail-summary { display: flex; flex-direction: column; gap: var(--sp-3); }
.detail-summary__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
}
.detail-summary h1 { line-height: 1.1; }

.detail-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
}
@media (min-width: 768px) { .detail-meta { grid-template-columns: repeat(4, 1fr); } }
.detail-meta__item { display: flex; flex-direction: column; gap: 2px; }
.detail-meta__label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.detail-meta__value { font-weight: 600; }

/* Disclosure layers */
details.layer {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  margin-bottom: var(--sp-3);
  overflow: hidden;
}
details.layer > summary {
  list-style: none;
  cursor: pointer;
  padding: var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  font-weight: 600;
  user-select: none;
}
details.layer > summary::-webkit-details-marker { display: none; }
details.layer > summary::after {
  content: "+";
  font-size: 1.4rem;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
details.layer[open] > summary::after { content: "−"; }
details.layer > .layer__body {
  padding: 0 var(--sp-4) var(--sp-4) var(--sp-4);
  border-top: 1px solid var(--border-soft);
}
details.layer--sensitive { border-color: #E0BFC9; background: var(--bpa-burgundy-soft); }
details.layer--sensitive > summary { color: var(--bpa-burgundy); }

.history-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.history-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: var(--fs-sm);
}
.history-item:last-child { border-bottom: none; }
.history-item time {
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
}

.placeholder-box {
  padding: var(--sp-4);
  background: var(--bpa-paper);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  text-align: center;
}

.dropzone {
  padding: var(--sp-6);
  background: repeating-linear-gradient(
    45deg,
    var(--bpa-paper),
    var(--bpa-paper) 10px,
    var(--bpa-off-white) 10px,
    var(--bpa-off-white) 20px
  );
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  color: var(--text-muted);
}

.detail-aside {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  position: sticky;
  top: 96px;
}

.action-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3);
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin: 0 calc(var(--sp-4) * -1) calc(var(--sp-4) * -1) calc(var(--sp-4) * -1);
  z-index: 20;
}
.action-bar .btn { flex: 1; justify-content: center; }
@media (min-width: 1024px) {
  .action-bar { position: static; margin: 0; border: none; padding: 0; background: transparent; }
}

/* ---------- Mobile cards view ---------- */
.mobile-stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.mobile-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: var(--sp-3);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.mobile-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}
.mobile-card__name { font-weight: 600; font-size: var(--fs-md); line-height: 1.3; }
.mobile-card__location { font-size: var(--fs-xs); color: var(--text-muted); }
.mobile-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--border-soft);
}
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bpa-mint-tint);
  border: 2px solid var(--surface);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--bpa-mint-dark);
  margin-left: -6px;
}
.avatar:first-child { margin-left: 0; }
.avatar--inactive { background: #ECEAE6; color: var(--text-faint); }

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: var(--sp-1) var(--sp-2) calc(var(--sp-2) + env(safe-area-inset-bottom));
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(33, 20, 15, 0.04);
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--sp-2);
  min-height: var(--tap);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 500;
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.tabbar a.is-active { color: var(--bpa-burgundy); }
.tabbar__icon { font-size: 1.25rem; line-height: 1; }

.mobile-shell {
  max-width: 375px;
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
  padding-bottom: 88px;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.mobile-shell .appbar { position: sticky; top: 0; }
.mobile-shell .shell { padding: var(--sp-3); }

details.mobile-filters {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-3);
}
details.mobile-filters > summary {
  list-style: none;
  cursor: pointer;
  padding: var(--sp-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: var(--fs-sm);
}
details.mobile-filters > summary::-webkit-details-marker { display: none; }
details.mobile-filters > summary::after { content: "▾"; color: var(--text-muted); }
details.mobile-filters[open] > summary::after { content: "▴"; }
details.mobile-filters > .filters-body {
  padding: 0 var(--sp-3) var(--sp-3) var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  border-top: 1px solid var(--border-soft);
}
details.mobile-filters > .filters-body select,
details.mobile-filters > .filters-body input {
  min-height: var(--tap);
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--fs-sm);
}

/* ---------- Forms (new project) ---------- */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  max-width: 760px;
}
.form-section {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}
.form-section h2 {
  font-size: var(--fs-lg);
  color: var(--bpa-burgundy);
  margin-bottom: var(--sp-1);
}
.form-section__hint {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: var(--sp-4);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3);
}
@media (min-width: 640px) {
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid .span-2 { grid-column: span 2; }
}
.field { display: flex; flex-direction: column; gap: var(--sp-1); }
.field__label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--bpa-charcoal);
}
.field__label .req { color: var(--bpa-burgundy); margin-left: 2px; }
.field__hint {
  font-size: var(--fs-xs);
  color: var(--text-faint);
}
.field input[type="text"],
.field input[type="number"],
.field input[type="date"],
.field select,
.field textarea {
  min-height: var(--tap);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--fs-sm);
  color: var(--text);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--bpa-mint-dark);
  box-shadow: 0 0 0 3px var(--bpa-mint-tint);
}
.field--required input,
.field--required select { border-color: var(--bpa-mint); }
.field textarea { min-height: 88px; resize: vertical; }

/* Suggestion chips for description */
.suggestion-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  margin-top: var(--sp-1);
}
.suggestion {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bpa-mint-tint);
  color: var(--bpa-mint-dark);
  border: 1px solid var(--bpa-mint);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
}
.suggestion:hover { background: var(--bpa-mint); color: var(--bpa-charcoal); }

/* Slider */
.slider-wrap { display: flex; align-items: center; gap: var(--sp-2); }
.slider-wrap input[type="range"] { flex: 1; accent-color: var(--bpa-mint-dark); }
.slider-value { font-weight: 700; min-width: 4ch; text-align: right; color: var(--bpa-burgundy); }

/* Multi-checkbox group */
.check-group { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.check-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 600;
}
.check-pill input { accent-color: var(--bpa-mint-dark); }
.check-pill:has(input:checked) {
  background: var(--bpa-mint);
  border-color: var(--bpa-mint-dark);
}

/* Form sticky footer */
.form-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3) 0;
  background: linear-gradient(to top, var(--bg) 80%, transparent);
  margin-top: var(--sp-3);
  flex-wrap: wrap;
}
.form-footer .btn { flex: 1 1 auto; min-width: 140px; }
.form-footer .btn--cancel {
  background: transparent;
  border: none;
  color: var(--text-muted);
  flex: 0 0 auto;
}

/* ---------- Misc helpers ---------- */
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.row { display: flex; gap: var(--sp-2); align-items: center; }
.row--wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.divider {
  height: 1px;
  background: var(--border-soft);
  margin: var(--sp-3) 0;
  border: none;
}

footer.footnote {
  margin-top: var(--sp-6);
  padding: var(--sp-4);
  color: var(--text-faint);
  font-size: var(--fs-xs);
  text-align: center;
}

.icon-lock::before { content: "🔒"; margin-right: var(--sp-2); }
.icon-doc::before  { content: "📂"; margin-right: var(--sp-2); }
.icon-eye::before  { content: "👁"; margin-right: var(--sp-2); }

/* Inline advance slider in projects table */
.advance-edit {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 140px;
}
.advance-edit input[type="range"] {
  flex: 1;
  min-width: 80px;
  accent-color: var(--bpa-mint-dark);
  cursor: pointer;
}
.advance-edit__val {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  min-width: 4ch;
  text-align: right;
  font-size: var(--fs-xs);
  color: var(--bpa-burgundy);
}

/* Draggable rows in phases view */
.projects-table tr[draggable="true"] .col-name { cursor: grab; }
.projects-table tr[draggable="true"]:active .col-name { cursor: grabbing; }
.projects-table tr.dragging { opacity: 0.35; background: var(--bpa-mint-tint); }
.phase-section.drag-over { box-shadow: inset 0 0 0 2px var(--bpa-mint-dark); background: var(--bpa-mint-tint); }
.phase-section.drag-over > summary { background: linear-gradient(to right, var(--bpa-mint-tint), var(--surface)); }

/* Former team member badge */
.badge-former {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 2px 8px;
  background: #ECEAE6;
  color: var(--text-faint);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--border);
}

/* ---------- Profile menu ---------- */
.profile-wrap { position: relative; }
.profile-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bpa-burgundy); color: #fff;
  font-family: var(--font-mono); font-weight: 700; font-size: 12px;
  border: 2px solid var(--bpa-mint); cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 120ms, transform 120ms;
}
.profile-btn:hover { background: var(--bpa-burgundy-dark); transform: scale(1.05); }
.profile-menu {
  position: absolute; top: calc(100% + 10px); right: 0;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  min-width: 260px; padding: var(--sp-3);
  display: none; z-index: 1000;
}
.profile-menu.is-open { display: block; }
.profile-menu__head {
  display: flex; gap: var(--sp-3); align-items: center;
  padding-bottom: var(--sp-3); border-bottom: 1px solid var(--border-soft);
  margin-bottom: var(--sp-2);
}
.profile-menu__avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--bpa-mint); color: var(--bpa-charcoal);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 16px;
  flex-shrink: 0;
}
.profile-menu__name { font-weight: 700; font-size: var(--fs-md); color: var(--bpa-charcoal); }
.profile-menu__role {
  font-size: 10px; color: var(--bpa-burgundy);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700;
  margin-top: 2px;
}
.profile-menu__email {
  font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px;
  word-break: break-all;
}
.profile-menu__item {
  width: 100%; text-align: left;
  padding: var(--sp-2) var(--sp-3);
  background: transparent; border: none;
  cursor: pointer; border-radius: var(--radius-sm);
  font-weight: 600; font-size: var(--fs-sm); color: var(--bpa-burgundy);
}
.profile-menu__item:hover { background: var(--bpa-burgundy-soft); }

/* ---------- Cards view ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3);
}
@media (min-width: 768px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .cards-grid { grid-template-columns: repeat(3, 1fr); } }

.project-card-big {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-top: 4px solid var(--bpa-mint);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-2);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 120ms, transform 120ms;
}
.project-card-big:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.project-card-big--standby { border-top-color: var(--phase-standby); }
.project-card-big--closed { border-top-color: var(--phase-closed); }
.project-card-big--const-hot { border-top-color: var(--phase-const-hot); }
.project-card-big--const-follow { border-top-color: var(--phase-const-follow); }
.project-card-big--design-hot { border-top-color: var(--phase-design-hot); }
.project-card-big--design { border-top-color: var(--phase-design); }

.project-card-big__top {
  display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap;
}
.project-card-big__name {
  font-size: var(--fs-lg); font-weight: 700; color: var(--bpa-charcoal);
  line-height: 1.2; margin: 0;
}
.project-card-big__name a { color: inherit; text-decoration: none; }
.project-card-big__name a:hover { color: var(--bpa-burgundy); }
.project-card-big__location {
  font-size: var(--fs-xs); color: var(--text-muted);
}
.project-card-big__desc {
  font-size: var(--fs-sm); color: var(--text); line-height: 1.4;
  margin: 0;
}
.project-card-big__remark {
  font-size: var(--fs-xs); color: var(--text-muted); font-style: italic;
  padding: var(--sp-2);
  background: var(--bpa-cream-soft);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--bpa-cream);
}
.project-card-big__footer {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: var(--sp-2);
  padding-top: var(--sp-2); border-top: 1px solid var(--border-soft);
  font-size: var(--fs-xs);
}
.project-card-big__advance {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-xs); color: var(--text-muted);
}
.project-card-big__advance .progress {
  flex: 1; min-width: 100px;
}

/* Kanban card slider */
.kanban-card__advance {
  display: flex; align-items: center;
}
.kanban-card__advance input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: var(--bpa-mint-dark);
  cursor: ew-resize;
}

/* Cards grouped by phase */
.cards-group { margin-bottom: var(--sp-5); }
.cards-group__head {
  display: flex; align-items: center; gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  background: linear-gradient(to right, var(--bpa-cream-soft), transparent);
  border-left: 4px solid var(--bpa-burgundy);
  border-radius: var(--radius-sm);
}
.cards-group__head .phase-section__name {
  font-size: var(--fs-lg);
  color: var(--bpa-charcoal);
  font-weight: 700;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(33, 20, 15, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: var(--sp-4);
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal h2 { font-size: var(--fs-xl); margin: 0; }

/* ---------- Mobile-specific tweaks ---------- */
@media (max-width: 640px) {
  .filterbar {
    flex-direction: column;
    align-items: stretch;
    position: static;
  }
  .filterbar__group { width: 100%; }
  .filterbar__group select { width: 100%; flex: 1; }
  .chip-row { gap: 4px; }
  .chip { font-size: 10px; padding: 3px 8px; }
  .appbar__nav a { padding: var(--sp-1) var(--sp-2); font-size: var(--fs-xs); }
  .view-tabs { width: 100%; }
  .view-tabs button { flex: 1; padding: var(--sp-2); font-size: var(--fs-xs); }
  .kanban-col { flex: 0 0 240px; }
  h1 { font-size: var(--fs-xl); }
  .phase-section__name { font-size: var(--fs-md); }
}
