/* =======================================================
   Arquitectura Industrial · Plataforma Local V0.1
   Identidad: Claro Arquitectos — blanco · negro · grises
   ======================================================= */

:root {
  /* Grafitos (reemplazan los negros) */
  --black:    #2e2c28;   /* grafito profundo · principal */
  --ink:      #3a3833;   /* grafito medio · textos fuertes */
  --graphite: #524e47;   /* grafito cálido */
  --stone:    #7a7268;   /* topo */
  --concrete: #a8a094;   /* topo claro */
  --silver:   #cfc6b5;   /* línea / borde cálido */

  /* Beiges (nuevos tonos base) */
  --beige-50: #faf6ec;   /* fondo más claro · canvas principal */
  --beige-100:#f1ebda;   /* fondo de tarjetas / topo cálido */
  --beige-200:#e6dcc2;   /* hover / acento sutil */
  --beige-300:#d4c5a3;   /* acento cálido medio */
  --beige-700:#8a7a5c;   /* acento oscuro */

  --paper:    #f1ebda;   /* alias legacy = beige-100 */
  --bone:     #faf6ec;   /* alias legacy = beige-50 */
  --white:    #ffffff;

  --serif:  "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans:   "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --sidebar-w: 240px;
  --topbar-h:  72px;

  --radius: 2px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.18);
}

/* =================== Reset =================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: var(--sans);
  font-weight: 300;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 300; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 28px; line-height: 1.1; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }
p  { margin: 0 0 8px 0; }
a  { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea, button { font-family: var(--sans); font-size: 12.5px; }

.eyebrow {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 9px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--stone);
  display: block;
  margin-bottom: 6px;
}
.muted { color: var(--stone); font-size: 12px; }
.italic { font-style: italic; }

/* =================== Layout =================== */
body { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--black);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bone);
}

/* =================== Sidebar =================== */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 22px 18px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}
.brand-logo {
  width: 100%;
  max-width: 150px;
  height: auto;
  display: block;
  mix-blend-mode: screen;       /* deja que el gris del logo respire sobre el grafito */
  filter: brightness(1.08);
}
.brand-sub {
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--beige-200);
  text-align: center;
}

.nav {
  display: flex;
  flex-direction: column;
  padding: 18px 0;
  flex: 1;
  overflow-y: auto;
}
.nav-item {
  padding: 10px 22px;
  font-size: 12.5px;
  font-weight: 300;
  color: var(--silver);
  border-left: 2px solid transparent;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.nav-item:hover { color: var(--white); background: rgba(255,255,255,0.03); }
.nav-item.active {
  color: var(--white);
  background: rgba(255,255,255,0.06);
  border-left-color: var(--white);
}

.sidebar-footer {
  padding: 20px 22px 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.quote {
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 300;
  color: var(--silver);
  line-height: 1.4;
}
.quote i { font-weight: 300; color: var(--white); }

/* =================== Topbar =================== */
.topbar {
  height: var(--topbar-h);
  padding: 0 32px;
  background: var(--white);
  border-bottom: 1px solid var(--silver);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title h1 { font-size: 22px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-actions input[type=search] {
  width: 280px;
  padding: 8px 12px;
  background: var(--paper);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 300;
  outline: none;
}
.topbar-actions input[type=search]:focus { border-color: var(--graphite); background: var(--white); }

/* =================== Buttons =================== */
.btn-primary, .btn-ghost {
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--black);
  background: var(--black);
  color: var(--white);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: 0.85; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--silver);
}
.btn-ghost:hover { border-color: var(--graphite); }
.btn-text {
  background: none; border: none; color: var(--graphite);
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 8px;
}
.btn-text:hover { color: var(--black); }
.btn-danger {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--graphite);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
}
.btn-danger:hover { background: var(--ink); color: var(--white); }

/* =================== Views =================== */
.views { padding: 28px 32px 8px; flex: 1; }
.view  { display: none; }
.view.active { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; } }

.footer {
  padding: 16px 32px;
  border-top: 1px solid var(--silver);
  display: flex; justify-content: space-between;
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--stone);
  background: var(--white);
}

/* =================== Cards =================== */
.card {
  background: var(--white);
  border: 1px solid var(--silver);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
}
.card-title {
  font-family: var(--serif);
  font-size: 17px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--silver);
  letter-spacing: -0.01em;
}
.card-body { font-size: 13px; }

.row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 1100px) { .row-2col { grid-template-columns: 1fr; } }

/* =================== KPI grid =================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
@media (max-width: 1200px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi {
  background: var(--white);
  border: 1px solid var(--silver);
  padding: 18px 20px;
  border-radius: var(--radius);
}
.kpi-label {
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--stone);
  margin-bottom: 8px;
}
.kpi-value {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
  color: var(--ink);
}
.kpi-sub {
  font-size: 11px;
  color: var(--stone);
  margin-top: 6px;
}
.kpi.alert .kpi-value { color: var(--black); }
.kpi.alert::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--black);
  margin-bottom: 8px;
  margin-right: 6px;
  vertical-align: middle;
}

/* =================== Toolbar (filters) =================== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters select, .filters input[type=date] {
  padding: 7px 10px;
  background: var(--white);
  border: 1px solid var(--silver);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--ink);
  min-width: 140px;
  outline: none;
}
.filters select:focus, .filters input[type=date]:focus { border-color: var(--graphite); }

/* =================== Tables =================== */
.table-wrap {
  background: var(--white);
  border: 1px solid var(--silver);
  border-radius: var(--radius);
  overflow: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.data-table thead th {
  text-align: left;
  font-weight: 500;
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--stone);
  background: var(--paper);
  padding: 12px 14px;
  border-bottom: 1px solid var(--silver);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--paper);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--bone); }
.data-table .row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.data-table .strong { font-weight: 500; color: var(--ink); }
.data-table .link {
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--concrete);
  cursor: pointer;
}
.data-table .link:hover { text-decoration-color: var(--ink); }

/* =================== Badges =================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid var(--silver);
  border-radius: 2px;
  color: var(--graphite);
  background: var(--white);
  white-space: nowrap;
}
.badge::before {
  content: "";
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--concrete);
}
.badge.b-ok        { color: var(--ink); }
.badge.b-ok::before        { background: var(--ink); }
.badge.b-warn      { color: var(--ink); border-color: var(--graphite); }
.badge.b-warn::before      { background: var(--graphite); border: 1px solid var(--graphite); }
.badge.b-danger    { background: var(--ink); color: var(--white); border-color: var(--ink); }
.badge.b-danger::before    { background: var(--white); }
.badge.b-muted     { color: var(--stone); }
.badge.b-muted::before     { background: var(--silver); }
.badge.b-info      { color: var(--ink); background: var(--paper); border-color: var(--paper); }
.badge.b-info::before      { background: var(--graphite); }

/* =================== Kanban =================== */
.kanban {
  display: grid;
  grid-template-columns: repeat(10, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
}
.kanban-col {
  background: var(--paper);
  border: 1px solid var(--silver);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 200px;
  min-width: 220px;
}
.kanban-col-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--silver);
}
.kanban-col-title {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--stone);
}
.kanban-col-count {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--graphite);
}
.kanban-card {
  background: var(--white);
  border: 1px solid var(--silver);
  padding: 10px 12px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.kanban-card:hover { border-color: var(--graphite); box-shadow: var(--shadow-sm); }
.kanban-card .kc-cliente { font-size: 9px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--stone); }
.kanban-card .kc-nombre  { font-family: var(--serif); font-size: 15px; margin-top: 2px; margin-bottom: 8px; line-height: 1.2; }
.kanban-card .kc-meta    { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--graphite); }
.kanban-card .kc-monto   { font-weight: 500; color: var(--ink); }

/* =================== Project detail =================== */
.proj-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--silver);
  margin-bottom: 20px;
}
.proj-header h2 { font-size: 28px; margin-bottom: 8px; }
.proj-meta {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--stone);
  letter-spacing: 0.04em;
}
.proj-meta strong { color: var(--ink); font-weight: 500; margin-right: 4px; }
.proj-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--serif);
  font-size: 22px;
}
.progress-track { width: 180px; height: 2px; background: var(--silver); }
.progress-fill  { height: 100%; background: var(--black); transition: width .25s; }

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--silver);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--stone);
  margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--black); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.detail-block {
  background: var(--white);
  border: 1px solid var(--silver);
  padding: 14px 16px;
  border-radius: var(--radius);
}
.detail-block .eyebrow { margin-bottom: 4px; }
.detail-block .v { font-family: var(--serif); font-size: 20px; color: var(--ink); }

/* =================== Reports =================== */
.report-section { margin-bottom: 28px; }
.report-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 1100px) { .report-grid { grid-template-columns: repeat(2, 1fr); } }
.report-card {
  background: var(--white);
  border: 1px solid var(--silver);
  padding: 22px 22px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.report-card:hover { border-color: var(--graphite); box-shadow: var(--shadow-sm); }
.report-title {
  font-family: var(--serif);
  font-size: 18px;
  margin-bottom: 6px;
}
.report-desc { font-size: 12px; color: var(--stone); }

/* =================== Finance =================== */
.fin-kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
@media (max-width: 1300px) { .fin-kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px)  { .fin-kpis { grid-template-columns: repeat(2, 1fr); } }

/* =================== Modal =================== */
.modal-root {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
}
.modal {
  position: relative;
  background: var(--white);
  width: min(720px, 92vw);
  max-height: 86vh;
  display: flex; flex-direction: column;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px 26px;
  border-bottom: 1px solid var(--silver);
}
.modal-header h2 { font-size: 22px; }
.modal-x {
  background: none; border: none; font-size: 26px; color: var(--graphite);
  padding: 4px 8px;
}
.modal-body {
  padding: 22px 26px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 16px 26px;
  border-top: 1px solid var(--silver);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* =================== Form =================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field.full { grid-column: 1 / -1; }
.field label {
  font-size: 9px; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--stone); font-weight: 500;
}
.field input, .field select, .field textarea {
  padding: 9px 11px;
  background: var(--white);
  border: 1px solid var(--silver);
  border-radius: var(--radius);
  outline: none;
  color: var(--ink);
  font-weight: 300;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--graphite); }
.field textarea { resize: vertical; min-height: 60px; }
.field .err { color: var(--ink); font-size: 11px; font-style: italic; }

/* =================== Toast =================== */
.toast-root {
  position: fixed; bottom: 22px; right: 22px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 2000; pointer-events: none;
}
.toast {
  background: var(--ink);
  color: var(--white);
  padding: 10px 16px;
  font-size: 12px;
  border-radius: var(--radius);
  min-width: 200px;
  box-shadow: var(--shadow-md);
  animation: toastIn .25s ease;
}
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { opacity: 1; } }

/* =================== Misc =================== */
.empty {
  text-align: center;
  padding: 36px 20px;
  color: var(--stone);
  font-style: italic;
  font-family: var(--serif);
  font-size: 16px;
}
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.list-line {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--paper);
}
.list-line:last-child { border-bottom: none; }
.list-line .ll-l { display: flex; flex-direction: column; }
.list-line .ll-r { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.list-line .ll-sub { font-size: 11px; color: var(--stone); }

.bar-track {
  background: var(--paper);
  height: 4px;
  width: 100%;
  border-radius: 2px;
  overflow: hidden;
}
.bar-fill { height: 100%; background: var(--ink); }
.bar-fill.warn { background: var(--graphite); }
.bar-fill.danger { background: var(--black); }

.tag-stage {
  font-family: var(--serif);
  font-style: italic;
  color: var(--graphite);
  font-size: 13px;
}

.report-view {
  background: var(--white);
  border: 1px solid var(--silver);
  padding: 28px 32px;
  border-radius: var(--radius);
}
.report-view h2 { font-size: 22px; margin-bottom: 4px; }
.report-view .report-meta { font-size: 11px; color: var(--stone); letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 24px; }

.eerr-table { width: 100%; font-size: 13px; }
.eerr-table td { padding: 7px 8px; border-bottom: 1px solid var(--paper); }
.eerr-table .label { color: var(--graphite); }
.eerr-table .num   { text-align: right; font-variant-numeric: tabular-nums; }
.eerr-table .row-sub td { font-weight: 500; border-bottom: 1px solid var(--silver); }
.eerr-table .row-total td { font-family: var(--serif); font-size: 16px; padding-top: 12px; }

/* Sub-tabs / kanban scroll hint */
.scroll-hint {
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--concrete); padding-bottom: 8px;
}

/* =================== Carta Gantt =================== */
.gantt {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}
.gantt-section-label {
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--stone);
  padding: 14px 0 6px 0;
  border-bottom: 1px solid var(--silver);
  margin-bottom: 4px;
}
.gantt-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
  align-items: center;
}
.gantt-row-head { margin-bottom: 8px; }
.gantt-label {
  font-size: 12px;
  color: var(--ink);
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gantt-label-head {
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--stone);
}
.gantt-label .strong { font-weight: 500; }
.gantt-sub {
  font-size: 10px;
  color: var(--stone);
  font-style: italic;
}
.gantt-track {
  position: relative;
  height: 22px;
  background: var(--beige-100);
  border-radius: 2px;
}
.gantt-track-head {
  background: transparent;
  height: 26px;
  border-bottom: 1px solid var(--silver);
}
/* Línea vertical "hoy" — sutil, replicada en cada track via ::after */
.gantt-track::after {
  content: "";
  position: absolute;
  top: -2px; bottom: -2px;
  left: var(--today-pct, -10%);
  width: 1px;
  background: var(--graphite);
  opacity: 0.55;
  pointer-events: none;
}
.gantt-track-head::after { top: 0; bottom: -1px; opacity: 0.7; }

.gantt-month {
  position: absolute;
  top: 0; bottom: 0;
  border-left: 1px solid var(--silver);
  padding-left: 6px;
  display: flex;
  align-items: center;
}
.gantt-month-label {
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--stone);
  white-space: nowrap;
}
.gantt-today-tag {
  position: absolute;
  top: -16px;
  transform: translateX(-50%);
  font-size: 8px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--graphite);
  padding: 2px 6px;
  border-radius: 2px;
  white-space: nowrap;
  z-index: 5;
}

.gantt-bar {
  position: absolute;
  top: 2px; bottom: 2px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  padding: 0 6px;
  overflow: hidden;
  white-space: nowrap;
  z-index: 1;
}
.gantt-bar-etapa {
  background: var(--graphite);
  color: var(--white);
}
.gantt-progress {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  background: var(--ink);
  z-index: 0;
}
.gantt-bar-etapa::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 2px;
  pointer-events: none;
}
.gantt-bar-tag {
  position: relative;
  z-index: 1;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gantt-bar-esp {
  background: var(--beige-300);
  color: var(--ink);
  border: 1px solid var(--beige-700);
}
.gantt-bar-esp.is-aprobada {
  background: var(--beige-200);
  border-color: var(--graphite);
}
.gantt-bar-esp.is-pagada::after {
  content: "";
  position: absolute;
  right: 4px; top: 50%;
  transform: translateY(-50%);
  width: 6px; height: 6px;
  background: var(--ink);
  border-radius: 50%;
}

.gantt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--silver);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--stone);
}
.gantt-legend .dot {
  display: inline-block;
  width: 12px; height: 6px;
  vertical-align: middle;
  margin-right: 6px;
  border-radius: 1px;
}
.gantt-legend .dot-etapa    { background: var(--graphite); }
.gantt-legend .dot-progress { background: var(--ink); }
.gantt-legend .dot-esp      { background: var(--beige-300); border: 1px solid var(--beige-700); }
.gantt-legend .dot-aprobada { background: var(--beige-200); border-color: var(--graphite); }
.gantt-legend .dot-today    { width: 2px; height: 12px; background: var(--graphite); }

@media (max-width: 900px) {
  .gantt-row { grid-template-columns: 140px 1fr; gap: 8px; }
  .gantt-label { font-size: 11px; }
}

/* =================== Responsive · Tablet =================== */
@media (max-width: 900px) {
  body { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 100;
    padding-top: env(safe-area-inset-top);
  }
  .brand { padding: 14px 16px; flex-direction: row; gap: 12px; align-items: center; }
  .brand-logo { max-width: 80px; }
  .brand-sub { text-align: left; }
  .nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item {
    border-left: none;
    border-bottom: 2px solid transparent;
    padding: 12px 14px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .nav-item.active { border-bottom-color: var(--white); border-left-color: transparent; }
  .sidebar-footer { display: none; }
  .topbar { flex-wrap: wrap; height: auto; padding: 14px 18px; gap: 8px; }
  .topbar-actions { width: 100%; flex-wrap: wrap; }
  .topbar-actions input[type=search] { width: 100%; min-width: 0; flex: 1; }
  .views { padding: 18px; }
}

/* =================== Responsive · iPhone =================== */
@media (max-width: 600px) {
  body { font-size: 14px; }
  html { -webkit-text-size-adjust: 100%; }
  * { -webkit-tap-highlight-color: transparent; }

  /* Brand más compacta */
  .brand { padding: 10px 14px; }
  .brand-logo { max-width: 64px; }
  .brand-sub { font-size: 8px; letter-spacing: 0.24em; }

  /* Topbar simplificada — los botones export/import viven solo en Config */
  .topbar { padding: 10px 14px; gap: 6px; }
  .topbar-title h1 { font-size: 18px; }
  .topbar-title .eyebrow { font-size: 8px; letter-spacing: 0.24em; }
  .topbar-actions #btn-export, .topbar-actions #btn-import { display: none; }

  .views { padding: 14px 12px 80px; }
  .footer { display: none; }

  /* KPIs en 2 columnas para no quedar muy alargados */
  .kpi-grid, .fin-kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 14px 14px; }
  .kpi-value { font-size: 24px; }
  .kpi-label { font-size: 8px; letter-spacing: 0.22em; }

  .row-2col, .detail-grid, .report-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Cards y bloques */
  .card { padding: 16px 16px; margin-bottom: 14px; }
  .card-title { font-size: 16px; padding-bottom: 10px; margin-bottom: 12px; }

  /* Toolbar y filtros — full width, stackeados */
  .toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .filters { gap: 6px; }
  .filters select, .filters input[type=date] { flex: 1; min-width: 0; font-size: 13px; padding: 10px 10px; }
  .btn-primary, .btn-ghost { padding: 12px 14px; font-size: 11px; }
  .btn-text { padding: 8px 10px; font-size: 12px; }
  .btn-danger { padding: 12px 14px; font-size: 11px; }

  /* Tablas — scroll horizontal con scrollbars suaves */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .data-table { font-size: 12px; }
  .data-table thead th { padding: 10px 10px; font-size: 8px; letter-spacing: 0.22em; }
  .data-table tbody td { padding: 10px 10px; }
  .data-table .row-actions { flex-direction: column; gap: 2px; align-items: stretch; }

  /* Kanban — scroll horizontal */
  .kanban { grid-auto-columns: 80vw; grid-template-columns: none; grid-auto-flow: column; }
  .kanban-col { min-width: 0; min-height: 180px; padding: 10px; }

  /* Tabs — scroll horizontal con momentum */
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    position: sticky; top: 0; background: var(--bone);
    z-index: 10; padding-top: 4px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 12px 14px; font-size: 10px; flex-shrink: 0; white-space: nowrap; }

  /* Detalle de proyecto */
  .proj-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .proj-header h2 { font-size: 22px; }
  .proj-meta { gap: 10px 14px; font-size: 10px; }
  .proj-meta span { display: block; }
  .progress-track { flex: 1; }

  /* Modal — full screen suave */
  .modal-root { padding: 0; }
  .modal {
    width: 100vw; height: 100vh; max-height: 100vh;
    border-radius: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modal-header { padding: 16px 18px; padding-top: calc(16px + env(safe-area-inset-top)); }
  .modal-header h2 { font-size: 18px; }
  .modal-body { padding: 16px 18px; }
  .modal-footer { padding: 14px 18px; flex-wrap: wrap; }
  .modal-footer button { flex: 1; min-width: 100px; }

  /* Formularios — 1 columna */
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .field input, .field select, .field textarea { padding: 12px; font-size: 16px; }
  /* font-size 16px evita el zoom automático de Safari iOS al enfocar inputs */

  /* Lista de líneas (dashboard) — empacada */
  .list-line { flex-direction: column; align-items: stretch; gap: 4px; }
  .list-line .ll-r { justify-content: flex-start; flex-wrap: wrap; font-size: 11px; }
  .list-line .ll-sub { font-size: 11px; }

  /* Reportes — tarjetas grandes para touch */
  .report-card { padding: 18px 16px; }
  .report-title { font-size: 17px; }

  /* Carta Gantt — apilada: label arriba, barra abajo */
  .gantt-row { grid-template-columns: 1fr; gap: 2px; }
  .gantt-label { font-size: 11px; padding: 2px 0; }
  .gantt-label-head { display: none; }
  .gantt-track { height: 24px; }
  .gantt-row-head { display: block; }
  .gantt-row-head .gantt-track-head { width: 100%; }
  .gantt-bar-tag { font-size: 8px; letter-spacing: 0.04em; }
  .gantt-month-label { font-size: 8px; letter-spacing: 0.14em; }
  .gantt-legend { font-size: 9px; gap: 10px; }

  /* Toasts — sobre safe-area */
  .toast-root { bottom: calc(16px + env(safe-area-inset-bottom)); right: 12px; left: 12px; }
  .toast { min-width: 0; width: 100%; }

  /* Empty states más aireados */
  .empty { padding: 24px 12px; font-size: 14px; }

  /* Hacer el sidebar como bottom-bar fija en proyectos muy frecuentes
     — pero ya está arriba; bajamos su altura visual */
  .sidebar { box-shadow: 0 1px 0 rgba(0,0,0,0.04); }
}

/* iPhone landscape: sólo apretar lo necesario */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .topbar { padding: 8px 14px; }
  .topbar-title h1 { font-size: 16px; }
  .kpi-value { font-size: 22px; }
}
