/* =====================================================
   Administración HK — Sistema de diseño
   Tipografía: Metropolis
   Paleta base: #C8202D (rojo marca) / #F0EEE9 / #08283E / #D8A622 / #406C7F
   ===================================================== */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

button {
  font-family: inherit;
  cursor: pointer;
}

:root {
  /* paleta cruda */
  --hk-red: #C8202D;
  --hk-red-700: #A51724;
  --hk-cream: #F0EEE9;
  --hk-navy: #08283E;
  --hk-gold: #D8A622;
  --hk-teal: #406C7F;

  /* tokens semánticos (light por defecto) */
  --bg: #F0EEE9;
  --bg-elev: #FFFFFF;
  --bg-sunken: #E8E5DD;
  --surface: #FFFFFF;
  --surface-2: #FAF8F3;
  --rail: #08283E;
  --rail-fg: #C7D2DA;
  --rail-fg-active: #FFFFFF;
  --rail-accent: #C8202D;
  --text: #08283E;
  --text-muted: #5A6B7A;
  --text-soft: #8694A2;
  --border: #DDD8CD;
  --border-strong: #C8C2B5;
  --accent: #C8202D;
  --accent-fg: #FFFFFF;
  --gold: #D8A622;
  --teal: #406C7F;
  --success: #2E7D5B;
  --danger: #C8202D;
  --warn: #D8A622;
  --info: #406C7F;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-1: 0 1px 2px rgba(8, 40, 62, 0.06), 0 1px 1px rgba(8, 40, 62, 0.04);
  --shadow-2: 0 6px 18px rgba(8, 40, 62, 0.08), 0 2px 6px rgba(8, 40, 62, 0.04);
  --shadow-pop: 0 18px 42px rgba(8, 40, 62, 0.18);

  --rail-w: 224px;
  --rail-w-compact: 200px;
  --topbar-h: 64px;

  --font: 'Metropolis', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #08283E;
  --bg-elev: #0F3650;
  --bg-sunken: #061E30;
  --surface: #0F3650;
  --surface-2: #143E5C;
  --rail: #061E30;
  --rail-fg: #8FA4B5;
  --rail-fg-active: #FFFFFF;
  --rail-accent: #C8202D;
  --text: #F0EEE9;
  --text-muted: #9BB0C0;
  --text-soft: #6E8597;
  --border: #1B486A;
  --border-strong: #245778;
  --accent: #C8202D;
  --accent-fg: #FFFFFF;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-feature-settings: "ss01", "kern";
  -webkit-font-smoothing: antialiased;
  font-weight: 400;
  letter-spacing: -0.005em;
}

/* ===== App layout ===== */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  min-height: 100vh;
  background: var(--rail);
  transition: grid-template-columns .25s ease;
}

.app[data-density="compact"] {
  --rail-w: var(--rail-w-compact);
}

.app[data-rail="collapsed"] {
  grid-template-columns: 0 1fr;
}

.app[data-rail="collapsed"] .rail {
  overflow: hidden;
  border-right: none;
}

/* ===== Sidebar / rail ===== */
.rail {
  background: var(--rail);
  color: var(--rail-fg);
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  /* Franja de acento a la izquierda: sombra interior, no un ::before absoluto (con el scroll del menú se cortaba) */
  box-shadow: inset 6px 0 0 var(--rail-accent);
}

.app[data-rail-accent="off"] .rail {
  box-shadow: none;
}

.rail__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 18px 18px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  min-width: 0;
}

.rail__logo {
  flex: 0 0 36px;
}

.rail__brand-meta {
  min-width: 0;
  flex: 1;
}

.rail__brand-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.15;
}

.rail__logo {
  width: 44px;
  height: 56px;
  border-radius: 10px;
  background: #FFFFFF;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .18);
  flex: 0 0 44px;
  padding: 6px 8px;
}

.rail__logo img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.rail__brand-meta {
  display: flex;
  flex-direction: column;
}

.rail__brand-name {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .02em;
}

.rail__brand-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, .45);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-top: 2px;
}

.rail__group {
  padding: 14px 14px 0;
}

.rail__group-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: rgba(255, 255, 255, .35);
  padding: 0 12px 6px;
}

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

.rail__item {
  all: unset;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--rail-fg);
  cursor: pointer;
  position: relative;
  transition: background .15s ease, color .15s ease;
}

.rail__item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.rail__item.is-active {
  background: rgba(200, 32, 45, 0.42);
  color: #fff;
}

.rail__item.is-active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--hk-red);
  border-radius: 2px;
}

.rail__item .icon {
  width: 36px !important;
  height: 36px !important;
  flex: 0 0 36px !important;
}

.btn .icon {
  width: 14px !important;
  height: 14px !important;
}

.topbar__search svg {
  width: 14px !important;
  height: 14px !important;
}

.topbar__icon-btn .icon {
  width: 14px !important;
  height: 14px !important;
}

.kpi__icon svg {
  width: 24px !important;
  height: 24px !important;
}

.rail__item .icon path,
.rail__item .icon circle,
.rail__item .icon rect,
.rail__item .icon line,
.rail__item .icon polyline,
.rail__item .icon polygon {
  stroke: currentColor;
}

.app[data-icon-style="solid"] .rail__item .icon path,
.app[data-icon-style="solid"] .rail__item .icon circle,
.app[data-icon-style="solid"] .rail__item .icon rect,
.app[data-icon-style="solid"] .rail__item .icon polygon {
  fill: currentColor;
  stroke: none;
}

.rail__foot {
  margin-top: auto;
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 10px;
}

.rail__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--hk-gold), var(--hk-red));
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.rail__user {
  display: flex;
  flex-direction: column;
}

.rail__user-name {
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}

.rail__user-role {
  color: rgba(255, 255, 255, .4);
  font-size: 11px;
}

/* ===== Topbar ===== */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  gap: 16px;
}

.topbar__spacer {
  flex: 1;
}

.topbar__search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 7px 12px;
  border-radius: 8px;
  width: 280px;
  color: var(--text-muted);
  font-size: 13px;
}

.topbar__search svg {
  width: 14px;
  height: 14px;
  color: var(--text-soft);
}

.topbar__search input {
  border: 0;
  background: transparent;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  width: 100%;
}

.topbar__icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  position: relative;
}

.topbar__icon-btn:hover {
  background: var(--surface-2);
}

.topbar__icon-btn .dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hk-red);
  border: 2px solid var(--bg);
}

.topbar__user-wrap {
  position: relative;
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.topbar__user:hover,
.topbar__user-wrap.is-open .topbar__user {
  background: var(--surface-2);
}

.topbar__user .caret {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform .15s;
}

.topbar__user-wrap.is-open .caret {
  transform: rotate(180deg);
}

.topbar__user-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 180px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elev);
  box-shadow: var(--shadow-pop);
  z-index: 20;
}

.topbar__user-wrap.is-open .topbar__user-menu {
  display: block;
}

.topbar__user-menu form {
  margin: 0;
}

.topbar__user-menu a,
.topbar__user-menu button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.topbar__user-menu a:hover,
.topbar__user-menu button:hover {
  background: var(--surface-2);
}

.topbar__user-menu .is-danger {
  color: var(--hk-red);
}

.topbar__user .av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--hk-navy);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
}

[data-theme="dark"] .topbar__user .av {
  background: var(--hk-cream);
  color: var(--hk-navy);
}

.topbar__user .name {
  font-size: 13px;
  font-weight: 500;
}

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

/* ===== Content / pages ===== */
.page {
  padding: 28px 32px;
  max-width: 1480px;
}

.page__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 24px;
}

.page__title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
}

.page__subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 6px;
}

.page__actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
}

.btn:hover {
  background: var(--surface-2);
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: #406C7F;
  color: #F0EEE9;
  border: 1px solid #D8A622;
}

.btn--primary::before {
  content: '';
  display: block;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F0EEE9' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.btn--primary:hover {
  background: #35596A;
  border-color: #C4941A;
}

/* alias sin doble guión para vistas que lo usan */
.btn-primary {
  background: #406C7F;
  color: #F0EEE9;
  border: 1px solid #D8A622;
}

.btn-primary::before {
  content: '';
  display: block;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F0EEE9' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.btn-primary:hover {
  background: #35596A;
  border-color: #C4941A;
}

.btn--gold {
  background: #406C7F;
  color: #F0EEE9;
  border: 1px solid #D8A622;
}

.btn--gold:hover {
  background: #35596A;
  border-color: #C4941A;
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn--ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn--back {
  background: #E5E7EB;
  color: #374151;
  border-color: var(--hk-navy);
}

.btn--back::before {
  content: '';
  display: block;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23374151' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 15L3 9m0 0l6-6M3 9h12a6 6 0 0 1 0 12h-3'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.btn--back:hover {
  background: #D1D5DB;
}

.btn--sm {
  padding: 6px 11px;
  font-size: 12.5px;
  border-radius: 7px;
}

.btn .icon {
  width: 14px;
  height: 14px;
}

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}

.card__head {
  padding: 18px 22px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.card__head>div {
  min-width: 0;
}

.card__title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
}

.card__subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.card__body {
  padding: 16px 22px 22px;
}

.card__divider {
  height: 1px;
  background: var(--border);
  margin: 0;
}

/* KPI cards */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

@media (max-width: 1180px) {
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 720px) {
  .kpis {
    grid-template-columns: 1fr;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr !important;
  }
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px 20px;
  box-shadow: var(--shadow-1);
  height: 200px;
  position: relative;
  overflow: hidden;
}

.kpi__label {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
  padding-right: 48px;
}

.kpi__value {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 12px;
  color: var(--text);
}

.kpi__value .unit {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 4px;
  font-weight: 500;
  letter-spacing: 0;
}

.kpi__icon {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(8, 40, 62, 0.05);
  color: var(--hk-navy);
}

[data-theme="dark"] .kpi__icon {
  background: rgba(255, 255, 255, 0.05);
  color: var(--hk-cream);
}

.kpi--gold .kpi__icon {
  background: rgba(216, 166, 34, 0.14);
  color: var(--hk-gold);
}

.kpi--teal .kpi__icon {
  background: rgba(64, 108, 127, 0.14);
  color: var(--hk-teal);
}

/* Layout grids */
.grid-2 {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ===== Tables ===== */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.table thead th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.table thead th:first-child {
  border-top-left-radius: var(--radius);
}

.table thead th:last-child {
  border-top-right-radius: var(--radius);
}

.table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.table tbody tr:hover td {
  background: var(--surface-2);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table .num {
  font-variant-numeric: tabular-nums;
}

.table .right {
  text-align: right;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}

/* ===== Badges / chips ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid transparent;
  letter-spacing: .01em;
}

.badge--neutral {
  background: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border);
}

.badge--prosp {
  background: rgba(64, 108, 127, 0.12);
  color: var(--hk-teal);
}

.badge--active {
  background: rgba(46, 125, 91, 0.12);
  color: var(--success);
}

.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ===== Project detail ===== */
.detail-tabs {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}

.detail-tabs a {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: 7px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  transition: background .12s, color .12s, border-color .12s;
}

.detail-tabs a:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}

.detail-tabs a.is-active {
  background: var(--hk-navy);
  color: #fff;
  border-color: var(--hk-navy);
}

.detail-tabs a.is-gold {
  color: var(--hk-gold);
  border-color: rgba(216, 166, 34, .30);
  background: rgba(216, 166, 34, .06);
}

.detail-tabs a.is-gold:hover {
  background: rgba(216, 166, 34, .12);
  border-color: var(--hk-gold);
}

/* ===== Form fields ===== */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.field input,
.field select,
.field textarea {
  font-family: inherit;
  font-size: 13.5px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: 8px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--hk-teal);
  box-shadow: 0 0 0 3px rgba(64, 108, 127, .15);
}

.fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}

/* ===== Waterfall levels ===== */
.wf-level {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-1);
}

.wf-level::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--hk-gold);
}

.wf-level[data-tone="navy"]::before {
  background: var(--hk-navy);
}

.wf-level[data-tone="teal"]::before {
  background: var(--hk-teal);
}

.wf-level[data-tone="red"]::before {
  background: var(--hk-red);
}

.wf-level__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.wf-level__title {
  font-size: 13px;
  color: var(--hk-teal);
  font-weight: 600;
  letter-spacing: .01em;
}

[data-theme="dark"] .wf-level__title {
  color: #87B2C7;
}

.wf-level__amount {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 4px;
  color: var(--text);
}

.wf-level__sub {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 2px;
}

.wf-level__split {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}

.wf-level__split b {
  color: var(--text);
  font-weight: 600;
}

/* Resumen ejecutivo */
.summary {
  background: var(--hk-navy);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 22px 24px 20px;
  margin-top: 22px;
}

[data-theme="dark"] .summary {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
}

.summary__title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 14px;
}

.summary__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.summary__cell {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 14px 16px;
}

.summary__cell .lbl {
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .55);
}

.summary__cell .val {
  font-size: 22px;
  font-weight: 600;
  margin-top: 8px;
  letter-spacing: -0.01em;
}

.summary__cell.accent .val {
  color: var(--hk-gold);
}

/* ===== Misc utility ===== */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dim {
  color: var(--text-muted);
}

.num {
  font-variant-numeric: tabular-nums;
}

/* tags inside table */
.cell-name {
  display: flex;
  flex-direction: column;
}

.cell-name b {
  font-weight: 600;
  font-size: 13.5px;
}

.cell-name span {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* alerts list (small list inside cards) */
.list-clean {
  list-style: none;
  padding: 0;
  margin: 0;
}

.list-clean>li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
}

.list-clean>li:last-child {
  border-bottom: 0;
}

.list-clean .li-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--hk-teal);
  display: grid;
  place-items: center;
  flex: 0 0 32px;
}

.list-clean .li-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.list-clean .li-title {
  font-size: 13.5px;
  font-weight: 500;
}

.list-clean .li-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Empty state */
.empty {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}

/* Scrollbar polish */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ===== Topbar breadcrumbs ===== */
.topbar__crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.topbar__crumbs span {
  color: var(--hk-teal);
  font-weight: 400;
}

.topbar__crumbs strong {
  color: var(--hk-navy);
  font-weight: 600;
}

[data-theme="dark"] .topbar__crumbs span {
  color: rgba(255, 255, 255, .5);
}

[data-theme="dark"] .topbar__crumbs strong {
  color: #fff;
}

.topbar__sep {
  color: var(--hk-teal);
  opacity: 0.4;
  font-weight: 300;
}

/* ===== Projects index table ===== */
.proj-table-wrap {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(8, 40, 62, 0.06);
  overflow: hidden;
}

[data-theme="dark"] .proj-table-wrap {
  background: var(--surface);
}

.proj-table-wrap.pi-scroll-x {
  overflow-x: auto;
  overflow-y: hidden;
}

.pi-scroll-x .proj-table {
  min-width: 900px;
}

.proj-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.proj-table thead th {
  background: rgba(8, 40, 62, 0.04);
  color: var(--hk-teal);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

[data-theme="dark"] .proj-table thead th {
  background: rgba(255, 255, 255, 0.04);
}

.proj-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .12s ease;
}

.proj-table tbody tr:last-child td {
  border-bottom: 0;
}

.proj-table tbody tr:hover td {
  background: rgba(8, 40, 62, 0.02);
}

[data-theme="dark"] .proj-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.proj-table tbody td {
  padding: 16px;
  vertical-align: middle;
}

/* ===== Badge etapa / estado ===== */
.badge-etapa {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Etapa: Modelado */
.badge-etapa--prospeccion {
  background: rgba(216, 166, 34, 0.12);
  color: #8A6010;
}

.badge-etapa--prospeccion .badge-dot {
  background: #D8A622;
}

/* Etapa: Estructuración */
.badge-etapa--estructuracion {
  background: rgba(64, 108, 127, 0.12);
  color: #406C7F;
}

.badge-etapa--estructuracion .badge-dot {
  background: #406C7F;
}

/* Etapa: En operación */
.badge-etapa--en-operacion {
  background: rgba(34, 139, 60, 0.12);
  color: #1A6B2E;
}

.badge-etapa--en-operacion .badge-dot {
  background: #1A6B2E;
}

/* Etapa: Cierre */
.badge-etapa--cierre {
  background: rgba(8, 40, 62, 0.12);
  color: #08283E;
}

.badge-etapa--cierre .badge-dot {
  background: #08283E;
}

/* Estado: Activo */
.badge-estado--activo {
  background: rgba(34, 139, 60, 0.12);
  color: #1A6B2E;
}

.badge-estado--activo .badge-dot {
  background: #1A6B2E;
}

/* Estado: En pausa */
.badge-estado--en-pausa {
  background: rgba(216, 166, 34, 0.12);
  color: #8A6010;
}

.badge-estado--en-pausa .badge-dot {
  background: #D8A622;
}

/* ===== Project index action buttons ===== */
.btn-proj-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--hk-navy);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s ease;
}

.btn-proj-filter:hover {
  background: rgba(8, 40, 62, 0.05);
}

[data-theme="dark"] .btn-proj-filter {
  color: #fff;
}

.btn-proj-new {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #406C7F;
  color: #F0EEE9;
  border: 1px solid #D8A622;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}

.btn-proj-new:hover {
  background: #35596A;
  border-color: #C4941A;
}

.btn-proj-view {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--hk-navy);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s ease;
  white-space: nowrap;
}

.btn-proj-view:hover {
  background: rgba(8, 40, 62, 0.06);
}

[data-theme="dark"] .btn-proj-view {
  color: #fff;
}

/* ===== Campo bloqueado (Waterfall – monto desde Finanzas) ===== */
.campo-bloqueado {
  background: rgba(8, 40, 62, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
}

[data-theme="dark"] .campo-bloqueado {
  background: rgba(255, 255, 255, 0.05);
}

.campo-bloqueado__valor {
  font-size: 22px;
  font-weight: 700;
  color: var(--hk-navy);
  margin-bottom: 4px;
}

[data-theme="dark"] .campo-bloqueado__valor {
  color: #fff;
}

.campo-bloqueado__origen {
  font-size: 11px;
  color: var(--hk-teal);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.campo-bloqueado__detalle {
  font-size: 12px;
  color: var(--hk-navy);
  opacity: 0.7;
  margin-bottom: 8px;
}

[data-theme="dark"] .campo-bloqueado__detalle {
  color: rgba(255, 255, 255, .6);
}

.campo-bloqueado__link {
  font-size: 12px;
  color: var(--hk-teal);
  text-decoration: none;
  font-weight: 500;
}

.campo-bloqueado__link:hover {
  text-decoration: underline;
}

/* ===== Aviso info (Waterfall – sin inversiones) ===== */
.aviso-info {
  font-size: 12px;
  color: var(--hk-teal);
  background: rgba(64, 108, 127, 0.08);
  border: 1px solid rgba(64, 108, 127, 0.20);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 6px;
  line-height: 1.6;
}

.aviso-info a {
  color: var(--hk-teal);
  font-weight: 600;
  text-decoration: none;
}

.aviso-info a:hover {
  text-decoration: underline;
}

/* Header de página documentos */
.doc-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}

.doc-page-header h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--text);
}

.doc-page-header__sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.doc-page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* ===== DMS — Buscador, Tags, Versiones, Carpetas ===== */

.doc-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 960px) {
  .doc-layout {
    grid-template-columns: 1fr;
  }
}

.doc-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Upload card */
.doc-upload-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: 18px 20px 22px;
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
}

.doc-upload-card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--hk-teal);
}

.doc-upload-card .field {
  margin-bottom: 10px;
}

.doc-upload-card .field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 5px;
  display: block;
}

.doc-upload-card select,
.doc-upload-card input[type="text"],
.doc-upload-card input[type="date"],
.doc-upload-card input[type="file"] {
  width: 100%;
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 7px;
  outline: none;
  transition: border-color .15s ease;
}

.doc-upload-card select:focus,
.doc-upload-card input:focus {
  border-color: var(--hk-teal);
  box-shadow: 0 0 0 3px rgba(64, 108, 127, .12);
}

.doc-upload-hint {
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 4px;
  display: block;
}

.doc-upload-btn {
  width: 100%;
  margin-top: 14px;
  padding: 10px;
  background: var(--hk-navy);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}

.doc-upload-btn:hover {
  background: var(--hk-teal);
}

.doc-clear-btn {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--hk-red);
  text-decoration: none;
  font-weight: 500;
}

.doc-clear-btn:hover {
  text-decoration: underline;
}

/* Tags checkboxes en upload */
.doc-tag-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.doc-tag-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

/* Panel principal */
.doc-main {
  min-width: 0;
}

.doc-results-bar {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}

.doc-results-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.doc-results-filtered {
  background: rgba(216, 166, 34, .15);
  color: #8A6010;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 4px;
  font-weight: 600;
}

/* Toggle vista */
.doc-view-toggle {
  display: inline-flex;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}

.doc-view-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
  transition: background .12s, color .12s;
}

.doc-view-btn svg {
  width: 15px;
  height: 15px;
}

.doc-view-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.doc-view-btn.is-active {
  background: var(--hk-navy);
  color: #fff;
}

/* Tabla lista */
.doc-list-group {
  margin: 18px 0;
}

.doc-list-group__title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--hk-navy);
  margin-bottom: 8px;
  padding-left: 2px;
}

.doc-list-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  margin-bottom: 9px;
}

.doc-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.doc-table thead th {
  background: rgba(8, 40, 62, .03);
  color: var(--hk-teal);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.doc-th-sortable {
  cursor: pointer;
  user-select: none;
}

.doc-th-sortable:hover {
  color: var(--hk-navy);
}

.doc-sort-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 9px;
}

.doc-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.doc-table tbody tr:last-child td {
  border-bottom: 0;
}

.doc-table tbody tr:hover td {
  background: rgba(8, 40, 62, .02);
}

.doc-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 600;
  border-radius: 6px;
  background: rgba(64, 108, 127, .10);
  color: var(--hk-teal);
  white-space: nowrap;
  text-transform: capitalize;
}

.doc-name {
  font-weight: 500;
  font-size: 13px;
  color: var(--text);
}

.doc-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.doc-description {
  font-size: 11.5px;
  color: var(--text-soft);
  font-style: italic;
  margin-top: 2px;
}

.doc-version-badge {
  background: rgba(216, 166, 34, .15);
  color: #8A6010;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
}

.doc-versions-link {
  font-size: 11px;
  font-weight: 600;
  color: var(--hk-teal);
  text-decoration: none;
  background: rgba(64, 108, 127, .10);
  padding: 2px 7px;
  border-radius: 5px;
}

.doc-versions-link:hover {
  background: rgba(64, 108, 127, .20);
}

/* Tags en tabla */
.doc-tags-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.doc-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(216, 166, 34, .12);
  color: #7A5500;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(216, 166, 34, .25);
}

.doc-tag-remove {
  all: unset;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  color: #7A5500;
  opacity: .6;
}

.doc-tag-remove:hover {
  opacity: 1;
}

.doc-tag-select {
  font-family: var(--font);
  font-size: 11px;
  padding: 2px 6px;
  border: 1px dashed var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  outline: none;
}

.doc-entity {
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 3px 7px;
  border-radius: 5px;
  border: 1px solid var(--border);
}

/* Acciones */
.doc-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: flex-end;
}

.doc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  font-size: 13px;
}

.doc-btn:hover {
  background: var(--surface-2);
  color: var(--hk-teal);
  border-color: var(--hk-teal);
}

.doc-btn--danger {
  color: var(--hk-red);
  background: rgba(200, 32, 45, .04);
  border-color: rgba(200, 32, 45, .2);
}

.doc-btn--danger:hover {
  background: rgba(200, 32, 45, .1);
  border-color: var(--hk-red);
}

/* Vista carpetas */
.doc-folders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.doc-folder {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}

.doc-folder:hover {
  border-color: var(--hk-teal);
  box-shadow: var(--shadow-2);
}

.doc-folder__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.doc-folder__icon {
  font-size: 28px;
  flex-shrink: 0;
}

.doc-folder__info {
  flex: 1;
  min-width: 0;
}

.doc-folder__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-transform: capitalize;
}

.doc-folder__count {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.doc-folder__chevron {
  font-size: 20px;
  color: var(--text-soft);
  transition: transform .2s ease;
  line-height: 1;
}

.doc-folder__body {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  padding-left: 18px;
}

.doc-folder__body.is-open {
  display: block;
}

/* Subcarpetas (empresa > proyecto > tipo) */
.doc-folder__body .doc-folder {
  margin: 6px 12px 6px 0;
  box-shadow: none;
}

.doc-folder__body .doc-folder .doc-folder__head {
  padding: 10px 14px;
}

.doc-folder__body .doc-folder .doc-folder__icon {
  font-size: 20px;
}

.doc-folder--project {
  border-left: 3px solid var(--hk-teal);
}

.doc-folder__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}

.doc-folder__item:last-child {
  border-bottom: 0;
}

.doc-folder__item:hover {
  background: rgba(8, 40, 62, .03);
}

.doc-folder__item-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.doc-folder__item-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.doc-folder__item-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-folder__item-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.doc-folder__item-desc {
  font-size: 11.5px;
  color: var(--text-soft);
  font-style: italic;
  margin-top: 2px;
}

.doc-folder__item-actions {
  flex-shrink: 0;
}

/* Empty state */
.doc-empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.doc-empty__icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: .5;
}

.doc-empty__text {
  font-size: 14px;
  font-weight: 500;
}

.doc-empty__sub {
  font-size: 12.5px;
  color: var(--text-soft);
  margin-top: 6px;
}

/* Utilitario */
.doc-hidden {
  display: none !important;
}

/* Entidades adicionales en upload */
.doc-extra-entity {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.doc-extra-entity select,
.doc-extra-entity input {
  width: 100%;
  font-family: var(--font);
  font-size: 12.5px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 6px;
  outline: none;
}

.doc-add-entity-btn {
  all: unset;
  cursor: pointer;
  font-size: 12px;
  color: var(--hk-teal);
  font-weight: 600;
  margin-top: 6px;
  display: inline-block;
}

.doc-add-entity-btn:hover {
  text-decoration: underline;
}

/* ===== Versiones ===== */
.doc-versions-wrap {
  max-width: 900px;
}

.doc-version-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.doc-version-pill--current {
  background: rgba(46, 125, 91, .10);
  color: #1A6B2E;
  border-color: rgba(46, 125, 91, .25);
}

.doc-version-current-label {
  font-size: 10px;
  font-weight: 500;
  opacity: .7;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.doc-sha {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--text-soft);
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  cursor: help;
}

/* ===== Nuevo Proyecto — Stepper ===== */

.proj-create-wrap {
  max-width: 1100px;
}

/* Stepper */
.proj-stepper {
  display: flex;
  align-items: center;
  margin-bottom: 28px;
  gap: 0;
}

.proj-step {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.proj-step__circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: all .2s ease;
  flex-shrink: 0;
}

.proj-step.is-active .proj-step__circle {
  background: var(--hk-navy);
  border-color: var(--hk-navy);
  color: #fff;
}

.proj-step.is-done .proj-step__circle {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.proj-step__label {
  line-height: 1.2;
}

.proj-step__num {
  font-size: 10px;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: .1em;
}

.proj-step__name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.proj-step.is-active .proj-step__name {
  color: var(--hk-navy);
}

.proj-step.is-done .proj-step__name {
  color: var(--success);
}

.proj-step__line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 12px;
}

/* Body layout */
.proj-create-body {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 960px) {
  .proj-create-body {
    grid-template-columns: 1fr;
  }

  .proj-stepper {
    flex-wrap: wrap;
    gap: 8px;
  }

  .proj-step__line {
    display: none;
  }
}

/* Paneles */
.proj-panel {
  display: none;
}

.proj-panel.is-active {
  display: block;
}

.proj-panel__head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.proj-panel__num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--hk-navy);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.proj-panel__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.proj-panel__sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.proj-panel__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* Input con prefijo/sufijo */
.proj-input-suffix {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-elev);
  transition: border-color .15s, box-shadow .15s;
}

.proj-input-suffix:focus-within {
  border-color: var(--hk-teal);
  box-shadow: 0 0 0 3px rgba(64, 108, 127, .12);
}

.proj-input-prefix,
.proj-input-unit {
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
  white-space: nowrap;
  border-right: 1px solid var(--border);
}

.proj-input-unit {
  border-right: none;
  border-left: 1px solid var(--border);
}

.proj-input-suffix input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 12px;
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--text);
  outline: none;
}

/* Moneda toggle */
.proj-currency-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
}

.proj-currency-btn {
  padding: 8px 24px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.proj-currency-btn.is-active {
  background: var(--hk-navy);
  color: #fff;
}

/* Plazo calculado */
.proj-plazo-calc {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--hk-teal);
  background: rgba(64, 108, 127, .08);
  border: 1px solid rgba(64, 108, 127, .20);
  border-radius: 7px;
  padding: 8px 14px;
}

/* Panel lateral — resumen en vivo */
.proj-create-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
}

.proj-live-card {
  background: var(--hk-navy);
  border-radius: var(--radius-lg);
  padding: 18px 20px 20px;
  color: #fff;
}

.proj-live-card__head {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: rgba(255, 255, 255, .5);
  margin-bottom: 14px;
}

.proj-live-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  font-size: 13px;
}

.proj-live-row span {
  color: rgba(255, 255, 255, .6);
}

.proj-live-row strong {
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.proj-live-amt {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.proj-live-pct {
  color: rgba(255, 255, 255, .45);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  min-width: 34px;
  text-align: right;
}

.proj-live-row--total {
  padding-top: 10px;
  margin-top: 4px;
}

.proj-live-row--total span {
  color: rgba(255, 255, 255, .8);
  font-weight: 600;
}

.proj-live-row--total strong {
  font-size: 18px;
}

.proj-live-divider {
  height: 1px;
  background: rgba(255, 255, 255, .1);
  margin: 4px 0;
}

/* Completitud */
.proj-completitud-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-1);
}

.proj-completitud__head {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 12px;
}

.proj-completitud__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.proj-comp-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-muted);
  transition: color .2s;
}

.proj-comp-item.is-done {
  color: var(--text);
}

.proj-comp-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
  transition: all .2s;
  position: relative;
}

.proj-comp-item.is-done .proj-comp-dot {
  background: var(--success);
  border-color: var(--success);
}

.proj-comp-item.is-done .proj-comp-dot::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 10px;
  color: #fff;
  font-weight: 700;
}

/* Resumen final paso 4 */
.proj-summary-final {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 8px;
}

.proj-live-row[hidden],
.proj-summary-row[hidden] {
  display: none;
}

.proj-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

.proj-summary-row:last-child {
  border-bottom: 0;
}

.proj-summary-row span {
  color: var(--text-muted);
}

.proj-summary-row strong {
  font-weight: 600;
}

/* ===== Project View ===== */

.pv-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 960px) {
  .pv-layout {
    grid-template-columns: 1fr;
  }
}

/* KPIs de flujo */
.pv-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

@media (max-width: 980px) {
  .pv-kpis {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .pv-kpis {
    grid-template-columns: 1fr;
  }
}

.pv-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
}

.pv-kpi::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.pv-kpi--green::before {
  background: var(--success);
}

.pv-kpi--red::before {
  background: var(--danger);
}

.pv-kpi--teal::before {
  background: var(--hk-teal);
}

.pv-kpi--gold::before {
  background: var(--hk-gold);
}

.pv-kpi__label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.pv-kpi__value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.pv-kpi__value span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 4px;
}

.pv-kpi__sub {
  font-size: 11.5px;
  color: var(--text-soft);
  margin-top: 4px;
}

/* Detalles grid */
.pv-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.pv-detail-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.pv-detail-item:nth-last-child(-n+2) {
  border-bottom: 0;
}

.pv-detail-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-soft);
}

.pv-detail-value {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
}

/* Panel lateral */
.pv-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
}

/* Accesos rápidos */
.pv-quick-links {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}

.pv-quick-head {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border);
}

.pv-quick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}

.pv-quick-item:last-child {
  border-bottom: 0;
}

.pv-quick-item:hover {
  background: var(--surface-2);
  color: var(--hk-teal);
}

/* Detalle del proyecto (Preliminar): resumen, composición de la venta y cascada con desglose */
.pv-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 980px) {
  .pv-facts {
    grid-template-columns: 1fr;
  }
}

.pv-fact {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: 14px 16px;
  border-top: 3px solid var(--hk-teal);
}

.pv-fact h4 {
  margin: 0 0 8px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--hk-teal);
}

.pv-fact dl {
  margin: 0;
  display: grid;
  gap: 2px;
}

.pv-fact dt {
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 6px;
}

.pv-fact dd {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.pv-card {
  margin-top: 14px;
}

.pv-card .card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pv-card__hint {
  font-size: 12px;
  color: var(--text-muted);
}

.pv-split {
  display: flex;
  gap: 2px;
  height: 18px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2);
}

.pv-split span {
  flex-grow: 0;
  flex-shrink: 1;
  min-width: 3px;
}

.pv-split-legend {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px 16px;
}

.pv-split-legend li {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  column-gap: 8px;
  align-items: center;
  font-size: 12.5px;
  color: var(--text-muted);
}

.pv-split-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.pv-split-legend b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.pv-split-legend em {
  grid-column: 2 / -1;
  font-style: normal;
  font-size: 12px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.pv-alert {
  margin: 12px 0 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(200, 32, 45, .08);
  color: var(--danger);
  font-size: 12.5px;
}

.pv-wf {
  font-size: 13px;
}

.pv-wf td.num,
.pv-wf th.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pv-wf__row.is-in td:first-child {
  box-shadow: inset 3px 0 0 var(--success);
}

.pv-wf__row.is-out td:first-child {
  box-shadow: inset 3px 0 0 var(--hk-red);
}

.pv-wf__row td:first-child {
  padding-left: 14px;
}

.pv-wf__row.is-in td:last-child b {
  color: var(--success);
}

.pv-wf__toggle,
.pv-wf__label {
  font: inherit;
  font-weight: 600;
  color: var(--text);
}

.pv-wf__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.pv-wf__toggle:hover {
  color: var(--hk-teal);
}

.pv-wf__toggle:focus-visible {
  outline: 2px solid var(--hk-teal);
  outline-offset: 2px;
  border-radius: 4px;
}

.pv-wf__chev {
  display: inline-block;
  width: 12px;
  color: var(--hk-teal);
  transition: transform .15s;
}

.pv-wf__toggle[aria-expanded="true"] .pv-wf__chev {
  transform: rotate(90deg);
}

.pv-wf__detail {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

.pv-wf__vat {
  color: var(--text-muted);
}

.pv-wf__item td {
  background: var(--surface-2);
  font-size: 12.5px;
}

.pv-wf__item td:first-child {
  padding-left: 36px;
}

.pv-wf__total td {
  background: var(--hk-navy);
  color: #fff;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border: 0;
  padding: 12px 14px;
}

.pv-wf__total td:last-child {
  color: var(--hk-gold);
  font-size: 15px;
}

.pv-wf__total.is-negative td:last-child {
  color: #F2767F;
}

.pv-note {
  font-size: 12px;
  color: var(--text-muted);
  margin: 10px 0 0;
}

.pv-rp__vat {
  color: var(--text-muted);
}

.pv-rp__pct {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.pv-rp__pct input {
  width: 78px;
  text-align: right;
  padding: 4px 6px;
  border: 1px solid var(--hk-teal);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.pv-rp__pct input:focus-visible {
  outline: 2px solid var(--hk-teal);
  outline-offset: 1px;
}

.pv-rp__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.pv-rp__actions .pv-note {
  margin: 0;
  margin-right: auto;
}

/* Calendario: estado, línea de tiempo con etapas y tabla de etapas */
.pv-facts--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 980px) {
  .pv-facts--4 {
    grid-template-columns: 1fr 1fr;
  }
}

.pv-fact__big {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.pv-fact__sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

[data-pv-panel="calendario"] {
  --tl-in: #2E7D5B;
  --tl-out: #C8202D;
  --tl-ret: #1D5FD1;
}

[data-theme="dark"] [data-pv-panel="calendario"] {
  --tl-in: #5BC892;
  --tl-out: #F2767F;
  --tl-ret: #7AA8FF;
}

.pv-tl {
  position: relative;
  min-width: 720px;
}

.pv-tl__legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.pv-tl__legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: -1px;
}

.pv-tl__legend i.is-today {
  width: 2px;
  height: 12px;
  border-radius: 0;
  background: var(--hk-gold);
}

.pv-tl__legend-note {
  color: var(--text-soft);
}

.pv-tl__card {
  position: absolute;
  z-index: 3;
  width: 172px;
  padding: 6px 8px;
  font-size: 11.5px;
  line-height: 1.35;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-1);
}

.pv-tl__card.is-return {
  border-color: var(--tl-ret);
}

.pv-tl__card b {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.pv-tl__lbl {
  color: var(--text);
  font-weight: 600;
}

.pv-tl__lbl.is-return {
  color: var(--tl-ret);
}

.pv-tl__mv {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  color: var(--text-muted);
}

.pv-tl__mv span:last-child {
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pv-tl__mv.is-in span:last-child {
  color: var(--tl-in);
}

.pv-tl__mv.is-out span:last-child {
  color: var(--tl-out);
}

.pv-tl__mv.is-return span:last-child {
  color: var(--tl-ret);
}

.pv-tl__lead {
  position: absolute;
  z-index: 1;
  width: 1px;
  background: var(--border-strong);
}

.pv-tl__axis {
  position: absolute;
  left: 12px;
  right: 12px;
  height: 2px;
  background: var(--border-strong);
  border-radius: 2px;
}

.pv-tl__phase {
  position: absolute;
  z-index: 2;
  height: 18px;
  line-height: 18px;
  padding: 0 5px;
  background: var(--hk-teal);
  border-left: 2px solid var(--surface);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  box-sizing: border-box;
}

.pv-tl__phase.is-slack {
  background: repeating-linear-gradient(135deg, rgba(64, 108, 127, .35) 0 4px, rgba(64, 108, 127, .15) 4px 8px);
  color: var(--text);
}

.pv-tl__today {
  position: absolute;
  z-index: 2;
  width: 0;
  border-left: 2px dashed var(--hk-gold);
}

.pv-tl__dot {
  position: absolute;
  z-index: 3;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: var(--hk-navy);
  border: 2px solid var(--surface);
  box-sizing: content-box;
}

.pv-tl__dot.is-return {
  background: var(--tl-ret);
  width: 12px;
  height: 12px;
  margin-left: -6px;
}

.pv-tl__tick {
  position: absolute;
  font-size: 11px;
  color: var(--text-muted);
  transform: translateX(-50%);
  white-space: nowrap;
}

.pv-chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.pv-chip.is-done {
  background: rgba(46, 125, 91, .12);
  color: var(--success);
}

.pv-chip.is-current {
  background: rgba(216, 166, 34, .18);
  color: #8A6A10;
}

.pv-chip.is-pending {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

[data-theme="dark"] .pv-chip.is-current {
  color: var(--hk-gold);
}

/* Tabla de etapas del calendario */
.pv-cal {
  font-size: 13px;
}

.pv-cal th,
.pv-cal td {
  vertical-align: middle;
}

.pv-cal__name {
  font-weight: 600;
  color: var(--text);
}

.pv-cal__row.is-slack .pv-cal__name {
  font-weight: 500;
  color: var(--text-muted);
}

.pv-cal__slack-mark {
  color: var(--text-soft);
  margin-right: 6px;
}

.pv-cal__row.is-slack .pv-cal__stage {
  padding-left: 26px;
}

.pv-cal__key {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--hk-navy);
  background: rgba(64, 108, 127, .14);
}

[data-theme="dark"] .pv-cal__key {
  color: var(--text);
}

.pv-cal__period {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pv-cal__gantt-h,
.pv-cal__gantt {
  width: 34%;
  min-width: 180px;
}

.pv-cal__track {
  position: relative;
  height: 10px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.pv-cal__bar {
  position: absolute;
  top: -1px;
  bottom: -1px;
  border-radius: 5px;
  background: var(--hk-teal);
}

.pv-cal__row.is-slack .pv-cal__bar {
  background: repeating-linear-gradient(135deg, rgba(64, 108, 127, .55) 0 4px, rgba(64, 108, 127, .25) 4px 8px);
}

.pv-cal__row.is-done .pv-cal__bar {
  background: var(--success);
}

.pv-cal__row.is-current .pv-cal__bar {
  background: var(--hk-gold);
}

.pv-cal__now {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 0;
  border-left: 2px dashed var(--hk-gold);
}

.pv-cal__row.is-current td {
  background: rgba(216, 166, 34, .08);
}

.pv-cal__row.is-current td:first-child {
  box-shadow: inset 3px 0 0 var(--hk-gold);
}

.pv-cal__row.is-done .pv-cal__name {
  color: var(--text-muted);
}

@media (max-width: 720px) {
  .pv-cal__gantt-h,
  .pv-cal__gantt {
    display: none;
  }
}

/* Flujo de efectivo: gráfica de saldo y movimientos por fecha */
.pv-cf__in {
  color: var(--success);
}

.pv-cf__out {
  color: var(--hk-red);
}

[data-theme="dark"] .pv-cf__in {
  color: #5BC892;
}

[data-theme="dark"] .pv-cf__out {
  color: #F2767F;
}

.pv-cf-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.pv-cf-grid {
  stroke: var(--border);
  stroke-width: 1;
}

.pv-cf-grid.is-zero {
  stroke: var(--border-strong);
  stroke-width: 1.5;
}

.pv-cf-axis {
  font-size: 11px;
  fill: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.pv-cf-axis.is-ret {
  fill: #1D5FD1;
  font-weight: 600;
}

.pv-cf-ret {
  stroke: #1D5FD1;
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

.pv-cf-area {
  fill: rgba(64, 108, 127, .12);
}

.pv-cf-line {
  fill: none;
  stroke: var(--hk-navy);
  stroke-width: 2;
  stroke-linejoin: round;
}

[data-theme="dark"] .pv-cf-line {
  stroke: #C7D2DA;
}

.pv-cf-dot {
  stroke: var(--surface);
  stroke-width: 2;
  cursor: pointer;
  transition: r .12s;
}

.pv-cf-dot:hover {
  r: 7;
}

.pv-cf-dot.is-in {
  fill: var(--success);
}

.pv-cf-dot.is-out {
  fill: var(--hk-red);
}

.pv-cf-dot.is-return {
  fill: #1D5FD1;
}

.pv-cf__date td {
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  padding-top: 8px;
  padding-bottom: 8px;
}

.pv-cf__date td span {
  font-weight: 400;
  color: var(--text-muted);
}

.pv-cf__date.is-return td {
  color: #1D5FD1;
  box-shadow: inset 3px 0 0 #1D5FD1;
}

.pv-cf td.num {
  font-variant-numeric: tabular-nums;
}

.pv-cf td.pv-cf__in {
  color: var(--success);
  font-weight: 600;
}

.pv-cf td.pv-cf__out {
  color: var(--hk-red);
  font-weight: 600;
}

.pv-cf__warn {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--hk-red);
  background: rgba(200, 32, 45, .08);
}

.pv-callout {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(29, 95, 209, .25);
  border-left: 4px solid #1D5FD1;
  background: rgba(29, 95, 209, .06);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.pv-cf__hint {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  color: #1D5FD1;
  background: rgba(29, 95, 209, .08);
}

[data-theme="dark"] .pv-cf__hint,
[data-theme="dark"] .pv-callout {
  color: var(--text);
}

/* Equipo asignado */
.pv-team__head {
  align-items: flex-start !important;
}

.pv-team__roles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.pv-team__role-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px dashed var(--border-strong);
  color: var(--text-soft);
}

.pv-team__role-chip.is-covered {
  border-style: solid;
  border-color: rgba(46, 125, 91, .35);
  background: rgba(46, 125, 91, .08);
  color: var(--success);
}

.pv-team__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.pv-team__form[hidden] {
  display: none;
}

.pv-team__form-actions {
  display: flex;
  gap: 8px;
}

@media (max-width: 720px) {
  .pv-team__form {
    grid-template-columns: 1fr;
  }
}

.pv-team__empty {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 22px;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
}

.pv-team__empty b {
  color: var(--text);
}

.pv-team__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.pv-team__card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 4px 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--role);
  border-radius: var(--radius);
  background: var(--surface);
}

.pv-team__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: var(--role);
}

.pv-team__who {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  font-size: 12.5px;
}

.pv-team__who b {
  font-size: 14px;
  color: var(--text);
}

.pv-team__who a {
  color: var(--text-muted);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pv-team__who a:hover {
  color: var(--hk-teal);
  text-decoration: underline;
}

.pv-team__role {
  align-self: flex-start;
  margin-top: 6px;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: var(--role);
}

.pv-team__desc {
  font-size: 11.5px;
  color: var(--text-soft);
}

.pv-team__remove {
  margin: 0;
}

.pv-team__remove .btn:hover {
  color: var(--hk-red);
}

.pv-team__tasks {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
}

.pv-team__tasks b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.pv-team__tasks .is-late,
.pv-team__tasks .is-late b {
  color: var(--hk-red);
}

.pv-team__tasks:hover {
  color: var(--hk-teal);
}

.pv-cf__subtotal td {
  font-weight: 700;
  border-top: 2px solid var(--border-strong);
  background: var(--surface);
}

.pv-cf__date.is-dist td {
  color: #8A6A10;
  box-shadow: inset 3px 0 0 var(--hk-gold);
}

[data-theme="dark"] .pv-cf__date.is-dist td {
  color: var(--hk-gold);
}

.pv-wf__row.is-dist td:first-child {
  box-shadow: inset 3px 0 0 var(--hk-gold);
  padding-left: 14px;
}

.pv-cf td.pv-cf__dist {
  color: #8A6A10;
  font-weight: 600;
}

[data-theme="dark"] .pv-cf td.pv-cf__dist {
  color: var(--hk-gold);
}

.pv-cf-dist {
  stroke: var(--hk-gold);
  stroke-width: 2;
  stroke-dasharray: 4 3;
}

.pv-cf-dot.is-dist {
  fill: var(--hk-gold);
}

/* Reparto con el estilo de Flujo de efectivo */
.pv-rp .pv-wf__row.is-op td:first-child {
  box-shadow: inset 3px 0 0 var(--hk-navy);
}

.pv-rp .pv-wf__row.is-inv td:first-child {
  box-shadow: inset 3px 0 0 var(--hk-teal);
}

.pv-rp .pv-wf__row.is-hk td:first-child {
  box-shadow: inset 3px 0 0 var(--hk-gold);
}

.pv-rp .pv-wf__row td:first-child {
  padding-left: 14px;
}

.pv-rp-link {
  stroke: var(--border-strong);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.pv-rp-val {
  font-size: 11.5px;
  font-weight: 700;
  fill: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Panel lateral «Estructura financiera» de Preliminar */
.pv-fin {
  padding: 16px 18px 14px;
}

.pv-fin__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .55);
}

.pv-fin__head em {
  font-style: normal;
  font-weight: 700;
  color: var(--hk-gold);
  letter-spacing: .06em;
}

/* TIR del inversionista, destacada debajo del título */
.pv-fin__tir {
  margin: 12px 0 2px;
  padding: 12px 10px;
  border-radius: 10px;
  background: rgba(216, 166, 34, .12);
  border: 1px solid rgba(216, 166, 34, .35);
  text-align: center;
}
.pv-fin__tir span {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .7);
}
.pv-fin__tir strong {
  display: block;
  margin: 2px 0;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--hk-gold);
}
.pv-fin__tir strong.is-neg { color: #FF8A8A; }
.pv-fin__tir small {
  display: block;
  font-size: 11px;
  color: rgba(255, 255, 255, .55);
}

.pv-fin__section {
  margin: 14px 0 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, .1);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .45);
}

.pv-fin__section small {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: rgba(255, 255, 255, .35);
}

.pv-fin__row,
.pv-fin__result,
.pv-fin__cash {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
  padding: 5px 0;
  font-size: 12.5px;
}

.pv-fin__row span,
.pv-fin__result span,
.pv-fin__cash span {
  color: rgba(255, 255, 255, .72);
}

.pv-fin small {
  display: block;
  font-size: 10.5px;
  color: rgba(255, 255, 255, .42);
  line-height: 1.35;
  margin-top: 1px;
}

.pv-fin strong {
  color: #fff;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pv-fin__row--sub {
  margin-top: 2px;
  border-top: 1px dashed rgba(255, 255, 255, .14);
  padding-top: 7px;
}

.pv-fin__row--sub span {
  color: #fff;
  font-weight: 600;
}

.pv-fin strong.is-pos {
  color: #5BC892;
}

.pv-fin strong.is-neg {
  color: #F2767F;
}

.pv-fin__result {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .06);
}

.pv-fin__result span {
  color: #fff;
  font-weight: 600;
}

.pv-fin__result strong {
  color: var(--hk-gold);
  font-size: 17px;
}

.pv-fin__row--vat {
  padding: 8px 12px 4px;
}

.pv-fin__cash {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(91, 200, 146, .45);
  background: rgba(91, 200, 146, .1);
}

.pv-fin__cash span {
  color: #fff;
  font-weight: 600;
}

.pv-fin__cash strong {
  color: #5BC892;
  font-size: 17px;
}

.pv-fin__foot {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, .1);
}

/* Tareas del proyecto */
.tskp-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-muted);
}

.tskp-meter {
  height: 6px;
  margin-top: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}

.tskp-meter span {
  display: block;
  height: 100%;
  background: var(--success);
}

.tskp-team {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.tskp-member {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--role);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}

.tskp-member:hover {
  background: var(--surface-2);
}

.tskp-member[aria-pressed="true"] {
  background: var(--surface-2);
  box-shadow: 0 0 0 2px var(--role) inset;
}

.tskp-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--role, var(--hk-teal));
}

.tskp-avatar--sm {
  width: 28px;
  height: 28px;
  font-size: 11px;
  flex: none;
}

.tskp-member__who {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 13px;
}

.tskp-member__who b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tskp-member__who small {
  font-size: 11.5px;
  color: var(--text-muted);
}

.tskp-member__count {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.tskp-member__count em {
  font-style: normal;
  color: var(--hk-red);
  font-weight: 600;
}

.tskp-quick {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.5fr) minmax(0, .9fr) minmax(0, .8fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.tskp-quick .field {
  margin: 0;
}

@media (max-width: 900px) {
  .tskp-quick {
    grid-template-columns: 1fr 1fr;
  }

  .tskp-quick__title {
    grid-column: 1 / -1;
  }
}

.tskp-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.tskp-search {
  min-width: 220px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.tskp-active-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.tskp-who {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.tskp-who small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.tskp-table tr[hidden] {
  display: none;
}

.tskp-none {
  padding: 18px;
}

.pv-desc {
  font-size: 13.5px;
  line-height: 1.6;
}

/* ===== Projects Index ===== */

/* KPIs */
.pi-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

@media (max-width: 960px) {
  .pi-kpis {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .pi-kpis {
    grid-template-columns: 1fr;
  }
}

.pi-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px 18px;
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
}

.pi-kpi::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--border);
}

.pi-kpi--gold::before {
  background: var(--hk-gold);
}

.pi-kpi--teal::before {
  background: var(--hk-teal);
}

.pi-kpi--green::before {
  background: var(--success);
}

.pi-kpi__label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.pi-kpi__value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.pi-kpi__value span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 4px;
}

.pi-kpi__sub {
  font-size: 11.5px;
  color: var(--text-soft);
  margin-top: 4px;
}

/* Filtros */
.pi-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.tsk-filters-row {
  margin: 20px 0 0;
  padding: 0 22px 16px;
}

.pi-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.pi-search svg {
  width: 14px;
  height: 14px;
  color: var(--text-soft);
  flex-shrink: 0;
}

.pi-search input {
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  width: 100%;
}

.pi-filter-select {
  font-family: var(--font);
  font-size: 12.5px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  outline: none;
  cursor: pointer;
  transition: border-color .15s;
}

.pi-filter-select:focus {
  border-color: var(--hk-teal);
}

.tsk-filter-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.tsk-filter-check input {
  cursor: pointer;
}

.pi-results {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
}

/* Acciones por fila */
.pi-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.pi-doc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}

.pi-doc-btn:hover {
  background: var(--surface-2);
  border-color: var(--hk-teal);
}

/* ===== Dashboard ===== */

.db-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

@media (max-width: 960px) {
  .db-grid {
    grid-template-columns: 1fr;
  }
}

.db-main {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.db-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
}

/* ===== Reportes ===== */

.rpt-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 960px) {
  .rpt-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .rpt-grid {
    grid-template-columns: 1fr;
  }
}

.rpt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 22px 20px;
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color .15s, box-shadow .15s;
  position: relative;
  overflow: hidden;
}

.rpt-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--border);
}

.rpt-card--active::before {
  background: var(--hk-teal);
}

.rpt-card--soon::before {
  background: var(--border);
}

.rpt-card--active:hover {
  border-color: var(--hk-teal);
  box-shadow: var(--shadow-2);
}

.rpt-card__icon {
  font-size: 32px;
  line-height: 1;
}

.rpt-card__body {
  flex: 1;
}

.rpt-card__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.rpt-card__desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}

.rpt-card__foot {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.rpt-badge-soon {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-soft);
  border: 1px solid var(--border);
}

.rpt-card--soon {
  opacity: .75;
}

/* ===== Documento imprimible ===== */

.rpt-doc {
  background: #fff;
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  color: #1a1a1a;
  font-family: var(--font);
}

.rpt-doc__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--hk-navy);
}

.rpt-doc__meta {
  text-align: right;
}

.rpt-doc__meta-row {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  font-size: 12.5px;
  margin-bottom: 4px;
  color: #555;
}

.rpt-doc__meta-row strong {
  color: #1a1a1a;
  font-weight: 600;
}

.rpt-doc__section {
  margin-bottom: 28px;
}

.rpt-doc__section-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--hk-teal);
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid #e8e5dd;
}

.rpt-doc__two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.rpt-doc__field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
  border-bottom: 1px dashed #e8e5dd;
  font-size: 13px;
}

.rpt-doc__field span {
  color: #888;
  font-size: 11px;
}

.rpt-doc__field strong {
  color: #1a1a1a;
  font-weight: 600;
}

.rpt-doc__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.rpt-doc__table thead th {
  background: #f5f3ee;
  padding: 10px 12px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #555;
  border-bottom: 1px solid #ddd;
}

.rpt-doc__table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  color: #333;
}

.rpt-doc__table-total td {
  background: #f9f7f2;
  font-weight: 700;
  border-top: 2px solid #333;
  border-bottom: 0;
}

.rpt-doc__footer {
  margin-top: 40px;
  text-align: center;
}

.rpt-doc__signature {
  margin-bottom: 32px;
}

.rpt-doc__signature-line {
  width: 220px;
  height: 1px;
  background: #333;
  margin: 0 auto 8px;
}

.rpt-doc__signature div {
  font-size: 12px;
  color: #555;
}

.rpt-doc__disclaimer {
  font-size: 11px;
  color: #aaa;
  font-style: italic;
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Print */
@media print {
  .no-print {
    display: none !important;
  }

  .rail,
  .topbar {
    display: none !important;
  }

  /* Sin el menú lateral, el contenido no debe caer en su columna angosta: ocupa toda la hoja */
  .app {
    display: block !important;
  }

  .main {
    margin: 0 !important;
    width: 100% !important;
  }

  .page {
    padding: 0 !important;
  }

  body {
    background: #fff !important;
  }

  .rpt-doc {
    border: none;
    box-shadow: none;
    padding: 20px;
    max-width: 100%;
  }
}

/* ===== Tareas ===== */

/* Alerta vencidas */
.tsk-overdue-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(200, 32, 45, .07);
  border: 1px solid rgba(200, 32, 45, .25);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 18px;
}

.tsk-overdue-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.tsk-overdue-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 8px;
}

.tsk-overdue-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tsk-overdue-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(200, 32, 45, .08);
  border: 1px solid rgba(200, 32, 45, .20);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12.5px;
  color: var(--text);
}

.tsk-overdue-date {
  font-size: 11px;
  font-weight: 700;
  color: var(--danger);
}

.tsk-overdue-who {
  color: var(--text-muted);
  font-size: 11.5px;
}

.tsk-overdue-done {
  all: unset;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--success);
  background: rgba(46, 125, 91, .12);
  border-radius: 4px;
  padding: 1px 6px;
  transition: background .12s;
}

.tsk-overdue-done:hover {
  background: rgba(46, 125, 91, .22);
}

/* Layout */
.tsk-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  align-items: start;
}

@media (max-width: 960px) {
  .tsk-layout {
    grid-template-columns: 1fr;
  }
}

.tsk-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
}

.tsk-main {
  display: flex;
  flex-direction: column;
}

/* Calendario */
.tsk-cal {
  padding: 16px;
}

.tsk-cal__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.tsk-cal__month {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  text-transform: capitalize;
}

.tsk-cal__arrow {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 16px;
  color: var(--text-muted);
  transition: background .12s;
}

.tsk-cal__arrow:hover {
  background: var(--bg-sunken);
  color: var(--text);
}

.tsk-cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.tsk-cal__dow {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  padding: 4px 0;
}

.tsk-cal__cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  transition: background .1s;
}

.tsk-cal__cell:hover {
  background: var(--surface-2);
}

.tsk-cal__cell--has {
  cursor: pointer;
}

.tsk-cal__cell--today .tsk-cal__day {
  background: var(--hk-navy);
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.tsk-cal__cell--selected .tsk-cal__day {
  background: var(--rail-accent);
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
}

/* Cuando el día seleccionado también es hoy, el granate tiene prioridad */
.tsk-cal__cell--today.tsk-cal__cell--selected .tsk-cal__day {
  background: var(--rail-accent);
}

.tsk-cal__day {
  font-size: 12px;
  color: var(--text);
  line-height: 1;
}

.tsk-cal__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-top: 2px;
}

.tsk-cal__dot--red {
  background: var(--danger);
}

.tsk-cal__dot--amber {
  background: var(--warn);
}

.tsk-cal__dot--green {
  background: var(--success);
}

.tsk-cal__legend {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.tsk-cal__legend span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tsk-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.tsk-dot--red {
  background: var(--danger);
}

.tsk-dot--amber {
  background: var(--warn);
}

.tsk-dot--green {
  background: var(--success);
}

/* ===== Waterfall veto panel ===== */
.card--veto {
  border-color: var(--hk-red);
  background: #fff0f0;
  padding: 18px 22px;
  margin-bottom: 18px;
}

.card--veto__title {
  color: var(--hk-red);
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.card--veto__msg {
  color: var(--hk-red);
  font-weight: 600;
  margin: 8px 0 0;
  font-size: 13px;
}

/* ===== Task form: participantes ===== */
.task-participants-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  max-height: 148px;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--surface);
}

.task-participant-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12.5px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: background .12s, border-color .12s;
  user-select: none;
}

.task-participant-chip:hover {
  background: var(--surface-2);
}

.task-participant-chip input[type="checkbox"] {
  accent-color: var(--hk-teal);
  width: 13px;
  height: 13px;
  cursor: pointer;
}

.task-participant-chip:has(input:checked) {
  background: rgba(64,108,127,.12);
  border-color: var(--hk-teal);
  color: var(--hk-teal);
  font-weight: 500;
}

/* all-day toggle */
.task-allday-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
}

.task-allday-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--hk-teal);
  cursor: pointer;
}

/* Tareas del día */
.tsk-today-group {
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  margin-bottom: 4px;
}

.tsk-today-group:last-child {
  border-bottom: 0;
}

.tsk-today-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 6px;
  background: var(--surface-2);
}

.tsk-today-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--hk-navy);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.tsk-today-user span:nth-child(2) {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.tsk-today-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-sunken);
  padding: 2px 7px;
  border-radius: 999px;
}

.tsk-today-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px dashed var(--border);
  transition: background .1s, opacity .3s;
}

.tsk-today-item:last-child {
  border-bottom: 0;
}

.tsk-today-item:hover {
  background: rgba(8, 40, 62, .02);
}

.tsk-today-check {
  all: unset;
  cursor: pointer;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 11px;
  color: transparent;
  flex-shrink: 0;
  transition: all .15s;
}

.tsk-today-check:hover {
  border-color: var(--success);
  color: var(--success);
  background: rgba(46, 125, 91, .1);
}

.tsk-today-info {
  flex: 1;
  min-width: 0;
}

.tsk-today-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tsk-today-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.tsk-today-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.tsk-prio-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Tabla completa */
.tsk-row--overdue td {
  background: rgba(200, 32, 45, .03);
}

.tsk-status-sel {
  font-family: var(--font);
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border-color .15s;
  width: 100%;
}

.tsk-status--done {
  background: rgba(46, 125, 91, .1);
  color: var(--success);
}

.tsk-status--in_progress {
  background: rgba(216, 166, 34, .1);
  color: #8A6010;
}

.tsk-status--open {
  background: var(--surface);
}

/* ── Flash messages ─────────────────────────── */
.flash {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}
.flash--ok {
  background: rgba(46,125,91,.1);
  color: var(--success);
  border: 1px solid rgba(46,125,91,.25);
}
.flash--err {
  background: rgba(185,28,28,.08);
  color: var(--hk-red);
  border: 1px solid rgba(185,28,28,.2);
}

.tsk-status--cancelled {
  background: var(--surface-2);
  color: var(--text-soft);
}

/* ── Tareas canceladas / pendientes de autorización ────── */
.tsk-row--cancelled td {
  background: rgba(134, 148, 162, .1);
}

.tsk-row--pending-cancel td {
  background: rgba(216, 166, 34, .05);
}

/* ── Indicador de comentarios en el listado ────────────── */
.tsk-comment-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--hk-teal);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
}

.tsk-comment-badge:hover {
  text-decoration: underline;
}

.tsk-comment-toggle-arrow {
  font-size: 9px;
}

/* Comentarios expandibles dentro del listado de tareas */
.tsk-comments-inline {
  display: none;
  flex-direction: column;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.tsk-comment--sm {
  padding: 6px 9px;
}

.tsk-comment--sm .tsk-comment__body {
  font-size: 12px;
}

.tsk-pending-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #8A6010;
  background: rgba(216, 166, 34, .12);
  white-space: nowrap;
}

/* ── Encabezados ordenables (tabla de tareas) ──────────── */
.tsk-th-sortable {
  cursor: pointer;
  user-select: none;
}

.tsk-th-sortable:hover {
  color: var(--hk-navy);
}

.tsk-sort-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 9px;
}

/* ── Listado: solicitudes de cancelación pendientes ────── */
.tsk-cancel-card {
  margin-bottom: 18px;
  border-color: rgba(216, 166, 34, .35);
}

.tsk-cancel-approve {
  background: rgba(46, 125, 91, .12);
  color: var(--success);
  border: 1px solid rgba(46, 125, 91, .3);
  margin-right: 6px;
}

.tsk-cancel-reject {
  background: rgba(200, 32, 45, .08);
  color: var(--danger);
  border: 1px solid rgba(200, 32, 45, .25);
}

/* ── Modal: motivo de cancelación ──────────────────────── */
.tsk-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 40, 62, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.tsk-modal {
  background: var(--surface);
  border-radius: 12px;
  padding: 22px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
}

.tsk-modal__title {
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--text);
}

.tsk-modal__hint {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0 0 14px;
}

.tsk-modal textarea {
  width: 100%;
  font-family: var(--font);
  font-size: 13px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  resize: vertical;
}

.tsk-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

/* ── Comentarios de tarea ──────────────────────────────── */
.tsk-comments-list {
  display: flex;
  flex-direction: column;
}

.tsk-comment {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.tsk-comment__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.tsk-comment__author {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text);
}

.tsk-comment__date {
  font-size: 11px;
  color: var(--text-soft);
}

.tsk-comment__body {
  font-size: 13px;
  color: var(--text-muted);
  white-space: pre-wrap;
}

/* ── Crear/editar tarea: layout de dos columnas ────────── */
.tsk-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
  max-width: 1100px;
}

.tsk-form-side {
  display: flex;
  flex-direction: column;
}

@media (max-width: 900px) {
  .tsk-form-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Barra de progreso de subtareas ─────────────────────── */
.tsk-progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.tsk-progress-pct {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.tsk-progress-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.tsk-progress-wrap .tsk-progress-track {
  flex: 1;
}

.tsk-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--success);
  transition: width .2s ease;
}

/* ── Subtareas: indentadas, expandibles, uno debajo del otro ── */
.tsk-subtasks-inline {
  display: none;
  flex-direction: column;
  margin-top: 8px;
  margin-left: 20px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.tsk-subtasks-list {
  display: flex;
  flex-direction: column;
  margin-left: 20px;
}

.tsk-subtask-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.tsk-subtask-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  flex-shrink: 0;
}

.tsk-subtask-check.is-done {
  color: var(--success);
}

.tsk-subtask-title {
  font-size: 12.5px;
  color: var(--text);
  text-align: left;
}

.tsk-subtask-title.is-done {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* ── Tabs de vista: Calendario / Por proyecto / Por persona ── */
.tsk-view-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.tsk-view-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: border-color .15s, color .15s, background .15s;
}

.tsk-view-tab:hover {
  color: var(--text);
  border-color: var(--hk-teal);
}

.tsk-view-tab.is-active {
  color: #fff;
  background: var(--hk-navy);
  border-color: var(--hk-navy);
}

/* ── Vistas "por proyecto" / "por persona": tarjetas ────── */
.tsk-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  align-items: start;
}

.tsk-proj-card {
  display: flex;
  flex-direction: column;
}

.tsk-proj-card__foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.tsk-proj-card__foot a {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--hk-teal);
  text-decoration: none;
}

.tsk-proj-card__foot a:hover {
  text-decoration: underline;
}

.tsk-card-count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  flex-shrink: 0;
  height: fit-content;
}

.tsk-card-empty {
  font-size: 12.5px;
  color: var(--text-muted);
  padding: 18px 16px;
  text-align: center;
  margin: 0;
}

.tsk-card-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.tsk-card-item--cancelled {
  background: rgba(134, 148, 162, .1);
}

.tsk-card-item--pending-cancel {
  background: rgba(216, 166, 34, .05);
}

.tsk-card-item .tsk-prio-dot,
.tsk-card-item > .tsk-mini-badge,
.tsk-card-item > .tsk-pending-badge {
  margin-top: 3px;
}

.tsk-card-item:last-child {
  border-bottom: 0;
}

.tsk-card-item__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.tsk-card-item__title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tsk-card-item__title:hover {
  text-decoration: underline;
}

.tsk-card-item__title.is-done {
  text-decoration: line-through;
  color: var(--text-muted);
}

.tsk-card-item__meta {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tsk-mini-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.tsk-mini-badge.tsk-status--open {
  background: var(--surface-2);
  color: var(--text-muted);
}

/* ===== Pipeline (Kanban) ===== */
.pipe-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.pipe-summary__row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.pipe-summary__row--fill .pipe-summary__card {
  flex: 1 1 0;
}

.pipe-summary__card {
  flex: 1 1 150px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
}

.pipe-total-badge {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--hk-teal);
  background: rgba(64, 108, 127, .1);
  padding: 3px 11px;
  border-radius: 999px;
  margin-left: 10px;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

.pipe-summary__card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--stage-color, var(--hk-teal));
}

.pipe-summary__label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pipe-summary__value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.pipe-board-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 16px;
}

.pipe-board {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  width: max-content;
  min-width: 100%;
}

.pipe-col {
  flex: 0 0 290px;
  width: 290px;
  display: flex;
  flex-direction: column;
  background: var(--bg-sunken);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  max-height: calc(100vh - 340px);
  min-height: 260px;
  overflow: hidden;
}

.pipe-board--fill {
  width: 100%;
}

.pipe-board--fill .pipe-col {
  flex: 1 1 0;
  width: auto;
  min-width: 220px;
}

.pipe-col__head {
  padding: 13px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

.pipe-col__head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pipe-col__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 8px;
}

.pipe-col__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pipe-col__count {
  background: var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.pipe-col__body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  transition: background .15s ease;
}

.pipe-col__body.is-dragover {
  background: rgba(64, 108, 127, .1);
}

.pipe-col__empty {
  padding: 26px 12px;
  text-align: center;
  color: var(--text-soft);
  font-size: 12px;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
}

.pipe-card {
  /* Sin esto la columna (con altura máxima) comprime las tarjetas y corta su parte inferior;
     así conservan su altura completa y la columna se desplaza. */
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-1);
  overflow: hidden;
  cursor: grab;
  transition: box-shadow .15s ease, opacity .15s ease;
}

.pipe-card:hover {
  box-shadow: 0 4px 14px rgba(8, 40, 62, .12);
}

.pipe-card.is-dragging {
  opacity: .4;
}

.pipe-card__accent {
  height: 3px;
  background: var(--hk-gold);
}

.pipe-card__body {
  padding: 12px 14px;
}

.pipe-card__top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.pipe-card__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--hk-gold), var(--hk-red));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex: 0 0 28px;
}

.pipe-card__name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.pipe-card__email {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 10px;
}

.pipe-card__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.pipe-card__badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(64, 108, 127, .1);
  color: var(--hk-teal);
  white-space: nowrap;
}

.pipe-card__move {
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  max-width: 90px;
}
/* "Perdido" en los combos del pipeline: fondo rojo y letra blanca (la opción y el combo cuando ya está en Perdido) */
.pipe-opt--lost,
select option.pipe-opt--lost { background: var(--danger, #C8202D); color: #fff; font-weight: 600; }
.pipe-card__move--lost { background: var(--danger, #C8202D); border-color: var(--danger, #C8202D); color: #fff; font-weight: 600; }
.pipe-card__move--lost option:not(.pipe-opt--lost) { background: var(--surface); color: var(--text); font-weight: 400; }

/* Datos de seguimiento en la tarjeta del pipeline */
.pipe-card__meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: -4px 0 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pipe-card__meta b {
  color: var(--text);
  font-weight: 600;
}

.pipe-card__meta .is-overdue {
  color: var(--hk-red);
  font-weight: 600;
}

/* Formularios de transición y seguimiento */
.pipe-field-error {
  font-size: 11.5px;
  color: var(--hk-red);
}

.pipe-alert {
  background: rgba(64, 108, 127, .08);
  border: 1px solid rgba(64, 108, 127, .2);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13.5px;
}

.pipe-alert--error {
  background: rgba(200, 32, 45, .1);
  border-color: rgba(200, 32, 45, .2);
  color: var(--hk-red);
}

.pipe-alert--success {
  background: rgba(46, 125, 91, .1);
  border-color: rgba(46, 125, 91, .2);
  color: var(--success);
}

/* Historial de seguimiento del inversionista */
.fu-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fu-item {
  border: 1px solid var(--border);
  border-left: 3px solid var(--hk-teal);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--surface);
}

.fu-item--negotiation { border-left-color: var(--hk-gold); }
.fu-item--commitment  { border-left-color: var(--hk-navy); }
.fu-item--investment  { border-left-color: var(--success); }

.fu-item__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.fu-item__title {
  font-weight: 600;
  color: var(--text);
}

.fu-item__row {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.5;
}

.fu-item__row span {
  color: var(--text-muted);
}
/* Campos que se capturan siempre en mayúsculas (RFC / Tax ID) */
.input-upper {
  text-transform: uppercase;
}

/* Subida rápida de documentos (pipeline, proyectos, empresas) */
button.pi-doc-btn {
  font-family: inherit;
  line-height: 1;
  padding: 0;
}

.qu-dialog {
  border: none;
  padding: 0;
  background: transparent;
  width: calc(100% - 32px);
  max-width: 440px;
}

/* Contacto de seguimiento desde el tablero: dos columnas de campos */
.qu-dialog.qf-dialog {
  max-width: 600px;
}

.qu-dialog::backdrop {
  background: rgba(10, 20, 30, .45);
}

.qu-dialog .doc-upload-card {
  position: static;
}

.qu-entity {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: -4px 0 12px;
}

.qu-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.qu-actions .qu-submit {
  width: auto;
  margin-top: 0;
  padding-left: 22px;
  padding-right: 22px;
}

/* Pipeline: prospecto perdido */
.pipe-card--lost {
  opacity: .8;
}

.pipe-card--lost .pipe-card__avatar {
  background: var(--text-soft);
}

.pipe-col__head--lost {
  background: var(--hk-red);
  border-bottom-color: var(--hk-red-700);
}

.pipe-col__head--lost .pipe-col__title { color: #FFFFFF; }
.pipe-col__head--lost .pipe-col__dot { background: #FFFFFF !important; }
.pipe-col__head--lost .pipe-col__count {
  background: rgba(255, 255, 255, .22);
  color: #FFFFFF;
}

.fu-item--lost        { border-left-color: var(--text-soft); }
.fu-item--reactivated { border-left-color: var(--hk-teal); }

/* ===== Referidos ===== */
.ref-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.ref-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.ref-item__main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  font-size: 13px;
}

.ref-item__meta {
  font-size: 11.5px;
  color: var(--text-muted);
}

.ref-item__obs {
  font-size: 12px;
  color: var(--text);
}

.ref-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.ref-form {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

/* ===== Portal de referidos (layout sin menú del sistema) ===== */
.portal-body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

.portal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.portal-top__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
}

.portal-top__brand img {
  width: 32px;
  height: 32px;
}

.portal-top__brand small {
  display: block;
  font-weight: 500;
  font-size: 11px;
  color: var(--text-muted);
}

.portal-top__user {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
}

.portal-top__user a {
  color: var(--hk-red);
  text-decoration: none;
  font-size: 12px;
}

.portal-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.portal-section-title {
  font-size: 15px;
  font-weight: 600;
  margin: 8px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Proceso por etapa: semáforo de tiempo y avance de pasos (tableros y expediente) */
.proc-line {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  color: var(--text-muted);
  text-decoration: none;
}
.proc-line:hover { color: var(--hk-teal); }
.proc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--text-soft);
}
.proc--ok .proc-dot   { background: var(--success); }
.proc--warn .proc-dot { background: var(--warn); }
.proc--late .proc-dot { background: var(--danger); }
.proc--late { color: var(--danger); font-weight: 600; }
.proc--warn { color: #8a6a10; }

.proc-tasks { display: flex; flex-direction: column; gap: 8px; }
.proc-task {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  background: var(--surface);
  font-size: 13px;
}
.proc-task--done { background: var(--surface-2); }
.proc-task__head { display: flex; align-items: flex-start; gap: 8px; }
.proc-task__check {
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 50%;
  border: 1.6px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  margin-top: 1px;
}
.proc-task--done .proc-task__check { background: var(--success); border-color: var(--success); color: #fff; }
.proc-task__name { flex: 1; font-weight: 600; }
.proc-task--done .proc-task__name { font-weight: 500; }
.proc-task__tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.proc-tag {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg-sunken);
  color: var(--text-muted);
  white-space: nowrap;
}
.proc-tag--req { background: rgba(200, 32, 45, .1); color: var(--danger); }
.proc-task__meta { font-size: 12px; color: var(--text-muted); margin: 4px 0 0 26px; }
.proc-task__form { margin: 8px 0 0 26px; display: flex; flex-direction: column; gap: 6px; }
.proc-task__form textarea { width: 100%; }

/* Configuración de etapas: flujo del pipeline */
.proc-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.proc-flow__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12.5px;
  color: var(--text);
  text-decoration: none;
}
.proc-flow__chip .proc-dot { background: var(--stage-color); }
.proc-flow__chip small { color: var(--text-soft); font-size: 10.5px; }
.proc-flow__arrow { color: var(--text-soft); font-size: 12px; }

/* Al abrir "Editar" en la configuración, el formulario ocupa todo el ancho bajo los botones */
.proc-task__meta details[open] { flex-basis: 100%; }

/* Fricciones abiertas en la tarjeta del tablero */
.proc--friction { color: #8a6a10; font-weight: 600; }

/* ===== Empresas: industrias y personas de contacto ===== */
.ind-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface);
}
.ind-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ind-box .ind-chips:not(:empty) { margin-bottom: 8px; }
.ind-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
}
.ind-chip small { color: var(--text-muted); font-size: 10px; }
.ind-chip--new { border-style: dashed; }
.ind-chip--sm { padding: 1px 8px; font-size: 11px; }
.ind-chip__x {
  border: 0;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}
.ind-chip__x:hover { color: var(--hk-red); }
.ind-input-wrap { position: relative; }
.ind-input-wrap input { width: 100%; }
.ind-suggest {
  display: none;
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
  max-height: 240px;
  overflow-y: auto;
}
.ind-suggest button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.ind-suggest button:hover { background: var(--surface-2); }
.ind-confirm {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--hk-gold, var(--border));
  font-size: 12.5px;
  color: var(--text);
}

.ct-list { display: flex; flex-direction: column; gap: 6px; }
.ct-row {
  display: grid;
  grid-template-columns: minmax(130px, 1.3fr) minmax(90px, 1fr) minmax(140px, 1.4fr) minmax(110px, 1fr) 64px 64px 28px;
  gap: 6px;
  align-items: center;
}
.ct-row input[type=text], .ct-row input[type=email] { width: 100%; min-width: 0; }
.ct-row--head span {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}
.ct-row--head span:nth-child(5), .ct-row--head span:nth-child(6) { text-align: center; }
.ct-radio { display: flex; justify-content: center; margin: 0; }
/* Sin otras personas de contacto no se muestran los encabezados de la tabla */
.ct-list .ct-row--head:only-child { display: none; }
.ct-remove {
  border: 0;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.ct-remove:hover { color: var(--hk-red); }
@media (max-width: 760px) {
  .ct-row { grid-template-columns: 1fr 1fr; }
  .ct-row--head { display: none; }
}

.contact-under { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.ct-view { display: flex; flex-direction: column; gap: 10px; }
.ct-view__item { padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.ct-view__item:last-child { border-bottom: 0; padding-bottom: 0; }
.ct-view__name { font-weight: 600; font-size: 13px; color: var(--text); }
.ct-view__role { font-size: 11.5px; color: var(--text-muted); }
.ct-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
}

/* Catálogo de industrias */
.ind-dup {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.ind-dup__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ind-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.ind-inline input[type=text] { min-width: 200px; }

/* Empresas: participación en el total invertido de Harmoney Kapital */
.inv-share { display: inline-flex; align-items: center; gap: 6px; margin-top: 3px; }
.inv-share__bar {
  display: inline-block;
  width: 60px;
  height: 5px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.inv-share__bar span { display: block; height: 100%; background: var(--hk-gold, var(--hk-teal)); border-radius: 999px; }
.inv-share__pct { font-size: 11px; font-weight: 600; color: var(--text-muted); min-width: 38px; text-align: right; }

/* Due diligence: calificación de clientes (AAA–C) y semáforo de proveedores */
.rating-badge {
  display: inline-block;
  min-width: 34px;
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  letter-spacing: .02em;
  color: #FFFFFF;
  background: var(--text-soft);
}
.rating-badge--aaa { background: #1E7B4F; }
.rating-badge--aa  { background: #3E9B6B; }
.rating-badge--a   { background: #B8860B; }
.rating-badge--b   { background: #C8702D; }
.rating-badge--c   { background: var(--hk-red); }

.light-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface-2);
}
.light-badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.light-badge--green  { color: #1E7B4F; }
.light-badge--yellow { color: #B8860B; }
.light-badge--red    { color: var(--hk-red); }

.top-clients { display: flex; flex-direction: column; gap: 3px; }
.top-clients__item { display: flex; align-items: center; gap: 6px; text-decoration: none; color: var(--text); font-size: 12px; }
.top-clients__item:hover .top-clients__name { color: var(--hk-teal); }
.top-clients__name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-clients__pct { color: var(--text-muted); font-size: 11px; }

.dd-knockout {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--hk-red);
  font-size: 12.5px;
  color: var(--text);
}
.dd-knockout ul { margin: 6px 0 0; padding-left: 18px; }
.ct-check { display: flex; align-items: center; gap: 6px; font-weight: 500; cursor: pointer; }

/* Captura de un corporativo: formulario + calificación en vivo (counterparties/_rating_preview.php) */
.dd-layout { display: grid; grid-template-columns: minmax(0, 980px) 340px; gap: 18px; align-items: start; }
.dd-layout > form { max-width: none !important; }
.dd-preview {
  position: sticky;
  top: calc(var(--topbar-h, 56px) + 16px);
  max-height: calc(100vh - var(--topbar-h, 56px) - 32px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface, #fff);
  padding: 14px 16px;
}
.dd-preview__head { display: flex; align-items: center; gap: 12px; }
.dd-preview__badge { font-size: 18px; min-width: 52px; padding: 6px 8px; border-radius: 8px; }
.dd-preview__title { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.dd-preview__score { font-size: 13.5px; font-weight: 600; }
.dd-preview__toggle { display: none; margin-left: auto; }
.dd-preview__body { margin-top: 12px; }
.dd-why__summary { font-size: 12.5px; margin: 0 0 10px; line-height: 1.45; }
.dd-why__missing { margin-bottom: 10px; font-size: 12.5px; }
.dd-why { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dd-why__item { padding: 7px 9px; border-radius: 8px; border: 1px solid var(--border); border-left-width: 3px; font-size: 12.5px; }
.dd-why__item.is-full { border-left-color: var(--success); }
.dd-why__item.is-part { border-left-color: #B8860B; }
.dd-why__item.is-zero { border-left-color: var(--hk-red); }
.dd-why__row { display: flex; justify-content: space-between; gap: 8px; }
.dd-why__pts { font-weight: 700; white-space: nowrap; }
.dd-why__detail { color: var(--text-muted); font-size: 12px; }
.dd-why__fix { margin-top: 4px; font-size: 12px; line-height: 1.4; }
.dd-why__go {
  border: none; background: none; padding: 0; cursor: pointer;
  color: var(--hk-teal); font: inherit; font-weight: 600; text-decoration: underline;
}
.dd-flash { animation: dd-flash 1.8s ease-out; border-radius: 8px; }
@keyframes dd-flash { 0%, 35% { box-shadow: 0 0 0 3px var(--hk-teal); } 100% { box-shadow: 0 0 0 3px transparent; } }
.qu-dialog.dd-confirm { max-width: 620px; }
.dd-confirm .card__body:first-of-type { max-height: 62vh; overflow: auto; }
.dd-confirm__rating { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.dd-confirm__rating .rating-badge { font-size: 20px; min-width: 60px; padding: 8px; border-radius: 8px; }
.dd-confirm__actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--border); }
@media (max-width: 1200px) {
  /* Angosto (y dentro de la ventana del proyecto): el panel queda pegado abajo, solo con la calificación */
  .dd-layout { grid-template-columns: minmax(0, 1fr); }
  .dd-preview { top: auto; bottom: 0; z-index: 5; max-height: 70vh; box-shadow: 0 -6px 18px rgba(10, 20, 30, .12); }
  .dd-preview__toggle { display: inline-flex; }
  .dd-preview:not(.is-open) .dd-preview__body { display: none; }
}

/* Directorio de corporativos (counterparties/index.php) */
.corp-rels { display: flex; flex-direction: column; gap: 4px; }
.corp-rel { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.corp-rel a { color: var(--text); text-decoration: none; }
.corp-rel a:hover { color: var(--hk-teal); }
.corp-rel__score { color: var(--text-muted); font-size: 11.5px; }
.corp-rel__warn { color: var(--hk-red); font-size: 11.5px; font-weight: 600; }
.corp-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Ancla #pasos del expediente: que el título no quede bajo la barra superior fija */
#pasos { scroll-margin-top: calc(var(--topbar-h, 56px) + 16px); }

/* Pasos con captura: revisión de datos, origen e intento de contacto */
.proc-check { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.proc-check--row { flex-direction: row; flex-wrap: wrap; }
.proc-check--row > * { flex: 1 1 140px; }
.proc-check__item { font-size: 12.5px; color: var(--text); }
.proc-check__item span { display: inline-block; width: 14px; font-weight: 700; }
.proc-check__item.is-ok span { color: var(--success); }
.proc-check__item.is-missing span, .proc-check__item.is-missing { color: var(--hk-red); }

/* Paso de intento de contacto: intentos sin respuesta registrados */
.proc-attempts { margin: 4px 0 2px; padding: 8px 10px; border-radius: 8px; border: 1px dashed var(--border); font-size: 12px; color: var(--text-muted); display: flex; flex-direction: column; gap: 2px; }
.proc-attempts b { color: var(--text); }

/* Tarjeta de pasos: botón para terminar y volver al tablero del pipeline */
.proc-finish { display: flex; justify-content: flex-end; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }

/* Pasos con captura: formularios en rejilla (necesidad, perfil, agenda) */
.proc-check--grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.proc-check--grid > label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--text-muted); }
.proc-check--grid .span-2 { grid-column: 1 / -1; }
.proc-guarantees { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; }
.proc-guarantees legend { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
@media (max-width: 760px) { .proc-check--grid { grid-template-columns: 1fr; } }

/* Paso a "En evaluación": renglones de documentos recibidos */

/* Seguimiento (ambos pipelines): asignación de responsable reemplazada o ya no vigente, en rojo al 80 % */
.fu-item--superseded { opacity: .8; border-left-color: var(--danger); }
.fu-item--superseded, .fu-item--superseded .fu-item__head, .fu-item--superseded .fu-item__title,
.fu-item--superseded .fu-item__row, .fu-item--superseded .fu-item__row span { color: var(--danger); }

/* Paso del pipeline: un archivo por documento requerido / varios archivos de evidencia */
.proc-docs { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.proc-docs__title { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.proc-docs__row { display: grid; grid-template-columns: minmax(170px, 1fr) 2fr; gap: 4px 10px; align-items: center; font-size: 12.5px; color: var(--text); }
.proc-docs__row small { grid-column: 2; color: var(--text-muted); font-size: 11px; }
.proc-docs__row.is-ok > span { color: var(--success); }
.proc-docs__list { display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 760px) { .proc-docs__row { grid-template-columns: 1fr; } .proc-docs__row small { grid-column: 1; } }

/* Configuración del paso: documentos que pide y cuáles son obligatorios */
.doc-req { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; max-height: 260px; overflow-y: auto; }
.doc-req__row { display: grid; grid-template-columns: 1fr 70px 90px; align-items: center; gap: 6px; padding: 4px 10px; font-size: 12.5px; border-bottom: 1px solid var(--border); }
.doc-req__row:last-child { border-bottom: 0; }
.doc-req__row input { justify-self: center; }
.doc-req__row--head { position: sticky; top: 0; background: var(--surface-2); font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.doc-req__row--head span:not(:first-child) { text-align: center; }

/* Mis tareas: semáforo de lo que tengo a cargo */
.tsk-mine-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tsk-mine-tile { padding: 14px 16px; text-align: center; }
.tsk-mine-tile__num { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1.1; }
.tsk-mine-tile__num--red    { color: var(--hk-red); }
.tsk-mine-tile__num--yellow { color: #B8860B; }
.tsk-mine-tile__num--green  { color: #1E7B4F; }
.tsk-mine-tile__label { margin-top: 6px; font-size: 12px; color: var(--text-muted); }
@media (max-width: 640px) { .tsk-mine-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.light-badge { white-space: nowrap; }
.tsk-card-item__meta .light-badge { margin-right: 4px; padding: 0 7px; font-size: 10px; }

/* Contador del menú lateral (tareas vencidas o de hoy a mi cargo) */
.rail__badge {
  position: absolute; top: 6px; left: 36px;
  min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box;
  border-radius: 999px; background: var(--hk-red); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--rail-bg, #08283E);
}

/* Resumen en vivo: secciones (estado de resultados / flujo de efectivo) */
.proj-live-section {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--hk-gold);
  margin-bottom: 4px;
}
.proj-live-section small { text-transform: none; letter-spacing: 0; font-weight: 400; color: rgba(255, 255, 255, .45); }
.proj-live-date { display: block; font-size: 10.5px; color: rgba(255, 255, 255, .4); }
.proj-live-cf-empty { font-size: 11.5px; color: rgba(255, 255, 255, .45); margin-top: 6px; }

/* Nuevo proyecto con letra al 150 % (mismo tamaño que el calendario del proyecto) */
.proj-create-wrap--large { max-width: 1440px; font-size: 18.75px; }
.proj-create-wrap--large .proj-create-body { grid-template-columns: 1fr 400px; }
@media (max-width: 960px) { .proj-create-wrap--large .proj-create-body { grid-template-columns: 1fr; } }
.proj-create-wrap--large .proj-step__circle { width: 46px; height: 46px; font-size: 19.5px; }
.proj-create-wrap--large .proj-step__num { font-size: 15px; }
.proj-create-wrap--large .proj-step__name { font-size: 18.75px; }
.proj-create-wrap--large .proj-panel__num { font-size: 24px; width: 46px; height: 46px; }
.proj-create-wrap--large .proj-panel__title { font-size: 27px; }
.proj-create-wrap--large .proj-panel__sub { font-size: 19.5px; }
.proj-create-wrap--large .field label { font-size: 18px; }
.proj-create-wrap--large .field input,
.proj-create-wrap--large .field select,
.proj-create-wrap--large .field textarea,
.proj-create-wrap--large .proj-input-suffix input { font-size: 20px; padding: 13px 15px; }
.proj-create-wrap--large .proj-input-unit,
.proj-create-wrap--large .proj-input-prefix { font-size: 18.75px; }
.proj-create-wrap--large .doc-upload-hint,
.proj-create-wrap--large .field small { font-size: 16.5px; }
.proj-create-wrap--large .proj-currency-btn { font-size: 19.5px; }
.proj-create-wrap--large .btn { font-size: 20px; padding: 13px 24px; }
.proj-create-wrap--large .proj-summary-row { font-size: 20px; }
.proj-create-wrap--large .proj-live-card { padding: 24px 26px 26px; }
.proj-create-wrap--large .proj-live-card__head { font-size: 16.5px; }
.proj-create-wrap--large .proj-live-section { font-size: 16.5px; }
.proj-create-wrap--large .proj-live-row { font-size: 19.5px; }
.proj-create-wrap--large .proj-live-pct { font-size: 16.5px; min-width: 52px; }
.proj-create-wrap--large .proj-live-row--total strong { font-size: 27px; }
.proj-create-wrap--large .proj-live-date { font-size: 15.75px; }
.proj-create-wrap--large .proj-live-cf-empty { font-size: 17px; }
.proj-create-wrap--large .proj-completitud__head { font-size: 18px; }
.proj-create-wrap--large .proj-comp-item { font-size: 18.75px; }

/* Resumen en vivo: separación con línea doble entre estado de resultados y flujo de efectivo */
.proj-live-double {
  border-top: 3px double rgba(255, 255, 255, .55);
  margin: 22px 0 18px;
}
.proj-create-wrap--large .proj-live-double { margin: 30px 0 24px; border-top-width: 4px; }

.pv-cf .pv-wf__row.is-in td:last-child b {
  color: inherit;
}

/* Un botón con el atributo hidden no se muestra (.btn define display) */
.btn[hidden] {
  display: none !important;
}

.pv-rp__actions .btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.pv-fin__section small {
  display: inline;
  margin-left: 4px;
}

.tskp-active-filter[hidden],
.tskp-none[hidden] {
  display: none;
}

.tskp-team {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.tskp-member__who b {
  white-space: normal;
}

/* Botón secundario con contorno (acción alterna junto a la principal) */
.btn--outline {
  background: var(--surface);
  color: var(--hk-teal);
  border: 1px solid var(--hk-teal);
  font-weight: 600;
}

.btn--outline:hover {
  background: rgba(64, 108, 127, .08);
  color: var(--hk-navy);
}

[data-theme="dark"] .btn--outline {
  color: var(--text);
}

/* Nueva tarea */
.tskn-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}

@media (max-width: 960px) {
  .tskn-grid {
    grid-template-columns: 1fr;
  }
}

.tskn-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tskn-card .card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tskn-step {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--hk-teal);
  vertical-align: 1px;
}

.tskn-opt {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 4px;
}

.tskn-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.tskn-when {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.tskn-when input[type="date"] {
  max-width: 200px;
}

.tskn-quick-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tskn-quick-dates .tsk-view-tab {
  padding: 5px 11px;
  font-size: 12px;
  cursor: pointer;
}

.tskn-time {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tskn-time input[type="time"] {
  max-width: 140px;
}

.tskn-time input[type="time"]:disabled {
  opacity: .4;
}

.tskn-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.tskn-prio {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  background: var(--surface-2);
}

.tskn-prio label {
  margin: 0;
  cursor: pointer;
}

.tskn-prio input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tskn-prio span {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.tskn-prio input:focus-visible + span {
  outline: 2px solid var(--hk-teal);
}

.tskn-prio .is-low input:checked + span {
  background: rgba(46, 125, 91, .14);
  color: var(--success);
}

.tskn-prio .is-medium input:checked + span {
  background: rgba(216, 166, 34, .2);
  color: #8A6A10;
}

.tskn-prio .is-high input:checked + span {
  background: rgba(200, 32, 45, .12);
  color: var(--hk-red);
}

.tskn-group-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.task-participant-chip .tskn-role {
  margin-left: 4px;
  font-size: 10.5px;
  color: var(--hk-teal);
}

.task-participant-chip.is-checked {
  border-color: var(--hk-teal);
  background: rgba(64, 108, 127, .1);
}

.task-participant-chip.is-disabled {
  opacity: .45;
  cursor: not-allowed;
}

.tskn-side {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
}

.tskn-summary dl {
  margin: 0 0 14px;
  display: grid;
  gap: 2px;
}

.tskn-summary dt {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-top: 8px;
}

.tskn-summary dd {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.tskn-summary dd.is-empty {
  font-weight: 400;
  color: var(--text-soft);
  font-style: italic;
}

.tskn-submit,
.tskn-cancel {
  width: 100%;
  justify-content: center;
}

.tskn-cancel {
  margin-top: 6px;
}

.tskn-prio {
  align-self: flex-start;
  width: max-content;
  max-width: 100%;
}

/* Editar proyecto */
.pe-nav {
  position: sticky;
  top: var(--topbar-h);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  padding: 8px 0;
  background: var(--bg);
}

.pe-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}

.pe-nav a span {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 11px;
  color: #fff;
  background: var(--text-soft);
}

.pe-nav a:hover,
.pe-nav a.is-active {
  color: var(--text);
  border-color: var(--hk-teal);
}

.pe-nav a.is-active span {
  background: var(--hk-teal);
}

.pe-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

@media (max-width: 1100px) {
  .pe-grid {
    grid-template-columns: 1fr;
  }
}

.pe-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pe-card {
  scroll-margin-top: calc(var(--topbar-h) + 60px);
}

.pe-card .card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pe-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pe-two,
.pe-three {
  display: grid;
  gap: 12px;
  align-items: start;
}

.pe-two {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
}

.pe-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 760px) {
  .pe-two,
  .pe-three {
    grid-template-columns: 1fr;
  }
}

.pe-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.pe-block:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.pe-note {
  font-size: 12px;
  color: var(--text-muted);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.pe-side {
  position: sticky;
  top: calc(var(--topbar-h) + 60px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pe-live-badge {
  margin-top: 6px;
  font-size: 10.5px;
  color: rgba(255, 255, 255, .45);
}

.pe-live-error {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(242, 118, 127, .15);
  color: #F2767F;
  font-size: 12px;
}

.pe-save {
  width: 100%;
  justify-content: center;
}

/* Editar proyecto con pestañas */
.pe-tabs {
  margin: 0 0 12px;
}

.pe-card[hidden] {
  display: none;
}

#field-fx + .pe-block {
  border-top: 0;
  padding-top: 0;
}

/* Editar proyecto: mismo esquema que la pantalla del proyecto */
.btn--cancel {
  background: var(--rail-accent);
  border-color: var(--rail-accent);
  color: #fff;
  font-weight: 600;
}

.btn--cancel:hover {
  background: var(--hk-red-700);
  border-color: var(--hk-red-700);
  color: #fff;
}

.pe-editing {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #8A6A10;
  background: rgba(216, 166, 34, .16);
}

[data-theme="dark"] .pe-editing {
  color: var(--hk-gold);
}

.pe-form .pe-tabs {
  margin: 18px 0 12px;
}

.pe-form .pe-card {
  margin-top: 0;
}

.pe-form .pe-card {
  border-top: 3px solid var(--hk-teal);
}

.pe-form .pv-side .pe-save {
  width: 100%;
  justify-content: center;
}

.pe-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Editar proyecto · Venta y costos */
.pe-card__hint {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

.pe-amt {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--amt);
  border-radius: var(--radius);
  background: var(--surface);
}

.pe-amt.is-in {
  --amt: var(--success);
}

.pe-amt.is-out {
  --amt: var(--hk-red);
}

.pe-amt__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.pe-amt__head h4 {
  margin: 2px 0 0;
  font-size: 15px;
  color: var(--text);
}

.pe-amt__tag {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--amt);
}

.pe-amt__sum {
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.pe-amt__sum b {
  color: var(--text);
  font-size: 14px;
}

/* El total con IVA ya está en el encabezado de cada bloque */
.pe-amt [id$="_vat_rate-hint"],
.pe-amt .oc-field > label {
  display: none;
}

.pe-gross {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--hk-navy);
  color: #fff;
}

.pe-gross span {
  display: block;
  font-size: 11.5px;
  color: rgba(255, 255, 255, .55);
}

.pe-gross__val {
  text-align: right;
}

.pe-gross__val strong {
  display: block;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.pe-gross__val strong.is-pos {
  color: #5BC892;
}

.pe-gross__val strong.is-neg {
  color: #F2767F;
}

.pe-gross__val small {
  font-size: 11.5px;
  color: rgba(255, 255, 255, .6);
}

.li-row--head,
.oc-row--head {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-bottom: 2px !important;
  border-bottom: 0 !important;
}

.li-row--head[hidden],
.oc-row--head[hidden] {
  display: none;
}

.li-row--head > span:nth-child(5),
.oc-row--head > span:nth-child(5) {
  text-align: right;
}

.li-row--head {
  margin-top: 10px;
  row-gap: 0 !important;
}

/* Editar proyecto · Cupón y tarifas */
.pe-term {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px auto;
  gap: 14px;
  align-items: end;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

@media (max-width: 760px) {
  .pe-term {
    grid-template-columns: 1fr;
  }
}

.pe-term__val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.pe-term__field {
  margin: 0;
}

.pe-term__field input[readonly] {
  background: transparent;
  color: var(--text-muted);
}

.pe-formula {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  font-size: 12.5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.pe-formula > span {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.pe-formula small {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Guardar y Cancelar del panel: un solo renglón que ocupa el ancho del panel */
.pe-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pe-actions .pe-save {
  width: 100%;
  justify-content: center;
  white-space: nowrap;
  padding-left: 8px;
  padding-right: 8px;
}

/* Guardar y Cancelar del encabezado: mismo ancho que el panel (columna lateral de .pv-layout) */
.pe-actions--head {
  width: 280px;
  flex: none;
  align-self: flex-end;
}

@media (max-width: 960px) {
  .pe-actions--head {
    width: 100%;
  }
}

/* Nuevo proyecto: pasos como pestañas */
.pe-tabs .pn-num {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 6px;
  border-radius: 50%;
  font-size: 11px;
  background: var(--surface-2);
  color: var(--text-muted);
}

.pe-tabs .tsk-view-tab.is-active .pn-num {
  background: rgba(255, 255, 255, .2);
  color: #fff;
}

.pe-tabs .tsk-view-tab.is-done .pn-num {
  background: var(--success);
  color: #fff;
  font-size: 0;
}

.pe-tabs .tsk-view-tab.is-done .pn-num::before {
  content: '✓';
  font-size: 11px;
}

.pn-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.pn-score {
  font-size: 13px;
  color: var(--text-muted);
}

.pn-score b {
  font-size: 18px;
  color: var(--text);
}

.pn-checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.pn-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.pn-check i {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex: none;
}

.pn-check.is-done {
  border-style: solid;
  border-color: rgba(46, 125, 91, .35);
  background: rgba(46, 125, 91, .07);
  color: var(--text);
}

.pn-check.is-done i {
  border-color: var(--success);
  background: var(--success) url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>") center / 10px no-repeat;
}

.pe-live-empty {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .75);
  font-size: 12px;
}

.pe-live-empty[hidden],
.pe-live-error[hidden] {
  display: none;
}

/* Usuarios: consejo de administración */
.board-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--hk-red);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
}

.board-check input {
  margin-top: 3px;
}

.board-check b {
  display: block;
  font-size: 13.5px;
  color: var(--text);
}

.board-check small {
  font-size: 12px;
  color: var(--text-muted);
}

/* Aprobar: votación del comité de inversión */
.detail-tabs a.is-approval:not(.is-active) {
  color: var(--hk-red) !important;
  border-color: rgba(200, 32, 45, .35);
  background: rgba(200, 32, 45, .05);
}

.ap-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--hk-navy);
  color: #fff;
  border-left: 6px solid var(--st);
}

.ap-status.is-pending { --st: var(--hk-gold); }
.ap-status.is-favor { --st: #5BC892; }
.ap-status.is-contra { --st: #F2767F; }
.ap-status.is-abst { --st: #C7D2DA; }

.ap-status span {
  display: block;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .55);
}

.ap-status b {
  display: block;
  font-size: 20px;
  color: var(--st);
}

.ap-status small {
  font-size: 12.5px;
  color: rgba(255, 255, 255, .7);
}

.ap-status__count {
  text-align: right;
  font-size: 14px;
  color: rgba(255, 255, 255, .7);
}

.ap-status__count b {
  display: inline;
  font-size: 28px;
  color: #fff;
}

.ap-status__count small {
  display: block;
}

.ap-bar {
  margin-top: 10px;
  height: 10px;
}

.ap-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 640px) {
  .ap-options {
    grid-template-columns: 1fr;
  }
}

.ap-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
}

.ap-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.ap-option span {
  font-size: 22px;
}

.ap-option b {
  font-size: 14px;
  color: var(--text);
}

.ap-option.is-favor { --op: var(--success); }
.ap-option.is-contra { --op: var(--hk-red); }
.ap-option.is-abst { --op: var(--text-muted); }

.ap-option:has(input:checked) {
  border-color: var(--op);
  background: color-mix(in srgb, var(--op) 10%, var(--surface));
}

.ap-option:has(input:checked) b {
  color: var(--op);
}

.ap-option:has(input:focus-visible) {
  outline: 2px solid var(--hk-teal);
  outline-offset: 2px;
}

.ap-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ap-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--vt, var(--border-strong));
  border-radius: var(--radius);
  background: var(--surface);
}

.ap-item.is-favor { --vt: var(--success); }
.ap-item.is-contra { --vt: var(--hk-red); }
.ap-item.is-abst { --vt: var(--text-soft); }

.ap-item__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.ap-item p {
  margin: 6px 0 4px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.ap-item small {
  font-size: 11.5px;
  color: var(--text-muted);
}

.ap-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.ap-chip.is-favor { background: rgba(46, 125, 91, .14); color: var(--success); }
.ap-chip.is-contra { background: rgba(200, 32, 45, .12); color: var(--hk-red); }
.ap-chip.is-abst { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.ap-chip.is-pending { background: rgba(216, 166, 34, .16); color: #8A6A10; }

.ap-board {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pv-team__roles-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.pv-team__roles-list .pv-team__role {
  margin-top: 0;
}

.pv-locked {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(200, 32, 45, .35);
  background: rgba(200, 32, 45, .06);
  color: var(--hk-red);
  font-size: 13px;
  font-weight: 600;
  cursor: help;
}

.pv-locked {
  white-space: nowrap;
}

/* Aprobar: dos votaciones (comité → consejo) */
.ap-chip.is-pre { background: rgba(64, 108, 127, .16); color: var(--hk-teal); }
.ap-status.is-pre { --st: #7FB4C9; }

.ap-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 10px;
}

.ap-steps li {
  display: grid;
  grid-template-columns: 22px auto;
  column-gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .06);
  font-size: 12.5px;
  color: #fff;
}

.ap-steps li b {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 12px;
  background: rgba(255, 255, 255, .15);
  color: #fff;
}

.ap-steps li small {
  grid-column: 2;
  font-size: 11px;
  color: rgba(255, 255, 255, .6);
}

.ap-steps li.is-aprobado b { background: #5BC892; }
.ap-steps li.is-rechazado b { background: #F2767F; }
.ap-steps li.is-en_votacion b { background: var(--hk-gold); }

@media (max-width: 900px) {
  .ap-status { flex-direction: column; align-items: flex-start; }
}

.ap-body.is-locked {
  opacity: .75;
}

.ap-tally {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 2fr);
  gap: 10px;
  align-items: stretch;
}

@media (max-width: 760px) {
  .ap-tally { grid-template-columns: repeat(2, 1fr); }
}

.ap-tally__item {
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-top: 3px solid var(--tc, var(--border-strong));
  background: var(--surface);
}

.ap-tally__item b { display: block; font-size: 20px; color: var(--text); }
.ap-tally__item span { font-size: 11.5px; color: var(--text-muted); }
.ap-tally__item.is-favor { --tc: var(--success); }
.ap-tally__item.is-contra { --tc: var(--hk-red); }
.ap-tally__item.is-abstencion { --tc: var(--text-soft); }
.ap-tally__item.is-pending { --tc: var(--hk-gold); }

.ap-meter {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.ap-meter span {
  display: block;
  height: 8px;
  border-radius: 4px;
  background: var(--success);
  box-shadow: 0 0 0 1px var(--border) inset;
}

.ap-meter small { font-size: 12px; color: var(--text-muted); }

.ap-vote {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--hk-teal);
  background: rgba(64, 108, 127, .05);
}

.ap-vote__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.ap-auth { color: #8A6A10; }

.ap-authorize { margin-top: 6px; }

/* Estados de la votación */
.badge-estado--preaprobado { background: rgba(64, 108, 127, .14); color: var(--hk-teal); }
.badge-estado--preaprobado .badge-dot { background: var(--hk-teal); }
.badge-estado--aprobado { background: rgba(29, 95, 209, .12); color: #1D5FD1; font-weight: 700; }
.badge-estado--aprobado .badge-dot { background: #1D5FD1; }
.badge-estado--rechazado { background: rgba(200, 32, 45, .1); color: var(--hk-red); }
.badge-estado--rechazado .badge-dot { background: var(--hk-red); }
.badge-estado--cerrado { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.badge-estado--cerrado .badge-dot { background: var(--text-soft); }

/* Ciclo del proyecto */
.pc-cycle { margin-top: 0; margin-bottom: 14px; border-top: 3px solid var(--hk-navy); }

/* Mensaje de la etapa, debajo del título del ciclo */
.pc-cycle__msg {
  margin-top: 8px;
  padding: 8px 12px;
  border-left: 4px solid var(--hk-teal);
  border-radius: 6px;
  background: rgba(64, 108, 127, .1);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--hk-teal);
}
.pc-cycle__msg.is-ok { border-left-color: #2E8B57; background: rgba(46, 139, 87, .1); color: #2E8B57; }
.pc-cycle__msg.is-failed { border-left-color: var(--hk-red); background: rgba(200, 32, 45, .08); color: var(--hk-red); }
[data-theme="dark"] .pc-cycle__msg { color: #8FC1D4; }
[data-theme="dark"] .pc-cycle__msg.is-ok { color: #7FD1A3; }
[data-theme="dark"] .pc-cycle__msg.is-failed { color: #FF8A8A; }

.pc-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.pc-steps li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-muted);
}

.pc-steps li b {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  background: var(--border-strong);
  color: #fff;
  flex: none;
}

.pc-steps li.is-done { color: var(--text); }
.pc-steps li.is-done b { background: var(--success); }
.pc-steps li.is-current { background: var(--hk-navy); border-color: var(--hk-navy); color: #fff; font-weight: 700; }
.pc-steps li.is-current b { background: var(--hk-gold); color: var(--hk-navy); }
.pc-steps li.is-current.is-failed { background: var(--hk-red); border-color: var(--hk-red); }

@media (max-width: 760px) { .pc-steps { grid-template-columns: 1fr 1fr; } }

.pc-meters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 900px) { .pc-meters { grid-template-columns: 1fr; } }

.pc-meter__top { display: flex; justify-content: space-between; font-size: 13px; }
.pc-meter__top span { font-weight: 700; font-variant-numeric: tabular-nums; }
.pc-meter__bar { height: 8px; margin: 6px 0 4px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.pc-meter__bar span { display: block; height: 100%; background: var(--hk-teal); }
.pc-meter__bar span.is-full { background: var(--success); }
.pc-meter small { font-size: 11.5px; color: var(--text-muted); }

.pc-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(8, 40, 62, .45);
}

.pc-modal[hidden] { display: none; }

.pc-modal__box {
  width: min(460px, calc(100vw - 32px));
  padding: 22px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border-top: 4px solid var(--hk-gold);
  box-shadow: var(--shadow-pop);
}

.pc-modal__box h3 { margin: 0 0 8px; font-size: 17px; color: var(--text); }
.pc-modal__box p { margin: 0 0 16px; font-size: 13.5px; line-height: 1.5; color: var(--text-muted); }
.pc-modal__actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ===== Listado de proyectos: ciclo, tips, orden y captación (pl-*) ===== */
.badge-etapa--monitoreo { background: rgba(29, 95, 209, .1); color: #1D5FD1; }
.badge-etapa--monitoreo .badge-dot { background: #1D5FD1; }
.badge-etapa--fallido { background: rgba(200, 32, 45, .1); color: var(--hk-red); font-weight: 600; }
.badge-etapa--fallido .badge-dot { background: var(--hk-red); }
.badge-etapa--cerrado-fallido { background: var(--surface-2); color: var(--text-muted); border: 1px solid rgba(200, 32, 45, .35); }
.badge-etapa--cerrado-fallido .badge-dot { background: var(--hk-red); }
[data-tip] { cursor: help; }
.badge-etapa[data-tip]:focus-visible, .pl-info:focus-visible { outline: 2px solid var(--hk-teal); outline-offset: 2px; }

.pi-kpi--red::before { background: var(--hk-red); }
.pl-alert { color: var(--hk-red); font-weight: 600; }

.pl-cycle {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.pl-cycle__btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 1 0 auto;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.pl-cycle__btn span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pl-cycle__btn b { font-size: 15px; font-variant-numeric: tabular-nums; }
.pl-cycle__btn .badge-dot { background: var(--text-soft); }
.pl-cycle__btn:hover { border-color: var(--hk-teal); }
.pl-cycle__btn.is-empty { color: var(--text-soft); }
.pl-cycle__btn.is-empty b { font-weight: 500; }
.pl-cycle__btn.is-on { background: var(--hk-navy); border-color: var(--hk-navy); color: #fff; }
.pl-cycle__btn--prospeccion .badge-dot { background: #D8A622; }
.pl-cycle__btn--estructuracion .badge-dot { background: #406C7F; }
.pl-cycle__btn--en-operacion .badge-dot { background: #1A6B2E; }
.pl-cycle__btn--monitoreo .badge-dot { background: #1D5FD1; }
.pl-cycle__btn--cierre .badge-dot { background: #08283E; }
.pl-cycle__btn--fallido .badge-dot, .pl-cycle__btn--cerrado-fallido .badge-dot { background: var(--hk-red); }
.pl-cycle__btn.is-on .badge-dot { box-shadow: 0 0 0 2px #fff; }

.pl-clear {
  border: 0;
  background: none;
  padding: 4px 2px;
  color: var(--hk-teal);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.pl-clear[hidden] { display: none; }

.pl-table thead th { white-space: nowrap; }
.pl-table .pl-num { text-align: right; }

.pl-sort {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.pl-sort::after { content: '↕'; margin-left: 4px; opacity: .35; }
.pl-sort[data-dir="asc"]::after { content: '↑'; opacity: 1; }
.pl-sort[data-dir="desc"]::after { content: '↓'; opacity: 1; }

.pl-info {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  vertical-align: 1px;
}

.pl-table tbody tr[data-href] { cursor: pointer; }
.pl-table tbody tr.is-ended td { color: var(--text-muted); }
.pl-table tbody tr.is-ended .pl-name { color: var(--text-muted); }

.pl-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
  text-decoration: none;
}

.pl-name:hover { color: var(--hk-teal); text-decoration: underline; }
.pl-muted { color: var(--text-soft); font-size: 11.5px; }
.pl-dates { margin-top: 2px; white-space: nowrap; }
.pl-term { font-size: 13px; }

.pl-amount {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pl-amount small { font-size: 10.5px; font-weight: 500; color: var(--text-muted); }

.pl-raised {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 5px;
}

.pl-raised small { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

.pl-raised__bar {
  width: 70px;
  height: 5px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.pl-raised__bar span { display: block; height: 100%; border-radius: 999px; background: var(--hk-gold); }
.pl-raised__bar span.is-full { background: var(--success); }

.pl-tip {
  position: fixed;
  z-index: 1200;
  max-width: 280px;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--hk-navy);
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: var(--shadow-pop);
  pointer-events: none;
}

.pl-tip[hidden] { display: none; }

/* ===== Proyecto cerrado: aviso de solo lectura (projects/_readonly.php) ===== */
.hk-readonly {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 0 0 16px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--hk-navy);
  background: var(--surface-2);
  font-size: 13px;
  color: var(--text-muted);
}

.hk-readonly b { color: var(--text); font-size: 13.5px; }

/* ===== Operación real (projects/operation.php): real vs preliminar ===== */
.op-locked { display: grid; gap: 8px; justify-items: start; padding: 22px; }
.op-locked b { font-size: 15px; color: var(--text); }
.op-locked p { margin: 0; color: var(--text-muted); font-size: 13.5px; max-width: 70ch; }

.op-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
  margin-bottom: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--success);
  background: var(--surface);
}

.op-summary.has-changes { border-left-color: var(--hk-gold); background: rgba(216, 166, 34, .07); }
.op-summary__text { display: grid; gap: 2px; font-size: 12.5px; color: var(--text-muted); }
.op-summary__text b { font-size: 14px; color: var(--text); }
.op-legend { display: flex; gap: 6px; flex-wrap: wrap; font-size: 11.5px; }
.op-legend span { padding: 3px 8px; border-radius: 999px; }
.op-legend__chg { background: rgba(216, 166, 34, .18); color: #8A6010; }
.op-legend__new { background: rgba(46, 125, 91, .14); color: var(--success); }
.op-legend__del { background: rgba(200, 32, 45, .1); color: var(--hk-red); text-decoration: line-through; }

.op-scroll { overflow-x: auto; }
.op-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.op-table th {
  padding: 9px 10px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--hk-teal);
  background: rgba(8, 40, 62, .04);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.op-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.op-table td small { display: block; font-size: 11px; color: var(--text-muted); }
.op-table tfoot td { background: var(--surface-2); border-bottom: 0; padding: 10px; }
.op-table .op-c-num { text-align: right; }
.op-muted { color: var(--text-muted); font-size: 12px; }
.op-items { min-width: 860px; }

.op-items input, .op-items select, .op-dates input {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
}

.op-items .op-c-num input { text-align: right; font-variant-numeric: tabular-nums; }
.op-items input[readonly] { background: var(--surface-2); }
.op-c-concept { min-width: 200px; }
.op-c-concept input { font-weight: 600; }
.op-c-num { width: 110px; }
.op-c-unit { width: 80px; }
.op-c-vat { width: 80px; }
.op-c-date { width: 140px; }
.op-c-act { width: 44px; text-align: right; }
.op-dates td:nth-child(3) { width: 170px; }

/* Lo que cambió contra el preliminar */
.op-table td.is-changed input, .op-table td.is-changed select { border-color: var(--hk-gold); background: rgba(216, 166, 34, .14); }
.op-table td.op-diff.is-changed, .op-delta.is-changed { color: #8A6010; font-weight: 700; }
.op-delta { font-size: 12px; color: var(--text-muted); }
.op-row.is-modified td:first-child { box-shadow: inset 3px 0 0 var(--hk-gold); }
.op-row.is-new td:first-child { box-shadow: inset 3px 0 0 var(--success); }
.op-row.is-new { background: rgba(46, 125, 91, .05); }
.op-row.is-removed { background: rgba(200, 32, 45, .04); }
.op-row.is-removed td:first-child { box-shadow: inset 3px 0 0 var(--hk-red); }
.op-row.is-removed input, .op-row.is-removed select { text-decoration: line-through; opacity: .55; pointer-events: none; }
.op-tag { display: inline-block; margin-top: 3px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #8A6010; }
.op-tag:empty { display: none; }
.op-row.is-new .op-tag { color: var(--success); }
.op-row.is-removed .op-tag { color: var(--hk-red); }

.op-x {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}

.op-x:hover { border-color: var(--hk-red); color: var(--hk-red); }
.op-row.is-removed .op-x:hover { border-color: var(--success); color: var(--success); }
.op-empty { padding: 14px 16px; }

.op-savebar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 4px;
  padding: 12px 0;
  background: linear-gradient(transparent, var(--bg, #F0EEE9) 35%);
  font-size: 12.5px;
  color: #8A6010;
}

/* Inversiones recaudadas */
.op-inv td b { font-variant-numeric: tabular-nums; }
.op-contrib { font-size: 12px; color: var(--text-muted); }
.op-contrib b { color: var(--text); }
.op-pop { position: relative; }
.op-pop summary { list-style: none; cursor: pointer; white-space: nowrap; }
.op-pop summary::-webkit-details-marker { display: none; }

.op-pop__box {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  display: grid;
  gap: 8px;
  width: 260px;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  text-align: left;
}

.op-pop__box label, .op-newinv label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.op-pop__box input, .op-newinv input, .op-newinv select {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.op-newinv { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.op-pop__box select {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

/* Operación real: guardado automático por renglón, documento de la factura, aportaciones y pagos */
.op-status { display: block; font-size: 11px; font-weight: 600; white-space: nowrap; color: var(--text-muted); min-height: 14px; }
.op-status.is-ok { color: var(--success); }
.op-status.is-busy { color: var(--hk-teal); }
.op-status.is-warn { color: #8A6010; }
.op-status.is-err { color: var(--hk-red); white-space: normal; max-width: 180px; }
.op-c-doc { min-width: 150px; }
.op-c-doc input { width: 100%; }
.op-file { display: inline-flex; gap: 6px; margin-top: 3px; font-size: 13px; }
.op-file a { text-decoration: none; }
.op-file__up { cursor: pointer; color: var(--hk-teal); font-weight: 700; }
.op-row.is-hk input[readonly], .op-row.is-hk select:disabled { background: transparent; border-color: transparent; }
/* La celda sigue siendo celda (con display:flex en el td los botones se enciman con la columna de movimientos) */
.op-inv td.op-inv__cell { width: 132px; vertical-align: top; }
.op-inv__act { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.op-inv__act .btn { justify-content: center; }
.op-inv__form td { background: var(--surface-2); }
.op-inv__form .op-newinv { margin-bottom: 6px; }
.op-contrib--out { color: var(--hk-navy); }

/* Balance general de la operación real (projects/_balance.php) */
.bg-date { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; font-size: 13px; }
.bg-date label { display: inline-flex; gap: 8px; align-items: center; font-weight: 700; color: var(--hk-navy); }
.bg-date input { padding: 6px 9px; border: 1px solid var(--border); border-radius: 6px; font: inherit; }
.bg-check { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.bg-check.is-ok { background: rgba(46, 125, 91, .14); color: var(--success); }
.bg-check.is-off { background: rgba(200, 32, 45, .1); color: var(--hk-red); }
.bg-sheet { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; align-items: start; }
.bg-col h4 { margin: 0 0 6px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--hk-teal); }
.bg-col .bg-table + h4 { margin-top: 18px; }
.bg-table td { font-variant-numeric: tabular-nums; }
.bg-table tfoot td { border-top: 2px solid var(--border); }
.bg-results .bg-total td { background: var(--surface-2); }
.bg-results td.is-changed { background: rgba(216, 166, 34, .16); color: #6E4E0A; }
.bg-results td.is-changed small { display: block; font-weight: 600; }
.op-inv .op-c-act .btn { white-space: nowrap; }

/* Detalle real: lo programado contra lo registrado (facturas, cobros y pagos), vencidos y libro diario */
.op-items { min-width: 1080px; }
.pv-layout > .pv-main { min-width: 0; } /* las tablas anchas hacen scroll dentro de su tarjeta */
.op-c-prog { min-width: 190px; }
.op-step + .op-step { margin-top: 4px; }
.op-step small { display: block; font-size: 10.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.op-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--text-muted); }
.op-chip.is-done { background: rgba(46, 125, 91, .14); color: var(--success); }
.op-chip.is-partial { background: rgba(26, 122, 140, .12); color: var(--hk-teal); }
.op-chip.is-due { background: rgba(216, 166, 34, .2); color: #6E4E0A; }
.op-chip.is-overdue { background: rgba(200, 32, 45, .12); color: var(--hk-red); }
.op-items .op-c-act { width: 96px; min-width: 96px; vertical-align: top; }
/* Registrado y los botones (+ Factura, + Cobro/Pago) quedan fijos a la derecha: el resto de la tabla hace scroll debajo */
.op-items .op-c-act, .op-items .op-c-prog, .op-items .op-c-foot { position: sticky; z-index: 1; background: var(--surface); }
.op-items .op-c-act, .op-items .op-c-foot { right: 0; }
.op-items .op-c-prog { right: 96px; box-shadow: -8px 0 8px -8px rgba(8, 40, 62, .25); }
.op-items .op-c-foot { box-shadow: -8px 0 8px -8px rgba(8, 40, 62, .25); }
.op-items thead .op-c-act, .op-items thead .op-c-prog { background: color-mix(in srgb, var(--hk-navy) 4%, var(--surface)); }
.op-items tfoot .op-c-foot { background: var(--surface-2); }
.op-row.is-flash td.op-c-act, .op-row.is-flash td.op-c-prog { background: color-mix(in srgb, var(--hk-gold) 18%, var(--surface)); }
.op-acts { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.op-btn { padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--hk-teal); font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.op-btn:hover { border-color: var(--hk-teal); }
.op-row.is-removed .op-btn { display: none; }
.op-row.is-flash td { background: rgba(216, 166, 34, .18); transition: background .4s; }
.op-recs > td { padding: 0 10px 10px 28px; background: var(--surface-2); }
.op-rec-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.op-rec-table td { padding: 5px 8px; border-bottom: 1px dashed var(--border); vertical-align: middle; font-variant-numeric: tabular-nums; }
.op-rec-table td small { display: inline; margin-left: 4px; }
.op-rec-table tr:last-child td { border-bottom: 0; }
.op-rec-table tr.is-cancelled td { color: var(--text-muted); }
.op-rec-table tr.is-cancelled td:nth-child(-n+5) { text-decoration: line-through; }
.op-rec__kind { width: 80px; }
.op-rec__badge { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.op-rec__badge--invoice { background: rgba(8, 40, 62, .08); color: var(--hk-navy); }
.op-rec__badge--payment { background: rgba(46, 125, 91, .12); color: var(--success); }
.op-rec__act { text-align: right; white-space: nowrap; }
.op-link { padding: 0; border: 0; background: none; color: var(--hk-teal); font: inherit; font-size: 12px; font-weight: 600; text-decoration: underline; cursor: pointer; }
.op-link + .op-link { margin-left: 8px; }
.op-link--danger, .op-danger { color: var(--hk-red) !important; }
.op-danger-bg { background: var(--hk-red) !important; border-color: var(--hk-red) !important; }
.op-contrib .op-link { margin-left: 6px; font-size: 11px; }
.op-mov { margin: 6px 0 10px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.op-mov__cancel { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.op-alert { padding: 12px 16px; border-radius: var(--radius); border: 1px solid rgba(216, 166, 34, .4); border-left: 4px solid var(--hk-gold); background: rgba(216, 166, 34, .08); font-size: 13px; line-height: 1.5; }
.op-alert.is-late { border-color: rgba(200, 32, 45, .3); border-left-color: var(--hk-red); background: rgba(200, 32, 45, .05); }
.op-alert > b { margin-right: 6px; color: var(--hk-red); }
.op-alert ul { margin: 6px 0 0; padding-left: 18px; }
.op-alert li a { color: var(--text); }
.op-tab-badge { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 5px; border-radius: 999px; background: var(--hk-red); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.op-journal { min-width: 900px; }
.op-je__head { cursor: pointer; }
.op-je__head:hover td, .op-je__head[aria-expanded="true"] td { background: var(--surface-2); }
.op-je__head td:nth-child(2) b::before { content: '▸ '; color: var(--text-muted); }
.op-je__head[aria-expanded="true"] td:nth-child(2) b::before { content: '▾ '; }
.op-je__line td { padding-top: 4px; padding-bottom: 4px; font-size: 12px; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.op-je__cr { padding-left: 34px !important; }
.op-rec-dialog { max-width: 560px; }
.op-fin-dialog.op-rec-dialog form { display: block; margin: 0; }
.op-items .op-c-vat { min-width: 88px; }
.op-rec-dialog__grid > label { min-width: 0; }
.op-rec-dialog input[type="file"] { width: 100%; min-width: 0; font-size: 12px; }
.op-rec-dialog label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.op-rec-dialog input { padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; }
.op-rec-dialog__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 12px 0 6px; }
.op-rec-dialog__wide { grid-column: 1 / -1; }
.op-rec-dialog__what { font-size: 13px !important; }
.op-rec-dialog__err { color: var(--hk-red); font-size: 13px; font-weight: 600; }
.op-rec-dialog__btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
[data-theme="dark"] .op-chip.is-due { color: #E8C35A; }
/* Sustitución de coinversionistas */
.op-sub { margin: 6px 0; padding: 6px 10px; border-left: 3px solid var(--hk-gold); border-radius: 0 6px 6px 0; background: rgba(216, 166, 34, .08); font-size: 12px; }
.op-sub small { display: block; margin-top: 2px; color: var(--text-muted); }
.op-sub__cancel { margin-top: 4px; }
.op-sub-tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; background: rgba(216, 166, 34, .16); color: #6E4E0A; font-size: 10.5px; font-weight: 700; }
[data-theme="dark"] .op-sub-tag { color: #E8C35A; }
[data-theme="dark"] .bg-results td.is-changed, [data-theme="dark"] .op-status.is-warn { color: #E8C35A; }

/* Catálogo de cuentas (catalog/accounts.php): mismo esquema que el listado de proyectos */
.ac-new { margin-bottom: 18px; }
.ac-new[hidden] { display: none; }
.ac-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.ac-form__name { grid-column: span 2; }
.field.ac-form__go { display: flex; flex-direction: row; gap: 8px; justify-content: flex-end; align-items: center; }
.ac-form__go { grid-column: 1 / -1; }
.ac-form__go button { white-space: nowrap; }
.ac-inactive-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); white-space: nowrap; cursor: pointer; }
.ac-dot--balance { background: var(--hk-navy) !important; }
.ac-dot--results { background: var(--success) !important; }
.ac-section { margin-top: 18px; }
.ac-section[hidden] { display: none; }
.ac-section__title { margin: 0 0 10px; font-size: 15px; font-weight: 700; color: var(--text); }
.ac-section__title small { margin-left: 8px; font-size: 12px; font-weight: 400; color: var(--text-muted); }
.ac-balance { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; align-items: start; }
.ac-wrap { overflow: visible; }
.ac-side { padding: 10px 16px; border-bottom: 1px solid var(--border); border-radius: 12px 12px 0 0; font-size: 13px; font-weight: 700; }
.ac-side small { margin-left: 6px; color: var(--text-muted); font-weight: 400; }
.ac-side--debit { background: rgba(8, 40, 62, .06); color: var(--hk-navy); box-shadow: inset 0 3px 0 var(--hk-navy); }
.ac-side--credit { background: rgba(216, 166, 34, .1); color: #8A6010; box-shadow: inset 0 3px 0 var(--hk-gold); }
[data-theme="dark"] .ac-side--debit { color: var(--text); }
[data-theme="dark"] .ac-side--credit { color: #E8C35A; }
.ac-table { width: 100%; }
.ac-table tr[hidden] { display: none; }
.ac-acc { display: flex; align-items: center; gap: 12px; }
.ac-num { flex: 0 0 auto; min-width: 52px; padding: 4px 8px; border-radius: 6px; background: var(--surface-2); font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; text-align: center; color: var(--text); }
.ac-table .cell-name b { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.ac-tag { padding: 1px 7px; border-radius: 999px; background: rgba(64, 108, 127, .12); color: var(--hk-teal); font-size: 10.5px; font-weight: 700; cursor: help; }
.ac-tag--off { background: rgba(200, 32, 45, .1); color: var(--hk-red); cursor: default; }
.ac-type { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--text-muted); }
.ac-type--asset_current, .ac-type--asset_deferred, .ac-type--asset_fixed { background: rgba(8, 40, 62, .08); color: var(--hk-navy); }
.ac-type--liability_short, .ac-type--liability_long, .ac-type--equity, .ac-type--equity_results { background: rgba(216, 166, 34, .16); color: #8A6010; }
.ac-type--income, .ac-type--other_income { background: rgba(46, 125, 91, .12); color: var(--success); }
.ac-type--cogs, .ac-type--expense, .ac-type--other_expense, .ac-type--tax { background: rgba(200, 32, 45, .08); color: var(--hk-red); }
[data-theme="dark"] .ac-type--asset_current, [data-theme="dark"] .ac-type--asset_deferred, [data-theme="dark"] .ac-type--asset_fixed { color: var(--text); }
.ac-nature { font-size: 12.5px; color: var(--text-muted); }
.ac-nature-auto { display: flex; align-items: center; min-height: 36px; padding: 0 10px; border: 1px dashed var(--border); border-radius: 6px; background: var(--surface-2); font-size: 13px; font-weight: 600; color: var(--text); }
.ac-table tr.is-inactive td { opacity: .6; }
.ac-actions { width: 1%; text-align: right; white-space: nowrap; }
.ac-pop { width: 320px; }
.ac-pop__form { display: grid; gap: 8px; }
.ac-pop__row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ac-pop label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.ac-pop input, .ac-pop select { width: 100%; min-width: 0; }
.ac-pop__lock { margin: 4px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: 11.5px; color: var(--text-muted); white-space: normal; }
.ac-pop__toggle { display: grid; gap: 4px; padding-top: 8px; border-top: 1px solid var(--border); white-space: normal; }
.ac-pop__toggle small { font-size: 11px; color: var(--text-muted); }
.ac-danger { color: var(--hk-red) !important; justify-self: start; }
@media (max-width: 640px) { .ac-balance { grid-template-columns: 1fr; } .ac-form__name { grid-column: auto; } }

/* Scoring: palabra destacada en la descripción de un KPI y condiciones fijas (HK-01 del cliente, HK-05/HK-06 del Modelo) */
.sc-hl { color: var(--hk-red); font-weight: 700; }
.sc-fixed { font-size: 13px; line-height: 1.45; }
.sc-fixed small { display: block; margin-top: 2px; color: var(--text-muted); }
.sc-fixed__rating { font-weight: 700; color: var(--hk-teal); }

/* Resultado del scoring de riesgo junto al nombre del proyecto (listado y detalle) */
.sc-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
  vertical-align: middle;
  border: 1px solid transparent;
}
.sc-badge b { font-weight: 800; opacity: .85; }
.sc-badge.sc-badge--aprobado { background: rgba(46, 125, 91, .14); color: var(--success); border-color: rgba(46, 125, 91, .35); }
.sc-badge.sc-badge--revision { background: rgba(216, 166, 34, .18); color: #8B6A0E; border-color: rgba(216, 166, 34, .5); }
.sc-badge.sc-badge--alto-riesgo { background: rgba(200, 32, 45, .12); color: var(--hk-red); border-color: rgba(200, 32, 45, .4); }
.sc-badge.sc-badge--vetado { background: var(--hk-red); color: #fff; box-shadow: 0 0 0 3px rgba(200, 32, 45, .18); }
.sc-badge.sc-badge--none { background: transparent; color: var(--text-muted); border: 1px dashed var(--border); font-weight: 600; }
.sc-badge.sc-badge--lg { padding: 6px 14px; font-size: 14px; }
[data-theme="dark"] .sc-badge.sc-badge--revision { color: #E8C35A; }
.cell-name .pl-name-row { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 0; font-size: inherit; color: inherit; }
.cell-name .sc-badge { margin-top: 0; font-size: 11px; }
.pv-title { display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; white-space: nowrap; }
.page__header > div:has(> .pv-title) { flex-shrink: 0; }
.pv-title__score { text-decoration: none; }

/* ===== Operación real: tope del 100 % y aviso de cambio del monto financiado ===== */
.op-newinv__set { display: contents; border: 0; margin: 0; padding: 0; min-width: 0; }
.op-newinv__set:disabled label { opacity: .55; }
.op-fin-dialog {
  max-width: 460px;
  width: calc(100% - 32px);
  border: 1px solid var(--border);
  border-top: 4px solid var(--hk-gold);
  border-radius: 12px;
  padding: 20px 22px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 40px rgba(8, 40, 62, .25);
}
.op-fin-dialog::backdrop { background: rgba(8, 40, 62, .45); }
.op-fin-dialog h3 { margin: 0 0 10px; font-size: 17px; color: var(--hk-navy); }
.op-fin-dialog p { margin: 0 0 10px; font-size: 14px; line-height: 1.5; }
.op-fin-dialog form { display: flex; justify-content: flex-end; margin-top: 14px; }

/* Aportó más de lo comprometido (over_committed_note): pendiente en $0.00 y este aviso destacado */
.over-commit {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--hk-gold);
  color: var(--hk-navy);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  white-space: normal;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* Subir varios archivos o una carpeta completa (documents/_multi_picker.php) */
.mu-picker { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mu-zone { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px; border: 1.5px dashed var(--border-strong, var(--border)); border-radius: 8px; background: var(--bg-sunken); font-size: 12.5px; color: var(--text-muted); }
.mu-zone.is-over { border-color: var(--hk-teal); background: color-mix(in srgb, var(--hk-teal) 12%, transparent); }
.mu-zone__txt { flex: 1 1 100%; }
.mu-picker--compact .mu-zone { padding: 6px 8px; }
.mu-picker--compact .mu-zone__txt { flex: 0 1 auto; }
.mu-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; }
.mu-list:empty { display: none; }
.mu-item { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 12.5px; color: var(--text); min-width: 0; }
.mu-item select { max-width: 45%; font-size: 12px; }
.mu-item__name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mu-item__size { color: var(--text-muted); font-size: 11px; white-space: nowrap; }
.mu-tag { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; padding: 1px 6px; border-radius: 10px; background: var(--bg-sunken); color: var(--text-soft); }
.mu-item--doc { flex-direction: column; align-items: stretch; }
.mu-item__row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mu-item--doc .mu-item__row select { flex: 0 1 45%; max-width: none; }
.mu-item--doc .mu-item__row input[type=text] { flex: 1 1 auto; min-width: 0; font-size: 12px; }
.mu-item.is-ok { border-color: var(--success); color: var(--success); }
.mu-item.is-error { border-color: var(--danger); }
.mu-item__error { color: var(--danger); font-size: 11.5px; }
.mu-notice { font-size: 12px; color: var(--text-muted); }
.mu-notice ul { margin: 4px 0 0 16px; padding: 0; color: var(--danger); }
.mu-result { margin-top: 10px; font-size: 12.5px; }
.mu-result.is-ok { color: var(--success); }
.mu-result.is-error { color: var(--danger); }
.mu-result .btn { margin-top: 6px; }
.mu-form-error { margin-top: 8px; padding: 8px 10px; border-radius: 6px; background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); font-size: 12.5px; }

/* ===== Documentos (documents/index.php): barra de filtros, lista, carpetas, selección, vista previa ===== */
.dx-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.dx-header h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.dx-header__sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.dx-header__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dx-header__actions a.btn, .dx-drawer a.btn { text-decoration: none; }
.dx-header .btn--primary::before, .dx-modal .btn--primary::before { display: none; }
.dx-viewtoggle { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.dx-viewtoggle__btn { width: 36px; height: 34px; display: grid; place-items: center; border: 0; background: none; color: var(--text-muted); cursor: pointer; }
.dx-viewtoggle__btn svg { width: 17px; height: 17px; }
.dx-viewtoggle__btn + .dx-viewtoggle__btn { border-left: 1px solid var(--border); }
.dx-viewtoggle__btn:hover { color: var(--text); background: var(--surface-2); }
.dx-viewtoggle__btn.is-active { background: var(--hk-navy); color: #fff; }
[data-theme="dark"] .dx-viewtoggle__btn.is-active { background: var(--hk-teal); }

.dx-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); }
.dx-toolbar select, .dx-toolbar input[type=date] { font: inherit; font-size: 13px; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elev); color: var(--text); max-width: 220px; }
.dx-toolbar select:focus, .dx-toolbar input:focus { outline: none; border-color: var(--hk-teal); box-shadow: 0 0 0 3px rgba(64, 108, 127, .15); }
.dx-search { flex: 1 1 280px; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elev); color: var(--text-muted); }
.dx-search:focus-within { border-color: var(--hk-teal); box-shadow: 0 0 0 3px rgba(64, 108, 127, .15); }
.dx-search svg { width: 16px; height: 16px; flex: none; }
.dx-search input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font: inherit; font-size: 13.5px; color: var(--text); }
.dx-search kbd { font: inherit; font-size: 11px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 5px; color: var(--text-soft); }
.dx-dates { display: flex; gap: 6px; }
.dx-dates label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.dx-statusbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 30px; margin: 12px 2px 10px; }
.dx-count { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.dx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dx-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }
.dx-chip span { color: var(--text-muted); font-size: 14px; line-height: 1; }
.dx-chip:hover { border-color: var(--hk-teal); }
.dx-chip--clear { border-style: dashed; color: var(--text-muted); }

.dx-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 2px 12px; font-size: 13.5px; }
.dx-crumbs[hidden] { display: none; }
.dx-crumb { border: 0; background: none; padding: 4px 6px; border-radius: 6px; font: inherit; color: var(--hk-teal); cursor: pointer; }
.dx-crumb:hover { background: var(--surface-2); text-decoration: underline; }
.dx-crumb.is-current { color: var(--text); font-weight: 600; cursor: default; }
.dx-crumb-sep { color: var(--text-soft); }
[data-theme="dark"] .dx-crumb { color: #8FC1D6; }

.dx-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 12px; align-items: start; }
.dx-folder { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 14px 14px 12px; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, transform .05s ease; }
.dx-folder:hover { border-color: var(--hk-teal); box-shadow: var(--shadow-2); }
.dx-folder:active { transform: translateY(1px); }
.dx-folder__icon { flex: none; width: 40px; height: 40px; display: grid; place-items: center; font-size: 20px; border-radius: 10px; background: var(--bg-sunken); }
.dx-folder__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dx-folder__name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-folder__meta { font-size: 12px; color: var(--text-muted); }
.dx-folder__types { font-size: 11.5px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-folder__chev { color: var(--text-soft); font-size: 20px; }

.dx-tablewrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); overflow-x: auto; }
.dx-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dx-table th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--bg-sunken); white-space: nowrap; }
.dx-th-sort { cursor: pointer; user-select: none; }
.dx-th-sort:hover, .dx-th-sort.is-sorted { color: var(--text); }
.dx-sort-arrow { margin-left: 4px; font-size: 9px; }
.dx-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
.dx-table tbody tr:last-child td { border-bottom: 0; }
.dx-table tbody tr:hover { background: var(--surface-2); }
.dx-table tbody tr.is-selected { background: color-mix(in srgb, var(--hk-teal) 10%, transparent); }
.dx-col-check { width: 34px; padding-right: 0 !important; }
.dx-col-check input { width: 16px; height: 16px; accent-color: var(--hk-teal); cursor: pointer; }
.dx-col-file { min-width: 240px; }
.dx-col-actions { width: 1%; white-space: nowrap; }
.dx-file { display: flex; align-items: flex-start; gap: 10px; }
.dx-file__body { min-width: 0; }
.dx-file__name { display: block; max-width: 340px; padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--text); text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-file__name:hover { color: var(--hk-teal); text-decoration: underline; }
.dx-file__meta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.dx-file__desc { font-size: 12px; color: var(--text-soft); font-style: italic; margin-top: 2px; }
.dx-ver { color: var(--hk-teal); font-weight: 600; text-decoration: none; }
.dx-ext { flex: none; width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; font-size: 9.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: #fff; background: #7A8896; }
.dx-ext--pdf { background: #C8202D; }
.dx-ext--doc { background: #2B5797; }
.dx-ext--xls { background: #2E7D5B; }
.dx-ext--ppt { background: #C8642D; }
.dx-ext--img { background: #6B4FA0; }
.dx-ext--aud { background: var(--hk-teal); }
/* Vista previa de audio: reproductor centrado con velocidad */
.dx-pv-audio { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 24px; text-align: center; max-width: 560px; margin: 0 auto; }
.dx-pv-audio__name { font-weight: 700; overflow-wrap: anywhere; }
.dx-pv-audio__desc { color: var(--text-muted); font-size: 13px; }
.dx-pv-audio audio { width: 100%; }
.dx-pv-audio__speed { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.dx-speed { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums; }
.dx-speed.is-active { background: var(--text); border-color: var(--text); color: var(--surface); }
.dx-speed:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.dx-pv-audio__hint { font-size: 12px; color: var(--text-muted); margin: 0; }
.dx-ext--big { width: 72px; height: 72px; font-size: 15px; border-radius: 14px; }
.dx-type { display: inline-block; padding: 3px 8px; border-radius: 6px; background: var(--bg-sunken); font-size: 12px; white-space: nowrap; }
.dx-place { font-size: 12.5px; }
.dx-place small { display: block; color: var(--text-muted); font-size: 11.5px; }
.dx-muted { color: var(--text-soft); }
.dx-nowrap { white-space: nowrap; }
.dx-exp { font-size: 12px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.dx-exp.is-warn { color: #A87C0E; }
.dx-exp.is-danger { color: var(--danger); }
.dx-tags { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; max-width: 260px; }
.dx-tag { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--hk-teal) 14%, transparent); color: var(--text); font-size: 11.5px; }
.dx-tag__x { border: 0; background: none; padding: 0 3px; color: var(--text-muted); cursor: pointer; font-size: 13px; line-height: 1; border-radius: 50%; }
.dx-tag__x:hover { color: var(--danger); }
.dx-tag-add { width: 22px; height: 22px; border-radius: 50%; border: 1px dashed var(--border-strong, var(--border)); background: none; color: var(--text-muted); cursor: pointer; font-size: 14px; line-height: 1; opacity: .55; }
.dx-table tr:hover .dx-tag-add, .dx-tag-add:focus-visible { opacity: 1; }
.dx-tag-add:hover { border-color: var(--hk-teal); color: var(--hk-teal); }
.dx-actions { display: flex; gap: 4px; justify-content: flex-end; }
.dx-icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--text-muted); cursor: pointer; font-size: 20px; line-height: 1; text-decoration: none; }
.dx-icon-btn svg { width: 17px; height: 17px; }
.dx-icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.dx-icon-btn:disabled { opacity: .35; cursor: default; background: none; border-color: transparent; }
.dx-icon-btn--danger:hover { color: var(--danger); }
.dx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.dx-pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 2px; }
.dx-pager:empty { display: none; }
.dx-pager__info { font-size: 12.5px; color: var(--text-muted); }
.dx-pager__nav { display: flex; gap: 4px; align-items: center; }
.dx-page { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.dx-page:hover:not(:disabled) { border-color: var(--hk-teal); }
.dx-page.is-current { background: var(--hk-navy); color: #fff; border-color: var(--hk-navy); }
.dx-page:disabled { opacity: .4; cursor: default; }
.dx-page-gap { color: var(--text-soft); padding: 0 2px; }

.dx-empty { text-align: center; padding: 48px 16px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius-lg); }
.dx-empty__icon { font-size: 34px; margin-bottom: 8px; opacity: .6; }
.dx-empty__title { font-weight: 600; font-size: 15px; color: var(--text); }
.dx-empty__sub { font-size: 13px; color: var(--text-muted); margin: 6px 0 14px; }

.dx-selbar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 900; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: max-content; max-width: calc(100vw - 32px); padding: 8px 8px 8px 16px; border-radius: 12px; background: var(--hk-navy); color: #fff; box-shadow: var(--shadow-pop); }
.dx-selbar[hidden] { display: none; }
[data-theme="dark"] .dx-selbar { border: 1px solid var(--border-strong); background: #0B3A57; }
.dx-selbar__count { font-size: 13px; font-weight: 600; }
.dx-selbar__link { border: 0; background: none; color: #BFD6E0; font: inherit; font-size: 12.5px; text-decoration: underline; cursor: pointer; }
.dx-selbar__spacer { flex: 1; min-width: 4px; }
.dx-selbar .btn.dx-selbar__btn { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.28); }
.dx-selbar .btn.dx-selbar__btn:hover { background: rgba(255,255,255,.2); }
.dx-selbar .btn.dx-selbar__btn--danger:hover { background: var(--danger); border-color: var(--danger); }
.dx-selbar__close { width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: #fff; font-size: 20px; cursor: pointer; }
.dx-selbar__close:hover { background: rgba(255,255,255,.15); }
body.dx-has-selbar .dx-pager { margin-bottom: 76px; }

.dx-drawer { position: fixed; inset: 0; z-index: 1000; }
.dx-drawer[hidden] { display: none; }
.dx-drawer__backdrop { position: absolute; inset: 0; background: rgba(8, 40, 62, .45); opacity: 0; transition: opacity .18s ease; }
.dx-drawer__panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); display: flex; flex-direction: column; background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-pop); transform: translateX(24px); opacity: 0; transition: transform .18s ease, opacity .18s ease; }
.dx-drawer--preview .dx-drawer__panel { width: min(960px, 100vw); }
.dx-drawer.is-open .dx-drawer__backdrop { opacity: 1; }
.dx-drawer.is-open .dx-drawer__panel { transform: none; opacity: 1; }
.dx-drawer__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.dx-drawer__title { margin: 0; font-size: 17px; font-weight: 700; }
.dx-pv-title { min-width: 0; flex: 1; }
.dx-pv-name { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.dx-pv-meta { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }
.dx-pv-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.dx-pv-pos { font-size: 12px; color: var(--text-muted); min-width: 44px; text-align: center; }
.dx-pv-body { flex: 1; min-height: 0; background: var(--bg-sunken); display: flex; align-items: center; justify-content: center; }
.dx-pv-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.dx-pv-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
.dx-pv-none { text-align: center; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
body.dx-noscroll { overflow: hidden; }

.dx-upform { flex: 1; overflow-y: auto; padding: 16px 18px 0; display: flex; flex-direction: column; gap: 14px; }
.dx-upform__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dx-upform__foot { position: sticky; bottom: 0; margin: auto -18px 0; padding: 12px 18px; background: var(--bg-elev); border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.dx-upform__foot .btn { justify-content: center; }
.dx-upform__foot .btn:disabled { opacity: .5; cursor: not-allowed; }
.dx-upform .mu-result { margin-top: 0; }
.dx-upform .mu-list { max-height: 260px; }
.dx-tagpick { display: flex; flex-wrap: wrap; gap: 6px; max-height: 108px; overflow-y: auto; margin-bottom: 6px; }
.dx-tagpick__item { position: relative; display: inline-flex; cursor: pointer; }
.dx-tagpick__item input { position: absolute; opacity: 0; pointer-events: none; }
.dx-tagpick__item span { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: 12px; color: var(--text); text-transform: none; letter-spacing: 0; }
.dx-tagpick__item input:checked + span { background: var(--hk-teal); border-color: var(--hk-teal); color: #fff; }
.dx-tagpick__item input:focus-visible + span { outline: 2px solid var(--hk-gold); outline-offset: 1px; }
.dx-check { display: flex !important; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px !important; color: var(--text-muted); }

.dx-dropzone { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; background: rgba(8, 40, 62, .55); pointer-events: none; }
.dx-dropzone[hidden] { display: none; }
.dx-dropzone__box { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 48px; border: 2px dashed #fff; border-radius: 18px; color: #fff; text-align: center; background: rgba(64, 108, 127, .35); }
.dx-dropzone__box strong { font-size: 18px; }
.dx-dropzone__box span { font-size: 13px; opacity: .9; }

.dx-modal { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 16px; background: rgba(8, 40, 62, .55); }
/* Reacomodar documentos (super admin) */
.dx-move { display: flex; flex-direction: column; gap: 10px; }
.dx-move [hidden] { display: none !important; }
.dx-move .dx-modal__label small { font-weight: 400; color: var(--text-muted); }
.dx-move__hint { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.dx-modal[hidden] { display: none; }
.dx-modal__box { width: min(420px, 100%); background: var(--surface); color: var(--text); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); padding: 20px; }
.dx-modal__title { margin: 0 0 10px; font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.dx-modal__body { font-size: 13.5px; color: var(--text); display: flex; flex-direction: column; gap: 10px; }
.dx-modal__body p { margin: 0; line-height: 1.5; }
.dx-modal__label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-muted); }
.dx-modal__label select, .dx-modal__label input { font: inherit; font-size: 13.5px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elev); color: var(--text); }
.dx-modal__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dx-modal .dx-btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.dx-toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 1300; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 10px; background: var(--success); color: #fff; font-size: 13px; box-shadow: var(--shadow-pop); }
.dx-toast[hidden] { display: none; }
.dx-toast.is-error { background: var(--danger); }

@media (max-width: 860px) {
  .dx-toolbar select { flex: 1 1 140px; max-width: none; }
  .dx-dates { flex: 1 1 100%; flex-wrap: wrap; }
  .dx-dates label { flex: 1 1 150px; min-width: 0; }
  .dx-toolbar .dx-dates input { flex: 1 1 0; min-width: 0; width: 100%; max-width: none; padding: 0 6px; }
  .dx-table thead { display: none; }
  .dx-table, .dx-table tbody, .dx-table tr, .dx-table td { display: block; width: auto; }
  .dx-table tr { position: relative; padding: 10px 12px 10px 44px; border-bottom: 1px solid var(--border); }
  .dx-table tbody tr:last-child { border-bottom: 0; }
  .dx-table td { padding: 3px 0; border: 0; }
  .dx-table td.dx-col-check { position: absolute; left: 14px; top: 16px; }
  .dx-table td[data-label] { display: flex; gap: 8px; align-items: center; font-size: 12.5px; }
  .dx-table td[data-label]::before { content: attr(data-label); min-width: 78px; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
  .dx-col-actions .dx-actions { justify-content: flex-start; margin-top: 4px; }
  .dx-file__name { max-width: 100%; white-space: normal; }
  .dx-upform__grid { grid-template-columns: 1fr; }
  .dx-header__actions { width: 100%; }
}

/* ===== Pantallas chicas (≤ 900 px): el menú lateral se abre encima de la página (layout/main.php) ===== */
.rail-backdrop { display: none; }
@media (max-width: 900px) {
  .app,
  .app[data-rail="collapsed"] { grid-template-columns: minmax(0, 1fr); }
  .rail,
  .app[data-rail="collapsed"] .rail {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 950;
    width: min(280px, 86vw);
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    transform: translateX(-102%);
    visibility: hidden;
    transition: transform .22s ease, visibility 0s linear .22s;
    box-shadow: inset 6px 0 0 var(--rail-accent), 0 18px 42px rgba(8, 40, 62, .35);
  }
  .app[data-rail-mobile="open"] .rail {
    transform: none;
    visibility: visible;
    transition: transform .22s ease, visibility 0s;
  }
  .app[data-rail-mobile="open"] .rail-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 940;
    background: rgba(8, 40, 62, .5);
  }
  body.rail-open { overflow: hidden; }

  .topbar { padding: 0 12px; gap: 8px; }
  .topbar__crumbs { min-width: 0; overflow: hidden; white-space: nowrap; }
  .topbar__crumbs > span, .topbar__crumbs .topbar__sep { display: none; }
  .topbar__crumbs strong { overflow: hidden; text-overflow: ellipsis; }
  .topbar__search { display: none; }
  .topbar__user { padding: 4px; gap: 0; }
  .topbar__user > div:not(.av), .topbar__user .caret { display: none; }
  .topbar__user-menu { right: 0; left: auto; }
  .page { padding: 18px 14px; max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .rail { transition: none !important; }
}

/* Documentos: lista agrupada por empresa › proyecto (vista general) */
.dx-groupctl { display: flex; gap: 6px; margin-left: auto; }
.dx-groupctl[hidden] { display: none; }   /* solo en la lista agrupada; en carpetas no aplican */
.dx-table tr.dx-grp td { padding: 0; background: var(--bg-sunken, var(--surface-2)); }
.dx-table tr.dx-grp:hover { background: none; }
.dx-table tr.dx-grp--2 td { background: var(--surface-2); }
.dx-grp__btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: none; background: none; cursor: pointer; text-align: left;
  font: inherit; color: var(--text); padding: 9px 12px;
}
.dx-grp--1 .dx-grp__btn { font-weight: 700; font-size: 13.5px; }
.dx-grp--2 .dx-grp__btn { font-weight: 600; font-size: 12.5px; padding-left: 34px; }
.dx-grp__chev { width: 12px; color: var(--text-muted); }
.dx-grp__kind { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; }
.dx-grp__count { margin-left: auto; font-size: 11.5px; font-weight: 500; color: var(--text-muted); }
.dx-grp__btn:hover .dx-grp__name { color: var(--hk-teal); }
.dx-table--grouped tbody tr[data-id] td:nth-child(2) { padding-left: 28px; }
@media (max-width: 860px) {
  .dx-table tr.dx-grp { padding: 0; }
  .dx-table--grouped tbody tr[data-id] td:nth-child(2) { padding-left: 0; }
  .dx-grp--2 .dx-grp__btn { padding-left: 24px; }
  .dx-groupctl { margin-left: 0; }
}

/* Documentos: Cancelar en el panel de subida (rojo, debajo de Subir) */
.dx-upform__foot .dx-btn-cancel { background: var(--danger, #C0392B); border-color: var(--danger, #C0392B); color: #fff; }
.dx-upform__foot .dx-btn-cancel:hover:not(:disabled) { filter: brightness(.92); }
