@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@500;600&family=IBM+Plex+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;700&display=swap");

:root {
  --bg: #f6f8fc;
  --ink: #0e1b2a;
  --muted: #5f6b7a;
  --line: #d9e1ea;
  --card: #ffffff;
  --accent: #0f766e;
  --accent-2: #b45309;
  --accent-3: #1d4ed8;
  --ok: #166534;
  --warn: #a16207;
  --danger: #b91c1c;
  --shadow: 0 14px 36px rgba(11, 28, 53, 0.1);
  --chart-frame-height: 680px;
  --chart-canvas-width: 100%;
  --chart-canvas-height: 600px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  font-family: "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, #d6fff1 0, transparent 42%),
    radial-gradient(circle at 90% 6%, #fef3c7 0, transparent 38%),
    var(--bg);
}

.app-shell {
  display: block;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 330px;
  z-index: 30;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  color: #e5eef9;
  padding: 24px 18px 24px;
}

.brand h1 {
  margin: 4px 0 0;
  font-size: 1.45rem;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  letter-spacing: 0.2px;
}

.brand .subtitle {
  margin-top: 8px;
  color: #adc7df;
  font-size: 0.92rem;
  line-height: 1.45;
}

.eyebrow {
  margin: 0;
  color: #7dd3fc;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 600;
  font-size: 0.72rem;
}

.sidebar-controls {
  margin: 18px 0;
}

.sidebar-controls label {
  display: block;
  font-size: 0.75rem;
  color: #a8bfd7;
  margin-bottom: 7px;
}

.sidebar-controls input {
  width: 100%;
  border: 1px solid #32506f;
  background: #0a223a;
  color: #d8e9fb;
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 0.92rem;
}

.sidebar-controls input::placeholder {
  color: #7ea6cc;
}

.theme-toggle {
  width: 100%;
  margin-top: 10px;
  border: 1px solid #2e5d79;
  border-radius: 9px;
  background: linear-gradient(135deg, #103a55, #13435f);
  color: #e2eff9;
  padding: 9px 11px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: #54a8c4;
}

.nav-links {
  display: grid;
  gap: 8px;
}

.nav-group-title {
  margin: 10px 0 2px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.45px;
  text-transform: uppercase;
  color: #8fb0cf;
}

.nav-links a {
  display: block;
  color: #cee4f8;
  text-decoration: none;
  font-size: 0.9rem;
  border: 1px solid #1f3954;
  border-radius: 9px;
  padding: 10px 12px;
  transition: all 0.18s ease;
}

.nav-links a:hover,
.nav-links a.is-active {
  background: linear-gradient(135deg, #164e63 0%, #155e75 100%);
  border-color: #2d8194;
}

.process-list-wrap {
  margin-top: 18px;
  border-top: 1px solid #2a3f57;
  padding-top: 14px;
}

.process-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.84rem;
  color: #9fc0df;
  font-weight: 600;
}

.process-nav {
  display: grid;
  gap: 7px;
}

.process-link {
  display: grid;
  gap: 2px;
  text-decoration: none;
  color: #d8e8f7;
  font-size: 0.86rem;
  border: 1px solid #24415d;
  border-radius: 10px;
  padding: 9px 10px;
  transition: all 0.2s ease;
}

.process-link small {
  color: #92b2d1;
  font-size: 0.72rem;
}

.process-link:hover,
.process-link.is-active {
  border-color: #4cb1c8;
  background: rgba(38, 114, 137, 0.36);
}

.main-content {
  margin-left: 330px;
  padding: 26px 32px 52px;
}

.topbar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.topbar h2 {
  margin: 4px 0 0;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: 1.62rem;
}

.topbar-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.meta-pill {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.8rem;
  color: #2f445c;
}

.content-section {
  display: none;
  margin-top: 22px;
  animation: sectionIn 0.25s ease;
}

.content-section.is-visible {
  display: block;
}

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.overview-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 14px;
}

.summary-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: #334155;
}

.summary-list li {
  margin-bottom: 8px;
  line-height: 1.5;
}

.metric-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.metric .label {
  font-size: 0.74rem;
  color: #5b7088;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.metric .value {
  font-size: 1.2rem;
  margin-top: 6px;
  font-weight: 700;
  color: #0b2940;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.process-tag-list {
  margin-top: 0;
}

.tag {
  padding: 6px 10px;
  border-radius: 999px;
  background: #ecfeff;
  border: 1px solid #9ee8f0;
  color: #0d5c6b;
  font-size: 0.77rem;
  font-weight: 600;
}

.process-concepts-wrap {
  width: auto;
}

.concept-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 6px 11px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
}

.concept-chip small {
  font-size: 0.68rem;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 2px 6px;
}

.concept-macro {
  background: #ccfbf1;
  border-color: #2dd4bf;
  color: #134e4a;
}

.concept-macro small {
  background: #14b8a6;
  color: #f0fdfa;
}

.macro-chip-kinder {
  background: #ccfbf1;
  border-color: #2dd4bf;
  color: #134e4a;
}

.macro-chip-kinder small {
  background: #14b8a6;
  color: #f0fdfa;
}

.macro-chip-hospedaje {
  background: #ede9fe;
  border-color: #a78bfa;
  color: #4c1d95;
}

.macro-chip-hospedaje small {
  background: #8b5cf6;
  color: #f5f3ff;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: #f4f7fb;
  color: #1f334a;
  font-weight: 600;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 1;
}

thead .table-filter-row th {
  background: #edf3f9;
  border-bottom: 1px solid var(--line);
  padding: 6px 8px;
  top: 38px;
  z-index: 2;
}

.table-filter-empty {
  color: #8a9bb0;
  font-size: 0.72rem;
}

.table-filter-pop {
  width: 100%;
}

.table-filter-summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid #cfdceb;
  border-radius: 8px;
  background: #fff;
  color: #21415f;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 8px;
  text-align: center;
}

.table-filter-summary::-webkit-details-marker {
  display: none;
}

.table-filter-panel {
  margin-top: 6px;
  border: 1px solid #d5e2ef;
  border-radius: 8px;
  background: #ffffff;
  padding: 8px;
  min-width: 200px;
  box-shadow: 0 8px 18px rgba(13, 34, 62, 0.12);
}

.table-filter-search {
  width: 100%;
  border: 1px solid #c7d6e5;
  border-radius: 7px;
  padding: 6px 8px;
  font-size: 0.72rem;
  margin-bottom: 6px;
}

.table-filter-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.table-filter-actions button {
  border: 1px solid #c6d5e4;
  border-radius: 7px;
  background: #f7fbff;
  color: #27455f;
  font-size: 0.7rem;
  padding: 4px 7px;
  cursor: pointer;
}

.table-filter-options {
  display: grid;
  gap: 4px;
  max-height: 180px;
  overflow: auto;
}

.table-filter-option {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 6px;
  align-items: start;
  font-size: 0.72rem;
  color: #28445f;
}

tbody td {
  border-top: 1px solid #e8edf3;
  padding: 10px;
  vertical-align: top;
  font-size: 0.84rem;
  color: #2a3f55;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.badge.phase-0 {
  background: #e0ebff;
  color: #264277;
}

.badge.phase-1 {
  background: #dcfce7;
  color: #14532d;
}

.badge.phase-2 {
  background: #fff7d6;
  color: #854d0e;
}

.badge.phase-3 {
  background: #ffe7d6;
  color: #9a3412;
}

.badge.phase-4 {
  background: #d1fae5;
  color: #065f46;
}

.gantt-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.gantt-toolbar select,
.gantt-toolbar button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #14324f;
  padding: 8px 10px;
  font-size: 0.83rem;
}

.gantt-board {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: auto;
  max-height: var(--chart-frame-height);
}

.gantt-header,
.gantt-row {
  display: grid;
  grid-template-columns: 260px 1fr;
}

.gantt-header .left,
.gantt-row .left {
  border-right: 1px solid #e5ebf2;
  padding: 8px 10px;
}

.gantt-header .left {
  font-weight: 700;
  background: #f4f7fb;
}

.gantt-header .right {
  border-bottom: 1px solid #e5ebf2;
}

.scale-row {
  display: flex;
  min-height: 26px;
  border-bottom: 1px solid #edf2f7;
}

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

.scale-cell {
  border-right: 1px solid #e8eef5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #38526e;
  white-space: nowrap;
}

.month-cell {
  background: #eef6ff;
  font-weight: 700;
}

.week-cell {
  background: #f8fafc;
  font-weight: 600;
}

.day-cell {
  background: #fff;
  color: #627a92;
}

.gantt-row .right {
  position: relative;
  min-height: 40px;
  border-top: 1px solid #eff3f8;
  background-image: repeating-linear-gradient(
    to right,
    #f2f6fb 0,
    #f2f6fb 1px,
    transparent 1px,
    transparent var(--slot-width, 36px)
  );
}

.gantt-bar {
  position: absolute;
  top: 8px;
  height: 23px;
  border-radius: 8px;
  color: #fff;
  font-size: 0.67rem;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 7px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.gantt-bar.phase-0 {
  background: #1d4ed8;
}
.gantt-bar.phase-1 {
  background: #047857;
}
.gantt-bar.phase-2 {
  background: #b45309;
}
.gantt-bar.phase-3 {
  background: #c2410c;
}
.gantt-bar.phase-4 {
  background: #0f766e;
}

.gantt-bar.is-milestone {
  border-radius: 2px;
  transform: rotate(45deg);
  transform-origin: center;
  width: 13px !important;
  height: 13px;
  top: 12px;
  padding: 0;
}

.gantt-bar.is-milestone span {
  display: none;
}

.gantt-row .left p {
  margin: 0;
}

.gantt-row .left small {
  color: #5f6e80;
}

.section-title {
  margin: 0 0 8px;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: 1.12rem;
}

.process-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.process-controls input,
.process-controls select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
  font-size: 0.84rem;
}

.process-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 12px;
}

.process-layout.process-layout-single {
  grid-template-columns: 1fr;
}

.process-cards {
  max-height: 72vh;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.process-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.process-card:hover,
.process-card.is-active {
  transform: translateY(-1px);
  border-color: #5ca6d8;
  box-shadow: 0 8px 20px rgba(15, 40, 72, 0.12);
}

.process-card h4 {
  margin: 4px 0;
  font-size: 0.95rem;
}

.process-card p {
  margin: 0;
  font-size: 0.78rem;
  color: #5d6d7f;
}

.scope-summary-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.scope-process-list {
  display: grid;
  gap: 12px;
}

.scope-process-card {
  padding: 14px;
}

.scope-process-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.scope-process-head h4 {
  margin: 0;
  font-size: 1.02rem;
}

.scope-pills {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.scope-process-card table td {
  vertical-align: top;
}

.scope-desc {
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #33475f;
}

.scope-check-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: #334155;
  font-weight: 600;
}

.scope-check-wrap input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.scope-note-input {
  width: 100%;
  min-width: 220px;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 7px 8px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #1f3348;
  font-family: "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif;
  resize: vertical;
}

.scope-note-input:focus {
  outline: none;
  border-color: #5ca6d8;
  box-shadow: 0 0 0 2px rgba(92, 166, 216, 0.15);
}

.scope-functional-analysis {
  display: block;
}

.scope-analysis-card .hint {
  font-size: 0.82rem;
}

.scope-analysis-prio {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  font-size: 0.76rem;
  font-weight: 700;
}

.scope-analysis-prio.alta {
  color: #14532d;
  background: #f0fdf4;
  border-color: #86efac;
}

.scope-analysis-prio.media {
  color: #92400e;
  background: #fffbeb;
  border-color: #fcd34d;
}

.scope-analysis-prio.baja {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #93c5fd;
}

.scope-analysis-tag {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.scope-analysis-tag.erp {
  color: #9a3412;
  background: #fff7ed;
  border-color: #fdba74;
}

.scope-analysis-tag.cli {
  color: #0f766e;
  background: #ecfeff;
  border-color: #67e8f9;
}

.scope-analysis-tag.ext {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.architecture-layer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.architecture-layer-card h4 {
  margin: 0 0 4px;
}

.architecture-tag {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  font-size: 0.74rem;
  font-weight: 700;
}

.architecture-tag.cli {
  background: #ecfeff;
  border-color: #67e8f9;
  color: #0f766e;
}

.architecture-tag.erp {
  background: #fff7ed;
  border-color: #fdba74;
  color: #9a3412;
}

.architecture-tag.ext {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.architecture-priority {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  font-size: 0.74rem;
  font-weight: 700;
}

.architecture-priority.alta {
  color: #14532d;
  border-color: #86efac;
  background: #f0fdf4;
}

.architecture-priority.media {
  color: #92400e;
  border-color: #fcd34d;
  background: #fffbeb;
}

.architecture-priority.baja {
  color: #1d4ed8;
  border-color: #93c5fd;
  background: #eff6ff;
}

.architecture-edge-type {
  display: inline-block;
  border-radius: 6px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
  color: #334155;
  background: #f8fafc;
}

.architecture-sequence-card table td:first-child {
  width: 62px;
  text-align: center;
}

.detail-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
  box-shadow: var(--shadow);
}

.detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.detail-head h3 {
  margin: 0;
  font-size: 1.2rem;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
}

.process-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.detail-pills {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.pill {
  border: 1px solid var(--line);
  background: #f7fafc;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.75rem;
  color: #294966;
}

.narrative-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.process-culture-note {
  margin-top: 10px;
  border-left: 4px solid #0ea5e9;
}

.process-culture-note p {
  margin: 0;
  font-size: 0.86rem;
  color: #1f466a;
  line-height: 1.45;
}

.narrative-grid .card p {
  margin: 0;
  line-height: 1.5;
  color: #33485f;
  font-size: 0.84rem;
}

.process-spec-grid,
.casuistica-grid,
.internal-grid,
.practice-grid,
.result-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.practice-grid {
  grid-template-columns: 1fr 1fr;
}

.result-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.process-spec-grid .card h4,
.casuistica-grid .card h4,
.internal-grid .card h4,
.practice-grid .card h4,
.result-grid .card h4 {
  margin: 0 0 6px;
}

.process-spec-grid .card p,
.casuistica-grid .card li,
.internal-grid .card li,
.practice-grid .card li,
.result-grid .card li {
  font-size: 0.84rem;
  color: #344a62;
  line-height: 1.45;
}

.process-spec-grid ul,
.casuistica-grid ul,
.internal-grid ul,
.result-grid ul,
.practice-grid ul,
.process-spec-grid ol {
  margin: 0;
  padding-left: 18px;
}

.practice-grid .case-block p {
  margin: 0 0 7px;
  font-size: 0.84rem;
  color: #33475f;
  line-height: 1.45;
}

.practice-grid .case-block h5 {
  margin: 4px 0 6px;
  font-size: 0.82rem;
  color: #1f3d5a;
}

.practice-grid .case-block ol {
  margin: 0 0 8px;
  padding-left: 18px;
}

.indicators-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.indicators-metric-grid {
  margin-top: 10px;
}

.indicator-note {
  margin-top: 12px;
}

.diagram-block {
  margin-top: 12px;
  width: 100%;
  min-width: 0;
}

.diagram-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.diagram-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.diagram-tools button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #26445d;
  padding: 6px 10px;
  font-size: 0.76rem;
  cursor: pointer;
}

.diagram-tools button.is-active {
  background: #1d4ed8;
  color: #fff;
  border-color: #1d4ed8;
}

.diagram-tools span {
  min-width: 44px;
  text-align: center;
  font-size: 0.8rem;
  color: #35536f;
  font-weight: 600;
}

.diagram-divider {
  display: inline-block;
  width: 1px;
  height: 22px;
  background: var(--line);
  margin: 0 4px;
}

.architecture-tools {
  margin: 10px 0;
}

.mermaid-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  height: clamp(420px, 72vh, var(--chart-frame-height));
  min-height: 420px;
  overflow: auto;
  background: #fcfdff;
}

.diagram-block .mermaid-wrap {
  height: clamp(230px, 38vh, 420px);
  min-height: 230px;
}

.mermaid-wrap.pan-enabled {
  cursor: grab;
  user-select: none;
}

.mermaid-wrap.pan-enabled.is-panning {
  cursor: grabbing;
}

.mermaid-stage {
  min-width: 100%;
  min-height: var(--chart-canvas-height);
  display: inline-block;
  position: relative;
}

.mermaid-stage svg {
  transform-origin: 0 0;
  max-width: none !important;
  display: block;
}

.flow-legend {
  margin: 8px 0 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.75rem;
  color: #264760;
  background: #fff;
}

.operational-flow-legend {
  margin: 8px 0 10px;
}

.operational-flow-legend .legend-item {
  background: #f8fbff;
  border-color: #c8d5e4;
  color: #2f4a66;
  font-size: 0.78rem;
  font-weight: 500;
}

.legend-swatch.op-intake {
  background: #dbeafe;
}

.legend-swatch.op-mobility {
  background: #cffafe;
}

.legend-swatch.op-center {
  background: #dcfce7;
}

.legend-swatch.op-ops {
  background: #ffedd5;
}

.legend-swatch.op-lodging {
  background: #ede9fe;
}

.legend-swatch.op-decision {
  background: #fef3c7;
}

.legend-swatch.op-incident {
  background: #fee2e2;
}

.map-purpose-note {
  margin: 6px 0 10px;
  font-size: 0.86rem;
  line-height: 1.5;
  color: #244663;
}

.architecture-legend .legend-item {
  font-size: 0.74rem;
}

.chart-tools {
  margin: 10px 0 8px;
}

.chart-legend {
  margin: 0 0 10px;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.sw-start {
  background: #d9f99d;
}
.sw-front {
  background: #dbeafe;
}
.sw-clinic {
  background: #dcfce7;
}
.sw-admin {
  background: #fef3c7;
}
.sw-control {
  background: #fce7f3;
}
.sw-event {
  background: #e2e8f0;
}

.legend-swatch.architecture-cli {
  background: #dbeafe;
}

.legend-swatch.architecture-erp {
  background: #fef3c7;
}

.legend-swatch.architecture-ext {
  background: #fce7f3;
}

.legend-swatch.sw-phase-0 {
  background: #1d4ed8;
}

.legend-swatch.sw-phase-1 {
  background: #047857;
}

.legend-swatch.sw-phase-2 {
  background: #b45309;
}

.legend-swatch.sw-phase-3 {
  background: #c2410c;
}

.legend-swatch.sw-phase-4 {
  background: #0f766e;
}

.legend-swatch.sw-milestone {
  background: #0f172a;
  transform: rotate(45deg);
  border-radius: 2px;
}

.diagram-error {
  border: 1px dashed #d97706;
  border-radius: 8px;
  padding: 10px;
  background: #fff7ed;
}

.mermaid-fallback {
  white-space: pre-wrap;
  font-size: 0.74rem;
  color: #7c2d12;
}

.sql-script-box {
  margin-top: 10px;
  border: 1px solid #d9e3ef;
  border-radius: 10px;
  background: #f8fbff;
  padding: 8px 10px;
}

.sql-script-box summary {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  color: #244663;
}

.sql-script {
  margin: 8px 0 0;
  white-space: pre;
  overflow: auto;
  border: 1px solid #d6e2ef;
  background: #fdfefe;
  border-radius: 8px;
  padding: 10px;
  font-size: 0.72rem;
  line-height: 1.5;
  font-family: "IBM Plex Mono", "Consolas", monospace;
  color: #0f172a;
}

.hint {
  font-size: 0.78rem;
  color: #5e7388;
  margin-top: 8px;
}

.activity-mode-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
}

.mode-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #24425b;
  padding: 5px 10px;
  font-size: 0.74rem;
  font-weight: 600;
}

.activity-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.activity-name {
  line-height: 1.35;
}

.activity-mode-text {
  font-size: 0.74rem;
  color: #36506a;
  font-weight: 600;
}

.activity-example {
  margin: 5px 0 0;
  font-size: 0.76rem;
  color: #49617b;
  line-height: 1.35;
}

.activity-name-erp {
  font-family: "IBM Plex Mono", "Consolas", monospace;
  letter-spacing: 0.2px;
}

.exec-badge {
  min-width: 38px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.68rem;
  text-align: center;
  font-weight: 700;
  line-height: 1.3;
  border: 1px solid transparent;
}

.exec-manual {
  color: #0b3a67;
  background: #dbeafe;
  border-color: #93c5fd;
}

.exec-erp {
  color: #064e3b;
  background: #dcfce7;
  border-color: #86efac;
}

.exec-otro_sistema {
  color: #334155;
  background: #e2e8f0;
  border-color: #94a3b8;
}

.exec-control {
  color: #713f12;
  background: #fef3c7;
  border-color: #fcd34d;
}

.pre-scope-badge {
  min-width: 62px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.66rem;
  text-align: center;
  font-weight: 700;
  line-height: 1.3;
  border: 1px solid transparent;
  letter-spacing: 0.2px;
}

.pre-scope-erp {
  color: #0f5132;
  background: #dcfce7;
  border-color: #86efac;
}

.pre-scope-cli {
  color: #1e3a8a;
  background: #dbeafe;
  border-color: #93c5fd;
}

.pre-scope-ext {
  color: #7c2d12;
  background: #ffedd5;
  border-color: #fdba74;
}

.pre-scope-mix {
  color: #0f172a;
  background: #e2e8f0;
  border-color: #94a3b8;
}

.scope-note {
  margin: 4px 0 0;
  font-size: 0.72rem;
  color: #475569;
  line-height: 1.35;
}

.decision-row td {
  background: #fef3c7;
}

.risk-box {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.risk-box .card h4 {
  margin: 0 0 6px;
}

.risk-box .card p,
.risk-box .card li {
  margin: 0;
  color: #30475e;
  font-size: 0.83rem;
  line-height: 1.5;
}

.risk-box ul {
  margin: 0;
  padding-left: 18px;
}

.closure-status {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  font-size: 0.72rem;
  font-weight: 700;
}

.closure-status.status-ok {
  color: #166534;
  background: #dcfce7;
  border-color: #86efac;
}

.closure-status.status-warn {
  color: #9a3412;
  background: #fff7ed;
  border-color: #fdba74;
}

.closure-status.status-backlog {
  color: #1e3a8a;
  background: #eff6ff;
  border-color: #93c5fd;
}

.usecase-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.usecase-module-card table td {
  vertical-align: top;
}

.ux-screen-card h5 {
  margin: 8px 0 6px;
}

.wireframe-canvas {
  margin-top: 8px;
  border: 1px solid #c8d6e5;
  border-radius: 10px;
  background: linear-gradient(180deg, #fbfdff, #f4f9ff);
  overflow: hidden;
  height: 320px;
  display: flex;
  flex-direction: column;
}

.wf-top {
  background: #dbeafe;
  color: #143f6b;
  padding: 8px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  border-bottom: 1px solid #bfdbfe;
}

.wf-body {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 8px;
  padding: 8px;
  flex: 1;
}

.wf-col {
  border: 1px dashed #9ab0c5;
  border-radius: 8px;
  background: #ffffff;
  color: #335171;
  font-size: 0.74rem;
  min-height: 90px;
  padding: 8px;
  line-height: 1.35;
}

.wf-col-main {
  background: #f8fbff;
}

.wf-sidebar,
.wf-sidepanel {
  background: #f7fbff;
}

.wf-footer {
  border-top: 1px solid #d9e5f2;
  background: #f8fbff;
  color: #3e5975;
  padding: 7px 10px;
  font-size: 0.74rem;
  font-weight: 600;
}

.mock-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dolibarr-mock-card h5 {
  margin: 0 0 4px;
}

.dolibarr-mockup {
  border: 1px solid #c7d4e2;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  min-height: 270px;
}

.dol-topbar {
  background: #1d3557;
  color: #e3effb;
  padding: 7px 10px;
  font-size: 0.74rem;
  font-weight: 700;
}

.dol-body {
  display: grid;
  grid-template-columns: 170px 1fr;
  min-height: 228px;
}

.dol-left {
  background: #f0f6ff;
  border-right: 1px solid #d2e0ef;
  padding: 8px;
  font-size: 0.72rem;
  color: #2f4d69;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dol-left span {
  border: 1px solid #d2deea;
  background: #fff;
  border-radius: 6px;
  padding: 4px 6px;
}

.dol-main {
  padding: 8px;
  background: #fbfdff;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.dol-main-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #224261;
  margin-bottom: 2px;
}

.dol-chip-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.dol-chip-row span {
  border: 1px solid #d7e3ef;
  background: #fff;
  border-radius: 6px;
  padding: 5px 6px;
  font-size: 0.7rem;
  color: #385875;
  line-height: 1.25;
}

.dol-table {
  border: 1px dashed #9db3c8;
  border-radius: 6px;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: #496785;
  background: #fff;
  text-align: center;
  padding: 8px;
}

.dol-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.dol-actions span {
  border-radius: 999px;
  border: 1px solid #9bb4ca;
  background: #ecf5ff;
  color: #1b466b;
  font-size: 0.68rem;
  padding: 3px 8px;
  font-weight: 700;
}

.dol-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.dol-form-grid span,
.dol-kpi-row span,
.dol-clinical-notes span {
  border: 1px solid #d4e0ed;
  border-radius: 6px;
  background: #fff;
  color: #365672;
  font-size: 0.7rem;
  padding: 6px;
}

.dol-calendar-shell {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 6px;
}

.dol-calendar-grid {
  border: 1px dashed #9cb4c9;
  border-radius: 8px;
  min-height: 92px;
  background: #fff;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.dol-calendar-grid span {
  border: 1px solid #d6e2ee;
  border-radius: 6px;
  background: #f8fbff;
  font-size: 0.68rem;
  color: #2f4f6a;
  padding: 5px;
  text-align: center;
}

.dol-side-stack {
  display: grid;
  gap: 6px;
}

.dol-mini-card {
  border: 1px solid #d4dfec;
  border-radius: 7px;
  background: #fff;
  color: #365572;
  min-height: 42px;
  padding: 8px;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
}

.dol-clinical-editor {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 6px;
}

.dol-clinical-notes {
  border: 1px dashed #9bb3c8;
  border-radius: 7px;
  background: #fff;
  min-height: 94px;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.dol-clinical-timeline {
  border: 1px solid #d4dfec;
  border-radius: 7px;
  background: #f9fcff;
  color: #2d4c68;
  min-height: 94px;
  padding: 8px;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
}

.dol-kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.dol-kanban-col {
  border: 1px solid #d5e2ee;
  border-radius: 7px;
  background: #fff;
  min-height: 84px;
  padding: 6px;
}

.dol-kanban-col h6 {
  margin: 0 0 6px;
  font-size: 0.67rem;
  color: #1f4568;
}

.dol-kanban-col p {
  margin: 0;
  font-size: 0.66rem;
  color: #4b6681;
}

.dol-pipeline {
  border: 1px dashed #9bb3c8;
  border-radius: 8px;
  background: #fff;
  min-height: 88px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
}

.dol-pipeline span {
  flex: 1;
  border: 1px solid #d4dfec;
  border-radius: 6px;
  background: #f7fbff;
  color: #2f4d68;
  font-size: 0.66rem;
  padding: 5px;
  text-align: center;
}

.dol-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

body.theme-dark {
  --bg: #0b1322;
  --ink: #e7eef8;
  --muted: #9cb0c7;
  --line: #2a3a52;
  --card: #111c2f;
  --shadow: 0 18px 32px rgba(0, 0, 0, 0.45);
  --accent: #2dd4bf;
  --accent-2: #f59e0b;
  --accent-3: #60a5fa;
  background:
    radial-gradient(circle at 10% 10%, rgba(6, 78, 59, 0.35) 0, transparent 34%),
    radial-gradient(circle at 90% 8%, rgba(124, 45, 18, 0.26) 0, transparent 30%),
    var(--bg);
}

body.theme-dark .main-content,
body.theme-dark .topbar h2,
body.theme-dark .section-title,
body.theme-dark .summary-list,
body.theme-dark .summary-list li {
  color: #e4edf8;
}

body.theme-dark .hint,
body.theme-dark .metric .label,
body.theme-dark .scope-note,
body.theme-dark .table-filter-empty {
  color: #9ab0c8;
}

body.theme-dark .card,
body.theme-dark .metric,
body.theme-dark .table-wrap,
body.theme-dark .meta-pill,
body.theme-dark .legend-item,
body.theme-dark .mode-item,
body.theme-dark .tag,
body.theme-dark .scope-check-wrap,
body.theme-dark .sql-script-box,
body.theme-dark .sql-script,
body.theme-dark .gantt-board,
body.theme-dark .wireframe-canvas,
body.theme-dark .dolibarr-mockup {
  background: #13213a;
  border-color: var(--line);
  color: #dce8f6;
}

body.theme-dark .metric .value,
body.theme-dark .meta-pill,
body.theme-dark .tag {
  color: #dce8f5;
}

body.theme-dark .macro-chip-kinder {
  background: #0f403d;
  border-color: #2dd4bf;
  color: #d2f7f2;
}

body.theme-dark .macro-chip-kinder small {
  background: #14b8a6;
  color: #e7fffb;
}

body.theme-dark .macro-chip-hospedaje {
  background: #34234e;
  border-color: #a78bfa;
  color: #efe6ff;
}

body.theme-dark .macro-chip-hospedaje small {
  background: #8b5cf6;
  color: #f5f3ff;
}

body.theme-dark .process-culture-note {
  border-left-color: #38bdf8;
}

body.theme-dark .table-wrap {
  background: #111c30;
}

body.theme-dark .map-purpose-note {
  color: #bcd2ea;
}

body.theme-dark thead th {
  background: #1a2a44;
  color: #dce8f6;
  border-bottom-color: var(--line);
}

body.theme-dark thead .table-filter-row th {
  background: #16263f;
}

body.theme-dark tbody td {
  color: #c7d6e8;
  border-top-color: #25374f;
}

body.theme-dark .table-filter-summary,
body.theme-dark .table-filter-panel,
body.theme-dark .table-filter-search,
body.theme-dark .table-filter-actions button {
  background: #0f1c31;
  border-color: #385274;
  color: #d8e6f6;
}

body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea,
body.theme-dark .gantt-toolbar button,
body.theme-dark .diagram-tools button {
  background: #0f1c31;
  color: #dce8f6;
  border-color: #385274;
}

body.theme-dark input::placeholder,
body.theme-dark textarea::placeholder {
  color: #86a0be;
}

body.theme-dark .gantt-header .left {
  background: #182842;
  color: #d6e3f3;
}

body.theme-dark .gantt-header .left,
body.theme-dark .gantt-row .left,
body.theme-dark .gantt-header .right,
body.theme-dark .scale-row,
body.theme-dark .scale-cell {
  border-color: #2a3b54;
}

body.theme-dark .diagram-error {
  background: #3a1f16;
  border-color: #a35b43;
}

body.theme-dark .mermaid-fallback {
  color: #ffd8c8;
}

body.theme-dark .sql-script {
  background: #0d192a;
  border-color: #334b6a;
}

@media (max-width: 1200px) {
  :root {
    --chart-frame-height: 460px;
    --chart-canvas-width: 100%;
    --chart-canvas-height: 380px;
  }

  .overview-grid,
  .process-layout,
  .narrative-grid,
  .process-spec-grid,
  .casuistica-grid,
  .internal-grid,
  .practice-grid,
  .result-grid,
  .indicators-grid,
  .architecture-layer-grid,
  .risk-box {
    grid-template-columns: 1fr;
  }

  .diagram-block {
    width: 100%;
    min-width: 0;
  }

  .metric-grid,
  .scope-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mock-grid {
    grid-template-columns: 1fr;
  }

  .wf-body {
    grid-template-columns: 1fr;
  }

  .dol-body {
    grid-template-columns: 1fr;
  }

  .dol-left {
    border-right: none;
    border-bottom: 1px solid #d2e0ef;
  }

  .dol-kanban {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  :root {
    --chart-frame-height: 400px;
    --chart-canvas-width: 100%;
    --chart-canvas-height: 320px;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    left: auto;
    top: auto;
    z-index: 1;
    border-right: none;
    border-bottom: 1px solid #1f3246;
  }

  .main-content {
    margin-left: 0;
    padding: 18px 14px 28px;
  }

  .diagram-block {
    width: 100%;
    min-width: 0;
  }

  .gantt-header,
  .gantt-row {
    grid-template-columns: 220px 1fr;
  }

  .dol-chip-row,
  .dol-form-grid,
  .dol-kpi-row,
  .dol-calendar-grid {
    grid-template-columns: 1fr;
  }

  .dol-calendar-shell,
  .dol-clinical-editor {
    grid-template-columns: 1fr;
  }

  .dol-pipeline {
    flex-direction: column;
    align-items: stretch;
  }
}
